@stacksjs/stx 0.2.803 → 0.2.805

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 (82) hide show
  1. package/dist/{chunk-k4csq6pk.js → chunk-117sk8mx.js} +2 -2
  2. package/dist/{chunk-y2q46m8b.js → chunk-1qp6vqdd.js} +1 -1
  3. package/dist/chunk-21yscass.js +2 -0
  4. package/dist/{chunk-ps5by9sq.js → chunk-2k8vxve1.js} +4 -4
  5. package/dist/chunk-2wdrznkm.js +2 -0
  6. package/dist/{chunk-qeyzgyhk.js → chunk-2zkzkjmr.js} +1 -1
  7. package/dist/chunk-4xtgh99h.js +3 -0
  8. package/dist/{chunk-j49t3p7e.js → chunk-4y304qhn.js} +1 -1
  9. package/dist/{chunk-8m5w99f3.js → chunk-5a1273xd.js} +1 -1
  10. package/dist/{chunk-fsjkavq5.js → chunk-5kqbj292.js} +1 -1
  11. package/dist/{chunk-4jrf6gsk.js → chunk-5pm5zq2f.js} +1 -1
  12. package/dist/{chunk-w3dsj0a6.js → chunk-6dg45cs2.js} +1 -1
  13. package/dist/{chunk-e6snnz4t.js → chunk-6g6542n1.js} +1 -1
  14. package/dist/chunk-6pch0363.js +2 -0
  15. package/dist/{chunk-qm3hkrcw.js → chunk-6tj3a33f.js} +2 -2
  16. package/dist/{chunk-87g1ryzs.js → chunk-7yycf63z.js} +1 -1
  17. package/dist/{chunk-gmme8c1s.js → chunk-8e99wh2m.js} +1 -1
  18. package/dist/{chunk-m1mrq876.js → chunk-8z10r3sa.js} +4 -4
  19. package/dist/chunk-8z9qtgjp.js +2 -0
  20. package/dist/{chunk-ncptqa8v.js → chunk-a706x1s8.js} +2 -2
  21. package/dist/{chunk-rmpgtyqh.js → chunk-aayq1a90.js} +1 -1
  22. package/dist/{chunk-gq5ffpq0.js → chunk-cwg1m0yp.js} +1 -1
  23. package/dist/chunk-d62tf4rh.js +2 -0
  24. package/dist/{chunk-zmckz1eq.js → chunk-dhv8ne0m.js} +1 -1
  25. package/dist/{chunk-5s31y4m0.js → chunk-dskgez6y.js} +1 -1
  26. package/dist/{chunk-kq0cee7k.js → chunk-f0zatmhn.js} +1 -1
  27. package/dist/{chunk-e848m5tj.js → chunk-f3b37bt7.js} +1 -1
  28. package/dist/{chunk-7v1pwjke.js → chunk-f3n4vkgk.js} +1 -1
  29. package/dist/chunk-f6f93b8g.js +2 -0
  30. package/dist/chunk-f8g151t2.js +2 -0
  31. package/dist/chunk-fdrk6pzr.js +2 -0
  32. package/dist/{chunk-8wd83rnz.js → chunk-fg0amm0c.js} +1 -1
  33. package/dist/{chunk-cwnx4rxk.js → chunk-ftfayqmk.js} +1 -1
  34. package/dist/{chunk-rssxm2jw.js → chunk-g0nbypak.js} +1 -1
  35. package/dist/{chunk-kn84qg00.js → chunk-g48x8yme.js} +1 -1
  36. package/dist/{chunk-16362f43.js → chunk-h5rcc2rx.js} +1 -1
  37. package/dist/{chunk-gzs0ertq.js → chunk-htrm7vx7.js} +1 -1
  38. package/dist/{chunk-19nnq90g.js → chunk-jngx8bzh.js} +1 -1
  39. package/dist/{chunk-9h72drk3.js → chunk-jrsz8e9x.js} +1 -1
  40. package/dist/{chunk-jjcw2pa9.js → chunk-kqnsztam.js} +1 -1
  41. package/dist/{chunk-8je2zse3.js → chunk-p48wb9v7.js} +4 -4
  42. package/dist/{chunk-69cphbrz.js → chunk-pnf0ev9m.js} +6 -6
  43. package/dist/chunk-r4mpr1qr.js +2 -0
  44. package/dist/{chunk-va9w63nh.js → chunk-t2tyvphs.js} +1 -1
  45. package/dist/{chunk-evmxrmjb.js → chunk-tanza35f.js} +2 -2
  46. package/dist/{chunk-k5xyb0dq.js → chunk-tb6s07sr.js} +1 -1
  47. package/dist/{chunk-hpqrcpjb.js → chunk-tesytdw5.js} +1 -1
  48. package/dist/{chunk-97daxgfk.js → chunk-tfv50vab.js} +1 -1
  49. package/dist/{chunk-mrc7hc4a.js → chunk-tj4gpffg.js} +1 -1
  50. package/dist/{chunk-3es17qjn.js → chunk-tns9qjwk.js} +1 -1
  51. package/dist/{chunk-3k4xb05m.js → chunk-twqd8vme.js} +3 -3
  52. package/dist/{chunk-77a2hse0.js → chunk-tx9wvkvp.js} +1 -1
  53. package/dist/{chunk-g9xx8qh1.js → chunk-txs6mfvk.js} +1 -1
  54. package/dist/{chunk-dc584r4z.js → chunk-tyvt5pfm.js} +2 -2
  55. package/dist/{chunk-4n7yqb9w.js → chunk-vp6ysefr.js} +1 -1
  56. package/dist/{chunk-5vxk8bz9.js → chunk-vqydn3xj.js} +5 -5
  57. package/dist/{chunk-72cm91wm.js → chunk-w2q6zmwn.js} +1 -1
  58. package/dist/chunk-w31y3j3k.js +2 -0
  59. package/dist/{chunk-amewvsn1.js → chunk-x6322cmf.js} +1 -1
  60. package/dist/{chunk-d98hgxky.js → chunk-xmntrbxe.js} +1 -1
  61. package/dist/{chunk-3ebwrpax.js → chunk-xwe3fysm.js} +4 -4
  62. package/dist/{chunk-nmc1vj8f.js → chunk-y5ah4ghz.js} +1 -1
  63. package/dist/{chunk-yhfrs6yn.js → chunk-yg0g5rm9.js} +2 -2
  64. package/dist/{chunk-dqa1g676.js → chunk-z843epx3.js} +1 -1
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/native/runtime/craft-bridge.js +15 -1
  69. package/dist/pwa.js +1 -1
  70. package/dist/ssg.js +2 -2
  71. package/package.json +5 -5
  72. package/dist/chunk-0xqec4yj.js +0 -2
  73. package/dist/chunk-36zj3myn.js +0 -2
  74. package/dist/chunk-4mb75g61.js +0 -2
  75. package/dist/chunk-8g3bgcac.js +0 -2
  76. package/dist/chunk-aznnh6cy.js +0 -3
  77. package/dist/chunk-cxahdpzz.js +0 -2
  78. package/dist/chunk-rnz6g3xv.js +0 -2
  79. package/dist/chunk-s1k2sc69.js +0 -2
  80. package/dist/chunk-s3z8jtfj.js +0 -2
  81. package/dist/chunk-wwbng2jf.js +0 -2
  82. package/dist/chunk-x7qctqj2.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ze,xn,Ws,xi,N}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-dqa1g676.js";import{Nr,k,ll,at,Ri,ul}from"./chunk-ybjfr7e8.js";import{P}from"./chunk-r9e0r6jx.js";import{R,qs,u,f,jt,d,q,F,w,Js,_e,Ve,Ys}from"./chunk-gebb12ak.js";import{r,ge}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-c5vzr1va.js";import Qe from"path";import kt from"process";import{AsyncLocalStorage as Bo}from"async_hooks";var cr=new Bo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function ar(e,t){return cr.run(mn(e),t)}async function lr(e,t){let i=cr.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let c=Promise.resolve().then(t).then((l)=>{let a=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(a);return i.values.set(e,y),y}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,c),c}function Cr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],c=new Set,l=0,a=0,y=i.length,v=()=>{if(l!==0)return;let E=i.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!c.has(I))n.push(I),c.add(I);return}let A=i.slice(a).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(a).startsWith("const"))return;A[1].split(",").forEach((I)=>{let j=I.trim();if(!j)return;let Q=j.indexOf(":"),z=(Q>=0?j.slice(Q+1).trim():j).split(/[\s=]/)[0];if(z&&!c.has(z))n.push(z),c.add(z)});return}let M=i.slice(a).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(a).startsWith("const"))return;M[1].split(",").forEach((I)=>{let j=I.trim().replace(/^\.\.\./,"");if(!j)return;let Q=j.split(/[\s=]/)[0];if(Q&&!c.has(Q))n.push(Q),c.add(Q)});return}if(t)return;let B=i.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let I=B[1];if(!c.has(I))n.push(I),c.add(I);return}let D=i.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let I=D[1];if(!c.has(I))n.push(I),c.add(I)}};while(a<y){if(i[a]==="{"){l++,a++;continue}if(i[a]==="}"){l--,a++;continue}if(l===0&&/[a-z]/i.test(i[a])&&(a===0||/\s|[;{}()]/.test(i[a-1])))v();a++}return n.join(", ")}function Is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Os(e,t){let i=`{ ${Wo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import An from"fs";import Te from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function yr(e,t=!0){let i=ur.get(e);if(t&&i)return i;let n=new Map,c=[Te.join(e,"src"),Te.join(e,"dist"),e];function l(a,y){if(y>6)return;let v;try{v=An.readdirSync(a,{withFileTypes:!0})}catch{return}for(let E of v){let A=Te.join(a,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!n.has(M))n.set(M,A);let B=M.toLowerCase();if(!n.has(B))n.set(B,A);let D=V(M);if(!n.has(D))n.set(D,A)}}}for(let a of c)if(l(a,0),n.size>0)break;if(t)ur.set(e,n);return n}function Ns(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Te.join(i,"node_modules",e);try{if(An.statSync(n).isDirectory())return n}catch{}let c=Te.dirname(i);if(c===i)return null;i=c}}function Ms(e,t,i={}){return[Te.resolve(Te.dirname(t),`${e}.stx`),Te.resolve(Te.dirname(t),e),Te.resolve(i.componentsDir||"components",`${e}.stx`),Te.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,c]=fr(e);for(let l of[i,i.toLowerCase(),n,c]){let a=t?.__importedComponents?.get(l);if(a!==void 0)return a}}function*ii(e,t,i={},n){let c=fr(e);if(c[0].startsWith("./")||c[0].startsWith("../")){yield Te.resolve(Te.dirname(t),`${c[0]}.stx`);return}let l=[...new Set(c.map((v)=>`${v}.stx`))],a=i.projectRoot||process.cwd(),y=[...n?.__originalFilePath?[Te.join(Te.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Te.join(Te.dirname(t),"components"),Te.resolve(a,"src/components"),Te.resolve(a,"components"),...import.meta.dir?[Te.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield Te.join(v,E);try{for(let E of An.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Te.join(v,E.name,A)}catch{}}}function pr(e,t,i={},n){let c=oi(e,n);if(c!==void 0)return c;for(let l of ii(e,t,i,n))try{if(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ds(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let c=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=c.get("alt"),a=c.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof a==="string"?!["false","0","off","no"].includes(a.trim().toLowerCase()):Boolean(a);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Zn from"fs";import ce from"path";import ht from"path";import Kt from"fs";var zo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function cs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return zo.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),gr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Fo=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function mr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(Fo.has(n))t.systemKeys.push(n);else if(n in $r)t.mouse=n;else if(n in gr||/^[a-z]$/.test(n))t.keys.push(gr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let c=n.match(/debounce(?:\.(\d+))?/);t.debounce=c?.[1]?Number.parseInt(c[1],10):300}else if(n.startsWith("throttle")){let c=n.match(/throttle(?:\.(\d+))?/);t.throttle=c?.[1]?Number.parseInt(c[1],10):300}}return t}function Rr(e,t=""){let i=[],n=0,c=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=c.exec(e))!==null){let[a,y,v]=l,E=l.index,A=E+a.length,M=`__stx_evt_${t}${n++}`,B=[],D=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=D.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!dr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:mr(z.slice(1)),elementId:M})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=j.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!dr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:mr(z.slice(1)),elementId:M})}if(B.length>0)i.push({originalTag:a,elementId:M,events:B,startIndex:E,endIndex:A})}return i}function Uo(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((c)=>`$event.key === '${c}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=$r[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Vo(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function as(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Ho(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=Uo(e),c=Vo(as(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(cs(e.event,t))l.push("passive: true");let a=l.length>0?`, { ${l.join(", ")} }`:"",y=c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{ze,xn,Ws,xi,N}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-z843epx3.js";import{Nr,k,ll,at,Ri,ul}from"./chunk-ybjfr7e8.js";import{P}from"./chunk-r9e0r6jx.js";import{R,qs,u,f,jt,d,q,F,w,Js,_e,Ve,Ys}from"./chunk-gebb12ak.js";import{r,ge}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-c5vzr1va.js";import Qe from"path";import kt from"process";import{AsyncLocalStorage as Bo}from"async_hooks";var cr=new Bo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function ar(e,t){return cr.run(mn(e),t)}async function lr(e,t){let i=cr.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let c=Promise.resolve().then(t).then((l)=>{let a=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(a);return i.values.set(e,y),y}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,c),c}function Cr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],c=new Set,l=0,a=0,y=i.length,v=()=>{if(l!==0)return;let E=i.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!c.has(I))n.push(I),c.add(I);return}let A=i.slice(a).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(a).startsWith("const"))return;A[1].split(",").forEach((I)=>{let j=I.trim();if(!j)return;let Q=j.indexOf(":"),z=(Q>=0?j.slice(Q+1).trim():j).split(/[\s=]/)[0];if(z&&!c.has(z))n.push(z),c.add(z)});return}let M=i.slice(a).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(a).startsWith("const"))return;M[1].split(",").forEach((I)=>{let j=I.trim().replace(/^\.\.\./,"");if(!j)return;let Q=j.split(/[\s=]/)[0];if(Q&&!c.has(Q))n.push(Q),c.add(Q)});return}if(t)return;let B=i.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let I=B[1];if(!c.has(I))n.push(I),c.add(I);return}let D=i.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let I=D[1];if(!c.has(I))n.push(I),c.add(I)}};while(a<y){if(i[a]==="{"){l++,a++;continue}if(i[a]==="}"){l--,a++;continue}if(l===0&&/[a-z]/i.test(i[a])&&(a===0||/\s|[;{}()]/.test(i[a-1])))v();a++}return n.join(", ")}function Is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Os(e,t){let i=`{ ${Wo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import An from"fs";import Te from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function yr(e,t=!0){let i=ur.get(e);if(t&&i)return i;let n=new Map,c=[Te.join(e,"src"),Te.join(e,"dist"),e];function l(a,y){if(y>6)return;let v;try{v=An.readdirSync(a,{withFileTypes:!0})}catch{return}for(let E of v){let A=Te.join(a,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!n.has(M))n.set(M,A);let B=M.toLowerCase();if(!n.has(B))n.set(B,A);let D=V(M);if(!n.has(D))n.set(D,A)}}}for(let a of c)if(l(a,0),n.size>0)break;if(t)ur.set(e,n);return n}function Ns(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Te.join(i,"node_modules",e);try{if(An.statSync(n).isDirectory())return n}catch{}let c=Te.dirname(i);if(c===i)return null;i=c}}function Ms(e,t,i={}){return[Te.resolve(Te.dirname(t),`${e}.stx`),Te.resolve(Te.dirname(t),e),Te.resolve(i.componentsDir||"components",`${e}.stx`),Te.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,c]=fr(e);for(let l of[i,i.toLowerCase(),n,c]){let a=t?.__importedComponents?.get(l);if(a!==void 0)return a}}function*ii(e,t,i={},n){let c=fr(e);if(c[0].startsWith("./")||c[0].startsWith("../")){yield Te.resolve(Te.dirname(t),`${c[0]}.stx`);return}let l=[...new Set(c.map((v)=>`${v}.stx`))],a=i.projectRoot||process.cwd(),y=[...n?.__originalFilePath?[Te.join(Te.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Te.join(Te.dirname(t),"components"),Te.resolve(a,"src/components"),Te.resolve(a,"components"),...import.meta.dir?[Te.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield Te.join(v,E);try{for(let E of An.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Te.join(v,E.name,A)}catch{}}}function pr(e,t,i={},n){let c=oi(e,n);if(c!==void 0)return c;for(let l of ii(e,t,i,n))try{if(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ds(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let c=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=c.get("alt"),a=c.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof a==="string"?!["false","0","off","no"].includes(a.trim().toLowerCase()):Boolean(a);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Zn from"fs";import ce from"path";import ht from"path";import Kt from"fs";var zo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function cs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return zo.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),gr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Fo=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function mr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(Fo.has(n))t.systemKeys.push(n);else if(n in $r)t.mouse=n;else if(n in gr||/^[a-z]$/.test(n))t.keys.push(gr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let c=n.match(/debounce(?:\.(\d+))?/);t.debounce=c?.[1]?Number.parseInt(c[1],10):300}else if(n.startsWith("throttle")){let c=n.match(/throttle(?:\.(\d+))?/);t.throttle=c?.[1]?Number.parseInt(c[1],10):300}}return t}function Rr(e,t=""){let i=[],n=0,c=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=c.exec(e))!==null){let[a,y,v]=l,E=l.index,A=E+a.length,M=`__stx_evt_${t}${n++}`,B=[],D=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=D.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!dr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:mr(z.slice(1)),elementId:M})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=j.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!dr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:mr(z.slice(1)),elementId:M})}if(B.length>0)i.push({originalTag:a,elementId:M,events:B,startIndex:E,endIndex:A})}return i}function Uo(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((c)=>`$event.key === '${c}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=$r[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Vo(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function as(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Ho(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=Uo(e),c=Vo(as(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(cs(e.event,t))l.push("passive: true");let a=l.length>0?`, { ${l.join(", ")} }`:"",y=c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${i}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function Zo(e,t=""){let i=Rr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,c=[];for(let l=i.length-1;l>=0;l--){let a=i[l],y=a.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${a.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of a.events)E.elementId=v[1]}for(let v of a.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(A,""),y=y.replace(M,"")}n=n.slice(0,a.startIndex)+y+n.slice(a.endIndex),c.push(...a.events)}return{template:n,bindings:c}}function hr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function $c(e,t,i){if(ul(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Zo(e,hr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],y}let n=Rr(e,hr(t));if(n.length===0)return e;let c=e;for(let y=n.length-1;y>=0;y--){let v=n[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let M of v.events)M.elementId=A[1]}for(let A of v.events){let M=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(B,""),E=E.replace(D,"")}c=c.slice(0,v.startIndex)+E+c.slice(v.endIndex)}let l=ai(n.flatMap((y)=>y.events)),a=c.lastIndexOf("</body>");if(a!==-1)c=c.slice(0,a)+l+`
115
- `+c.slice(a);else c+=l;return c}function Ar(e,t){let i=new Set;for(let n of e.split(",")){let c=n.trim().replace(/^\.\.\./,"").trim();if(!c)continue;if(t){let l=c.lastIndexOf(":");if(l!==-1)c=c.slice(l+1).trim()}if(c=c.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(c))i.add(c)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:c}=ge(i),l=(y)=>!c||n[y]===0,a=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let y of i.matchAll(a)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Ar(y[1],!0).has(t))return!0;for(let y of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Ar(y[1],!1).has(t))return!0;return!1}var Tr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),ut=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Ir=["(","[","{"],Or=[")","]","}"],Ko=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Xo(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let c=n.index??0;i.push({text:n[0],start:c,end:c+n[0].length})}return{code:t,tokens:i}}function ls(e){let t=Tr.get(e);if(t)return t;let{code:i,tokens:n}=Xo(e),c=new Map,l=[];for(let Q=0;Q<n.length;Q++){let X=n[Q].text;if(["(","[","{"].includes(X))l.push(Q);else if([")","]","}"].includes(X)){let z=l.at(-1);if(z!==void 0&&["()","[]","{}"].includes(n[z].text+X))l.pop(),c.set(z,Q),c.set(Q,z)}}function a(Q,X){let z=[],L=Q;for(let ee=Q;ee<X;ee++){if(["(","[","{"].includes(n[ee].text)&&(c.get(ee)??X)<X){ee=c.get(ee);continue}if(n[ee].text===",")z.push([L,ee]),L=ee+1}return z.push([L,X]),z}let y=[];function v(Q,X,z,L=!1){if(n[Q]?.text==="...")Q++;if(Q>=X)return;let ee=n[Q].text;if(ut.test(ee)){if(z.add(ee),z===M)y.push({name:ee,token:Q,functionScoped:L});return}if(ee!=="{"&&ee!=="[")return;let te=c.get(Q);if(te===void 0||te>=X)return;for(let[re,me]of a(Q+1,te)){let he=re;if(ee==="{")for(let le=re;le<me;le++){if(n[le].text===":"){he=le+1;break}if(n[le].text==="=")break;if(["(","[","{"].includes(n[le].text)&&c.has(le))le=c.get(le)}v(he,me,z,L)}}function E(Q,X){let z=new Set;for(let[L,ee]of a(Q,X))v(L,ee,z);return z}function A(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(["(","[","{"].includes(z)&&c.has(X)){X=c.get(X);continue}if([",",";",")","]","}"].includes(z))break}return n[Math.max(Q,X-1)]?.end??i.length}let M=new Set,B=[];for(let Q=0;Q<n.length;Q++)if(n[Q].text==="=>"){let X=Q-1,z=X,L;if(n[X]?.text===")"&&c.has(X))z=c.get(X),L=E(z+1,X);else if(n[X]&&ut.test(n[X].text))L=new Set([n[X].text]);else continue;let ee=Q+1,te=n[ee]?.text==="{"&&c.has(ee)?n[c.get(ee)].end:A(ee);B.push({start:n[z].start,end:te,bodyStart:n[ee]?.start??te,functionBody:!0,names:L})}else if(n[Q].text==="("&&c.has(Q)){let X=n[Q-1]?.text;if(!X||qo.has(X)||!ut.test(X)&&X!=="*"&&X!=="]")continue;let z=c.get(Q),L=z+1;if(n[L]?.text===":"){L++;while(L<n.length&&!["{","=>",";","="].includes(n[L].text))L++}if(n[L]?.text!=="{"||!c.has(L))continue;B.push({start:n[Q].start,end:n[c.get(L)].end,bodyStart:n[L].start,functionBody:X!=="catch",names:E(Q+1,z)})}function D(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(Ir.includes(z)&&c.has(X)){X=c.get(X);continue}if(z===";"||Or.includes(z))break;let L=n[X-1];if(X>Q&&Ko.has(z)&&L.text!==".")break;if(X>Q&&/[\n\r]/.test(i.slice(L.end,n[X].start))&&(/^[\w$]+$/.test(L.text)||Or.includes(L.text)||['"',"'","`"].includes(L.text))&&ut.test(z)&&!["in","of","instanceof"].includes(z))break}return X}let I=[];for(let Q=0;Q<n.length;Q++){if(n[Q].text!=="for")continue;let X=n[Q+1]?.text==="await"?Q+2:Q+1;if(n[X]?.text!=="("||!c.has(X))continue;let z=c.get(X),L=z+1,ee=n[L]?.text==="{"&&c.has(L)?c.get(L):D(L),te=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(L,ee-1)]?.end??i.length;I.push({headStart:X,headEnd:z,start:n[X].start,end:te})}for(let Q=0;Q<n.length;Q++){let X=n[Q].text,z=n[Q-1]?.text;if(z==="."||n[Q+1]?.text===":")continue;if(z==="as"||z==="<")continue;if(X==="const"||X==="let"||X==="var"){let L=D(Q+1),ee=Q+1,te=!1,re=!1,me=0;for(let he=Q+1;he<=L;he++){let le=n[he]?.text;if(he<L&&Ir.includes(le)&&c.has(he)&&c.get(he)<L){he=c.get(he);continue}if(he<L&&le===":"&&!re)te=!0;else if(he<L&&le==="="&&me===0)te=!1,re=!0;else if(he<L&&te&&le==="<")me++;else if(he<L&&te&&le===">"&&me>0)me--;else if(he===L||le===","&&me===0)v(ee,he,M,X==="var"),ee=he+1,te=!1,re=!1}}else if(X==="function"||X==="class"){let L=Q+1;if(n[L]?.text==="*")L++;if(n[L]&&ut.test(n[L].text)&&n[L].text!=="extends")M.add(n[L].text),y.push({name:n[L].text,token:L})}else if(X==="import"){let L=Q+1;if(n[L]?.text==="*"&&n[L+1]?.text==="as")L+=2;let ee=n[L]?.text;if(ee&&ut.test(ee)&&ee!=="type"&&n[L+1]?.text!=="("&&n[L+1]?.text!==".")M.add(ee),y.push({name:ee,token:L,file:!0});let te=n[L]?.text==="{"?L:n[L+1]?.text===","&&n[L+2]?.text==="{"?L+2:-1;if(te!==-1&&c.has(te)){let re=c.get(te);for(let[me,he]of a(te+1,re)){let le=he-1;while(le>=me&&!ut.test(n[le].text))le--;if(le>=me&&n[le].text!=="type")y.push({name:n[le].text,token:le,file:!0})}}}}let j={code:i,scopes:B,loops:I,declarations:M,sites:y,tokens:n,pairs:c};return Tr.set(e,j),j}function qt(e){let t=ls(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((c)=>n>=c.start&&n<c.end&&c.names.has(i))}}function Tn(e){return new Set(ls(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:c,tokens:l,pairs:a}=ls(e),y=Array.from({length:l.length},()=>-1),v=[];for(let D=0;D<l.length;D++){y[D]=v.length?v[v.length-1]:-1;let I=l[D].text;if(I==="{"&&a.has(D))v.push(D);else if(I==="}"&&v.length&&a.get(D)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let D of c){if(!t.has(D.name))continue;E.add(D.token);let I=D.file?-1:y[D.token],j=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[a.get(I)].end];if(D.functionScoped){let X=l[D.token].start,z=i.filter((L)=>L.functionBody&&X>=L.bodyStart&&X<L.end).sort((L,ee)=>L.end-L.bodyStart-(ee.end-ee.bodyStart))[0];j=z?[z.bodyStart,z.end]:[0,Number.POSITIVE_INFINITY]}else if(!D.file){let X=n.filter((z)=>D.token>z.headStart&&D.token<z.headEnd).sort((z,L)=>z.headEnd-z.headStart-(L.headEnd-L.headStart))[0];if(X)j=[X.start,X.end]}let Q=A.get(D.name);if(Q)Q.push(j);else A.set(D.name,[j])}let M=new Set;for(let D=0;D<l.length;D++){if(l[D].text!=="import"||l[D-1]?.text===".")continue;let I=D+1;if(l[I]?.text==="type")I++;if(l[I]&&ut.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&a.has(I))for(let j=I+1;j<a.get(I);j++)M.add(j)}let B=new Set;for(let D=0;D<l.length;D++){let I=l[D].text;if(!t.has(I)||B.has(I)||E.has(D)||M.has(D))continue;let j=l[D-1]?.text;if(j==="#"||j==="."&&l[D-2]?.text!=="..")continue;if(l[D+1]?.text===":"&&(j==="{"||j===","))continue;let Q=l[D].start;if(A.get(I)?.some(([X,z])=>Q>=X&&Q<z))continue;if(i.some((X)=>Q>=X.start&&Q<X.end&&X.names.has(I)))continue;B.add(I)}return B}var Pe="0.2.803";var Pr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Go(){let e=globalThis;return e[Pr]??=new Map,e[Pr]}function o(e,t){let i=Go(),n=`${import.meta.url}\x00${e}`,c=i.get(n);if(c)return c;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var Yo=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Yo,"<\\/$1")}import Dr from"fs";var Mr=[];function b(e){let t=new R(e);return Mr.push(t),t}function Rc(){for(let e of Mr)e.clear()}function x(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Dr.statSync(i).mtimeMs})}catch{}return t}function Ls(e){for(let t of e)try{if(Dr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Qo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ec(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function tc(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let c=ht.dirname(i);if(c===i)return null;i=c}}function nc(e,t){if(!e||typeof e!=="object")return null;let i=(c)=>{if(typeof c==="string")return c;if(c&&typeof c==="object"){if(typeof c.import==="string")return c.import;if(typeof c.default==="string")return c.default;if(typeof c.import==="object")return i(c.import);if(typeof c.default==="object")return i(c.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let c of Object.keys(e)){let l=c.indexOf("*");if(l===-1)continue;let a=c.slice(0,l),y=c.slice(l+1);if(!t.startsWith(a)||!t.endsWith(y))continue;if(t.length<a.length+y.length)continue;if(!n||a.length>n.prefix.length)n={pattern:c,prefix:a,suffix:y}}if(n){let c=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",c)}return null}function sc(e,t){let i=ec(e);if(!i||!i.subpath)return null;let n=tc(i.pkg,t);if(!n)return null;let c;try{c=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,a=nc(c.exports,l);if(!a)return null;let y=ht.resolve(n,a);return Kt.existsSync(y)?y:null}function mi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),c=new Set,l=[],a=[];return{code:e.replace(Qo,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(E,n)}catch{M=sc(E,n)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),a.push(E),""}if(c.has(A))return"";c.add(A);try{let M=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),a.push(E)}return""}),styles:l,unresolved:a}}function rc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${rc(t.source)}" data-stx-layer="vendor">
115
+ `+c.slice(a);else c+=l;return c}function Ar(e,t){let i=new Set;for(let n of e.split(",")){let c=n.trim().replace(/^\.\.\./,"").trim();if(!c)continue;if(t){let l=c.lastIndexOf(":");if(l!==-1)c=c.slice(l+1).trim()}if(c=c.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(c))i.add(c)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:c}=ge(i),l=(y)=>!c||n[y]===0,a=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let y of i.matchAll(a)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Ar(y[1],!0).has(t))return!0;for(let y of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Ar(y[1],!1).has(t))return!0;return!1}var Tr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),ut=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Ir=["(","[","{"],Or=[")","]","}"],Ko=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Xo(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let c=n.index??0;i.push({text:n[0],start:c,end:c+n[0].length})}return{code:t,tokens:i}}function ls(e){let t=Tr.get(e);if(t)return t;let{code:i,tokens:n}=Xo(e),c=new Map,l=[];for(let Q=0;Q<n.length;Q++){let X=n[Q].text;if(["(","[","{"].includes(X))l.push(Q);else if([")","]","}"].includes(X)){let z=l.at(-1);if(z!==void 0&&["()","[]","{}"].includes(n[z].text+X))l.pop(),c.set(z,Q),c.set(Q,z)}}function a(Q,X){let z=[],L=Q;for(let ee=Q;ee<X;ee++){if(["(","[","{"].includes(n[ee].text)&&(c.get(ee)??X)<X){ee=c.get(ee);continue}if(n[ee].text===",")z.push([L,ee]),L=ee+1}return z.push([L,X]),z}let y=[];function v(Q,X,z,L=!1){if(n[Q]?.text==="...")Q++;if(Q>=X)return;let ee=n[Q].text;if(ut.test(ee)){if(z.add(ee),z===M)y.push({name:ee,token:Q,functionScoped:L});return}if(ee!=="{"&&ee!=="[")return;let te=c.get(Q);if(te===void 0||te>=X)return;for(let[re,me]of a(Q+1,te)){let he=re;if(ee==="{")for(let le=re;le<me;le++){if(n[le].text===":"){he=le+1;break}if(n[le].text==="=")break;if(["(","[","{"].includes(n[le].text)&&c.has(le))le=c.get(le)}v(he,me,z,L)}}function E(Q,X){let z=new Set;for(let[L,ee]of a(Q,X))v(L,ee,z);return z}function A(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(["(","[","{"].includes(z)&&c.has(X)){X=c.get(X);continue}if([",",";",")","]","}"].includes(z))break}return n[Math.max(Q,X-1)]?.end??i.length}let M=new Set,B=[];for(let Q=0;Q<n.length;Q++)if(n[Q].text==="=>"){let X=Q-1,z=X,L;if(n[X]?.text===")"&&c.has(X))z=c.get(X),L=E(z+1,X);else if(n[X]&&ut.test(n[X].text))L=new Set([n[X].text]);else continue;let ee=Q+1,te=n[ee]?.text==="{"&&c.has(ee)?n[c.get(ee)].end:A(ee);B.push({start:n[z].start,end:te,bodyStart:n[ee]?.start??te,functionBody:!0,names:L})}else if(n[Q].text==="("&&c.has(Q)){let X=n[Q-1]?.text;if(!X||qo.has(X)||!ut.test(X)&&X!=="*"&&X!=="]")continue;let z=c.get(Q),L=z+1;if(n[L]?.text===":"){L++;while(L<n.length&&!["{","=>",";","="].includes(n[L].text))L++}if(n[L]?.text!=="{"||!c.has(L))continue;B.push({start:n[Q].start,end:n[c.get(L)].end,bodyStart:n[L].start,functionBody:X!=="catch",names:E(Q+1,z)})}function D(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(Ir.includes(z)&&c.has(X)){X=c.get(X);continue}if(z===";"||Or.includes(z))break;let L=n[X-1];if(X>Q&&Ko.has(z)&&L.text!==".")break;if(X>Q&&/[\n\r]/.test(i.slice(L.end,n[X].start))&&(/^[\w$]+$/.test(L.text)||Or.includes(L.text)||['"',"'","`"].includes(L.text))&&ut.test(z)&&!["in","of","instanceof"].includes(z))break}return X}let I=[];for(let Q=0;Q<n.length;Q++){if(n[Q].text!=="for")continue;let X=n[Q+1]?.text==="await"?Q+2:Q+1;if(n[X]?.text!=="("||!c.has(X))continue;let z=c.get(X),L=z+1,ee=n[L]?.text==="{"&&c.has(L)?c.get(L):D(L),te=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(L,ee-1)]?.end??i.length;I.push({headStart:X,headEnd:z,start:n[X].start,end:te})}for(let Q=0;Q<n.length;Q++){let X=n[Q].text,z=n[Q-1]?.text;if(z==="."||n[Q+1]?.text===":")continue;if(z==="as"||z==="<")continue;if(X==="const"||X==="let"||X==="var"){let L=D(Q+1),ee=Q+1,te=!1,re=!1,me=0;for(let he=Q+1;he<=L;he++){let le=n[he]?.text;if(he<L&&Ir.includes(le)&&c.has(he)&&c.get(he)<L){he=c.get(he);continue}if(he<L&&le===":"&&!re)te=!0;else if(he<L&&le==="="&&me===0)te=!1,re=!0;else if(he<L&&te&&le==="<")me++;else if(he<L&&te&&le===">"&&me>0)me--;else if(he===L||le===","&&me===0)v(ee,he,M,X==="var"),ee=he+1,te=!1,re=!1}}else if(X==="function"||X==="class"){let L=Q+1;if(n[L]?.text==="*")L++;if(n[L]&&ut.test(n[L].text)&&n[L].text!=="extends")M.add(n[L].text),y.push({name:n[L].text,token:L})}else if(X==="import"){let L=Q+1;if(n[L]?.text==="*"&&n[L+1]?.text==="as")L+=2;let ee=n[L]?.text;if(ee&&ut.test(ee)&&ee!=="type"&&n[L+1]?.text!=="("&&n[L+1]?.text!==".")M.add(ee),y.push({name:ee,token:L,file:!0});let te=n[L]?.text==="{"?L:n[L+1]?.text===","&&n[L+2]?.text==="{"?L+2:-1;if(te!==-1&&c.has(te)){let re=c.get(te);for(let[me,he]of a(te+1,re)){let le=he-1;while(le>=me&&!ut.test(n[le].text))le--;if(le>=me&&n[le].text!=="type")y.push({name:n[le].text,token:le,file:!0})}}}}let j={code:i,scopes:B,loops:I,declarations:M,sites:y,tokens:n,pairs:c};return Tr.set(e,j),j}function qt(e){let t=ls(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((c)=>n>=c.start&&n<c.end&&c.names.has(i))}}function Tn(e){return new Set(ls(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:c,tokens:l,pairs:a}=ls(e),y=Array.from({length:l.length},()=>-1),v=[];for(let D=0;D<l.length;D++){y[D]=v.length?v[v.length-1]:-1;let I=l[D].text;if(I==="{"&&a.has(D))v.push(D);else if(I==="}"&&v.length&&a.get(D)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let D of c){if(!t.has(D.name))continue;E.add(D.token);let I=D.file?-1:y[D.token],j=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[a.get(I)].end];if(D.functionScoped){let X=l[D.token].start,z=i.filter((L)=>L.functionBody&&X>=L.bodyStart&&X<L.end).sort((L,ee)=>L.end-L.bodyStart-(ee.end-ee.bodyStart))[0];j=z?[z.bodyStart,z.end]:[0,Number.POSITIVE_INFINITY]}else if(!D.file){let X=n.filter((z)=>D.token>z.headStart&&D.token<z.headEnd).sort((z,L)=>z.headEnd-z.headStart-(L.headEnd-L.headStart))[0];if(X)j=[X.start,X.end]}let Q=A.get(D.name);if(Q)Q.push(j);else A.set(D.name,[j])}let M=new Set;for(let D=0;D<l.length;D++){if(l[D].text!=="import"||l[D-1]?.text===".")continue;let I=D+1;if(l[I]?.text==="type")I++;if(l[I]&&ut.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&a.has(I))for(let j=I+1;j<a.get(I);j++)M.add(j)}let B=new Set;for(let D=0;D<l.length;D++){let I=l[D].text;if(!t.has(I)||B.has(I)||E.has(D)||M.has(D))continue;let j=l[D-1]?.text;if(j==="#"||j==="."&&l[D-2]?.text!=="..")continue;if(l[D+1]?.text===":"&&(j==="{"||j===","))continue;let Q=l[D].start;if(A.get(I)?.some(([X,z])=>Q>=X&&Q<z))continue;if(i.some((X)=>Q>=X.start&&Q<X.end&&X.names.has(I)))continue;B.add(I)}return B}var Pe="0.2.805";var Pr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Go(){let e=globalThis;return e[Pr]??=new Map,e[Pr]}function o(e,t){let i=Go(),n=`${import.meta.url}\x00${e}`,c=i.get(n);if(c)return c;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var Yo=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Yo,"<\\/$1")}import Dr from"fs";var Mr=[];function b(e){let t=new R(e);return Mr.push(t),t}function Rc(){for(let e of Mr)e.clear()}function x(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Dr.statSync(i).mtimeMs})}catch{}return t}function Ls(e){for(let t of e)try{if(Dr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Qo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ec(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function tc(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let c=ht.dirname(i);if(c===i)return null;i=c}}function nc(e,t){if(!e||typeof e!=="object")return null;let i=(c)=>{if(typeof c==="string")return c;if(c&&typeof c==="object"){if(typeof c.import==="string")return c.import;if(typeof c.default==="string")return c.default;if(typeof c.import==="object")return i(c.import);if(typeof c.default==="object")return i(c.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let c of Object.keys(e)){let l=c.indexOf("*");if(l===-1)continue;let a=c.slice(0,l),y=c.slice(l+1);if(!t.startsWith(a)||!t.endsWith(y))continue;if(t.length<a.length+y.length)continue;if(!n||a.length>n.prefix.length)n={pattern:c,prefix:a,suffix:y}}if(n){let c=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",c)}return null}function sc(e,t){let i=ec(e);if(!i||!i.subpath)return null;let n=tc(i.pkg,t);if(!n)return null;let c;try{c=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,a=nc(c.exports,l);if(!a)return null;let y=ht.resolve(n,a);return Kt.existsSync(y)?y:null}function mi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),c=new Set,l=[],a=[];return{code:e.replace(Qo,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(E,n)}catch{M=sc(E,n)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),a.push(E),""}if(c.has(A))return"";c.add(A);try{let M=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),a.push(E)}return""}),styles:l,unresolved:a}}function rc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${rc(t.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${t.contents}
118
118
  }
@@ -182,7 +182,7 @@ else {
182
182
  // STX: auto-generated event bindings
183
183
  ${e.map((i,n)=>mc(i,n)).join(`
184
184
  `)}`}function Wr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),c=0,l=n.length,a=0;while(a<l){let y=n[a];if(y==="'"||y==='"'||y==="`"){let v=y;if(a++,v==="`"){let E=0;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"&&E===0){a++;break}if(n[a]==="$"&&n[a+1]==="{"){E++,a+=2;continue}if(n[a]==="}"&&E>0){E--,a++;continue}a++}}else while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===v){a++;break}a++}continue}if(y==="/"&&n[a+1]==="/"){while(a<l&&n[a]!==`
185
- `)a++;continue}if(y==="/"&&n[a+1]==="*"){a+=2;while(a<l-1&&!(n[a]==="*"&&n[a+1]==="/"))a++;a+=2;continue}if(y==="{"){c++,a++;continue}if(y==="}"){c--,a++;continue}if(c===0){let v=n.slice(a),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let B=E[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((B)=>{let D=B.trim(),I=D.indexOf(":"),j=I>=0?D.slice(I+1).trim().split(/[\s=]/)[0]:D.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!i.has(j))t.push(j),i.add(j)}),a+=A[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let B=M[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=M[0].length;continue}}a++}return t}var xc=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function bc(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(B){let D;while((D=i.exec(B))!==null){let I=D[0];if(!xc.has(I))t.add(I)}}let c=/\{\{([\s\S]*?)\}\}/g,l;while((l=c.exec(e))!==null)n(l[1]);let a=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=a.exec(e))!==null)n(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",c=!1,l=[],a=mi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=a.code;let y=hi(a.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-rmpgtyqh.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),c=!0;if(t.autoImports!==!1){let L=qc(i);i=L.code,n=Kc(L.stxImports,L.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${yn(i,t.serverData)}${n}`,i=P(i),!c&&je(t.attrs||""))i=Be(i);let M=hc(t.eventBindings||[]),B=(t.attrs||"").trim(),D=/\btype\s*=\s*["']module["']/i.test(B),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(D){let L=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${L?` ${L}`:""}`;return`${y}<script ${ee}>
185
+ `)a++;continue}if(y==="/"&&n[a+1]==="*"){a+=2;while(a<l-1&&!(n[a]==="*"&&n[a+1]==="/"))a++;a+=2;continue}if(y==="{"){c++,a++;continue}if(y==="}"){c--,a++;continue}if(c===0){let v=n.slice(a),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let B=E[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((B)=>{let D=B.trim(),I=D.indexOf(":"),j=I>=0?D.slice(I+1).trim().split(/[\s=]/)[0]:D.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!i.has(j))t.push(j),i.add(j)}),a+=A[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let B=M[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=M[0].length;continue}}a++}return t}var xc=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function bc(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(B){let D;while((D=i.exec(B))!==null){let I=D[0];if(!xc.has(I))t.add(I)}}let c=/\{\{([\s\S]*?)\}\}/g,l;while((l=c.exec(e))!==null)n(l[1]);let a=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=a.exec(e))!==null)n(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",c=!1,l=[],a=mi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=a.code;let y=hi(a.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-aayq1a90.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),c=!0;if(t.autoImports!==!1){let L=qc(i);i=L.code,n=Kc(L.stxImports,L.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${yn(i,t.serverData)}${n}`,i=P(i),!c&&je(t.attrs||""))i=Be(i);let M=hc(t.eventBindings||[]),B=(t.attrs||"").trim(),D=/\btype\s*=\s*["']module["']/i.test(B),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(D){let L=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${L?` ${L}`:""}`;return`${y}<script ${ee}>
186
186
  ${dn(`${n}${i}
187
187
  ${M}`)}
188
188
  </script>`}let j=Ri(e),Q=/function __stx_setup_/.test(i),X=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function z(L){let ee=L.length>0?`
@@ -285,8 +285,8 @@ ${E.join(`
285
285
  `){let I=e[c];if(I==="\\"){c+=2;continue}if(I==="[")D=!0;else if(I==="]")D=!1;else if(I==="/"&&!D){c++;while(c<l&&/[a-z]/i.test(e[c]))c++;return}c++}},B=()=>{if(n!==0)return;let D=e.slice(c).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(D){let X=D[2].split(",").map((z)=>{let L=z.trim().split(":");return L[L.length-1].trim()});for(let z of X)if(z&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(z)&&!i.has(z))t.push(z),i.add(z);return}let I=e.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(I){let X=I[2];if(!i.has(X))t.push(X),i.add(X);return}let j=e.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let X=j[1];if(!i.has(X))t.push(X),i.add(X);return}let Q=e.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let X=Q[1];if(!i.has(X))t.push(X),i.add(X)}};while(c<l){if(v())continue;if(e[c]==="'"||e[c]==='"'){a(e[c]);continue}if(e[c]==="`"){y();continue}if(e[c]==="/"&&A()){M();continue}if(e[c]==="{"){n++,c++;continue}if(e[c]==="}"){n--,c++;continue}if(n===0&&/[a-z]/i.test(e[c])&&(c===0||/\s|[;{}()]/.test(e[c-1])))B();c++}return t}function kl(e){let t=[],i=0,n=0,c=null;for(let l=0;l<e.length;l++){let a=e[l];if(c){if(a==="\\"){l++;continue}if(a===c)c=null;continue}if(a==='"'||a==="'"||a==="`"){c=a;continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Rl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let c=e[n];if(i){if(c==="\\"){n++;continue}if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c==="="&&t===0){let l=e[n-1],a=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(a==="="||a===">")continue;return n}}return-1}function Cl(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let c=n,l=0,a=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){a=n;break}}}if(a===-1)return;let y=e.slice(a+1,c);for(let v of kl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Rl(E);if(A===-1)continue;let M=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let B=E.slice(A+1).trim();if(!B)continue;try{let D=Object.keys(t).filter(jt),I=Function(...D,`"use strict"; return (${B});`);t[M]=I(...D.map((j)=>t[j]))}catch{}}}catch{}}var Al=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function pg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!Al.has(n))return null;let c=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,A)=>(c.lastIndex=A,c.exec(E)?.index===A?c.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let a=0,y=!1;for(let E of l){if(a+=E.token.startsWith("</")?-1:1,a<0)return null;if(a===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function wo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let c=ce.relative(ce.resolve(n),ce.resolve(e));return!c.startsWith("..")&&!ce.isAbsolute(c)})}async function Er(e,t,i,n,c){let l=e.endsWith(".stx")?e.slice(0,-4):e,a=(re)=>re.split("-").map((me)=>me.charAt(0).toUpperCase()+me.slice(1)).join(""),y=i.__importedComponents;if(y){for(let re of[l,l.toLowerCase(),a(l),V(l)])if(y.has(re))return!0}let v=[...new Set([`${l}.stx`,`${a(l)}.stx`,`${V(l)}.stx`])],E=typeof c.root==="string"?ce.resolve(c.root):void 0,A=E??ce.dirname(n),M=[],B=(re)=>{if(re&&!M.includes(re))M.push(re)},D=i.__originalFilePath;if(D)B(ce.join(ce.dirname(D),"components"));if(wo(t,c))B(c._rootComponentsDir);B(t),B(c._rootComponentsDir),B(ce.join(ce.dirname(n),"components")),B(c.componentsDir);for(let re of c.additionalComponentsDirs??[])B(re);let I=c._targetComponentFallbackNames?.some((re)=>re.toLowerCase()===l.toLowerCase());if(!I)for(let re of c._targetComponentDirs??[])B(re);if(E)B(ce.resolve(E,"resources/views/components")),B(ce.resolve(E,"resources/components")),B(ce.resolve(E,"src/components")),B(ce.resolve(E,"components"));for(let re of c._layerComponentDirs??[])B(re);let j=c._pluginComponentDirs;if(Array.isArray(j))for(let re of j)B(typeof re==="string"?re:null);if(B(c.fallbackComponentsDir),I)for(let re of c._targetComponentDirs??[])B(re);let Q=c._nativePrimitivesFallback;if(Q&&!Q.except.some((re)=>re.toLowerCase()===l.toLowerCase()))B(Q.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(n),`${l}.stx`));let X=po(ce.resolve(import.meta.dir,"components")),z=M.map((re)=>ce.isAbsolute(re)?re:ce.resolve(A,re)),L=`${v.join("\x00")}\x00\x00${z.join("\x00")}`,ee=Ps.get(L);if(ee!==void 0)return ee;let te=!1;e:for(let re of z){if(po(re)===X)continue;for(let me of v)if(await s(ce.join(re,me))){te=!0;break e}}return Ps.set(L,te),te}function po(e){let t=Zs.get(e);if(t!==void 0)return t;let i=e;try{i=Zn.realpathSync(e)}catch{}return Zs.set(e,i),i}function fg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Xc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function Tl(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(c,l)=>{let a;try{a=T(c,t)}catch{return l}if(a===void 0||a===null)return"";let y=String(a);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(c,l)=>n(l,c)).replace(/\{\{([\s\S]*?)\}\}/g,(c,l)=>n(l,c))}var go=new Set;function mo(e,t,i,n){let c=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&go.has(c))return;go.add(c);let l=t?` used in ${t}`:"",a=n?` Cause: ${n}.`:"",y=i.length>0?`
286
286
  searched:
287
287
  ${i.map((v)=>` - ${v}`).join(`
288
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${a}${y}`)}function ho(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Il=new Set(["for","if","show","key","ref","class","className","style"]),xo=new Set,So="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Gc=new RegExp(`\\b(?:${So})\\s*(?:<[^>]*>)?\\s*\\(`);function yi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${So})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let c;while((c=i.exec(n))!==null)t.add(c[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,c,l,a,y=new Set,v,E=rt(c),A,M=e){let{extractVariables:B}=await o("stx/variable-extractor",()=>import("./chunk-e848m5tj.js")),D=y??new Set;if(D.has(e))return`[Circular component reference: ${e}]`;let I=new Set(D);I.add(e);let j=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let Q=j&&j!=="load"&&fg(j)?j:"";try{let X=(se)=>se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),z=M.endsWith(".stx")?M.slice(0,-4):M,L=null,ee=c.__importedComponents;if(ee){let se=[z,z.toLowerCase(),X(z),V(z)];for(let ae of se)if(ee.has(ae)){L=ee.get(ae);break}}let te=[];if(!L){let se=[`${z}.stx`,`${X(z)}.stx`,`${V(z)}.stx`],ae=[...new Set(se)],we=c.__originalFilePath,be=[];if(be.push(...a._layerComponentDirs??[]),we){let ye=ce.join(ce.dirname(we),"components");be.push(ye)}let Ue=a._rootComponentsDir;if(typeof Ue==="string"&&wo(n,a)&&!be.includes(Ue))be.push(Ue);if(n&&!be.includes(n))be.push(n);if(typeof Ue==="string"&&!be.includes(Ue))be.push(Ue);let Ae=ce.join(ce.dirname(l),"components");if(!be.includes(Ae))be.push(Ae);if(a.componentsDir&&a.componentsDir!==n&&!be.includes(a.componentsDir))be.push(a.componentsDir);for(let ye of a.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ct=a._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(z),lt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),es=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ts=!lt.includes("valuechange")&&(yt||lt.includes("change")&&!es),gt=a._nativeHostAttrs&&/^textinput$/i.test(z),_t=lt.includes("update:value")&&!lt.includes("input"),Ht=a._nativeHostAttrs&&/^video$/i.test(z),ns=a._nativeHostAttrs&&/^image$/i.test(z),ln=Ds([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=Ht&&wt&&!un&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),mt=(ye)=>Object.hasOwn(t,ye)||Boolean(A?.reactiveProps?.includes(ye)),Sn=a._nativeHostAttrs&&/^button$/i.test(z)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!i.trim()),Zt=a._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&(!ct||ts)&&(!gt||_t)&&(!Ht||_n)&&(!ns||ln)&&!Sn;for(let ye of Zt?[]:a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof a.root==="string"?ce.resolve(a.root):void 0,jo=St??ce.dirname(l),$t=[];if(St)$t.push(ce.resolve(St,"resources/views/components")),$t.push(ce.resolve(St,"resources/components")),$t.push(ce.resolve(St,"src/components")),$t.push(ce.resolve(St,"components"));$t.push(ce.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let sr=a._pluginComponentDirs;if(Array.isArray(sr)){for(let ye of sr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(a.fallbackComponentsDir&&!be.includes(a.fallbackComponentsDir))be.push(a.fallbackComponentsDir);if(Zt){for(let ye of a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let $n=a._nativePrimitivesFallback;if($n&&!$n.except.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&!be.includes($n.dir))be.push($n.dir);let rr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ce.isAbsolute(ye)?ye:ce.resolve(jo,ye)}))];be.length=0,be.push(...rr);let ss=`${z}\x00${l}\x00${rr.join("\x00")}`,rs=Vn.get(ss);if(rs)if(await s(rs))L=rs;else Vn.delete(ss);if(!L&&(z.startsWith("./")||z.startsWith("../")))L=ce.resolve(ce.dirname(l),`${z}.stx`),te.push(L);else if(!L)for(let ye of be){if(!ye)continue;for(let En of ae){let kn=ce.join(ye,En);if(te.push(kn),await s(kn)){L=kn;break}}if(L)break;if(!L)try{let En=await import("fs");if(!En.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let No=8,is=[{path:ye,depth:0}];while(is.length>0&&!L){let Rn=is.pop();if(Rn.depth>=No)continue;let ir;try{ir=En.readdirSync(Rn.path,{withFileTypes:!0})}catch{continue}for(let Cn of ir){if(!Cn.isDirectory())continue;if(Cn.name==="node_modules"||Cn.name.startsWith("."))continue;let or=ce.join(Rn.path,Cn.name);for(let Lo of ae){let os=ce.join(or,Lo);if(te.push(os),await s(os)){L=os;break}}if(L)break;is.push({path:or,depth:Rn.depth+1})}}}catch{}if(L)break}if(L)Vn.set(ss,L)}if(!L||!await s(L))return mo(e,l,te),ho(e);v.add(L);let re;if(tn.has(L)&&Ts.get(L)===lo(L))re=tn.get(L);else try{let se=lo(L);re=await Bun.file(L).text(),tn.set(L,re),Ts.set(L,se)}catch(se){let ae=se instanceof Error?se.message:String(se);return mo(e,l,[L],ae),ho(e)}if(A)for(let se of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ae=se.toLowerCase();if(ae.startsWith("aria-")||ae.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(re))A.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(re))A.consumedProps?.add(se)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(re))for(let se of A.reactiveProps){if(Il.has(se)||A.consumedProps?.has(se))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(re))continue;let ae=`${L}\x00${se}`;if(xo.has(ae))continue;xo.add(ae),console.warn(`[stx] ${ce.basename(L)} reads \`${se}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${se}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${se}').`)}let me=new Set(["__originalFilePath","__importedComponents",Pn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[se,ae]of Object.entries(c))if(!se.startsWith("__")||me.has(se))he[se]=ae;let le=E.length>0?{[Bn]:[...E]}:{},ke=i;if(i.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-8wd83rnz.js"));ke=await se(i,c,l,a,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ke)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-fsjkavq5.js")),ae={...c,__processedComponents:D,...le};ke=await se(ke,ae,l,a,v);let we=ae.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)c.__stx_preserved_client_expressions=[...new Set([...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...we])]}let Re=[];if(Xc(ke)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-gzs0ertq.js")),ae=c.__stx_signals_gate===void 0?{...c,__stx_signals_gate:!0,...le}:E.length>0?{...c,...le}:c;ke=se(ke,ae,l);for(let we of ke.matchAll(/\{\{([\s\S]*?)\}\}/g))Re.push(we[1].trim())}let He=G(ke),Xe=[],Ze=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,ae)=>{let we=He.scripts[Number(ae)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ae=!Ue||["module","text/javascript","application/javascript"].includes(Ue),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Ae&&!ct)return Xe.push(we),"";return we}),{extractSlotContent:Kn}=await o("stx/slots",()=>import("./chunk-kn84qg00.js")),ft=Kn(Ze),pt={};if(ft.defaultSlot?.trim())pt.default=ft.defaultSlot;for(let[se,ae]of ft.namedSlots)pt[se]=ae.content;let dt=c.__stx_scope_seq??={n:0,key:Vs(String(c.__filename??l))},Ct=_o(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,We={...he,$uid:it,$native:a._nativeHostAttrs===!0,...t,props:t,slot:Ze,$slots:pt,__processedComponents:I,__sections:{},__stx_signals_gate:Se(re)||Xc(i),__stx_preserved_client_expressions:[...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...Re]};Cl(re,We);let Tt=re,sn=de(Tt);if(sn)Tt=sn.content.trim();let Xn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Xn)];for(let[,se,ae]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(ae,L,a.strict);let Je=[],Lt=null,Jn=Dt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,et=null,Bt=null,rn=0,Wt=null;if(wl(a),Jn&&Ks>0){let se=Sl({props:t,slot:ke,slotContext:i.trim()?$l(he):void 0,buildMode:a.buildMode??"",skipEventDirectives:a.skipEventDirectives===!0,native:a._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:a._layerGraph?.layers.map((ae)=>ae.configFile),uid:it});if(se!==null){bt=`${L}\x00${x(re)}\x00${se}`;let ae=Hn.get(bt);if(ae){for(let we of ae.dependencies)v.add(we);if(Kr(c,ae.clientFactories),dt.n+=ae.uidsConsumed,ae.preservedClientExpressions.length>0){let we=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let be of ae.preservedClientExpressions)we.add(be);c.__stx_preserved_client_expressions=[...we]}return ae.output}et=new Set(v),Bt=Zr(c),rn=dt.n,Wt=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let se of Dt){let ae=se[1]||"",we=se[2]||"",be=ae.includes("server");if(je(ae)&&we.trim())we=Be(we);if(be&&we){for(let Ae of Me(we))zt.add(Ae);try{await B(we,We,L,{onFailure:(Ae)=>{if(Ae.kind!=="unknown")Lt=Ae.kind}})}catch(Ae){}}if(!be){let Ae=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ae.includes("{{")&&Ae.includes("}}"),lt=Ae.includes("{!!")&&Ae.includes("!!}");if(ct||lt)Ae=wi(Ae,We,L);let yt=ae.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${yt}>${Ae}</script>`)}}let Ge=G(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=Ge?Ge[1]:"",Gn=Ge?Ge[2]:"",tt="",ne=Ft&&/\bscoped\b/i.test(Ft);if(Ge)tt=`<style${Ft}>${Tl(Gn,We,L)}</style>`;let ie=Tt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ge)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ae=[];if(ie=ie.replace(se,(we,be)=>{let Ue=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)ae.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ae.length>0)tt=`${tt}${ae.join(`
289
- `)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-kn84qg00.js")),{defaultSlot:$e,namedSlots:Ce}=ft,qe=c.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ze),nt=a._nativeHostAttrs===!0&&Je.length>0||qe&&Je.length>0||Je.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),Yn=(se)=>nt?Ni(se,it):se,Qn=new Map([...Ce].map(([se,ae])=>[se,{...ae,content:Yn(ae.content)}]));ie=await ue(ie,Yn($e),Qn,We,nt?it:"");let on=yi(Je),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((se)=>!zt.has(se));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Vt=E.filter((se)=>!zt.has(se)&&!(se in t));if(Vt.length>0)We[Bn]=Vt;let cn={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:ce.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:a._nativeHostAttrs===!0||nt||Je.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(c.__stxProcessingDepth||0)+1;let{processDirectives:an}=await o("stx/process",()=>import("./chunk-0xqec4yj.js")),Ye=await an(ie,We,L,cn,v),ot=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let se of Ye.matchAll(/\{\{([\s\S]*?)\}\}/g))ot.add(se[1].trim());if(ot.size>0)c.__stx_preserved_client_expressions=[...ot];let st=it,Ke=Ye;if(nt){let se="";if(Object.keys(t).length>0)try{se=` data-stx-props="${Cs(JSON.stringify(t))}"`}catch{}let ae=Q?` stx-hydrate="${Cs(Q)}"`:"",we=Object.fromEntries(Object.entries(pt).map(([gt,_t])=>[gt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Cs(JSON.stringify(we))}"`:"",Ue=` data-stx-scope="${st}"${se}${be}${ae}`,Ae=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ye),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ye),lt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ye),yt=Ae?"span":"div",es=ct&&a._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':lt&&a._nativeHostAttrs?' style="width:100%;height:100%"':Ae||ct?' style="display:contents"':"";Ke=pg(Ye,Ue)??`<${yt}${Ue} data-stx-component-wrapper${es}>${Ye}</${yt}>`;let ts=await Promise.all(Je.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,Ht,ns]=_t,ln=ao(gt,We,L);if(ln!==null)return ln;let wt=await Pl(ns,L,a.buildMode==="compile"),un=yn(wt.clientCode,De(We)),{vendorStyleTags:_n}=wt,mt=un?`function(__scopeId) {
288
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${a}${y}`)}function ho(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Il=new Set(["for","if","show","key","ref","class","className","style"]),xo=new Set,So="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Gc=new RegExp(`\\b(?:${So})\\s*(?:<[^>]*>)?\\s*\\(`);function yi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${So})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let c;while((c=i.exec(n))!==null)t.add(c[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,c,l,a,y=new Set,v,E=rt(c),A,M=e){let{extractVariables:B}=await o("stx/variable-extractor",()=>import("./chunk-f3b37bt7.js")),D=y??new Set;if(D.has(e))return`[Circular component reference: ${e}]`;let I=new Set(D);I.add(e);let j=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let Q=j&&j!=="load"&&fg(j)?j:"";try{let X=(se)=>se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),z=M.endsWith(".stx")?M.slice(0,-4):M,L=null,ee=c.__importedComponents;if(ee){let se=[z,z.toLowerCase(),X(z),V(z)];for(let ae of se)if(ee.has(ae)){L=ee.get(ae);break}}let te=[];if(!L){let se=[`${z}.stx`,`${X(z)}.stx`,`${V(z)}.stx`],ae=[...new Set(se)],we=c.__originalFilePath,be=[];if(be.push(...a._layerComponentDirs??[]),we){let ye=ce.join(ce.dirname(we),"components");be.push(ye)}let Ue=a._rootComponentsDir;if(typeof Ue==="string"&&wo(n,a)&&!be.includes(Ue))be.push(Ue);if(n&&!be.includes(n))be.push(n);if(typeof Ue==="string"&&!be.includes(Ue))be.push(Ue);let Ae=ce.join(ce.dirname(l),"components");if(!be.includes(Ae))be.push(Ae);if(a.componentsDir&&a.componentsDir!==n&&!be.includes(a.componentsDir))be.push(a.componentsDir);for(let ye of a.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ct=a._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(z),lt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),es=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ts=!lt.includes("valuechange")&&(yt||lt.includes("change")&&!es),gt=a._nativeHostAttrs&&/^textinput$/i.test(z),_t=lt.includes("update:value")&&!lt.includes("input"),Ht=a._nativeHostAttrs&&/^video$/i.test(z),ns=a._nativeHostAttrs&&/^image$/i.test(z),ln=Ds([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=Ht&&wt&&!un&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),mt=(ye)=>Object.hasOwn(t,ye)||Boolean(A?.reactiveProps?.includes(ye)),Sn=a._nativeHostAttrs&&/^button$/i.test(z)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!i.trim()),Zt=a._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&(!ct||ts)&&(!gt||_t)&&(!Ht||_n)&&(!ns||ln)&&!Sn;for(let ye of Zt?[]:a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof a.root==="string"?ce.resolve(a.root):void 0,jo=St??ce.dirname(l),$t=[];if(St)$t.push(ce.resolve(St,"resources/views/components")),$t.push(ce.resolve(St,"resources/components")),$t.push(ce.resolve(St,"src/components")),$t.push(ce.resolve(St,"components"));$t.push(ce.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let sr=a._pluginComponentDirs;if(Array.isArray(sr)){for(let ye of sr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(a.fallbackComponentsDir&&!be.includes(a.fallbackComponentsDir))be.push(a.fallbackComponentsDir);if(Zt){for(let ye of a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let $n=a._nativePrimitivesFallback;if($n&&!$n.except.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&!be.includes($n.dir))be.push($n.dir);let rr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ce.isAbsolute(ye)?ye:ce.resolve(jo,ye)}))];be.length=0,be.push(...rr);let ss=`${z}\x00${l}\x00${rr.join("\x00")}`,rs=Vn.get(ss);if(rs)if(await s(rs))L=rs;else Vn.delete(ss);if(!L&&(z.startsWith("./")||z.startsWith("../")))L=ce.resolve(ce.dirname(l),`${z}.stx`),te.push(L);else if(!L)for(let ye of be){if(!ye)continue;for(let En of ae){let kn=ce.join(ye,En);if(te.push(kn),await s(kn)){L=kn;break}}if(L)break;if(!L)try{let En=await import("fs");if(!En.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let No=8,is=[{path:ye,depth:0}];while(is.length>0&&!L){let Rn=is.pop();if(Rn.depth>=No)continue;let ir;try{ir=En.readdirSync(Rn.path,{withFileTypes:!0})}catch{continue}for(let Cn of ir){if(!Cn.isDirectory())continue;if(Cn.name==="node_modules"||Cn.name.startsWith("."))continue;let or=ce.join(Rn.path,Cn.name);for(let Lo of ae){let os=ce.join(or,Lo);if(te.push(os),await s(os)){L=os;break}}if(L)break;is.push({path:or,depth:Rn.depth+1})}}}catch{}if(L)break}if(L)Vn.set(ss,L)}if(!L||!await s(L))return mo(e,l,te),ho(e);v.add(L);let re;if(tn.has(L)&&Ts.get(L)===lo(L))re=tn.get(L);else try{let se=lo(L);re=await Bun.file(L).text(),tn.set(L,re),Ts.set(L,se)}catch(se){let ae=se instanceof Error?se.message:String(se);return mo(e,l,[L],ae),ho(e)}if(A)for(let se of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ae=se.toLowerCase();if(ae.startsWith("aria-")||ae.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(re))A.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(re))A.consumedProps?.add(se)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(re))for(let se of A.reactiveProps){if(Il.has(se)||A.consumedProps?.has(se))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(re))continue;let ae=`${L}\x00${se}`;if(xo.has(ae))continue;xo.add(ae),console.warn(`[stx] ${ce.basename(L)} reads \`${se}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${se}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${se}').`)}let me=new Set(["__originalFilePath","__importedComponents",Pn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[se,ae]of Object.entries(c))if(!se.startsWith("__")||me.has(se))he[se]=ae;let le=E.length>0?{[Bn]:[...E]}:{},ke=i;if(i.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-fg0amm0c.js"));ke=await se(i,c,l,a,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ke)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-5kqbj292.js")),ae={...c,__processedComponents:D,...le};ke=await se(ke,ae,l,a,v);let we=ae.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)c.__stx_preserved_client_expressions=[...new Set([...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...we])]}let Re=[];if(Xc(ke)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-htrm7vx7.js")),ae=c.__stx_signals_gate===void 0?{...c,__stx_signals_gate:!0,...le}:E.length>0?{...c,...le}:c;ke=se(ke,ae,l);for(let we of ke.matchAll(/\{\{([\s\S]*?)\}\}/g))Re.push(we[1].trim())}let He=G(ke),Xe=[],Ze=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,ae)=>{let we=He.scripts[Number(ae)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ae=!Ue||["module","text/javascript","application/javascript"].includes(Ue),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Ae&&!ct)return Xe.push(we),"";return we}),{extractSlotContent:Kn}=await o("stx/slots",()=>import("./chunk-g48x8yme.js")),ft=Kn(Ze),pt={};if(ft.defaultSlot?.trim())pt.default=ft.defaultSlot;for(let[se,ae]of ft.namedSlots)pt[se]=ae.content;let dt=c.__stx_scope_seq??={n:0,key:Vs(String(c.__filename??l))},Ct=_o(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,We={...he,$uid:it,$native:a._nativeHostAttrs===!0,...t,props:t,slot:Ze,$slots:pt,__processedComponents:I,__sections:{},__stx_signals_gate:Se(re)||Xc(i),__stx_preserved_client_expressions:[...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...Re]};Cl(re,We);let Tt=re,sn=de(Tt);if(sn)Tt=sn.content.trim();let Xn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Xn)];for(let[,se,ae]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(ae,L,a.strict);let Je=[],Lt=null,Jn=Dt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,et=null,Bt=null,rn=0,Wt=null;if(wl(a),Jn&&Ks>0){let se=Sl({props:t,slot:ke,slotContext:i.trim()?$l(he):void 0,buildMode:a.buildMode??"",skipEventDirectives:a.skipEventDirectives===!0,native:a._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:a._layerGraph?.layers.map((ae)=>ae.configFile),uid:it});if(se!==null){bt=`${L}\x00${x(re)}\x00${se}`;let ae=Hn.get(bt);if(ae){for(let we of ae.dependencies)v.add(we);if(Kr(c,ae.clientFactories),dt.n+=ae.uidsConsumed,ae.preservedClientExpressions.length>0){let we=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let be of ae.preservedClientExpressions)we.add(be);c.__stx_preserved_client_expressions=[...we]}return ae.output}et=new Set(v),Bt=Zr(c),rn=dt.n,Wt=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let se of Dt){let ae=se[1]||"",we=se[2]||"",be=ae.includes("server");if(je(ae)&&we.trim())we=Be(we);if(be&&we){for(let Ae of Me(we))zt.add(Ae);try{await B(we,We,L,{onFailure:(Ae)=>{if(Ae.kind!=="unknown")Lt=Ae.kind}})}catch(Ae){}}if(!be){let Ae=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ae.includes("{{")&&Ae.includes("}}"),lt=Ae.includes("{!!")&&Ae.includes("!!}");if(ct||lt)Ae=wi(Ae,We,L);let yt=ae.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${yt}>${Ae}</script>`)}}let Ge=G(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=Ge?Ge[1]:"",Gn=Ge?Ge[2]:"",tt="",ne=Ft&&/\bscoped\b/i.test(Ft);if(Ge)tt=`<style${Ft}>${Tl(Gn,We,L)}</style>`;let ie=Tt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ge)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ae=[];if(ie=ie.replace(se,(we,be)=>{let Ue=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)ae.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ae.length>0)tt=`${tt}${ae.join(`
289
+ `)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-g48x8yme.js")),{defaultSlot:$e,namedSlots:Ce}=ft,qe=c.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ze),nt=a._nativeHostAttrs===!0&&Je.length>0||qe&&Je.length>0||Je.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),Yn=(se)=>nt?Ni(se,it):se,Qn=new Map([...Ce].map(([se,ae])=>[se,{...ae,content:Yn(ae.content)}]));ie=await ue(ie,Yn($e),Qn,We,nt?it:"");let on=yi(Je),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((se)=>!zt.has(se));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Vt=E.filter((se)=>!zt.has(se)&&!(se in t));if(Vt.length>0)We[Bn]=Vt;let cn={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:ce.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:a._nativeHostAttrs===!0||nt||Je.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(c.__stxProcessingDepth||0)+1;let{processDirectives:an}=await o("stx/process",()=>import("./chunk-w31y3j3k.js")),Ye=await an(ie,We,L,cn,v),ot=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let se of Ye.matchAll(/\{\{([\s\S]*?)\}\}/g))ot.add(se[1].trim());if(ot.size>0)c.__stx_preserved_client_expressions=[...ot];let st=it,Ke=Ye;if(nt){let se="";if(Object.keys(t).length>0)try{se=` data-stx-props="${Cs(JSON.stringify(t))}"`}catch{}let ae=Q?` stx-hydrate="${Cs(Q)}"`:"",we=Object.fromEntries(Object.entries(pt).map(([gt,_t])=>[gt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Cs(JSON.stringify(we))}"`:"",Ue=` data-stx-scope="${st}"${se}${be}${ae}`,Ae=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ye),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ye),lt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ye),yt=Ae?"span":"div",es=ct&&a._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':lt&&a._nativeHostAttrs?' style="width:100%;height:100%"':Ae||ct?' style="display:contents"':"";Ke=pg(Ye,Ue)??`<${yt}${Ue} data-stx-component-wrapper${es}>${Ye}</${yt}>`;let ts=await Promise.all(Je.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,Ht,ns]=_t,ln=ao(gt,We,L);if(ln!==null)return ln;let wt=await Pl(ns,L,a.buildMode==="compile"),un=yn(wt.clientCode,De(We)),{vendorStyleTags:_n}=wt,mt=un?`function(__scopeId) {
290
290
  ${un}
291
291
  return (${wt.factoryBody})(__scopeId);
292
292
  }`:wt.factoryBody,Sn=Q?null:hs(c,mt),Zt=Sn?`window.__stxComponentFactories[${JSON.stringify(Sn)}](${JSON.stringify(st)});`:`(${mt})(${JSON.stringify(st)});`;if(Q)return`${_n}<script type="stx/island" data-stx-island="${st}" data-stx-scoped data-stx-owner="${st}"${Ht}>${Zt}</script>`;return`${_n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${st}"${Ht}>${Zt}</script>`}));if(Ke=Ke+`
@@ -312,7 +312,7 @@ ${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
312
312
  `,y)A+=`
313
313
  ${Ee.blue}${Ee.bold}Context:${Ee.reset}
314
314
  ${Ee.dim}${y}${Ee.reset}
315
- `;return A}function fe(){tn.clear(),Ts.clear(),Vn.clear(),Ps.clear(),Zs.clear(),Hn.clear()}function Xh(){return{size:tn.size,maxSize:500}}var As=b(128);async function Pl(e,t,i){let n=x(e,t,i),c=As.get(n);if(c){if(Ls(c.deps))return c;As.delete(n)}let l=mi(e,{filePath:t,projectRoot:process.cwd()}),a=l.code,y=hi(l.styles);a=Nt(a).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-rmpgtyqh.js")),A=[],M=!1;if(v(a)){let z=a;a=await E(z,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),M=a===z}let{stripStxRuntimeImports:B}=await o("stx/signal-processing",()=>import("./chunk-8m5w99f3.js"));a=B(a);let D=P(a),I=El(D),j=new Set(H(D,!0).split(",").map((z)=>z.trim())),Q=`function(__scopeId) {
315
+ `;return A}function fe(){tn.clear(),Ts.clear(),Vn.clear(),Ps.clear(),Zs.clear(),Hn.clear()}function Xh(){return{size:tn.size,maxSize:500}}var As=b(128);async function Pl(e,t,i){let n=x(e,t,i),c=As.get(n);if(c){if(Ls(c.deps))return c;As.delete(n)}let l=mi(e,{filePath:t,projectRoot:process.cwd()}),a=l.code,y=hi(l.styles);a=Nt(a).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-aayq1a90.js")),A=[],M=!1;if(v(a)){let z=a;a=await E(z,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),M=a===z}let{stripStxRuntimeImports:B}=await o("stx/signal-processing",()=>import("./chunk-5a1273xd.js"));a=B(a);let D=P(a),I=El(D),j=new Set(H(D,!0).split(",").map((z)=>z.trim())),Q=`function(__scopeId) {
316
316
  ${at("const",[...ll,...I],D)}
317
317
  const __scope = window.stx._scopes = window.stx._scopes || {};
318
318
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tm}from"./chunk-tb6s07sr.js";import"./chunk-twqd8vme.js";import"./chunk-gb3tv53p.js";import"./chunk-2zkzkjmr.js";import"./chunk-f0zatmhn.js";import"./chunk-p48wb9v7.js";import"./chunk-a706x1s8.js";import"./chunk-8z10r3sa.js";import"./chunk-c84pxd2k.js";import"./chunk-dhv8ne0m.js";import"./chunk-4xtgh99h.js";import"./chunk-ftfayqmk.js";import"./chunk-y7sf7aj0.js";import"./chunk-yg0g5rm9.js";import"./chunk-xwe3fysm.js";import"./chunk-1carv1dw.js";import"./chunk-g0nbypak.js";import"./chunk-tanza35f.js";import"./chunk-txs6mfvk.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-hn2me1qx.js";import"./chunk-pnf0ev9m.js";import"./chunk-z843epx3.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{tm as buildForProduction};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{m,gi,Uc,Wc,ig,ag,cg,lg,ug,Vs,dg,je,Y,Be,pg,Er,fg,Xc,Gc,yi,Fe,s,bn,Jc,h,fe,Xh}from"./chunk-69cphbrz.js";import"./chunk-dqa1g676.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Gc as SIGNAL_COMPOSABLE_CALL,fe as clearComponentCache,yi as componentClientSignalNames,gi as convertToCommonJS,h as createDetailedErrorMessage,ug as extractDirectiveNames,Uc as extractScriptFromTemplate,m as extractVariables,s as fileExists,Xh as getComponentCacheStats,ag as getPositionInfo,Y as getSharedTranspiler,Jc as getSourceLineInfo,lg as hasDirectives,Wc as hasVariables,fg as isHydrateTrigger,dg as isJavaScriptScript,Fe as renderComponentWithSlot,bn as resolveTemplatePath,pg as scopeOnRootElement,Vs as scopeSequenceKey,je as shouldTranspileTypeScript,Xc as slotContentHasExpressions,Be as transpileTypeScript,Er as userComponentFileExists,cg as validateDirective,ig as validateTemplate};
2
+ import{m,gi,Uc,Wc,ig,ag,cg,lg,ug,Vs,dg,je,Y,Be,pg,Er,fg,Xc,Gc,yi,Fe,s,bn,Jc,h,fe,Xh}from"./chunk-pnf0ev9m.js";import"./chunk-z843epx3.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Gc as SIGNAL_COMPOSABLE_CALL,fe as clearComponentCache,yi as componentClientSignalNames,gi as convertToCommonJS,h as createDetailedErrorMessage,ug as extractDirectiveNames,Uc as extractScriptFromTemplate,m as extractVariables,s as fileExists,Xh as getComponentCacheStats,ag as getPositionInfo,Y as getSharedTranspiler,Jc as getSourceLineInfo,lg as hasDirectives,Wc as hasVariables,fg as isHydrateTrigger,dg as isJavaScriptScript,Fe as renderComponentWithSlot,bn as resolveTemplatePath,pg as scopeOnRootElement,Vs as scopeSequenceKey,je as shouldTranspileTypeScript,Xc as slotContentHasExpressions,Be as transpileTypeScript,Er as userComponentFileExists,cg as validateDirective,ig as validateTemplate};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,l}from"./chunk-gebb12ak.js";import{s,bn,h}from"./chunk-69cphbrz.js";import{tt}from"./chunk-hn2me1qx.js";import{Cs,Es}from"./chunk-3z0e637x.js";import{xc,Yo,ks,_s}from"./chunk-vbc8a8fh.js";import{bc,wc}from"./chunk-g9xx8qh1.js";import{xt}from"./chunk-mv3yhspn.js";import{un,Tc,mr,hr}from"./chunk-0rjcbqk3.js";import{g}from"./chunk-0dve54ne.js";import{to}from"./chunk-gqjb1y7c.js";import Q from"fs";import j from"path";import{loadConfigWithResult as Bt}from"bunfig";var U={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,r={}){let{duration:i,delay:o,ease:n,direction:c,custom:d}={...U,...r};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{t,l}from"./chunk-gebb12ak.js";import{s,bn,h}from"./chunk-pnf0ev9m.js";import{tt}from"./chunk-hn2me1qx.js";import{Cs,Es}from"./chunk-3z0e637x.js";import{xc,Yo,ks,_s}from"./chunk-vbc8a8fh.js";import{bc,wc}from"./chunk-txs6mfvk.js";import{xt}from"./chunk-mv3yhspn.js";import{un,Tc,mr,hr}from"./chunk-0rjcbqk3.js";import{g}from"./chunk-0dve54ne.js";import{to}from"./chunk-gqjb1y7c.js";import Q from"fs";import j from"path";import{loadConfigWithResult as Bt}from"bunfig";var U={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,r={}){let{duration:i,delay:o,ease:n,direction:c,custom:d}={...U,...r};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${c==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1307,6 +1307,6 @@ ${y}
1307
1307
  customElements.define('${r}', ${d});
1308
1308
  `}async function Ze(e,r,i,o){if(r.length<1)return l("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let n=r[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=F.isAbsolute(d)?[F.join(d,`${n}.stx`),F.join(F.dirname(o),`${n}.stx`)]:[F.join(F.dirname(o),d,`${n}.stx`),F.join(process.cwd(),d,`${n}.stx`),F.join(F.dirname(o),`${n}.stx`)],u=null;for(let f of p)if(await s(f)){u=await Bun.file(f).text();break}if(!u)return l("WebComponent",`Component file not found: ${n}.stx`,t.FILE_NOT_FOUND);let m=Ht(u,n);return`<script type="module">
1309
1309
  ${Ut(m)}
1310
- </script>`}var B={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:un,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},bc,wc,Cs,Es,Pe,Ae,_e,ke,Re,Ee,qe,Se,...to],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,r,i){let o=r||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),c=j.join(n,"resources","views"),d=j.join(n,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var et=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,r){let i=r.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function Bf(e,r){let i=!e.root,o=Jt(e.root,e.pagesDir,r);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${r}::${o.root}`;if(!et.has(n))et.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let n={};for(let c of pe){let d=e[c];if(typeof d==="string"&&d)n[c]=d}Ce.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let c of pe){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Kt(d,n))continue;e[c]=j.join(n,d)}}for(let n of pe){let c=e[n];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[n]=j.resolve(r,c)}return e}function Gt(e,r){let i=Ce.get(e);for(let o of pe){let n=e[o];if(typeof n!=="string"||!n)continue;let c=j.isAbsolute(n)?n:j.join(r,n);if(Q.existsSync(c))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(Tc(e.stateDir),e.stateDir=mr(),e.cachePath=hr(e.cachePath),e.build)e.build.cacheDir=hr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=hr(e.media.cache.directory);if(e.story)e.story.outDir=hr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function Go(e,r=Bt){try{return await r(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let r=e?j.resolve(e):process.cwd(),i=ue.get(r);if(i&&i.signature!==ks(i.graph)){let c=Y.get(r);if(Y.delete(r),ue.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-va9w63nh.js"),{partialsCache:p}=await import("./chunk-8wd83rnz.js");if(d(),p.clear(),c&&i.configSignature===_s(i.graph)){let u=c.then(async(m)=>{let y={...i.graph};await Yo(y,r),ue.set(r,{graph:y,signature:ks(y),configSignature:_s(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(r);if(o)return o;let n=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await Go({name:"ui",cwd:j.join(r,"config"),defaultConfig:B,errorPolicy:"throw",verbose:!1});u=(await Go({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Go({name:"stx",alias:"ui",cwd:r,defaultConfig:B,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await xc(r,B);u=v.config,ue.set(r,{graph:v.graph,signature:ks(v.graph),configSignature:_s(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-m5cdkb11.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-jjcw2pa9.js");await b(r,u.runtimeConfig)}Yt(u),Xt(u),Bf(u,r),Gt(u,r);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[r]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-3e85etrf.js"),b=[],x=[];for(let P of f){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,O;try{let w=g.resolve(S,{paths:[r]});k=await import(w),O=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),O=j.dirname(w)}let E=k.default||k;if(!v.has(E.name))await v.register(E,u);if(E.components){let w=Array.isArray(E.components)?E.components:[E.components];for(let C of w)b.push(j.resolve(O,C))}if(E.pages){let w=j.resolve(O,E.pages),C=A.path||"/";x.push({dir:w,prefix:C})}if(E.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:O,config:u};await E.setup(A,w)}process.stderr.write(`[stx] Plugin loaded: ${E.name||S}
1310
+ </script>`}var B={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:un,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},bc,wc,Cs,Es,Pe,Ae,_e,ke,Re,Ee,qe,Se,...to],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,r,i){let o=r||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),c=j.join(n,"resources","views"),d=j.join(n,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var et=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,r){let i=r.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function Bf(e,r){let i=!e.root,o=Jt(e.root,e.pagesDir,r);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${r}::${o.root}`;if(!et.has(n))et.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let n={};for(let c of pe){let d=e[c];if(typeof d==="string"&&d)n[c]=d}Ce.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let c of pe){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Kt(d,n))continue;e[c]=j.join(n,d)}}for(let n of pe){let c=e[n];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[n]=j.resolve(r,c)}return e}function Gt(e,r){let i=Ce.get(e);for(let o of pe){let n=e[o];if(typeof n!=="string"||!n)continue;let c=j.isAbsolute(n)?n:j.join(r,n);if(Q.existsSync(c))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(Tc(e.stateDir),e.stateDir=mr(),e.cachePath=hr(e.cachePath),e.build)e.build.cacheDir=hr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=hr(e.media.cache.directory);if(e.story)e.story.outDir=hr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function Go(e,r=Bt){try{return await r(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let r=e?j.resolve(e):process.cwd(),i=ue.get(r);if(i&&i.signature!==ks(i.graph)){let c=Y.get(r);if(Y.delete(r),ue.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-t2tyvphs.js"),{partialsCache:p}=await import("./chunk-fg0amm0c.js");if(d(),p.clear(),c&&i.configSignature===_s(i.graph)){let u=c.then(async(m)=>{let y={...i.graph};await Yo(y,r),ue.set(r,{graph:y,signature:ks(y),configSignature:_s(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(r);if(o)return o;let n=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await Go({name:"ui",cwd:j.join(r,"config"),defaultConfig:B,errorPolicy:"throw",verbose:!1});u=(await Go({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Go({name:"stx",alias:"ui",cwd:r,defaultConfig:B,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await xc(r,B);u=v.config,ue.set(r,{graph:v.graph,signature:ks(v.graph),configSignature:_s(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-m5cdkb11.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-kqnsztam.js");await b(r,u.runtimeConfig)}Yt(u),Xt(u),Bf(u,r),Gt(u,r);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[r]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-3e85etrf.js"),b=[],x=[];for(let P of f){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,O;try{let w=g.resolve(S,{paths:[r]});k=await import(w),O=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),O=j.dirname(w)}let E=k.default||k;if(!v.has(E.name))await v.register(E,u);if(E.components){let w=Array.isArray(E.components)?E.components:[E.components];for(let C of w)b.push(j.resolve(O,C))}if(E.pages){let w=j.resolve(O,E.pages),C=A.path||"/";x.push({dir:w,prefix:C})}if(E.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:O,config:u};await E.setup(A,w)}process.stderr.write(`[stx] Plugin loaded: ${E.name||S}
1311
1311
  `)}catch(k){console.warn(`[stx] Failed to load plugin ${S}:`,k.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:xs(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return u})();if(Y.set(r,n),n.catch(()=>{if(Y.get(r)===n)Y.delete(r)}),!e)se=n,n.then((c)=>{K=c}).catch(()=>{});return n}var I=new Proxy(B,{get(e,r){if(K&&r in K)return K[r];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[r]}});function Fh(e){return e}function zh(e){let r=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")r.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")r.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")r.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")r.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)r.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)r.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))r.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))r.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)r.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)r.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))r.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))r.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))r.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))r.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")r.push({path:`customDirectives[${n}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")r.push({path:`customDirectives[${n}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))r.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")r.push({path:`middleware[${n}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")r.push({path:`middleware[${n}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))r.push({path:`middleware[${n}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)r.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))r.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))r.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((n,c)=>{if(!n.pattern||typeof n.pattern!=="string")r.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(n.strategy))r.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(n.maxAgeSeconds!==void 0&&(typeof n.maxAgeSeconds!=="number"||n.maxAgeSeconds<0))r.push({path:`pwa.routes[${c}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(n.maxEntries!==void 0&&(typeof n.maxEntries!=="number"||n.maxEntries<1))r.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((n)=>typeof n!=="number"||n<16||n>1024).length>0)r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!o.includes(c)).length>0)r.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:r.length===0,errors:r,warnings:i}}
1312
1312
  export{pc,fc,dr,Qe,gc,xs,Ss,B,Bf,Go,a,I,Fh,zh};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{tt}from"./chunk-hn2me1qx.js";import{ht,Hn}from"./chunk-gb3tv53p.js";import{Rr,Ar,Pr,Or,_e}from"./chunk-gebb12ak.js";import{Me,gn,Yc,Zc}from"./chunk-69cphbrz.js";import{N}from"./chunk-m7hfcxt3.js";import{vi}from"./chunk-dqa1g676.js";import{y}from"./chunk-ncptqa8v.js";import{i}from"./chunk-8je2zse3.js";import{B,a}from"./chunk-evmxrmjb.js";import{Sc}from"./chunk-vbc8a8fh.js";import{Pn,We,Ee,la,ua,In}from"./chunk-3k4xb05m.js";import{on,Po}from"./chunk-kq0cee7k.js";import{On}from"./chunk-j3st59hv.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{X}from"./chunk-3ebwrpax.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?Hn():ht(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=tt(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Yc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Me(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...B,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Pn(b)+We(b),j=Zc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:gn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function tm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=_e(e.app?.head,{known:Or,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=On(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)on(o,w);if(e.runtimeConfig)N(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Pr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Rr(t.html,u);if(g.htmlAttrs)t.html=Ar(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),O){let p=await In(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ee(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Zn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Yn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Zt}/`)}let F={runtime:v.filename,router:x.filename},C=la(H,F,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await Po(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await vi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Sc(e._layerGraph),null,2));ua(C,r);let K=Date.now()-l;return console.log(`
2
+ import{tt}from"./chunk-hn2me1qx.js";import{ht,Hn}from"./chunk-gb3tv53p.js";import{Rr,Ar,Pr,Or,_e}from"./chunk-gebb12ak.js";import{Me,gn,Yc,Zc}from"./chunk-pnf0ev9m.js";import{N}from"./chunk-m7hfcxt3.js";import{vi}from"./chunk-z843epx3.js";import{y}from"./chunk-a706x1s8.js";import{i}from"./chunk-p48wb9v7.js";import{B,a}from"./chunk-tanza35f.js";import{Sc}from"./chunk-vbc8a8fh.js";import{Pn,We,Ee,la,ua,In}from"./chunk-twqd8vme.js";import{on,Po}from"./chunk-f0zatmhn.js";import{On}from"./chunk-j3st59hv.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{X}from"./chunk-xwe3fysm.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?Hn():ht(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=tt(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Yc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Me(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...B,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Pn(b)+We(b),j=Zc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:gn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function tm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=_e(e.app?.head,{known:Or,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=On(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)on(o,w);if(e.runtimeConfig)N(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Pr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Rr(t.html,u);if(g.htmlAttrs)t.html=Ar(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),O){let p=await In(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ee(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Zn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Yn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Zt}/`)}let F={runtime:v.filename,router:x.filename},C=la(H,F,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await Po(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await vi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Sc(e._layerGraph),null,2));ua(C,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
4
4
  export{tm};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-gebb12ak.js";import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-69cphbrz.js";import"./chunk-m7hfcxt3.js";import"./chunk-dqa1g676.js";import"./chunk-2ws2qe1k.js";import"./chunk-g9xx8qh1.js";import{c}from"./chunk-0rjcbqk3.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-gebb12ak.js";import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-pnf0ev9m.js";import"./chunk-m7hfcxt3.js";import"./chunk-z843epx3.js";import"./chunk-2ws2qe1k.js";import"./chunk-txs6mfvk.js";import{c}from"./chunk-0rjcbqk3.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ef,sc,Ch,oc,Tf,$f,cn,sr,Eh,Rf,Af,Th,y}from"./chunk-ncptqa8v.js";import"./chunk-rssxm2jw.js";import"./chunk-69cphbrz.js";import"./chunk-dqa1g676.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{cn as buildCss,Rf as extractClassNames,$f as fingerprintConfig,Af as generateCss,Eh as getCachedCSS,Ef as getCssServeAsset,y as injectCss,sc as loadCssEngine,oc as loadCssEngineConfig,sr as rebuildCss,Ch as resetCssCache,Tf as resolveUserCssConfig,Th as withLinkedModuleBundles};
2
+ import{Ef,sc,Ch,oc,Tf,$f,cn,sr,Eh,Rf,Af,Th,y}from"./chunk-a706x1s8.js";import"./chunk-g0nbypak.js";import"./chunk-pnf0ev9m.js";import"./chunk-z843epx3.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{cn as buildCss,Rf as extractClassNames,$f as fingerprintConfig,Af as generateCss,Eh as getCachedCSS,Ef as getCssServeAsset,y as injectCss,sc as loadCssEngine,oc as loadCssEngineConfig,sr as rebuildCss,Ch as resetCssCache,Tf as resolveUserCssConfig,Th as withLinkedModuleBundles};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{on,Ao,Po,Io,_h,Oo}from"./chunk-kq0cee7k.js";import"./chunk-vbc8a8fh.js";import"./chunk-hn2me1qx.js";import"./chunk-m7hfcxt3.js";export{Po as buildServerApi,_h as createServerApi,on as discoverServerApi,Ao as generateApiTypes,Oo as isServerApiSource,Io as productionApiDispatcher};
2
+ import{on,Ao,Po,Io,_h,Oo}from"./chunk-f0zatmhn.js";import"./chunk-vbc8a8fh.js";import"./chunk-hn2me1qx.js";import"./chunk-m7hfcxt3.js";export{Po as buildServerApi,_h as createServerApi,on as discoverServerApi,Ao as generateApiTypes,Oo as isServerApiSource,Io as productionApiDispatcher};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{xe,Pt,ci,js,Pc,Ic,Oc,Nc,_r,ui,Mc,Dc,di,hn}from"./chunk-69cphbrz.js";import{k}from"./chunk-ybjfr7e8.js";import{a}from"./chunk-evmxrmjb.js";import{wo}from"./chunk-16362f43.js";import{c}from"./chunk-0rjcbqk3.js";import{existsSync as B,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=hn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),ye=new Set(te),Se=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(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 d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?be:ye;Y.lastIndex=0;for(let l of d.code.matchAll(Y)){let g=l.index+l[0].indexOf("{")+1;for(let u of l[1].matchAll(/[^,]+/g)){let y=u[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!Se.has(r)||i.has(r))continue;let p=d.offset+g+u.index+b[0].length-r.length,f=e.slice(0,p),T=f.split(`
2
+ import{xe,Pt,ci,js,Pc,Ic,Oc,Nc,_r,ui,Mc,Dc,di,hn}from"./chunk-pnf0ev9m.js";import{k}from"./chunk-ybjfr7e8.js";import{a}from"./chunk-tanza35f.js";import{wo}from"./chunk-h5rcc2rx.js";import{c}from"./chunk-0rjcbqk3.js";import{existsSync as B,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=hn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),ye=new Set(te),Se=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(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 d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?be:ye;Y.lastIndex=0;for(let l of d.code.matchAll(Y)){let g=l.index+l[0].indexOf("{")+1;for(let u of l[1].matchAll(/[^,]+/g)){let y=u[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!Se.has(r)||i.has(r))continue;let p=d.offset+g+u.index+b[0].length-r.length,f=e.slice(0,p),T=f.split(`
3
3
  `).length;s.push({line:T,column:p-(f.lastIndexOf(`
4
4
  `)+1)+1,offset:p,length:r.length,name:r,kind:d.kind,message:ke(r,d.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let d=E.join(s,"tsconfig.json");if(t(d))return d;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let d=$e(e,s);if(!d)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let u=t(g);if(!u)return;let y=u.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((f)=>f?.name===we),p=Array.isArray(r?.libs)?r.libs.filter((f)=>typeof f==="string"):[];return r?{configPath:g,libs:p.map((f)=>E.resolve(E.dirname(g),f))}:null}let b=typeof u.extends==="string"?[u.extends]:Array.isArray(u.extends)?u.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let p=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),f=l(p);if(f!==void 0)return f}return};return l(d)??void 0}function oa(e,t="",s=""){let d=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=ci(ui(e)+e.code,t),l=js(i.code),g=e.kind==="client"||e.kind==="plain"?Oc(t,e.code):"",u=(d+l).split(`
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{kn}from"./chunk-gebb12ak.js";import{W,S,It,Ot,Cr,m,Qc,bi,U,T}from"./chunk-69cphbrz.js";import{Qt}from"./chunk-qeyzgyhk.js";import{n}from"./chunk-aznnh6cy.js";import{K}from"./chunk-c5vzr1va.js";var q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function _(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=z(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||q.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var ft="private, no-store";function An(t){return t.replace(/&#(\d+);/g,(r,e)=>N(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>N(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function N(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function L(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${E(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=An(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=An(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
- `}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-nrqv8s48.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function aa(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function mo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Qt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-wwbng2jf.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Kr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{kn}from"./chunk-gebb12ak.js";import{W,S,It,Ot,Cr,m,Qc,bi,U,T}from"./chunk-pnf0ev9m.js";import{Qt}from"./chunk-2zkzkjmr.js";import{n}from"./chunk-4xtgh99h.js";import{K}from"./chunk-c5vzr1va.js";var q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function _(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=z(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||q.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var ft="private, no-store";function An(t){return t.replace(/&#(\d+);/g,(r,e)=>N(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>N(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function N(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function L(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${E(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=An(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=An(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
+ `}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-nrqv8s48.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function aa(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function mo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Qt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-8z9qtgjp.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Kr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -28,5 +28,5 @@ ${c}
28
28
  `));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
29
29
  `));if(R.length>0)d.push(R.filter((x)=>!u.has(x)).join(`
30
30
  `));return d.push(y),d.join(`
31
- `)}import O from"fs";import H from"path";function la(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ua(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function da(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function ho(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!ho(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function pa(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function In(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=It(s),c=Ot(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-e6snnz4t.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-0xqec4yj.js"),{defaultConfig:h}=await import("./chunk-72cm91wm.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!bi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=Cr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!bi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=T(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?U(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Qc(t.html,i)),context:e,cookies:s.cookies}}
31
+ `)}import O from"fs";import H from"path";function la(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ua(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function da(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function ho(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!ho(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function pa(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function In(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=It(s),c=Ot(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-6g6542n1.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-w31y3j3k.js"),{defaultConfig:h}=await import("./chunk-w2q6zmwn.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!bi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=Cr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!bi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=T(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?U(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Qc(t.html,i)),context:e,cookies:s.cookies}}
32
32
  export{ft,An,Ce,L,Pn,aa,mo,Kr,We,ca,qe,Ee,la,ua,da,ho,pa,In};