@stacksjs/stx 0.2.730 → 0.2.731

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 (83) hide show
  1. package/dist/{chunk-324ykbvc.js → chunk-028w2zsn.js} +6 -6
  2. package/dist/{chunk-0vev19fg.js → chunk-09ty695q.js} +1 -1
  3. package/dist/{chunk-1g6t4dg5.js → chunk-0gv1jjkd.js} +1 -1
  4. package/dist/{chunk-xbdyr6kh.js → chunk-152dg4h2.js} +1 -1
  5. package/dist/{chunk-f8m1ape4.js → chunk-16jn5hdg.js} +1 -1
  6. package/dist/{chunk-kdgj0a4c.js → chunk-2md9ffgh.js} +1 -1
  7. package/dist/{chunk-3d09q038.js → chunk-33s441gw.js} +1 -1
  8. package/dist/{chunk-8qcam2x3.js → chunk-38cas2am.js} +3 -3
  9. package/dist/{chunk-tpmhe6e6.js → chunk-3m5kbph6.js} +1 -1
  10. package/dist/{chunk-4fd36208.js → chunk-3x4q1014.js} +1 -1
  11. package/dist/{chunk-y5bmc572.js → chunk-3ynfgvpy.js} +3 -3
  12. package/dist/chunk-42ryy009.js +2 -0
  13. package/dist/{chunk-ga2wta0n.js → chunk-4c27r05w.js} +5 -5
  14. package/dist/{chunk-gpm6f8fr.js → chunk-4gmc4vm0.js} +1 -1
  15. package/dist/chunk-4xvt5tkt.js +2 -0
  16. package/dist/{chunk-1qmrcnx0.js → chunk-5drnbdj8.js} +1 -1
  17. package/dist/chunk-6hpx7070.js +2 -0
  18. package/dist/{chunk-sdkyrewa.js → chunk-6qxyrafx.js} +2 -2
  19. package/dist/{chunk-tn7af59k.js → chunk-70rawzs2.js} +2 -2
  20. package/dist/{chunk-6r4nk78c.js → chunk-755wsp41.js} +40 -3
  21. package/dist/{chunk-32f60sv7.js → chunk-7m06vgxj.js} +1 -1
  22. package/dist/chunk-8shya0zr.js +2 -0
  23. package/dist/{chunk-qf4e1f19.js → chunk-91km397c.js} +2 -2
  24. package/dist/{chunk-tfayhked.js → chunk-94jm76pr.js} +1 -1
  25. package/dist/{chunk-b8a9cfdb.js → chunk-acgpk94p.js} +1 -1
  26. package/dist/{chunk-zqt6ffxh.js → chunk-apznv2mt.js} +1 -1
  27. package/dist/chunk-b7s7sxqj.js +2 -0
  28. package/dist/{chunk-k5rm5d45.js → chunk-bx7mqza3.js} +2 -2
  29. package/dist/{chunk-zw87df01.js → chunk-ck04vpy8.js} +1 -1
  30. package/dist/{chunk-4zs0fphm.js → chunk-cm7h9f3y.js} +1 -1
  31. package/dist/{chunk-23zgfwak.js → chunk-csfghrwe.js} +4 -4
  32. package/dist/chunk-exsx47p8.js +2 -0
  33. package/dist/{chunk-f03qnfq0.js → chunk-fhbwdk0y.js} +1 -1
  34. package/dist/{chunk-87g6x9z2.js → chunk-fzpkf5w7.js} +1 -1
  35. package/dist/{chunk-3p1zrv86.js → chunk-h219k9qd.js} +1 -1
  36. package/dist/chunk-h4gehmrp.js +2 -0
  37. package/dist/{chunk-fmwbyba6.js → chunk-haxzq49z.js} +1 -1
  38. package/dist/{chunk-pbz3b3yc.js → chunk-j7471e9y.js} +1 -1
  39. package/dist/chunk-k29p6g0h.js +2 -0
  40. package/dist/{chunk-rf6j5t0z.js → chunk-k86adw4s.js} +1 -1
  41. package/dist/{chunk-m26w2n1s.js → chunk-kd4fjgz5.js} +1 -1
  42. package/dist/chunk-m2aksmz2.js +2 -0
  43. package/dist/{chunk-d6sa77de.js → chunk-mh7wxkpc.js} +4 -4
  44. package/dist/{chunk-agvjbgqn.js → chunk-mq8tmepp.js} +1 -1
  45. package/dist/{chunk-pn651hkk.js → chunk-msb3q876.js} +1 -1
  46. package/dist/{chunk-m7xj95vn.js → chunk-qnpfkdea.js} +1 -1
  47. package/dist/{chunk-4p4djjh3.js → chunk-qprabe63.js} +1 -1
  48. package/dist/{chunk-fg21ebdc.js → chunk-qsksxtn7.js} +2 -2
  49. package/dist/{chunk-b885q789.js → chunk-r3b215k4.js} +1 -1
  50. package/dist/{chunk-7ygdpq1r.js → chunk-r4y0p0m1.js} +5 -5
  51. package/dist/{chunk-3qtwbad9.js → chunk-r7vtb2pc.js} +1 -1
  52. package/dist/chunk-re5vaz0d.js +3 -0
  53. package/dist/{chunk-y98v9as6.js → chunk-rhcfdp90.js} +1 -1
  54. package/dist/{chunk-6yzrhdrz.js → chunk-s5sf1pyq.js} +1 -1
  55. package/dist/{chunk-pn9jqd2s.js → chunk-t7dnt01m.js} +1 -1
  56. package/dist/{chunk-r323cyjn.js → chunk-v1rpc5ap.js} +1 -1
  57. package/dist/{chunk-ad8cs63k.js → chunk-vba39qx0.js} +1 -1
  58. package/dist/{chunk-nrnqxazz.js → chunk-vkws6yvd.js} +1 -1
  59. package/dist/{chunk-z00ptaes.js → chunk-yez7513h.js} +1 -1
  60. package/dist/chunk-ym46qt2x.js +2 -0
  61. package/dist/{chunk-grh8796h.js → chunk-ynbqdg6p.js} +1 -1
  62. package/dist/{chunk-189j53p7.js → chunk-ysk3rmz2.js} +1 -1
  63. package/dist/{chunk-rah5rds8.js → chunk-z00ag8jy.js} +1 -1
  64. package/dist/{chunk-w0z8yt9e.js → chunk-z8s83g6g.js} +1 -1
  65. package/dist/{chunk-vv6ja21h.js → chunk-zcktxs74.js} +1 -1
  66. package/dist/cli.js +8 -8
  67. package/dist/client/signals-fetch-runtime.js +40 -3
  68. package/dist/craft-entry.js +1 -1
  69. package/dist/craft.js +1 -1
  70. package/dist/pwa.js +1 -1
  71. package/dist/ssg.js +2 -2
  72. package/package.json +5 -5
  73. package/dist/chunk-1casvr33.js +0 -2
  74. package/dist/chunk-35dah9fm.js +0 -2
  75. package/dist/chunk-3qm6558d.js +0 -2
  76. package/dist/chunk-6vgxe0jw.js +0 -2
  77. package/dist/chunk-f6q6x1tz.js +0 -2
  78. package/dist/chunk-frhdytza.js +0 -3
  79. package/dist/chunk-m04m59gy.js +0 -2
  80. package/dist/chunk-mmwkh0j5.js +0 -2
  81. package/dist/chunk-vzw0shc7.js +0 -2
  82. package/dist/chunk-xy92sewc.js +0 -2
  83. package/dist/chunk-zeg9vs5y.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{m,h,p}from"./chunk-324ykbvc.js";import{j}from"./chunk-tn7af59k.js";import{i}from"./chunk-7ygdpq1r.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Jg(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{m,h,p}from"./chunk-028w2zsn.js";import{j}from"./chunk-70rawzs2.js";import{i}from"./chunk-r4y0p0m1.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Jg(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{qr}from"./chunk-4hv1camf.js";import{S}from"./chunk-324ykbvc.js";import{a}from"./chunk-tn7af59k.js";import{We,re}from"./chunk-hez09ssh.js";import{Na}from"./chunk-qf4e1f19.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Jl=`
2
+ import{qr}from"./chunk-4hv1camf.js";import{S}from"./chunk-028w2zsn.js";import{a}from"./chunk-70rawzs2.js";import{We,re}from"./chunk-hez09ssh.js";import{Na}from"./chunk-91km397c.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Jl=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xg}from"./chunk-16jn5hdg.js";import"./chunk-3ynfgvpy.js";import"./chunk-apznv2mt.js";import"./chunk-s5sf1pyq.js";import"./chunk-re5vaz0d.js";import"./chunk-mh7wxkpc.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{xg as startProductionServer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{vf,oh,ih,ah,ch,wf,xf,lh,uh,No,dh,ir,ar,cs}from"./chunk-3p1zrv86.js";import{et}from"./chunk-j2mpqa4p.js";import"./chunk-324ykbvc.js";import"./chunk-r323cyjn.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{ch as __setSignalsGeneratorsForTest,et as cacheEngineFingerprint,ar as cacheTemplate,ir as checkCache,dh as clearDevCaches,xf as getCachedRouterScript,wf as getCachedSignalsRuntime,lh as getServeClientAsset,No as getServeModuleBundle,cs as hashFilePath,ih as invalidateFileCache,ah as invalidateFileCacheByDir,oh as readFileCached,uh as registerServeModuleBundle,vf as templateCache};
2
+ import{vf,oh,ih,ah,ch,wf,xf,lh,uh,No,dh,ir,ar,cs}from"./chunk-h219k9qd.js";import{et}from"./chunk-j2mpqa4p.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{ch as __setSignalsGeneratorsForTest,et as cacheEngineFingerprint,ar as cacheTemplate,ir as checkCache,dh as clearDevCaches,xf as getCachedRouterScript,wf as getCachedSignalsRuntime,lh as getServeClientAsset,No as getServeModuleBundle,cs as hashFilePath,ih as invalidateFileCache,ah as invalidateFileCacheByDir,oh as readFileCached,uh as registerServeModuleBundle,vf as templateCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Yn,$e}from"./chunk-1xjv71dw.js";import{z,w,gr,Cs,C}from"./chunk-324ykbvc.js";import{a,P}from"./chunk-tn7af59k.js";import{vo}from"./chunk-6yzrhdrz.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-qc93ce5h.js";import{s,ge}from"./chunk-05qf3e2p.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||vo(t,e,n)}var at=2;function tf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function nf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=nf();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}D("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function rf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(rf())console.log("[stx:bundler]",...t)}var Y=[];function Ba(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Yt(){return Y.slice()}function Zt(){Y.length=0}var Z;function Gm(t){Z=t}function Fa(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return D("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return D("detected side-effect import:",u),!0}return!1}var Jn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function sf(t,e){return d.relative(t,e).split(d.sep).join("/")}function of(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Jn)?`${i}${u}${c}${u}`:n})}function af(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let R=y.trim();if(!R)continue;let B=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let R=y.slice(Jn.length),B=i(R),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Jn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function mo(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function en(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,R){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Jn}${sf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let A=B(r.importer,x,r.path);if(A)return A;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Jn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=R?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,k=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function cf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function tn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||tf(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(R,`${p}.js`),o=k.get(r);if(o){if(Cs(o.files)&&o.files.every((M)=>!X(M.path,i,u))){D("memo hit:",p);let M=o.files.map((O)=>O.path);return q(e,M),n.collectInputs?.push(...M),o.code}k.delete(r),D("memo invalidated by dep change:",p)}let b=d.join(R,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let M=Bun.file(b),O=!1,I=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===at&&Array.isArray(F.files)&&bt(F.files,i))I=gr(F.files.map((g)=>ct(g,i))),O=I.length===F.files.length&&!I.some((g)=>X(g.path,i,u))}catch{O=!1}if(O){if(D("cache hit:",p),I)q(e,I.map((T)=>T.path)),n.collectInputs?.push(...I.map((T)=>T.path));let F=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),I)k.set(r,{code:F,files:I});return F}D("cache invalidated by dep change:",p)}let A=H.get(p);if(A){let M=await A;if(n.collectInputs)n.collectInputs.push(...(k.get(r)?.files??[]).map((O)=>O.path));return M}let V=cf(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:R,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function lf(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:R,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=lf(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,A=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:O,balanced:I}=ge(M),F=(_)=>!I||O[_]===0,g;while((g=A.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((_)=>{let f=Et(_);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;x.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!F(g.index))continue;let _=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(_&&Q.some((f)=>f.test(_)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let L=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(L)x.add(L)}}for(let _ of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of _[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
2
+ import{Yn,$e}from"./chunk-1xjv71dw.js";import{z,w,gr,Cs,C}from"./chunk-028w2zsn.js";import{a,P}from"./chunk-70rawzs2.js";import{vo}from"./chunk-s5sf1pyq.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-qc93ce5h.js";import{s,ge}from"./chunk-05qf3e2p.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||vo(t,e,n)}var at=2;function tf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function nf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=nf();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}D("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function rf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(rf())console.log("[stx:bundler]",...t)}var Y=[];function Ba(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Yt(){return Y.slice()}function Zt(){Y.length=0}var Z;function Gm(t){Z=t}function Fa(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return D("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return D("detected side-effect import:",u),!0}return!1}var Jn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function sf(t,e){return d.relative(t,e).split(d.sep).join("/")}function of(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Jn)?`${i}${u}${c}${u}`:n})}function af(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let R=y.trim();if(!R)continue;let B=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let R=y.slice(Jn.length),B=i(R),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Jn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function mo(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function en(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,R){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Jn}${sf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let A=B(r.importer,x,r.path);if(A)return A;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Jn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=R?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,k=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function cf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function tn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||tf(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(R,`${p}.js`),o=k.get(r);if(o){if(Cs(o.files)&&o.files.every((M)=>!X(M.path,i,u))){D("memo hit:",p);let M=o.files.map((O)=>O.path);return q(e,M),n.collectInputs?.push(...M),o.code}k.delete(r),D("memo invalidated by dep change:",p)}let b=d.join(R,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let M=Bun.file(b),O=!1,I=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===at&&Array.isArray(F.files)&&bt(F.files,i))I=gr(F.files.map((g)=>ct(g,i))),O=I.length===F.files.length&&!I.some((g)=>X(g.path,i,u))}catch{O=!1}if(O){if(D("cache hit:",p),I)q(e,I.map((T)=>T.path)),n.collectInputs?.push(...I.map((T)=>T.path));let F=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),I)k.set(r,{code:F,files:I});return F}D("cache invalidated by dep change:",p)}let A=H.get(p);if(A){let M=await A;if(n.collectInputs)n.collectInputs.push(...(k.get(r)?.files??[]).map((O)=>O.path));return M}let V=cf(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:R,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function lf(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:R,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=lf(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,A=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:O,balanced:I}=ge(M),F=(_)=>!I||O[_]===0,g;while((g=A.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((_)=>{let f=Et(_);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;x.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!F(g.index))continue;let _=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(_&&Q.some((f)=>f.test(_)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let L=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(L)x.add(L)}}for(let _ of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of _[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
3
3
  export { ${[...x].join(", ")} }`:"";D("bundling:",c,"from:",d.basename(e));let tt=new Set,nt=new Map;try{let _=await Bun.build({entrypoints:[r],outdir:o,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[Bt(i,b,r,t+ut,tt,B,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...C()},root:i});if(!_.success){let E=_.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,U=Yn(_.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",E),Ba(e||"",E,U),n.throwOnFailure||Fa()==="error")throw Error(E);return t}let f="";for(let h of _.outputs){f=await h.text();break}let S=[];for(let h of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let E of h[1].split(",")){let U=E.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U){S.push([U[2],U[1]]);continue}let N=E.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))S.push([N,N])}if(n.expose){let h=new Set(n.expose);for(let E=S.length-1;E>=0;E--)if(!h.has(S[E][0]))S.splice(E,1)}let L=[];f=af(of(f,nt),L);let dt=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${c}`,pt=new Set(z(t,!0).split(",").map((h)=>h.trim())),ft=S.map(([h,E])=>`get ${JSON.stringify(h)}() { return ${E} }${pt.has(h)?`, set ${JSON.stringify(h)}(__stxValue_${E}) { ${E} = __stxValue_${E} }`:""}`).join(", "),mt=S.map(([h])=>`var ${h} = undefined;`).join(`
4
4
  `),gt=S.map(([h])=>`${h} = ${J}[${JSON.stringify(h)}];`).join(`
5
5
  `);if(f=`${dt.join(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Im,Om}from"./chunk-acgpk94p.js";import"./chunk-kd4fjgz5.js";import"./chunk-s5sf1pyq.js";import"./chunk-1xjv71dw.js";import"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Om as clearStoreCache,Im as getStoreScript};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{ur}from"./chunk-2mqzpzy7.js";import{Sr}from"./chunk-zkx2m308.js";import{a}from"./chunk-tn7af59k.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{Xa}from"./chunk-630yrhzv.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function sr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function G(e,r={}){return new ur(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=G(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function ye(e){return e.includes("data-stx-runtime")}function Ka(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=sr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{ur}from"./chunk-2mqzpzy7.js";import{Sr}from"./chunk-zkx2m308.js";import{a}from"./chunk-70rawzs2.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{Xa}from"./chunk-630yrhzv.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function sr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function G(e,r={}){return new ur(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=G(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function ye(e){return e.includes("data-stx-runtime")}function Ka(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=sr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=Sr(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(L(e))return Xe(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function or(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-rf6j5t0z.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-rf6j5t0z.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Ga(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Xa()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
7
+ ${e}`}async function or(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-k86adw4s.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-k86adw4s.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Ga(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Xa()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function be(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-rf6j5t0z.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
9
+ ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function be(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-k86adw4s.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
12
- `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-rf6j5t0z.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
12
+ `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-k86adw4s.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
13
13
  </body>`+e.slice(d+7)}
14
14
  export{sr,G,ye,Ka,or,Ga,be};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gn,Nf,Df,Mf,Lf,jf,m,Bf,ei,Ff,Rc,Ac}from"./chunk-324ykbvc.js";import"./chunk-r323cyjn.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{gn as STX_ENGINE_BINDING_NAMES,ei as convertToCommonJS,Rc as extractScriptFromTemplate,m as extractVariables,Ac as hasVariables,Bf as isCompleteImport,jf as isMissingBindingFailure,Mf as isModuleResolutionFailure,Lf as isSyntaxFailure,Ff as splitDeclaration,Nf as stripTypeScript,Df as withoutStxReferrer};
2
+ import{gn,Nf,Df,Mf,Lf,jf,m,Bf,ei,Ff,Rc,Ac}from"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{gn as STX_ENGINE_BINDING_NAMES,ei as convertToCommonJS,Rc as extractScriptFromTemplate,m as extractVariables,Ac as hasVariables,Bf as isCompleteImport,jf as isMissingBindingFailure,Mf as isModuleResolutionFailure,Lf as isSyntaxFailure,Ff as splitDeclaration,Nf as stripTypeScript,Df as withoutStxReferrer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_}from"./chunk-ez35607j.js";import{we,At,Go,Xo,mc,hc,yc,bc,Ts,Yo,vc,wc,xc,gn}from"./chunk-324ykbvc.js";import{a}from"./chunk-tn7af59k.js";import{so}from"./chunk-tfayhked.js";import{l}from"./chunk-qc93ce5h.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=gn.filter((e)=>!ge.has(e)).sort(),te=[..._].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function xe(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),k=p.split(`
2
+ import{_}from"./chunk-ez35607j.js";import{we,At,Go,Xo,mc,hc,yc,bc,Ts,Yo,vc,wc,xc,gn}from"./chunk-028w2zsn.js";import{a}from"./chunk-70rawzs2.js";import{so}from"./chunk-94jm76pr.js";import{l}from"./chunk-qc93ce5h.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=gn.filter((e)=>!ge.has(e)).sort(),te=[..._].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function xe(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),k=p.split(`
3
3
  `).length;s.push({line:k,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:xe(r,u.kind)})}}}return s}import v from"path";var Se="@stacksjs/stx-typescript-plugin";function ke(e,t){let s=v.resolve(e);for(;;){let u=v.join(s,"tsconfig.json");if(t(u))return u;let i=v.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let u=ke(e,s);if(!u)return;let i=new Set,c=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let r=x.find((p)=>p?.name===Se),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>v.resolve(v.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...y].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=v.resolve(v.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=c(f);if(p!==void 0)return p}return};return c(u)??void 0}function bl(e,t="",s=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=Yo(e)+Xo(Go(e.code)),c=e.kind==="client"||e.kind==="plain"?yc(t,e.code):"";return Ts(`${u+i}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{sh,yf,Ro,rs,rr,Ao,Po,ss,os,is,Io,qa,bf,yt}from"./chunk-k5rm5d45.js";import"./chunk-d6sa77de.js";import"./chunk-m5nzpjej.js";import"./chunk-tn7af59k.js";import"./chunk-0vev19fg.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import{z}from"./chunk-324ykbvc.js";import"./chunk-r323cyjn.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{sh as clearScriptScanCache,ss as convertServerLoopAttributesToDirectives,Ao as convertSignalDirectivesToAttributes,os as convertSignalLoopsToAttributes,rr as extractClientSignalNames,z as extractExports,qa as findMarkupIndexOutsideScripts,rs as hasSignalsSyntax,Ro as parseLoopExpression,Po as preEvalLiteralReactiveIfs,is as processScriptSetup,Io as processSignals,bf as rewriteStxImportSpecifiers,yf as scanScriptTags,yt as stripStxRuntimeImports};
2
+ import{sh,yf,Ro,rs,rr,Ao,Po,ss,os,is,Io,qa,bf,yt}from"./chunk-bx7mqza3.js";import"./chunk-mh7wxkpc.js";import"./chunk-m5nzpjej.js";import"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import{z}from"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{sh as clearScriptScanCache,ss as convertServerLoopAttributesToDirectives,Ao as convertSignalDirectivesToAttributes,os as convertSignalLoopsToAttributes,rr as extractClientSignalNames,z as extractExports,qa as findMarkupIndexOutsideScripts,rs as hasSignalsSyntax,Ro as parseLoopExpression,Po as preEvalLiteralReactiveIfs,is as processScriptSetup,Io as processSignals,bf as rewriteStxImportSpecifiers,yf as scanScriptTags,yt as stripStxRuntimeImports};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{j,Sf,Do,a,P,ph,fh}from"./chunk-tn7af59k.js";import"./chunk-0vev19fg.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-324ykbvc.js";import"./chunk-r323cyjn.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{P as config,j as defaultConfig,ph as defineStxConfig,Do as discoverConfig,a as loadStxConfig,Sf as resolveStxDirectories,fh as validateConfig};
2
+ import{j,Sf,Do,a,P,ph,fh}from"./chunk-70rawzs2.js";import"./chunk-09ty695q.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{P as config,j as defaultConfig,ph as defineStxConfig,Do as discoverConfig,a as loadStxConfig,Sf as resolveStxDirectories,fh as validateConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{at,ct,lt}from"./chunk-6ts3sthp.js";import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{m}from"./chunk-324ykbvc.js";import"./chunk-zkx2m308.js";import"./chunk-rbmt5w9v.js";import"./chunk-r323cyjn.js";import{zt,Ws,Ht,Ai,it,Pi,qs,Vt,Oi,Ut}from"./chunk-h16qbyjd.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()=>{Pi("Config file changed, restarting...");try{await e.onChange()}catch(p){it(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:dt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function dt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var pt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,pt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{at,ct,lt}from"./chunk-6ts3sthp.js";import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{m}from"./chunk-028w2zsn.js";import"./chunk-zkx2m308.js";import"./chunk-rbmt5w9v.js";import"./chunk-v1rpc5ap.js";import{zt,Ws,Ht,Ai,it,Pi,qs,Vt,Oi,Ut}from"./chunk-h16qbyjd.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()=>{Pi("Config file changed, restarting...");try{await e.onChange()}catch(p){it(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:dt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function dt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var pt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,pt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,7 +556,7 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-6vgxe0jw.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-6vgxe0jw.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-42ryy009.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-42ryy009.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
561
  `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await Vt(t);ct(t,r);let s=Ut(t.config,r);lt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),g=`http://${o}:${e.port}`,y=Oi(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let u=await Vt(t);ct(t,u);let f=Ut(t.config,u);if(lt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=g;try{let{exec:l}=await import("child_process"),u=process.platform;l(`${u==="darwin"?"open":u==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:g,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],g=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((u)=>u.id===p);if(!l)return new Response("Story not found",{status:404});try{let u=await Y(t,l,g,y);return Response.json({html:u.html,css:u.css,js:u.js,errors:u.errors,duration:u.duration})}catch(u){return Response.json({html:"",css:"",js:"",errors:[u instanceof Error?u.message:String(u)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((g)=>g.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Jc,Yc}from"./chunk-ez35607j.js";import{H,Ss,ks,_s,Wo,qo,mr,Oe,pe,X,Es,ie,J,I,tt,yr,Jo,wr,Be,r,p,V,yn}from"./chunk-324ykbvc.js";import{f,R,nt,d}from"./chunk-zkx2m308.js";import{n}from"./chunk-frhdytza.js";import{se}from"./chunk-r3j4m04w.js";import{s}from"./chunk-05qf3e2p.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var pt=!1;function me(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new mt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let w=Error(y.error?.message??"image worker failed");if(y.error?.name)w.name=y.error.name;if(y.error?.stack)w.stack=y.error.stack;u(()=>a(w))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function mn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:mn(i.relativePath),...pn(i.absolutePath)?{options:{storage:t}}:{}}))}function pn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function bn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ko(e){let t=At(e);return t?ye().catalog.get(t):void 0}function _o(e){let t=At(e);return t?ye().transparent.has(t):!1}function Co(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=ko(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Co(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:_o(e)?void 0:t.placeholder?.dataUrl}}function ts(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return ts(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ts(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let v=a[h.relativePath];if(!v)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==v.mtimeMs||S.size!==v.size});if(c.length===0)return ts(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let v=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(v.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ts(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let w=await xn(y.entries),x=bn(y.entries,w),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=w;let b=w.size===0&&x.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...w].sort(),droppedWebp:x.sort()})).digest("hex");return{count:u.length,fingerprint:b}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Wo(e,o);if(a!==void 0)return a;for(let c of qo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let w=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,w)),u.push(...ae(e,w)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function _e(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=ko(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),w=K(e,"densities"),x=K(e,"format"),C=_o(o)||qe(o)?.transparent===!0,b=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",v=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||_e(e,"picture",!1)||!!x,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&v&&v!=="local"&&v!=="static")z=Ve(o,Xe,v,x),G=Ze(u);else if(!z&&w){let _=w.split(/\s+/).map((F)=>Number.parseFloat(F.replace("x","")));z=Pn(o,_,B,v,x)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let W=[],ce=b==="blur"||b==="color"||b==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&b==="color")j.push(`background-color:${_.color}`),W.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundColor","backgroundImage");else{let F=In(B||16,T||9,h);j.push(`background-image:url(${F})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage")}}else if(!ce&&b&&b!=="empty"&&b!=="none")j.push(`background-image:url(${n(b)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage");let we=a?.fallback.url||xe(o,B,T,v,x),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(mr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(W.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",F=_n(W)+(_?`;${_}`:"");Y.push(`onload="${n(F)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let F=x==="webp"?"image/webp":x==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${F?` type="${F}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
2
+ import{Jc,Yc}from"./chunk-ez35607j.js";import{H,Ss,ks,_s,Wo,qo,mr,Oe,pe,X,Es,ie,J,I,tt,yr,Jo,wr,Be,r,p,V,yn}from"./chunk-028w2zsn.js";import{f,R,nt,d}from"./chunk-zkx2m308.js";import{n}from"./chunk-re5vaz0d.js";import{se}from"./chunk-r3j4m04w.js";import{s}from"./chunk-05qf3e2p.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var pt=!1;function me(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new mt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let w=Error(y.error?.message??"image worker failed");if(y.error?.name)w.name=y.error.name;if(y.error?.stack)w.stack=y.error.stack;u(()=>a(w))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function mn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:mn(i.relativePath),...pn(i.absolutePath)?{options:{storage:t}}:{}}))}function pn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function bn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ko(e){let t=At(e);return t?ye().catalog.get(t):void 0}function _o(e){let t=At(e);return t?ye().transparent.has(t):!1}function Co(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=ko(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Co(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:_o(e)?void 0:t.placeholder?.dataUrl}}function ts(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return ts(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ts(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let v=a[h.relativePath];if(!v)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==v.mtimeMs||S.size!==v.size});if(c.length===0)return ts(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let v=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(v.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ts(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let w=await xn(y.entries),x=bn(y.entries,w),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=w;let b=w.size===0&&x.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...w].sort(),droppedWebp:x.sort()})).digest("hex");return{count:u.length,fingerprint:b}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Wo(e,o);if(a!==void 0)return a;for(let c of qo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let w=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,w)),u.push(...ae(e,w)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function _e(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=ko(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),w=K(e,"densities"),x=K(e,"format"),C=_o(o)||qe(o)?.transparent===!0,b=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",v=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||_e(e,"picture",!1)||!!x,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&v&&v!=="local"&&v!=="static")z=Ve(o,Xe,v,x),G=Ze(u);else if(!z&&w){let _=w.split(/\s+/).map((F)=>Number.parseFloat(F.replace("x","")));z=Pn(o,_,B,v,x)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let W=[],ce=b==="blur"||b==="color"||b==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&b==="color")j.push(`background-color:${_.color}`),W.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundColor","backgroundImage");else{let F=In(B||16,T||9,h);j.push(`background-image:url(${F})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage")}}else if(!ce&&b&&b!=="empty"&&b!=="none")j.push(`background-image:url(${n(b)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage");let we=a?.fallback.url||xe(o,B,T,v,x),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(mr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(W.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",F=_n(W)+(_?`;${_}`:"");Y.push(`onload="${n(F)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let F=x==="webp"?"image/webp":x==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${F?` type="${F}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
3
3
  `}if(E){let _=[];if(a)for(let F of Co(a))_.push(`<source type="image/${F.format}" srcset="${n(F.srcset)}"${G?` sizes="${n(G)}"`:""} />`);if(!a&&(x==="avif"||x==="auto")){let F=xe(o,B,T,v,"avif"),te=z?Ve(o,Xe,v,"avif"):`${F}`;_.push(`<source type="image/avif" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}if(!a&&(x==="webp"||x==="auto")){let F=xe(o,B,T,v,"webp"),te=z?Ve(o,Xe,v,"webp"):`${F}`;_.push(`<source type="image/webp" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}return`${Z}<picture>
4
4
  ${_.join(`
5
5
  `)}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ko,pc,o,$t,oe,C,Ie,un,Oe,pe,X,hr,dn,$s,kc,fn,vr,As,Ps,_c,Qo,Cc,Ec,Tc,$c,De,Me,Is,Be,r,hn,h,p,V,Z,xe,k,E}from"./chunk-324ykbvc.js";import{u,f,R,t,ae,q,c,Se,ui,B,wn,di,jt,pi,zc,kr,Hc,st,Vc,_r,Uc,xn,fi,Wc,Cr,Tr,ke,gi}from"./chunk-zkx2m308.js";import{Dt}from"./chunk-rbmt5w9v.js";import{bn}from"./chunk-r323cyjn.js";import{y}from"./chunk-sdkyrewa.js";import{dr,vs}from"./chunk-2mqzpzy7.js";import{Ja,Ya,cr,Ye,Za,P}from"./chunk-tn7af59k.js";import{jo,Bo,Fo,zo}from"./chunk-q7fh1xka.js";import{Wa,ns}from"./chunk-b885q789.js";import{Zr,Qr,es}from"./chunk-23zgfwak.js";import{rs,Ao,Po,ss,os,Io}from"./chunk-k5rm5d45.js";import{Yr,nr}from"./chunk-1g6t4dg5.js";import{So}from"./chunk-x9wwd2ee.js";import{se,Eo,To,$o}from"./chunk-r3j4m04w.js";import{sr,ye,Ka,or,Ga}from"./chunk-d6sa77de.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{Qa,ec}from"./chunk-0vev19fg.js";import{T,Sn,mi}from"./chunk-xaddgvkx.js";import fs from"fs";import ce from"path";function lt(){return`
2
+ import{Ko,pc,o,$t,oe,C,Ie,un,Oe,pe,X,hr,dn,$s,kc,fn,vr,As,Ps,_c,Qo,Cc,Ec,Tc,$c,De,Me,Is,Be,r,hn,h,p,V,Z,xe,k,E}from"./chunk-028w2zsn.js";import{u,f,R,t,ae,q,c,Se,ui,B,wn,di,jt,pi,zc,kr,Hc,st,Vc,_r,Uc,xn,fi,Wc,Cr,Tr,ke,gi}from"./chunk-zkx2m308.js";import{Dt}from"./chunk-rbmt5w9v.js";import{bn}from"./chunk-v1rpc5ap.js";import{y}from"./chunk-6qxyrafx.js";import{dr,vs}from"./chunk-2mqzpzy7.js";import{Ja,Ya,cr,Ye,Za,P}from"./chunk-70rawzs2.js";import{jo,Bo,Fo,zo}from"./chunk-q7fh1xka.js";import{Wa,ns}from"./chunk-r3b215k4.js";import{Zr,Qr,es}from"./chunk-csfghrwe.js";import{rs,Ao,Po,ss,os,Io}from"./chunk-bx7mqza3.js";import{Yr,nr}from"./chunk-0gv1jjkd.js";import{So}from"./chunk-x9wwd2ee.js";import{se,Eo,To,$o}from"./chunk-r3j4m04w.js";import{sr,ye,Ka,or,Ga}from"./chunk-mh7wxkpc.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{Qa,ec}from"./chunk-09ty695q.js";import{T,Sn,mi}from"./chunk-xaddgvkx.js";import fs from"fs";import ce from"path";function lt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -1558,13 +1558,13 @@ ${M}
1558
1558
  </style>`;a=a.replace(x,I),v.lastIndex=0}catch(M){}}}return a}import it from"path";var us=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ds=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ps(s,e){if(!e||!s.includes("/"))return s;let l=it.dirname(e);return s.replace(us,(a,g,n,d)=>{let v=it.resolve(l,d);return`${g}${n}${v.split(it.sep).join("/")}${n}`})}function cn(s,e){if(!e||!s.includes("<script"))return s;return s.replace(ds,(l,a,g,n)=>`${a}${ps(g,e)}${n}`)}var _e="<!--PARENT_CONTENT_PLACEHOLDER-->";function ln(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kn(s,e){let l=s.length,a=e,g=!0,n=[],d=(v)=>v+9<=l&&s[v]==="<"&&s[v+1]==="/"&&(s[v+2]==="s"||s[v+2]==="S")&&(s[v+3]==="c"||s[v+3]==="C")&&(s[v+4]==="r"||s[v+4]==="R")&&(s[v+5]==="i"||s[v+5]==="I")&&(s[v+6]==="p"||s[v+6]==="P")&&(s[v+7]==="t"||s[v+7]==="T")&&(s[v+8]===">"||/\s/.test(s[v+8]));while(a<l){let v=s[a];if(d(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
1559
1559
  `,a+2),a===-1)return-1;a+=1,g=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(v==="/"&&g){let m=a+1,x=!1;while(m<l){let b=s[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
1560
1560
  `){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
1561
- `)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function pn(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-rf6j5t0z.js");return`<script ${s} src="${a(e)}"></script>`}async function Zn(s,e,l){try{let{registeredModuleIdsIn:a,buildModuleRegistryScript:g}=await o("stx/client-module-registry",()=>import("./chunk-xbdyr6kh.js")),n=[],d=await g(a(...s),{minify:mi(e.buildMode,e.minifyClient),collectInputs:n});for(let v of n)l?.add(v);if(!d)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-rf6j5t0z.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(d)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${d.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ms(s,e=""){let l=$n(s,"data-stx-runtime");if(!l)return s;let a=sr(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
1561
+ `)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function pn(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-k86adw4s.js");return`<script ${s} src="${a(e)}"></script>`}async function Zn(s,e,l){try{let{registeredModuleIdsIn:a,buildModuleRegistryScript:g}=await o("stx/client-module-registry",()=>import("./chunk-152dg4h2.js")),n=[],d=await g(a(...s),{minify:mi(e.buildMode,e.minifyClient),collectInputs:n});for(let v of n)l?.add(v);if(!d)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-k86adw4s.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(d)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${d.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ms(s,e=""){let l=$n(s,"data-stx-runtime");if(!l)return s;let a=sr(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
1562
1562
  `+s.slice(a,l.start)+s.slice(l.end);let g=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),d=sr(n);if(d===-1)return g+e+`
1563
1563
  `+n;return n.slice(0,d)+g+e+`
1564
1564
  `+n.slice(d)}function hs(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,g){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=xe(s,l);let n=!e.__stxProcessingDepth;fn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await bn(e,l,a.runtimeConfig);if(n)Tc(e),e.__stx_scope_seq??={n:0,key:Is(String(e.__filename??l))},e.__stx_head_injections=pi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!T()&&!Sn())&&l&&l.endsWith(".stx"))So(s,l);try{return await oe.timeAsync("template-processing",async()=>{let d=await ys(s,e,l,a,g);if(n)d=Qo(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=ke(a.app?.head,{known:Tr,source:"app.head"}),x=(e.__stx_runtime_head||null)??gi(),b=(e.__stx_head_raw||"").trim(),w,S=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(S)w=S[1].trim(),b=b.replace(S[0],"").trim();let _=e.__sections?.title,D=_?k(_,e,l):void 0,A=x.title||w||D,M=!x.title&&(!!w||!!D),I=x.meta||[],N=new Set(I.map((K)=>st(K)).filter(Boolean)),U={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((K)=>!N.has(st(K))),...I],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
1565
1565
  `),...x.htmlAttrs&&{htmlAttrs:Vc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},W=fi(d);if(d=Cr(d,U,{...M&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},W),W)d=Wc(d,v),d=_r(d,U.htmlAttrs);let O=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&d.includes("<head")){let K=O[1],G=vs(K);d=d.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
1566
1566
  <meta name="stx-layout" content="${ln(K)}">
1567
- <meta name="stx-layout-group" content="${ln(G)}">`)}let j=d.match(/function (__stx_setup_\w+)\(/),H=j?L(d):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){d=Xe(d,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");d=d.replace(K,"$1")}}if(n){let v=e.__stx_head_injections??pi(),m=Uc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=zc(d,v);let b=a.app?.colorMode;if(b)d=kr(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,S=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-1casvr33.js")),A=a.storesDir,M=await D(A);if(M)b=`<script data-stx-stores>${M}</script>`,x=await pn("data-stx-stores",M,a)??b}catch{}m=await Zn([d,b],a,g);try{let{getFrameworkComposableScript:D}=await o("stx/framework-composables",()=>import("./chunk-grh8796h.js"));S=await D(d)}catch{}try{let{getComposableScript:D}=await o("stx/composable-loader",()=>import("./chunk-35dah9fm.js")),A=a.composablesDir,M=[m,b,S].filter((N)=>N!==null),I=await D(a._layerComposableDirs??A,d,M);if(I)w=await pn('data-stx-scoped data-stx-run="always" data-stx-composables',I,a)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${I}</script>`}catch{}let _=[m,x,w,S].filter((D)=>D!==null).map((D)=>`
1567
+ <meta name="stx-layout-group" content="${ln(G)}">`)}let j=d.match(/function (__stx_setup_\w+)\(/),H=j?L(d):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){d=Xe(d,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");d=d.replace(K,"$1")}}if(n){let v=e.__stx_head_injections??pi(),m=Uc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=zc(d,v);let b=a.app?.colorMode;if(b)d=kr(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,S=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-m2aksmz2.js")),A=a.storesDir,M=await D(A);if(M)b=`<script data-stx-stores>${M}</script>`,x=await pn("data-stx-stores",M,a)??b}catch{}m=await Zn([d,b],a,g);try{let{getFrameworkComposableScript:D}=await o("stx/framework-composables",()=>import("./chunk-ynbqdg6p.js"));S=await D(d)}catch{}try{let{getComposableScript:D}=await o("stx/composable-loader",()=>import("./chunk-h4gehmrp.js")),A=a.composablesDir,M=[m,b,S].filter((N)=>N!==null),I=await D(a._layerComposableDirs??A,d,M);if(I)w=await pn('data-stx-scoped data-stx-run="always" data-stx-composables',I,a)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${I}</script>`}catch{}let _=[m,x,w,S].filter((D)=>D!==null).map((D)=>`
1568
1568
  ${D}`).join("");d=ms(d,_)}else{let m=await Zn([d],a,g);if(m){let x=d.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)d=d.slice(0,x)+m+`
1569
1569
  `+d.slice(x)}}if(n)d=Hc(d);if(n&&e.__stx_inject_css!==!1)d=await y(d,void 0,a.buildMode==="serve",!0);else if(n)d=dn(d);if(d=d.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),d=hs(d),n&&e.__stx_runtime_config)d=Dt(d,e.__stx_runtime_config);if(n&&!e.__stx_defer_server_data){let v=vr(e);if(v){let m=/<head\b[^>]*>/i.exec(d),x=m?m.index+m[0].length:0;d=d.slice(0,x)+v+d.slice(x)}}return d})}catch(d){if(d instanceof q)throw d;let v=d instanceof Error?d.message:String(d),m=new ae(`Template processing failed: ${v}`,l,void 0,void 0,s.substring(0,200)+(s.length>200?"...":""));if(B.log(m,{filePath:l,context:e}),wn.logDetailedError(m,{filePath:l,template:s.substring(0,500)}),T()&&!a.debug)console.error(`[stx] ${ce.relative(process.cwd(),l)||l}: ${m.message}`);if(a.debug)throw m;return ui.createFallbackContent("Template Processing",m)}}async function ys(s,e,l,a,g){let n=process.cwd(),d={...a,partialsDir:a.partialsDir&&!ce.isAbsolute(a.partialsDir)?ce.resolve(n,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ce.isAbsolute(a.componentsDir)?ce.resolve(n,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ce.isAbsolute(a.layoutsDir)?ce.resolve(n,a.layoutsDir):a.layoutsDir},v=d,m=s;await xs(l,e),ws(e,v),m=await Se(()=>zt(m,e,l,v),m,(O)=>{B.log(O,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${O.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=pe(m,Oe,(O,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);m=x.output;let b=x.tokens,w=(O)=>b.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,H)=>b[Number(H)]??""),S="\x00STX_ESCAPED_AT\x00",_="\x00STX_ESC_MUSTACHE_OPEN\x00",D="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,S),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(O,j)=>`${_}${j}${D}`),m=Jt(m),m=await an(m,l,g);let A={};m=Qr(m,A);let M={...e.__sections||{}},I="",N=gt(mt(s)),U=/@nolayout\b/.test(m)||N===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let W=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)I=W[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(I=N,!/@section\s*\(/.test(m))m=`@section('content')
1570
1570
  ${m.trim()}
@@ -1573,7 +1573,7 @@ ${m.trim()}
1573
1573
  @endsection`}}if(I&&m.includes("<script")){let O=X(m),j=O.scripts.map((H)=>gn(H,l)??H);m=hr(O.output,j)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,j,H)=>(M[j]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,j,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return O;try{let K=u(H.trim(),e);if(K===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(K)-1;return M[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,j,H)=>{if(H.includes("@parent"))M[j]=H.replace("@parent",_e);else M[j]=H.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,j,H)=>M[j]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=es(m,A),I){let O=[],j=X(m),H=pe(j.output,un,(K,G)=>`\x00STX_ORPHAN_STYLE_${G}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,G,Y)=>{let ee=G==="SCRIPT"?gn(j.scripts[Number(Y)],l):H.tokens[Number(Y)];if(ee)O.push(ee);return""}),O.length>0){let K=O.join(`
1574
1574
  `);M.content=M.content?`${M.content}
1575
1575
  ${K}`:K,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,g.add(I);else O=await Se(()=>hn(I,l,d,g),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let ee=(re)=>{if(!re)return[];try{let ie=ce.isAbsolute(re)?re:ce.resolve(process.cwd(),re);return fs.readdirSync(ie).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(d.layoutsDir),...ee(d.fallbackLayoutsDir)].filter((re,ie,le)=>le.indexOf(re)===ie).sort(),ue=`Layout not found: ${I} (referenced from ${l})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"");if(B.log(Error(ue),{layoutPath:I,filePath:l,available:te},"error"),console.error(`[stx] ${ue}`),d.debug)throw new ae(ue,l);return m}let j=await Se(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});j=cn(j,O);let H=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${O}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,le,be)=>(ee[le]=be.trim(),""));for(let[ie,le]of Object.entries(ee))if(M[ie]&&M[ie].includes(_e)){let be=M[ie].indexOf(_e);M[ie]=M[ie].slice(0,be)+le+M[ie].slice(be+_e.length)}else if(!M[ie])M[ie]=le;let ue={...e,__sections:M},re=`@layout('${H[1]}')${te}`;return await i(re,ue,O,d,g)}let K=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Qr(K,A),Y={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(M[te]){let re=M[te];if(re.includes(_e)){let ie=Y[te]||"",le=re.indexOf(_e);re=re.slice(0,le)+ie+re.slice(le+_e.length)}return re}return ue||""}),G=bs(G,M),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),G=es(G,A),e.__originalFilePath=l,m=await vn(G,e,O,d,g),m=`<!-- stx-layout: ${I} -->
1576
- ${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await vn(m,e,l,d,g))}function bs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ws(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function xs(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function gn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-m7xj95vn.js")),n=[],d=!T()&&!Sn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=kn(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let _=ks(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-agvjbgqn.js"));await A(S,e,_,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:M.kind,message:M.message}),!d)return;n.push({...D,markup:yn(_,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${M.message}`),d)n.push({...D,markup:yn(_,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function Es(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-tpmhe6e6.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return B.log(g,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${g.message}`),s}}async function vn(s,e,l,a,g){let n=s,d=a;if(n=await Ss(n,e,l,a),n=await Bt(n,e,l),n=await Ft(n,e,l),n=await Es(n,e,l),n=await At(n,e,l,d),xe(n))n=Ao(n,e),n=os(n,e),n=ss(n,e);n=Po(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-nrnqxazz.js"));n=v(n,e),n=nr(n,e,l,d,!0),n=await en(n,e,l,d,g),n=await ns(n,e,l,d,g),n=Ja(n,e,l,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-8dfq934n.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-hrb9fmq0.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-sx1aer4p.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=_(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-5d1c504j.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-r5re2zj0.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-3nbvr34s.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await o("stx/virtual-scrolling",()=>import("./chunk-8w1ep4w3.js"));n=I(n,e,l),n=N(n,e,l),n=U(n,e,l);let{processPartialHydrationDirectives:W,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-336t7zzz.js"));n=W(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=H(n,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-y98v9as6.js"));n=K(n,e,l);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-agjysd2b.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
1576
+ ${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await vn(m,e,l,d,g))}function bs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ws(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function xs(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function gn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-qnpfkdea.js")),n=[],d=!T()&&!Sn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=kn(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let _=ks(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-mq8tmepp.js"));await A(S,e,_,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:M.kind,message:M.message}),!d)return;n.push({...D,markup:yn(_,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${M.message}`),d)n.push({...D,markup:yn(_,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function Es(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-3m5kbph6.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return B.log(g,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${g.message}`),s}}async function vn(s,e,l,a,g){let n=s,d=a;if(n=await Ss(n,e,l,a),n=await Bt(n,e,l),n=await Ft(n,e,l),n=await Es(n,e,l),n=await At(n,e,l,d),xe(n))n=Ao(n,e),n=os(n,e),n=ss(n,e);n=Po(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-vkws6yvd.js"));n=v(n,e),n=nr(n,e,l,d,!0),n=await en(n,e,l,d,g),n=await ns(n,e,l,d,g),n=Ja(n,e,l,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-8dfq934n.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-hrb9fmq0.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-sx1aer4p.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=_(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-5d1c504j.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-r5re2zj0.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-3nbvr34s.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await o("stx/virtual-scrolling",()=>import("./chunk-8w1ep4w3.js"));n=I(n,e,l),n=N(n,e,l),n=U(n,e,l);let{processPartialHydrationDirectives:W,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-336t7zzz.js"));n=W(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=H(n,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-rhcfdp90.js"));n=K(n,e,l);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-agjysd2b.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
1577
1577
  `;if(n=Y(n,e),n=ee(n,e,l),n=Xt(n),n=Eo(n,e),n=Ct(n),n=Ut(n),n=await Zr(n,e,l,d,g),n=await ns(n,e,l,d,g),e.__stxProcessingDepth===1)n=$c(n,e);if(n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=Qo(n),n=se(n,e,l),n=Yr(n),n=kc(n,e,{filePath:l,buildMode:d.buildMode}),n=To(n,e),n=$o(n,e),n=ze(n,e),n=Nt(n,e),n=Ht(n,e),n=await bt(n,e,l,d),n=await Za(n,e,l),n=await Qa(n,e,l,d),n=ec(n,e,l,d),n=jo(n,e,l,d),n=Bo(n,e,l),n=Fo(n,e,l,d),n=_t(n,e,l,d),n=As(n,e),n=Ps(n),n=_c(n),!d.skipEventDirectives)n=pc(n,e,l);if(n=vt(n,e,l),d.debug){let F=/\bx-data\s*=/.test(n),z=rs(s);if(F&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1578
1578
  Both work on the same page, but they manage separate scopes.
1579
1579
  Prefer signals (state/derived/effect) for new components.`)}n=Wa(n,e),n=await k(n,e,l),n=Cc(n),n=Ec(n),n=pt(n);let{processXElementDirectives:re}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=re(n);let ie=e.__originalFilePath||l,le=De(e);if(n=await Io(n,d,ie,le),n=Ot(n,e),n=await Wt(n,e,l,d),d.media?.image?.autoSiblings){let F=d.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-6h1qa3hw.js"));n=await z(n,{publicDir:F})}if(d.seo?.enabled)n=zo(n,e,d);let be=(F,z,J=!0)=>{if(!z)return F;let me=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Te=ne.index+fe.index;F=F.slice(0,Te)+me[0]+F.slice(Te+fe[0].length)}if(z=z.replace(me[0],"").trim(),!z)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${z}
@@ -1587,6 +1587,6 @@ ${lt()}
1587
1587
  `+Te}else n=n.replace("</head>",`${z}
1588
1588
  </head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
1589
1589
  ${z}`);else n=z+`
1590
- `+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-m7xj95vn.js")),z=[];for(let J of F(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=kn(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;z.push({start:J.start,end:fe})}if(z.length>0){let J=Array(z.length+1),me=0;for(let ne=0;ne<z.length;ne++){let{start:fe,end:Te}=z[ne];J[ne]=n.slice(me,fe),me=Te}J[z.length]=n.slice(me),n=J.join("")}}let at=$s(n,l);if(at.hasScoped)n=at.html;let Rn=e.__stx_event_bindings||[],Ke=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Dn}=await o("stx/signal-processing",()=>import("./chunk-m7xj95vn.js"));for(let F of Dn(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:J}of ct){Ke=!0;let me=J;Ie(J,l,a.strict,e.__originalFilePath);let ne=await Me(J,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:mi(a.buildMode,a.minifyClient),serverData:le});n=n.replace(F,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=Ko(F);if(z){let J=n.lastIndexOf("</body>");n=J===-1?n+z:n.slice(0,J)+z+`
1590
+ `+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-qnpfkdea.js")),z=[];for(let J of F(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=kn(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;z.push({start:J.start,end:fe})}if(z.length>0){let J=Array(z.length+1),me=0;for(let ne=0;ne<z.length;ne++){let{start:fe,end:Te}=z[ne];J[ne]=n.slice(me,fe),me=Te}J[z.length]=n.slice(me),n=J.join("")}}let at=$s(n,l);if(at.hasScoped)n=at.html;let Rn=e.__stx_event_bindings||[],Ke=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Dn}=await o("stx/signal-processing",()=>import("./chunk-qnpfkdea.js"));for(let F of Dn(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:J}of ct){Ke=!0;let me=J;Ie(J,l,a.strict,e.__originalFilePath);let ne=await Me(J,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:mi(a.buildMode,a.minifyClient),serverData:le});n=n.replace(F,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=Ko(F);if(z){let J=n.lastIndexOf("</body>");n=J===-1?n+z:n.slice(0,J)+z+`
1591
1591
  `+n.slice(J)}e.__stx_event_bindings=[]}}if(!ye(n)&&Ka(n))n=await or(n,d);if(n=Ga(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=Et(n,e.cspNonce);return n}
1592
1592
  export{mt,Re,za,Jr,wo,xo,Zn,i};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{we,ti,ni,zf,Ot,Pc,ri,Ic,vh,De,mn,Me}from"./chunk-324ykbvc.js";import{jc,s}from"./chunk-05qf3e2p.js";import"./chunk-r323cyjn.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{we as BROWSER_CORE_IMPORTS,zf as STX_AUTO_IMPORTS,ti as extractAndStripCssImports,De as extractBridgeData,jc as findInterpolationEnd,Ic as generateAutoImportDestructuring,vh as generateBrowserAutoImportDestructuring,mn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,Me as processClientScript,ri as referencesName,ni as renderVendorStyleTags,s as stripCommentsAndLiterals,Pc as transformAutoImports};
2
+ import{we,ti,ni,zf,Ot,Pc,ri,Ic,vh,De,mn,Me}from"./chunk-028w2zsn.js";import{jc,s}from"./chunk-05qf3e2p.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{we as BROWSER_CORE_IMPORTS,zf as STX_AUTO_IMPORTS,ti as extractAndStripCssImports,De as extractBridgeData,jc as findInterpolationEnd,Ic as generateAutoImportDestructuring,vh as generateBrowserAutoImportDestructuring,mn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,Me as processClientScript,ri as referencesName,ni as renderVendorStyleTags,s as stripCommentsAndLiterals,Pc as transformAutoImports};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{V}from"./chunk-028w2zsn.js";function n(t){return V(t)}
3
+ export{n};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ra,Hl,Ln,Gg,Vl,Ul,Wl,Xg}from"./chunk-87g6x9z2.js";import"./chunk-324ykbvc.js";import"./chunk-r323cyjn.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Ln as Validator,Hl as defineForm,Vl as processErrorDirective,Ul as processErrorsDirective,Xg as processFormValidationDirectives,Wl as processHasErrorsDirective,ra as useForm,Gg as v};
2
+ import{ra,Hl,Ln,Gg,Vl,Ul,Wl,Xg}from"./chunk-fzpkf5w7.js";import"./chunk-028w2zsn.js";import"./chunk-v1rpc5ap.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{Ln as Validator,Hl as defineForm,Vl as processErrorDirective,Ul as processErrorsDirective,Xg as processFormValidationDirectives,Wl as processHasErrorsDirective,ra as useForm,Gg as v};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{ue}from"./chunk-2mqzpzy7.js";import{Fe,O}from"./chunk-rbmt5w9v.js";import{sc}from"./chunk-3fwdxxh1.js";import{l}from"./chunk-qc93ce5h.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function nn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function ho(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ue(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
3
  `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function yo(s,c,o={}){let i=nn(s,o);await ho(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function bo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Xm(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=nn(s,o);return await ho(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=nn(s,o);await ho(s,t);let{loadStxConfig:e}=await import("./chunk-4p4djjh3.js"),a=O((await e(s)).runtimeConfig);return await Fe(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
4
+ `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function bo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Xm(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=nn(s,o);return await ho(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=nn(s,o);await ho(s,t);let{loadStxConfig:e}=await import("./chunk-qprabe63.js"),a=O((await e(s)).runtimeConfig);return await Fe(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function vo(s,c,o){if(sc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
6
6
  export{nn,ho,yo,bo,Xm,vo};