@stacksjs/stx 0.2.793 → 0.2.794

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 (85) hide show
  1. package/dist/{chunk-dyp0kgmr.js → chunk-0675z8hj.js} +4 -4
  2. package/dist/{chunk-66r0f799.js → chunk-15ckxpq7.js} +1 -1
  3. package/dist/chunk-1ds97d9m.js +2 -0
  4. package/dist/{chunk-hs9fzxn0.js → chunk-1hajf3wc.js} +1 -1
  5. package/dist/{chunk-r2nvxbjc.js → chunk-1stvxcjv.js} +1 -1
  6. package/dist/{chunk-g89fx9rq.js → chunk-2m5h2mtr.js} +4 -4
  7. package/dist/{chunk-xc0vws7m.js → chunk-488kx8j5.js} +2 -2
  8. package/dist/{chunk-628jcm1d.js → chunk-5gppagt3.js} +1 -1
  9. package/dist/{chunk-brqcepmv.js → chunk-5v5w0cd2.js} +1 -1
  10. package/dist/{chunk-bb2zfgwf.js → chunk-66b56g2z.js} +2 -2
  11. package/dist/{chunk-44ep7dkr.js → chunk-6pt4158p.js} +1 -1
  12. package/dist/{chunk-7yb8943c.js → chunk-7fr038wx.js} +1 -1
  13. package/dist/{chunk-1pbyr47e.js → chunk-7mrr4ke5.js} +1 -1
  14. package/dist/{chunk-bxxgr5c5.js → chunk-7sartb04.js} +1 -1
  15. package/dist/chunk-7tzzzvdg.js +2 -0
  16. package/dist/{chunk-t9744tty.js → chunk-8a5txj4f.js} +1 -1
  17. package/dist/{chunk-syheccfj.js → chunk-8e23zh2y.js} +1 -1
  18. package/dist/{chunk-g3z2g6hm.js → chunk-8q63njnd.js} +1 -1
  19. package/dist/{chunk-js5zve3p.js → chunk-8rmb79zw.js} +1 -1
  20. package/dist/chunk-8rwnzmvb.js +2 -0
  21. package/dist/{chunk-55j4jxwe.js → chunk-8ztgy5y4.js} +5 -5
  22. package/dist/{chunk-0ppx28f6.js → chunk-90pxjq62.js} +1 -1
  23. package/dist/{chunk-4gx5ze56.js → chunk-9s4ggstz.js} +1 -1
  24. package/dist/{chunk-vaqqch06.js → chunk-9xdz8r73.js} +1 -1
  25. package/dist/{chunk-dtnyrjcj.js → chunk-agvykxs8.js} +1 -1
  26. package/dist/{chunk-ddbkw53b.js → chunk-ay4ep67v.js} +1 -1
  27. package/dist/{chunk-276e3d0g.js → chunk-bwfncfe1.js} +1 -1
  28. package/dist/{chunk-g7anxh36.js → chunk-d6arvs57.js} +1 -1
  29. package/dist/{chunk-7fx8p9w5.js → chunk-dsrn2vgp.js} +1 -1
  30. package/dist/{chunk-6h7yhyb8.js → chunk-e0wxcst7.js} +1 -1
  31. package/dist/{chunk-4de6rhaj.js → chunk-efrc97by.js} +2 -2
  32. package/dist/{chunk-j4s5k8sp.js → chunk-enep9r03.js} +2 -2
  33. package/dist/{chunk-4cffjp4f.js → chunk-epcy3r18.js} +6 -6
  34. package/dist/chunk-fpw03bhv.js +2 -0
  35. package/dist/chunk-g747k4gg.js +3 -0
  36. package/dist/chunk-gryrg1c0.js +2 -0
  37. package/dist/{chunk-0cm94ksp.js → chunk-gvj862m1.js} +1 -1
  38. package/dist/{chunk-8698v9gf.js → chunk-h5nrnen8.js} +1 -1
  39. package/dist/chunk-hagk74x6.js +2 -0
  40. package/dist/{chunk-spt5kmb2.js → chunk-hh9t97hr.js} +1 -1
  41. package/dist/{chunk-1aent61q.js → chunk-hv0whj8t.js} +1 -1
  42. package/dist/{chunk-xadd911n.js → chunk-j56mg28d.js} +1 -1
  43. package/dist/{chunk-gg71gm25.js → chunk-j6255z7f.js} +1 -1
  44. package/dist/{chunk-zsjw2jgy.js → chunk-k2brrhf8.js} +1 -1
  45. package/dist/{chunk-qd9f47ds.js → chunk-k6ncb5qm.js} +1 -1
  46. package/dist/{chunk-5pe7wcvh.js → chunk-nbjgytem.js} +1 -1
  47. package/dist/{chunk-6jzqzap6.js → chunk-ne69yaak.js} +4 -4
  48. package/dist/{chunk-6jx0trea.js → chunk-nps2whkz.js} +4 -4
  49. package/dist/chunk-nt7wqqax.js +2 -0
  50. package/dist/{chunk-a1ynjj47.js → chunk-nwbq8qvb.js} +12 -4
  51. package/dist/chunk-pq1qs7bp.js +2 -0
  52. package/dist/{chunk-98308vtv.js → chunk-pvw58x2j.js} +1 -1
  53. package/dist/{chunk-gnydrw29.js → chunk-qk9v0emh.js} +1 -1
  54. package/dist/{chunk-ad2fk303.js → chunk-qnj444zc.js} +1 -1
  55. package/dist/{chunk-0ykteae5.js → chunk-rgz797k3.js} +1 -1
  56. package/dist/{chunk-44tq4d62.js → chunk-sq0qc9sk.js} +1 -1
  57. package/dist/{chunk-a4cse2tj.js → chunk-ssh2gycr.js} +1 -1
  58. package/dist/{chunk-vj59es75.js → chunk-t3ptzpfc.js} +1 -1
  59. package/dist/{chunk-1z9hbzpk.js → chunk-vav9ktgm.js} +1 -1
  60. package/dist/{chunk-2hwwmn7c.js → chunk-w6taxq7d.js} +3 -3
  61. package/dist/{chunk-m997knnz.js → chunk-wk6xsyv3.js} +1 -1
  62. package/dist/chunk-wmh4yxcs.js +2 -0
  63. package/dist/chunk-xmae29mn.js +2 -0
  64. package/dist/{chunk-56yhvhjq.js → chunk-y0pqpch2.js} +2 -2
  65. package/dist/{chunk-c2qwbej3.js → chunk-yyr7vb7k.js} +2 -2
  66. package/dist/{chunk-ncxed9r1.js → chunk-zssf9fdg.js} +1 -1
  67. package/dist/cli.js +8 -8
  68. package/dist/client/signals-binding-utils-runtime.js +12 -4
  69. package/dist/craft-entry.js +1 -1
  70. package/dist/craft.js +1 -1
  71. package/dist/native/runtime/native-host.js +45 -23
  72. package/dist/pwa.js +1 -1
  73. package/dist/ssg.js +2 -2
  74. package/package.json +5 -5
  75. package/dist/chunk-0a9ceqa8.js +0 -2
  76. package/dist/chunk-22z2cwhv.js +0 -2
  77. package/dist/chunk-27vn4674.js +0 -2
  78. package/dist/chunk-499v1ade.js +0 -2
  79. package/dist/chunk-55wsqxfk.js +0 -2
  80. package/dist/chunk-5y5k6x3r.js +0 -2
  81. package/dist/chunk-fc384a2h.js +0 -2
  82. package/dist/chunk-jkm34gec.js +0 -2
  83. package/dist/chunk-k3mcb700.js +0 -3
  84. package/dist/chunk-nptp3x62.js +0 -2
  85. package/dist/chunk-t8vtf522.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ze,xn,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-syheccfj.js";import{Or,k,cl,at,$i,ll}from"./chunk-gb65t4n1.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-94gyfwpz.js";import{s,ge}from"./chunk-14ft0zc7.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ye from"path";import Ct from"process";import{AsyncLocalStorage as Fo}from"async_hooks";var fr=new Fo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=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(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Vo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Vo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import In from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=In.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(In.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of In.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(In.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].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)=>i.has(E))}import Xn from"fs";import ce from"path";import ht from"path";import Jt from"fs";var Uo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Uo.has(e.toLowerCase())}var $r=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"]),Er={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"},Ho=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Ho.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Ko(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Zo(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function fs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function qo(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ko(e),a=Zo(fs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(us(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.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,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-8e23zh2y.js";import{Or,k,cl,at,$i,ll}from"./chunk-gb65t4n1.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-94gyfwpz.js";import{s,ge}from"./chunk-14ft0zc7.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ye from"path";import Ct from"process";import{AsyncLocalStorage as Fo}from"async_hooks";var fr=new Fo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=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(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Vo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Vo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import In from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=In.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(In.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of In.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(In.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].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)=>i.has(E))}import Xn from"fs";import ce from"path";import ht from"path";import Jt from"fs";var Uo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Uo.has(e.toLowerCase())}var $r=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"]),Er={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"},Ho=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Ho.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Ko(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Zo(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function fs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function qo(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ko(e),a=Zo(fs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(us(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${t}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function Xo(e,n=""){let t=Ir(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(R,""),y=y.replace(M,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Tr(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Ec(e,n,t){if(ll(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Xo(e,Tr(n)),E=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...E,...v],y}let i=Ir(e,Tr(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let R=E.match(/id=["']([^"']+)["']/);if(R)for(let M of v.events)M.elementId=R[1]}for(let R of v.events){let M=R.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(N,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=oi(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,Jo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Go=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Yo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function ds(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Yo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let se=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){se=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(se,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&&lt.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||Jo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Go.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&&lt.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let se=P+1;se<=F;se++){let ue=t[se]?.text;if(se<F&&Dr.includes(ue)&&i.has(se)&&i.get(se)<F){se=i.get(se);continue}if(se<F&&ue===":"&&!te)Q=!0;else if(se<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(se<F&&Q&&ue==="<")ae++;else if(se<F&&Q&&ue===">"&&ae>0)ae--;else if(se===F||ue===","&&ae===0)y(L,se,R,D==="var"),L=se+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&&lt.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&&lt.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,se]of l(Q+1,te)){let ue=se-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ps(e){let n=ds(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(ds(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=ds(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&lt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.793";var Nr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function ea(){let e=globalThis;return e[Nr]??=new Map,e[Nr]}function o(e,n){let t=ea(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var ta=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ta,"<\\/$1")}import zr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var vt=new Map,na=500;function At(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!vt.has(t)){if(vt.size>=na){let i=vt.keys().next().value;if(i)vt.delete(i)}vt.set(t,new RegExp(e,n))}return vt.get(t)}class Lr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}R=Function(...n,`
115
+ `+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,Jo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Go=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Yo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function ds(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Yo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let se=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){se=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(se,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&&lt.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||Jo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Go.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&&lt.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let se=P+1;se<=F;se++){let ue=t[se]?.text;if(se<F&&Dr.includes(ue)&&i.has(se)&&i.get(se)<F){se=i.get(se);continue}if(se<F&&ue===":"&&!te)Q=!0;else if(se<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(se<F&&Q&&ue==="<")ae++;else if(se<F&&Q&&ue===">"&&ae>0)ae--;else if(se===F||ue===","&&ae===0)y(L,se,R,D==="var"),L=se+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&&lt.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&&lt.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,se]of l(Q+1,te)){let ue=se-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ps(e){let n=ds(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(ds(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=ds(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&lt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.794";var Nr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function ea(){let e=globalThis;return e[Nr]??=new Map,e[Nr]}function o(e,n){let t=ea(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var ta=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ta,"<\\/$1")}import zr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var vt=new Map,na=500;function At(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!vt.has(t)){if(vt.size>=na){let i=vt.keys().next().value;if(i)vt.delete(i)}vt.set(t,new RegExp(e,n))}return vt.get(t)}class Lr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}R=Function(...n,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${v};
@@ -193,7 +193,7 @@ else {
193
193
  // STX: auto-generated event bindings
194
194
  ${e.map((t,i)=>_a(t,i)).join(`
195
195
  `)}`}function Hr(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let E=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&E===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){E++,c+=2;continue}if(i[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
196
- `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var Sa=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 $a(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!Sa.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Mt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-ncxed9r1.js"));if(E(t))t=await R(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Wc(t);t=Q.code,i=qc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${yn(t,n.serverData)}${i}`,t=A(t),!a&&je(n.attrs||""))t=Be(t);let M=wa(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
196
+ `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var Sa=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 $a(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!Sa.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Mt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-zssf9fdg.js"));if(E(t))t=await R(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Wc(t);t=Q.code,i=qc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${yn(t,n.serverData)}${i}`,t=A(t),!a&&je(n.attrs||""))t=Be(t);let M=wa(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
197
197
  ${dn(`${i}${t}
198
198
  ${M}`)}
199
199
  </script>`}let D=$i(e),X=/function __stx_setup_/.test(t),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function L(Q){let te=Q.length>0?`
@@ -288,8 +288,8 @@ ${E.join(`
288
288
  `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},N=()=>{if(i!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((L)=>{let Q=L.trim().split(":");return Q[Q.length-1].trim()});for(let L of F)if(L&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(L)&&!t.has(L))n.push(L),t.add(L);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!t.has(F))n.push(F),t.add(F);return}let D=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let F=D[1];if(!t.has(F))n.push(F),t.add(F);return}let X=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let F=X[1];if(!t.has(F))n.push(F),t.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&R()){M();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))N();a++}return n}function Pl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function Ol(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function Ml(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of Pl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let R=Ol(E);if(R===-1)continue;let M=E.slice(0,R).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(n[M]!==void 0)continue;let N=E.slice(R+1).trim();if(!N)continue;try{let j=Object.keys(n).filter(jt),P=Function(...j,`"use strict"; return (${N});`);n[M]=P(...j.map((D)=>n[D]))}catch{}}}catch{}}var Dl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function ug(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!Dl.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,R)=>(a.lastIndex=R,a.exec(E)?.index===R?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}function vo(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Cr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(se)=>se.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),y=t.__importedComponents;if(y){for(let se of[l,l.toLowerCase(),c(l),H(l)])if(y.has(se))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${H(l)}.stx`])],E=typeof a.root==="string"?ce.resolve(a.root):void 0,R=E??ce.dirname(i),M=[],N=(se)=>{if(se&&!M.includes(se))M.push(se)},j=t.__originalFilePath;if(j)N(ce.join(ce.dirname(j),"components"));if(vo(n,a))N(a._rootComponentsDir);N(n),N(a._rootComponentsDir),N(ce.join(ce.dirname(i),"components")),N(a.componentsDir);for(let se of a.additionalComponentsDirs??[])N(se);let P=a._targetComponentFallbackNames?.some((se)=>se.toLowerCase()===l.toLowerCase());if(!P)for(let se of a._targetComponentDirs??[])N(se);if(E)N(ce.resolve(E,"resources/views/components")),N(ce.resolve(E,"resources/components")),N(ce.resolve(E,"src/components")),N(ce.resolve(E,"components"));for(let se of a._layerComponentDirs??[])N(se);let D=a._pluginComponentDirs;if(Array.isArray(D))for(let se of D)N(typeof se==="string"?se:null);if(N(a.fallbackComponentsDir),P)for(let se of a._targetComponentDirs??[])N(se);let X=a._nativePrimitivesFallback;if(X&&!X.except.some((se)=>se.toLowerCase()===l.toLowerCase()))N(X.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let F=ho(ce.resolve(import.meta.dir,"components")),L=M.map((se)=>ce.isAbsolute(se)?se:ce.resolve(R,se)),Q=`${v.join("\x00")}\x00\x00${L.join("\x00")}`,te=Ys.get(Q);if(te!==void 0)return te;let ae=!1;e:for(let se of L){if(ho(se)===F)continue;for(let ue of v)if(await r(ce.join(se,ue))){ae=!0;break e}}return Ys.set(Q,ae),ae}function ho(e){let n=Qs.get(e);if(n!==void 0)return n;let t=e;try{t=Xn.realpathSync(e)}catch{}return Qs.set(e,t),t}function dg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Kc(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function jl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=T(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var xo=new Set;function bo(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&xo.has(a))return;xo.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
289
289
  searched:
290
290
  ${t.map((v)=>` - ${v}`).join(`
291
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Nl=new Set(["for","if","show","key","ref","class","className","style"]),_o=new Set,Eo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Xc=new RegExp(`\\b(?:${Eo})\\s*(?:<[^>]*>)?\\s*\\(`);function hi(e){let n=new Set,t=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|${Eo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-zsjw2jgy.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&dg(D)?D:"";try{let F=(ne)=>ne.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let ne=[L,L.toLowerCase(),F(L),H(L)];for(let le of ne)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let ne=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(ne)],ye=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),ye){let be=ce.join(ce.dirname(ye),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&vo(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ot=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),ct=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),ss=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),rs=!ct.includes("valuechange")&&(yt||ct.includes("change")&&!ss),gt=c._nativeHostAttrs&&/^textinput$/i.test(L),_t=ct.includes("update:value")&&!ct.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(L),is=c._nativeHostAttrs&&/^image$/i.test(L),_n=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),wt=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),Sn=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),$n=qt&&wt&&!Sn&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),En=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),Xt=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ot||rs)&&(!gt||_t)&&(!qt||$n)&&(!is||_n)&&!En;for(let be of Xt?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let St=typeof c.root==="string"?ce.resolve(c.root):void 0,Bo=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 be of $t)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Xt){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(kn.dir))he.push(kn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(Bo,be)}))];he.length=0,he.push(...cr);let os=`${L}\x00${l}\x00${cr.join("\x00")}`,as=Zn.get(os);if(as)if(await r(as))Q=as;else Zn.delete(os);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Rn of le){let Cn=ce.join(be,Rn);if(ae.push(Cn),await r(Cn)){Q=Cn;break}}if(Q)break;if(!Q)try{let Rn=await import("fs");if(!Rn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let zo=8,cs=[{path:be,depth:0}];while(cs.length>0&&!Q){let Tn=cs.pop();if(Tn.depth>=zo)continue;let lr;try{lr=Rn.readdirSync(Tn.path,{withFileTypes:!0})}catch{continue}for(let An of lr){if(!An.isDirectory())continue;if(An.name==="node_modules"||An.name.startsWith("."))continue;let ur=ce.join(Tn.path,An.name);for(let Wo of le){let ls=ce.join(ur,Wo);if(ae.push(ls),await r(ls)){Q=ls;break}}if(Q)break;cs.push({path:ur,depth:Tn.depth+1})}}}catch{}if(Q)break}if(Q)Zn.set(os,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let se;if(sn.has(Q)&&Js.get(Q)===po(Q))se=sn.get(Q);else try{let ne=po(Q);se=await Bun.file(Q).text(),sn.set(Q,se),Js.set(Q,ne)}catch(ne){let le=ne instanceof Error?ne.message:String(ne);return bo(e,l,[Q],le),yo(e)}if(R)for(let ne of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=ne.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let ye=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ye}\\b`).test(se))R.declaredProps.add(ne);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ye}\\b|\\[\\s*['"]${ye}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ye}['"]`).test(se))R.consumedProps?.add(ne)}if(R?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let ne of R.reactiveProps){if(Nl.has(ne)||R.consumedProps?.has(ne))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let le=`${Q}\x00${ne}`;if(_o.has(le))continue;_o.add(le),console.warn(`[stx] ${ce.basename(Q)} reads \`${ne}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${ne}): 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('${ne}').`)}let ue=new Set(["__originalFilePath","__importedComponents",jn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ne,le]of Object.entries(a))if(!ne.startsWith("__")||ue.has(ne))Ee[ne]=le;let Te=E.length>0?{[Fn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:ne}=await o("stx/includes",()=>import("./chunk-vaqqch06.js"));Ae=await ne(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ne}=await o("stx/component-renderer",()=>import("./chunk-0ppx28f6.js")),le={...a,__processedComponents:j,...Te};Ae=await ne(Ae,le,l,c,v);let ye=le.__stx_preserved_client_expressions;if(Array.isArray(ye)&&ye.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ye])]}let ke=[];if(Kc(Ae)){let{processExpressions:ne}=await o("stx/expressions",()=>import("./chunk-1aent61q.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=ne(Ae,le,l);for(let ye of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(ye[1].trim())}let Je=G(Ae),ut=[],Tt=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ne,le)=>{let ye=Je.scripts[Number(le)]||"",he=ye.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ot)return ut.push(ye),"";return ye}),{extractSlotContent:Gn}=await o("stx/slots",()=>import("./chunk-8698v9gf.js")),ft=Gn(Tt),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[ne,le]of ft.namedSlots)dt[ne]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Lt=$o(e,process.cwd()),st=`stx_${(Lt.endsWith(".stx")?Lt.slice(0,-4):Lt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:st,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Tt,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(se)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Ml(se,Ue);let Bt=se,on=de(Bt);if(on)Bt=on.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,zt=[...se.matchAll(Yn)];for(let[,ne,le]of zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ne))Oe(le,Q,c.strict);let qe=[],Wt=null,Qn=zt.some((ne)=>/\bserver\b/.test(ne[1]||"")&&/\bcache\b/.test(ne[1]||"")),bt=null,Qe=null,Ft=null,an=0,Vt=null;if(Rl(c),Qn&&er>0){let ne=Cl({props:n,slot:Ae,slotContext:t.trim()?Tl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:st});if(ne!==null){bt=`${Q}\x00${x(se)}\x00${ne}`;let le=qn.get(bt);if(le){for(let ye of le.dependencies)v.add(ye);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let ye=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)ye.add(he);a.__stx_preserved_client_expressions=[...ye]}return le.output}Qe=new Set(v),Ft=Gr(a),an=pt.n,Vt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ut=new Set;for(let ne of zt){let le=ne[1]||"",ye=ne[2]||"",he=le.includes("server");if(je(le)&&ye.trim())ye=Be(ye);if(he&&ye){for(let Ce of Me(ye))Ut.add(Ce);try{await N(ye,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Wt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=ye.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ot=Ce.includes("{{")&&Ce.includes("}}"),ct=Ce.includes("{!!")&&Ce.includes("!!}");if(ot||ct)Ce=bi(Ce,Ue,Q);let yt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${yt}>${Ce}</script>`)}}let Xe=G(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ht=Xe?Xe[1]:"",es=Xe?Xe[2]:"",et="",ee=Ht&&/\bscoped\b/i.test(Ht);if(Xe)et=`<style${Ht}>${jl(es,Ue,Q)}</style>`;let re=Bt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ne=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(ne,(ye,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)et=`${et}${le.join(`
292
- `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-8698v9gf.js")),{defaultSlot:we,namedSlots:Re}=ft,Ke=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Tt),tt=c._nativeHostAttrs===!0&&qe.length>0||Ke&&qe.length>0||qe.some((ne)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ne)),ts=(ne)=>tt?Vi(ne,st):ne,ns=new Map([...Re].map(([ne,le])=>[ne,{...le,content:ts(le.content)}]));re=await me(re,ts(we),ns,Ue,tt?st:"");let cn=hi(qe),Kt=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ne)=>!Ut.has(ne));if(cn.length>0||Kt.length>0)Ue.__stx_client_signal_names=[...new Set([...Kt,...cn])];else delete Ue.__stx_client_signal_names;let Zt=E.filter((ne)=>!Ut.has(ne)&&!(ne in n));if(Zt.length>0)Ue[Fn]=Zt;let ln={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||qe.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:un}=await o("stx/process",()=>import("./chunk-nptp3x62.js")),Ge=await un(re,Ue,Q,ln,v),it=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ne of Ge.matchAll(/\{\{([\s\S]*?)\}\}/g))it.add(ne[1].trim());if(it.size>0)a.__stx_preserved_client_expressions=[...it];let nt=st,Ze=Ge;if(tt){let ne="";if(Object.keys(n).length>0)try{ne=` data-stx-props="${Zs(JSON.stringify(n))}"`}catch{}let le=X?` stx-hydrate="${Zs(X)}"`:"",ye=Object.fromEntries(Object.entries(dt).map(([gt,_t])=>[gt,Boolean(_t)])),he=Object.keys(ye).length>0?` data-stx-slots="${Zs(JSON.stringify(ye))}"`:"",He=` data-stx-scope="${nt}"${ne}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ge),ot=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ge),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ge),yt=Ce?"span":"div",ss=ot&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':ct&&c._nativeHostAttrs?' style="width:100%;height:100%"':Ce||ot?' style="display:contents"':"";Ze=ug(Ge,He)??`<${yt}${He} data-stx-component-wrapper${ss}>${Ge}</${yt}>`;let rs=await Promise.all(qe.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,qt,is]=_t,_n=fo(gt,Ue,Q);if(_n!==null)return _n;let wt=await Bl(is,Q,c.buildMode==="compile"),Sn=yn(wt.clientCode,De(Ue)),{vendorStyleTags:$n}=wt,mt=Sn?`function(__scopeId) {
291
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Nl=new Set(["for","if","show","key","ref","class","className","style"]),_o=new Set,Eo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Xc=new RegExp(`\\b(?:${Eo})\\s*(?:<[^>]*>)?\\s*\\(`);function hi(e){let n=new Set,t=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|${Eo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-k2brrhf8.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&dg(D)?D:"";try{let F=(ne)=>ne.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let ne=[L,L.toLowerCase(),F(L),H(L)];for(let le of ne)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let ne=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(ne)],ye=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),ye){let be=ce.join(ce.dirname(ye),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&vo(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ot=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),ct=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),ss=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),rs=!ct.includes("valuechange")&&(yt||ct.includes("change")&&!ss),gt=c._nativeHostAttrs&&/^textinput$/i.test(L),_t=ct.includes("update:value")&&!ct.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(L),is=c._nativeHostAttrs&&/^image$/i.test(L),_n=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),wt=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),Sn=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),$n=qt&&wt&&!Sn&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),En=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),Xt=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ot||rs)&&(!gt||_t)&&(!qt||$n)&&(!is||_n)&&!En;for(let be of Xt?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let St=typeof c.root==="string"?ce.resolve(c.root):void 0,Bo=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 be of $t)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Xt){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(kn.dir))he.push(kn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(Bo,be)}))];he.length=0,he.push(...cr);let os=`${L}\x00${l}\x00${cr.join("\x00")}`,as=Zn.get(os);if(as)if(await r(as))Q=as;else Zn.delete(os);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Rn of le){let Cn=ce.join(be,Rn);if(ae.push(Cn),await r(Cn)){Q=Cn;break}}if(Q)break;if(!Q)try{let Rn=await import("fs");if(!Rn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let zo=8,cs=[{path:be,depth:0}];while(cs.length>0&&!Q){let Tn=cs.pop();if(Tn.depth>=zo)continue;let lr;try{lr=Rn.readdirSync(Tn.path,{withFileTypes:!0})}catch{continue}for(let An of lr){if(!An.isDirectory())continue;if(An.name==="node_modules"||An.name.startsWith("."))continue;let ur=ce.join(Tn.path,An.name);for(let Wo of le){let ls=ce.join(ur,Wo);if(ae.push(ls),await r(ls)){Q=ls;break}}if(Q)break;cs.push({path:ur,depth:Tn.depth+1})}}}catch{}if(Q)break}if(Q)Zn.set(os,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let se;if(sn.has(Q)&&Js.get(Q)===po(Q))se=sn.get(Q);else try{let ne=po(Q);se=await Bun.file(Q).text(),sn.set(Q,se),Js.set(Q,ne)}catch(ne){let le=ne instanceof Error?ne.message:String(ne);return bo(e,l,[Q],le),yo(e)}if(R)for(let ne of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=ne.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let ye=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ye}\\b`).test(se))R.declaredProps.add(ne);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ye}\\b|\\[\\s*['"]${ye}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ye}['"]`).test(se))R.consumedProps?.add(ne)}if(R?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let ne of R.reactiveProps){if(Nl.has(ne)||R.consumedProps?.has(ne))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let le=`${Q}\x00${ne}`;if(_o.has(le))continue;_o.add(le),console.warn(`[stx] ${ce.basename(Q)} reads \`${ne}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${ne}): 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('${ne}').`)}let ue=new Set(["__originalFilePath","__importedComponents",jn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ne,le]of Object.entries(a))if(!ne.startsWith("__")||ue.has(ne))Ee[ne]=le;let Te=E.length>0?{[Fn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:ne}=await o("stx/includes",()=>import("./chunk-9xdz8r73.js"));Ae=await ne(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ne}=await o("stx/component-renderer",()=>import("./chunk-90pxjq62.js")),le={...a,__processedComponents:j,...Te};Ae=await ne(Ae,le,l,c,v);let ye=le.__stx_preserved_client_expressions;if(Array.isArray(ye)&&ye.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ye])]}let ke=[];if(Kc(Ae)){let{processExpressions:ne}=await o("stx/expressions",()=>import("./chunk-hv0whj8t.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=ne(Ae,le,l);for(let ye of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(ye[1].trim())}let Je=G(Ae),ut=[],Tt=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ne,le)=>{let ye=Je.scripts[Number(le)]||"",he=ye.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ot)return ut.push(ye),"";return ye}),{extractSlotContent:Gn}=await o("stx/slots",()=>import("./chunk-h5nrnen8.js")),ft=Gn(Tt),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[ne,le]of ft.namedSlots)dt[ne]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Lt=$o(e,process.cwd()),st=`stx_${(Lt.endsWith(".stx")?Lt.slice(0,-4):Lt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:st,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Tt,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(se)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Ml(se,Ue);let Bt=se,on=de(Bt);if(on)Bt=on.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,zt=[...se.matchAll(Yn)];for(let[,ne,le]of zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ne))Oe(le,Q,c.strict);let qe=[],Wt=null,Qn=zt.some((ne)=>/\bserver\b/.test(ne[1]||"")&&/\bcache\b/.test(ne[1]||"")),bt=null,Qe=null,Ft=null,an=0,Vt=null;if(Rl(c),Qn&&er>0){let ne=Cl({props:n,slot:Ae,slotContext:t.trim()?Tl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:st});if(ne!==null){bt=`${Q}\x00${x(se)}\x00${ne}`;let le=qn.get(bt);if(le){for(let ye of le.dependencies)v.add(ye);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let ye=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)ye.add(he);a.__stx_preserved_client_expressions=[...ye]}return le.output}Qe=new Set(v),Ft=Gr(a),an=pt.n,Vt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ut=new Set;for(let ne of zt){let le=ne[1]||"",ye=ne[2]||"",he=le.includes("server");if(je(le)&&ye.trim())ye=Be(ye);if(he&&ye){for(let Ce of Me(ye))Ut.add(Ce);try{await N(ye,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Wt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=ye.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ot=Ce.includes("{{")&&Ce.includes("}}"),ct=Ce.includes("{!!")&&Ce.includes("!!}");if(ot||ct)Ce=bi(Ce,Ue,Q);let yt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${yt}>${Ce}</script>`)}}let Xe=G(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ht=Xe?Xe[1]:"",es=Xe?Xe[2]:"",et="",ee=Ht&&/\bscoped\b/i.test(Ht);if(Xe)et=`<style${Ht}>${jl(es,Ue,Q)}</style>`;let re=Bt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ne=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(ne,(ye,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)et=`${et}${le.join(`
292
+ `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-h5nrnen8.js")),{defaultSlot:we,namedSlots:Re}=ft,Ke=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Tt),tt=c._nativeHostAttrs===!0&&qe.length>0||Ke&&qe.length>0||qe.some((ne)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ne)),ts=(ne)=>tt?Vi(ne,st):ne,ns=new Map([...Re].map(([ne,le])=>[ne,{...le,content:ts(le.content)}]));re=await me(re,ts(we),ns,Ue,tt?st:"");let cn=hi(qe),Kt=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ne)=>!Ut.has(ne));if(cn.length>0||Kt.length>0)Ue.__stx_client_signal_names=[...new Set([...Kt,...cn])];else delete Ue.__stx_client_signal_names;let Zt=E.filter((ne)=>!Ut.has(ne)&&!(ne in n));if(Zt.length>0)Ue[Fn]=Zt;let ln={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||qe.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:un}=await o("stx/process",()=>import("./chunk-1ds97d9m.js")),Ge=await un(re,Ue,Q,ln,v),it=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ne of Ge.matchAll(/\{\{([\s\S]*?)\}\}/g))it.add(ne[1].trim());if(it.size>0)a.__stx_preserved_client_expressions=[...it];let nt=st,Ze=Ge;if(tt){let ne="";if(Object.keys(n).length>0)try{ne=` data-stx-props="${Zs(JSON.stringify(n))}"`}catch{}let le=X?` stx-hydrate="${Zs(X)}"`:"",ye=Object.fromEntries(Object.entries(dt).map(([gt,_t])=>[gt,Boolean(_t)])),he=Object.keys(ye).length>0?` data-stx-slots="${Zs(JSON.stringify(ye))}"`:"",He=` data-stx-scope="${nt}"${ne}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ge),ot=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ge),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ge),yt=Ce?"span":"div",ss=ot&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':ct&&c._nativeHostAttrs?' style="width:100%;height:100%"':Ce||ot?' style="display:contents"':"";Ze=ug(Ge,He)??`<${yt}${He} data-stx-component-wrapper${ss}>${Ge}</${yt}>`;let rs=await Promise.all(qe.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,qt,is]=_t,_n=fo(gt,Ue,Q);if(_n!==null)return _n;let wt=await Bl(is,Q,c.buildMode==="compile"),Sn=yn(wt.clientCode,De(Ue)),{vendorStyleTags:$n}=wt,mt=Sn?`function(__scopeId) {
293
293
  ${Sn}
294
294
  return (${wt.factoryBody})(__scopeId);
295
295
  }`:wt.factoryBody,En=X?null:_s(a,mt),Xt=En?`window.__stxComponentFactories[${JSON.stringify(En)}](${JSON.stringify(nt)});`:`(${mt})(${JSON.stringify(nt)});`;if(X)return`${$n}<script type="stx/island" data-stx-island="${nt}" data-stx-scoped data-stx-owner="${nt}"${qt}>${Xt}</script>`;return`${$n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${nt}"${qt}>${Xt}</script>`}));if(Ze=Ze+`
@@ -315,7 +315,7 @@ ${$e.yellow}${$e.bold}Message:${$e.reset} ${n}
315
315
  `,y)R+=`
316
316
  ${$e.blue}${$e.bold}Context:${$e.reset}
317
317
  ${$e.dim}${y}${$e.reset}
318
- `;return R}function fe(){sn.clear(),Js.clear(),Zn.clear(),Ys.clear(),Qs.clear(),qn.clear()}function qh(){return{size:sn.size,maxSize:500}}var qs=b(128);async function Bl(e,n,t){let i=x(e,n,t),a=qs.get(i);if(a){if(Ms(a.deps))return a;qs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-ncxed9r1.js")),R=[],M=!1;if(v(c)){let L=c;c=await E(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:R}),M=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-4gx5ze56.js"));c=N(c);let j=A(c),P=Il(j),D=new Set(z(j,!0).split(",").map((L)=>L.trim())),X=`function(__scopeId) {
318
+ `;return R}function fe(){sn.clear(),Js.clear(),Zn.clear(),Ys.clear(),Qs.clear(),qn.clear()}function qh(){return{size:sn.size,maxSize:500}}var qs=b(128);async function Bl(e,n,t){let i=x(e,n,t),a=qs.get(i);if(a){if(Ms(a.deps))return a;qs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-zssf9fdg.js")),R=[],M=!1;if(v(c)){let L=c;c=await E(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:R}),M=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-9s4ggstz.js"));c=N(c);let j=A(c),P=Il(j),D=new Set(z(j,!0).split(",").map((L)=>L.trim())),X=`function(__scopeId) {
319
319
  ${at("const",[...cl,...P],j)}
320
320
  const __scope = window.stx._scopes = window.stx._scopes || {};
321
321
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{_l,Cl}from"./chunk-8ztgy5y4.js";import"./chunk-1y9ez7nz.js";import"./chunk-hh9t97hr.js";import"./chunk-t3ptzpfc.js";import"./chunk-vav9ktgm.js";import"./chunk-b4r7d6me.js";import"./chunk-h0c6jtrj.js";import"./chunk-pvw58x2j.js";import"./chunk-j56mg28d.js";import"./chunk-w6taxq7d.js";import"./chunk-5j619xgb.js";import"./chunk-v8rfeev5.js";import"./chunk-vrbcdds3.js";import"./chunk-7sartb04.js";import"./chunk-0r61tkfe.js";import"./chunk-vkn133cs.js";import"./chunk-2p4yad7w.js";import"./chunk-rrb9m2q2.js";import"./chunk-6v4b0xc1.js";import"./chunk-pa9zfbh6.js";import"./chunk-1stvxcjv.js";import"./chunk-15ckxpq7.js";import"./chunk-agtvdtx4.js";import"./chunk-tnn0br4w.js";import"./chunk-gv3bfkdm.js";import"./chunk-tnkxww7b.js";import"./chunk-7fr038wx.js";import"./chunk-rgz797k3.js";import"./chunk-nwbq8qvb.js";import"./chunk-efrc97by.js";import"./chunk-c0ejyxfj.js";import"./chunk-d18xd9x5.js";import{Qt}from"./chunk-5gppagt3.js";import"./chunk-j6255z7f.js";import"./chunk-d6arvs57.js";import"./chunk-7sh9fa3q.js";import{Re,i}from"./chunk-2m5h2mtr.js";import"./chunk-66b56g2z.js";import"./chunk-ne69yaak.js";import"./chunk-2gqhfge6.js";import"./chunk-e0wxcst7.js";import"./chunk-g747k4gg.js";import"./chunk-ssh2gycr.js";import"./chunk-qv85c3qy.js";import"./chunk-y0pqpch2.js";import{we}from"./chunk-nps2whkz.js";import"./chunk-w5hhqjwr.js";import{lr,ur}from"./chunk-bwfncfe1.js";import{vs,j,a}from"./chunk-enep9r03.js";import"./chunk-wk6xsyv3.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import{m,Le}from"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";import"./chunk-5a92srn2.js";import"./chunk-e3wmnjz8.js";export{vs as buildWebComponents,ur as cacheTemplate,lr as checkCache,Qt as classifyAllScripts,_l as createMiddleware,Cl as createRoute,j as defaultConfig,m as extractVariables,we as injectRouterScript,a as loadStxConfig,Le as processClientScript,i as processDirectives,Re as readMarkdownFile};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{V}from"./chunk-epcy3r18.js";function n(t){return V(t)}
3
+ export{n};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ml,sa,Gg,Dl,Ll,Jg,Yg}from"./chunk-pvw58x2j.js";import"./chunk-rgz797k3.js";import"./chunk-j6255z7f.js";import"./chunk-d6arvs57.js";import"./chunk-7sh9fa3q.js";import"./chunk-y0pqpch2.js";import"./chunk-nps2whkz.js";import"./chunk-w5hhqjwr.js";import"./chunk-enep9r03.js";import"./chunk-wk6xsyv3.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import{It,Gf}from"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Ml as buildVirtualSource,It as extractScriptBlocks,Gf as extractTemplateExpressions,Dl as findRuntimeTypeDeclarations,Ll as findStxModuleDeclarations,Yg as formatTypecheckDiagnostics,Gg as sourcePathFor,Jg as typecheckStxFiles,sa as virtualPathFor};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{on,$o,Ro,Ao,xh,Po}from"./chunk-g7anxh36.js";import"./chunk-605b93pe.js";import"./chunk-q14d714d.js";import"./chunk-27rzdq3n.js";export{Ro as buildServerApi,xh as createServerApi,on as discoverServerApi,$o as generateApiTypes,Po as isServerApiSource,Ao as productionApiDispatcher};
2
+ import{on,$o,Ro,Ao,xh,Po}from"./chunk-d6arvs57.js";import"./chunk-605b93pe.js";import"./chunk-q14d714d.js";import"./chunk-27rzdq3n.js";export{Ro as buildServerApi,xh as createServerApi,on as discoverServerApi,$o as generateApiTypes,Po as isServerApiSource,Ao as productionApiDispatcher};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Fl,dm,zl,Hl,pm,fm}from"./chunk-bxxgr5c5.js";import"./chunk-4cffjp4f.js";import"./chunk-syheccfj.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{fm as applySlots,pm as extractSlotContent,dm as parseSlotElement,Fl as parseSlots,Hl as processSlots,zl as renderSlot};
2
+ import{Fl,dm,zl,Hl,pm,fm}from"./chunk-7sartb04.js";import"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{fm as applySlots,pm as extractSlotContent,dm as parseSlotElement,Fl as parseSlots,Hl as processSlots,zl as renderSlot};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zg}from"./chunk-j56mg28d.js";import"./chunk-w6taxq7d.js";import"./chunk-nwbq8qvb.js";import"./chunk-5gppagt3.js";import"./chunk-d6arvs57.js";import"./chunk-2m5h2mtr.js";import"./chunk-66b56g2z.js";import"./chunk-ne69yaak.js";import"./chunk-2gqhfge6.js";import"./chunk-e0wxcst7.js";import"./chunk-g747k4gg.js";import"./chunk-ssh2gycr.js";import"./chunk-qv85c3qy.js";import"./chunk-y0pqpch2.js";import"./chunk-nps2whkz.js";import"./chunk-w5hhqjwr.js";import"./chunk-bwfncfe1.js";import"./chunk-enep9r03.js";import"./chunk-wk6xsyv3.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Zg as buildForProduction};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_}from"./chunk-4cffjp4f.js";import{i}from"./chunk-g89fx9rq.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{_}from"./chunk-epcy3r18.js";import{i}from"./chunk-2m5h2mtr.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ve,Hs,pg,Kh,fg,Xh,Dt,p,V,Z,wn,Se,gg,bi,mg,Gh,_,hg,Jh,T,Yh}from"./chunk-4cffjp4f.js";import"./chunk-syheccfj.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{hg as applyFilters,Xh as clearCustomFilters,gg as clientLoopScopes,Hs as defaultFilters,wn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,T as evaluateExpression,ve as findMustacheEnd,fg as getAllFilters,mg as interpolateScriptAttributes,bi as interpolateScriptExpressions,Gh as interpolateScriptsInTemplate,_ as processExpressions,pg as registerFilter,Kh as registerFilters,Dt as replaceInterpolations,Jh as resetRejectedExpressionWarnings,Yh as unescapeHtml,Se as usesSignalsInScript};
2
+ import{ve,Hs,pg,Kh,fg,Xh,Dt,p,V,Z,wn,Se,gg,bi,mg,Gh,_,hg,Jh,T,Yh}from"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{hg as applyFilters,Xh as clearCustomFilters,gg as clientLoopScopes,Hs as defaultFilters,wn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,T as evaluateExpression,ve as findMustacheEnd,fg as getAllFilters,mg as interpolateScriptAttributes,bi as interpolateScriptExpressions,Gh as interpolateScriptsInTemplate,_ as processExpressions,pg as registerFilter,Kh as registerFilters,Dt as replaceInterpolations,Jh as resetRejectedExpressionWarnings,Yh as unescapeHtml,Se as usesSignalsInScript};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{tt}from"./chunk-q14d714d.js";import{ht,Hn}from"./chunk-a1ynjj47.js";import{Me,gn,Jc,Yc}from"./chunk-4cffjp4f.js";import{$r,Rr,Ar,Ir,_e}from"./chunk-94gyfwpz.js";import{O}from"./chunk-27rzdq3n.js";import{wi}from"./chunk-syheccfj.js";import{y}from"./chunk-bb2zfgwf.js";import{i}from"./chunk-g89fx9rq.js";import{j,a}from"./chunk-j4s5k8sp.js";import{vc}from"./chunk-605b93pe.js";import{Pn,We,Ee,aa,ca,In}from"./chunk-2hwwmn7c.js";import{on,Ro}from"./chunk-g7anxh36.js";import{On}from"./chunk-985afhhy.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{X}from"./chunk-6jx0trea.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);Jc();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={...j,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Pn(b)+We(b),P=Yc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:P,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 Zg(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:Ir,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)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.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=[],k=[];for(let s of B){let f=T(s.pattern),H=f.rendering==="prerender";if(H&&(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=Ar(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=$r(t.html,u);if(g.htmlAttrs)t.html=Rr(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),H){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),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:H}),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 E=c.resolve(o,d);if(m.existsSync(E)){let{copied:s,bytes:f}=Z(E,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 F=Zn(o);if(F){let{copied:s,bytes:f}=Z(F,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 N={runtime:v.filename,router:x.filename},C=aa(k,N,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await Ro(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await wi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(vc(e._layerGraph),null,2));ca(C,r);let K=Date.now()-l;return console.log(`
2
+ import{tt}from"./chunk-q14d714d.js";import{ht,Hn}from"./chunk-nwbq8qvb.js";import{Me,gn,Jc,Yc}from"./chunk-epcy3r18.js";import{$r,Rr,Ar,Ir,_e}from"./chunk-94gyfwpz.js";import{O}from"./chunk-27rzdq3n.js";import{wi}from"./chunk-8e23zh2y.js";import{y}from"./chunk-66b56g2z.js";import{i}from"./chunk-2m5h2mtr.js";import{j,a}from"./chunk-enep9r03.js";import{vc}from"./chunk-605b93pe.js";import{Pn,We,Ee,aa,ca,In}from"./chunk-w6taxq7d.js";import{on,Ro}from"./chunk-d6arvs57.js";import{On}from"./chunk-985afhhy.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{X}from"./chunk-nps2whkz.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);Jc();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={...j,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Pn(b)+We(b),P=Yc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:P,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 Zg(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:Ir,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)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.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=[],k=[];for(let s of B){let f=T(s.pattern),H=f.rendering==="prerender";if(H&&(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=Ar(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=$r(t.html,u);if(g.htmlAttrs)t.html=Rr(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),H){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),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:H}),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 E=c.resolve(o,d);if(m.existsSync(E)){let{copied:s,bytes:f}=Z(E,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 F=Zn(o);if(F){let{copied:s,bytes:f}=Z(F,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 N={runtime:v.filename,router:x.filename},C=aa(k,N,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await Ro(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await wi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(vc(e._layerGraph),null,2));ca(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:N,outputDir:r,duration:K}}
4
4
  export{Zg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{er,$e}from"./chunk-7sh9fa3q.js";import{z,b,br,Ms,C}from"./chunk-4cffjp4f.js";import{a,P}from"./chunk-j4s5k8sp.js";import{Po}from"./chunk-g7anxh36.js";import{nt}from"./chunk-5emrarpf.js";import{l}from"./chunk-jdj1358b.js";import{s,ge}from"./chunk-14ft0zc7.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Po(t,e,n)}var at=2;function wf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((c,d)=>d.length-c.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),c=t.startsWith(`${i}${p.sep}`);return{path:c?p.relative(i,t):t,...c?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let c=B.statSync(i);if(c.size!==n.size)return!1;if(c.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function vf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=vf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,w)=>w.at-o.at);for(let o of d.slice(i)){let w=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${w}.js`),{force:!0}),await B.promises.rm(p.join(t,`${w}.deps.json`),{force:!0})}k("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function xf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function k(...t){if(xf())console.log("[stx:bundler]",...t)}var K=[];function Za(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function wh(t){Q=t}function Qa(){if(Q)return Q;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let c=n[1];if(!Y.some((o)=>o.test(c)))return k("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let c=n[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!Y.some((o)=>o.test(c)))return k("detected side-effect import:",c),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Sf(t,e){return p.relative(t,e).split(p.sep).join("/")}function kf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,c,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${c}${o}${c}`:n})}function _f(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,w=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(d,o)=>{for(let w of d.split(",")){let I=w.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,w)=>{let I=w.slice(Qn.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function rs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,c]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${c}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return G.getStore()?.key??""}function ut(t,e,n,i,c,d,o=new Map,w,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,r,u)=>{if(X(r,t,w))return null;if(!d||!f(j)||!Bt.test(r))return null;try{if(!B.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${Qn}${Sf(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(j,r)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,r);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=it(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(r)=>{let u=p.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return k(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${Qn}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,t,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=p.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(r.path,"utf8"),loader:E}})}}}var q=new Map,V=b(64),ot=Symbol.for("stx.client-bundle-build-queue");function Cf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),c=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||wf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=V.get(v);if(y){if(Ms(y.files)&&y.files.every((h)=>!X(h.path,i,c))){k("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}V.delete(v),k("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(j),D=!1,N=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===at&&Array.isArray(O.files)&&St(O.files,i))N=br(O.files.map((g)=>ct(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(k("cache hit:",f),N)Z(e,N.map((T)=>T.path)),n.collectInputs?.push(...N.map((T)=>T.path));let O=await r.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}k("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return h}let E=Cf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function ec(t){return`${t}-${process.pid}-${yt()}`}async function vh(t,e){let{projectRoot:n}=e,i=ec(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),c=p.join(l(n,"bundle-tmp"),"out",i);B.mkdirSync(c,{recursive:!0});let d=new Map,o=new Map,w=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${w++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let r=o.get(j.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:c,cacheDir:d,hash:o,cachePath:w,depsPath:I,externalizeUserModules:M}=n,S=l(i,"bundle-tmp"),f=ec(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=s(t),{depths:D,balanced:N}=ge(h),O=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(h))!==null){if(!O(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let U=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(U)r.add(U)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let pt=r.size>0?`
2
+ import{er,$e}from"./chunk-7sh9fa3q.js";import{z,b,br,Ms,C}from"./chunk-epcy3r18.js";import{a,P}from"./chunk-enep9r03.js";import{Po}from"./chunk-d6arvs57.js";import{nt}from"./chunk-5emrarpf.js";import{l}from"./chunk-jdj1358b.js";import{s,ge}from"./chunk-14ft0zc7.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Po(t,e,n)}var at=2;function wf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((c,d)=>d.length-c.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),c=t.startsWith(`${i}${p.sep}`);return{path:c?p.relative(i,t):t,...c?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let c=B.statSync(i);if(c.size!==n.size)return!1;if(c.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function vf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=vf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,w)=>w.at-o.at);for(let o of d.slice(i)){let w=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${w}.js`),{force:!0}),await B.promises.rm(p.join(t,`${w}.deps.json`),{force:!0})}k("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function xf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function k(...t){if(xf())console.log("[stx:bundler]",...t)}var K=[];function Za(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function wh(t){Q=t}function Qa(){if(Q)return Q;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let c=n[1];if(!Y.some((o)=>o.test(c)))return k("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let c=n[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!Y.some((o)=>o.test(c)))return k("detected side-effect import:",c),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Sf(t,e){return p.relative(t,e).split(p.sep).join("/")}function kf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,c,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${c}${o}${c}`:n})}function _f(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,w=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(d,o)=>{for(let w of d.split(",")){let I=w.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,w)=>{let I=w.slice(Qn.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function rs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,c]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${c}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return G.getStore()?.key??""}function ut(t,e,n,i,c,d,o=new Map,w,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,r,u)=>{if(X(r,t,w))return null;if(!d||!f(j)||!Bt.test(r))return null;try{if(!B.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${Qn}${Sf(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(j,r)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,r);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=it(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(r)=>{let u=p.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return k(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${Qn}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,t,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=p.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(r.path,"utf8"),loader:E}})}}}var q=new Map,V=b(64),ot=Symbol.for("stx.client-bundle-build-queue");function Cf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),c=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||wf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=V.get(v);if(y){if(Ms(y.files)&&y.files.every((h)=>!X(h.path,i,c))){k("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}V.delete(v),k("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(j),D=!1,N=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===at&&Array.isArray(O.files)&&St(O.files,i))N=br(O.files.map((g)=>ct(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(k("cache hit:",f),N)Z(e,N.map((T)=>T.path)),n.collectInputs?.push(...N.map((T)=>T.path));let O=await r.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}k("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return h}let E=Cf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function ec(t){return`${t}-${process.pid}-${yt()}`}async function vh(t,e){let{projectRoot:n}=e,i=ec(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),c=p.join(l(n,"bundle-tmp"),"out",i);B.mkdirSync(c,{recursive:!0});let d=new Map,o=new Map,w=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${w++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let r=o.get(j.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:c,cacheDir:d,hash:o,cachePath:w,depsPath:I,externalizeUserModules:M}=n,S=l(i,"bundle-tmp"),f=ec(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=s(t),{depths:D,balanced:N}=ge(h),O=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(h))!==null){if(!O(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let U=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(U)r.add(U)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let pt=r.size>0?`
3
3
  export { ${[...r].join(", ")} }`:"";k("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ")||`Unable to bundle ${p.basename(e)}`,L=er(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),Za(e||"",F,L),n.throwOnFailure||Qa()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let L=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(L){_.push([L[2],L[1]]);continue}let A=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(A))_.push([A,A])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let U=[];m=_f(kf(m,et),U);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(z(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
4
4
  `),ht=_.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
5
5
  `);if(m=`${dt.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{hn,Jf,Yf,Zf,Qf,eg,m,tg,pi,ng,Vc,Uc}from"./chunk-4cffjp4f.js";import"./chunk-syheccfj.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{hn as STX_ENGINE_BINDING_NAMES,pi as convertToCommonJS,Vc as extractScriptFromTemplate,m as extractVariables,Uc as hasVariables,tg as isCompleteImport,eg as isMissingBindingFailure,Zf as isModuleResolutionFailure,Qf as isSyntaxFailure,ng as splitDeclaration,Jf as stripTypeScript,Yf as withoutStxReferrer};
2
+ import{hn,Jf,Yf,Zf,Qf,eg,m,tg,pi,ng,Vc,Uc}from"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{hn as STX_ENGINE_BINDING_NAMES,pi as convertToCommonJS,Vc as extractScriptFromTemplate,m as extractVariables,Uc as hasVariables,tg as isCompleteImport,eg as isMissingBindingFailure,Zf as isModuleResolutionFailure,Qf as isSyntaxFailure,ng as splitDeclaration,Jf as stripTypeScript,Yf as withoutStxReferrer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Mf,Ph,Ih,Oh,Nh,Df,Lf,Mh,Dh,qo,Lh,lr,ur,bs}from"./chunk-276e3d0g.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-4cffjp4f.js";import"./chunk-syheccfj.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Nh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,Lh as clearDevCaches,Lf as getCachedRouterScript,Df as getCachedSignalsRuntime,Mh as getServeClientAsset,qo as getServeModuleBundle,bs as hashFilePath,Ih as invalidateFileCache,Oh as invalidateFileCacheByDir,Ph as readFileCached,Dh as registerServeModuleBundle,Mf as templateCache};
2
+ import{Mf,Ph,Ih,Oh,Nh,Df,Lf,Mh,Dh,qo,Lh,lr,ur,bs}from"./chunk-bwfncfe1.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Nh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,Lh as clearDevCaches,Lf as getCachedRouterScript,Df as getCachedSignalsRuntime,Mh as getServeClientAsset,qo as getServeModuleBundle,bs as hashFilePath,Ih as invalidateFileCache,Oh as invalidateFileCacheByDir,Ph as readFileCached,Dh as registerServeModuleBundle,Mf as templateCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{j,jf,Ko,a,P,jh,Bh}from"./chunk-j4s5k8sp.js";import"./chunk-m997knnz.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-4cffjp4f.js";import"./chunk-syheccfj.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{P as config,j as defaultConfig,jh as defineStxConfig,Ko as discoverConfig,a as loadStxConfig,jf as resolveStxDirectories,Bh as validateConfig};
2
+ import{j,jf,Ko,a,P,jh,Bh}from"./chunk-enep9r03.js";import"./chunk-wk6xsyv3.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-epcy3r18.js";import"./chunk-8e23zh2y.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{P as config,j as defaultConfig,jh as defineStxConfig,Ko as discoverConfig,a as loadStxConfig,jf as resolveStxDirectories,Bh as validateConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{u,f,R,d,q}from"./chunk-94gyfwpz.js";import{z,As,U,Oe,de,kr,je,Be,r,h,Se,_}from"./chunk-4cffjp4f.js";import{at}from"./chunk-gb65t4n1.js";import{A}from"./chunk-2yxva96k.js";import{se}from"./chunk-qv85c3qy.js";import{L,Ye}from"./chunk-k3rcpnzm.js";import{E,_n}from"./chunk-bmfk3b29.js";import C from"path";import{existsSync as St}from"fs";function ct(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=S.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),S.lastIndex=g+N.length,s=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
2
+ import{u,f,R,d,q}from"./chunk-94gyfwpz.js";import{z,As,U,Oe,de,kr,je,Be,r,h,Se,_}from"./chunk-epcy3r18.js";import{at}from"./chunk-gb65t4n1.js";import{A}from"./chunk-2yxva96k.js";import{se}from"./chunk-qv85c3qy.js";import{L,Ye}from"./chunk-k3rcpnzm.js";import{E,_n}from"./chunk-bmfk3b29.js";import C from"path";import{existsSync as St}from"fs";function ct(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=S.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),S.lastIndex=g+N.length,s=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
3
3
  `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<g-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},rt=()=>{if(S!==0)return;let N=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let H=N[2];if(!i.has(H))c.push(H),i.add(H);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let H=et[1];if(!i.has(H))c.push(H),i.add(H);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!i.has(H))c.push(H),i.add(H)}};while(s<g){if(Z())continue;if(t[s]==="'"||t[s]==='"'){e(t[s]);continue}if(t[s]==="`"){D();continue}if(t[s]==="{"){S++,s++;continue}if(t[s]==="}"){S--,s++;continue}if(S===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))rt();s++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${at("var",c)}
@@ -44,10 +44,10 @@ ${s}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return c+a+i}function It(a,t){if(L(a)){let S=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ye(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Eh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Af(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!Z)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Je=new U(500),sc=new Set;function Th(){sc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return sc}async function os(a,t,c,i,S,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,I,x)=>{let p=I.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),I});{let m=/@includeIf\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")")n--;w++}if(n!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],P=Z(O,g,c),k="";if(P&&await Bun.file(P).exists())S.add(P),k=`@include(${l})`;e=e.substring(0,x)+k+e.substring(w),m.lastIndex=0}}for(let[m,I]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,w=n+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),P=ct(O,0);if(P===-1){x.lastIndex=o;continue}let k=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let b=W[1],J=V.substring(W[0].length),B,M=ct(J,0);if(M!==-1)B=J.substring(M+1).trim();try{let T=`Boolean(${k})`,j;if(f(T)){let it=d(T,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(T,t));let tt=I?!j:j,nt="";if(tt){let it=Z(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(T){let j=T instanceof Error?T.message:String(T),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,k,V,W]=O;try{let b,J=k.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let M of b){let T={...t,[V]:M},j=await et(P,T,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],k=l.slice(O[0].length),V,W=k.match(/^\s*,\s*\{/);if(W){k=k.slice(W[0].length-1);let B=1,M=1;while(M<k.length&&B>0){if(k[M]==="{")B++;else if(k[M]==="}"){if(B--,B===0)break}M++}V=k.substring(0,M+1),k=k.slice(M+1)}let b,J=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),M={};if(V)try{M=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let T=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,M,a,x);e=e.replace(o,()=>nt),T=!0;break}}if(!T)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let M=B instanceof Error?B.message:String(B),T=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>T)}m.lastIndex=0}}function Z(m,I,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(I),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let b=C.resolve(W,p);if(b.startsWith(`${C.resolve(W)}${C.sep}`)&&St(b))return b}l=C.resolve(I,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(w+C.sep)||o===w,k=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))k=!0}if(!O&&!P&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,I,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:I,partialsDir:g}),h("Include",I,c,x,p)}async function et(m,I={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(n);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-t9744tty.js");l=v(l,t)}if(l&&(i.debug||!E()&&!_n()))try{let{warnUnbalancedTags:v}=await import("./chunk-ajj56vrw.js");v(l,n)}catch{}try{let{processESImports:v}=await import("./chunk-0ppx28f6.js");l=await v(l,t,n,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,v instanceof Error?v.message:v)}let o=l,O=de(o);if(O)o=O.content.trim();let k=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(k)V=`<style${k[1]}>${k[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,K,y)=>{if(!ft(K))return"";return W.push({attrs:K,body:y}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=Se(l,n);for(let[v,K]of Object.entries(I))b[v]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((v,K)=>{let y=(v[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(y)}),M="",T=null,j=!1,tt=!1;for(let v of B){let K=v[1]||"",y=v[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=je(K);if(!X&&!/\bsrc\s*=/i.test(K))Oe(y,n,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-1aent61q.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-44tq4d62.js"),st=F(y,{filePath:n,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Be(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-44tq4d62.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-ncxed9r1.js");if(st(y))y=await bt(y,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-4gx5ze56.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-44tq4d62.js"),st=Q(y,F(b));if(st)y=`${st}
47
+ })();`;return c+a+i}function It(a,t){if(L(a)){let S=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ye(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Eh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Af(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!Z)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Je=new U(500),sc=new Set;function Th(){sc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return sc}async function os(a,t,c,i,S,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,I,x)=>{let p=I.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),I});{let m=/@includeIf\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")")n--;w++}if(n!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],P=Z(O,g,c),k="";if(P&&await Bun.file(P).exists())S.add(P),k=`@include(${l})`;e=e.substring(0,x)+k+e.substring(w),m.lastIndex=0}}for(let[m,I]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,w=n+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),P=ct(O,0);if(P===-1){x.lastIndex=o;continue}let k=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let b=W[1],J=V.substring(W[0].length),B,M=ct(J,0);if(M!==-1)B=J.substring(M+1).trim();try{let T=`Boolean(${k})`,j;if(f(T)){let it=d(T,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(T,t));let tt=I?!j:j,nt="";if(tt){let it=Z(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(T){let j=T instanceof Error?T.message:String(T),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,k,V,W]=O;try{let b,J=k.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let M of b){let T={...t,[V]:M},j=await et(P,T,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],k=l.slice(O[0].length),V,W=k.match(/^\s*,\s*\{/);if(W){k=k.slice(W[0].length-1);let B=1,M=1;while(M<k.length&&B>0){if(k[M]==="{")B++;else if(k[M]==="}"){if(B--,B===0)break}M++}V=k.substring(0,M+1),k=k.slice(M+1)}let b,J=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),M={};if(V)try{M=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let T=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,M,a,x);e=e.replace(o,()=>nt),T=!0;break}}if(!T)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let M=B instanceof Error?B.message:String(B),T=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>T)}m.lastIndex=0}}function Z(m,I,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(I),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let b=C.resolve(W,p);if(b.startsWith(`${C.resolve(W)}${C.sep}`)&&St(b))return b}l=C.resolve(I,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(w+C.sep)||o===w,k=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))k=!0}if(!O&&!P&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,I,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:I,partialsDir:g}),h("Include",I,c,x,p)}async function et(m,I={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(n);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-8a5txj4f.js");l=v(l,t)}if(l&&(i.debug||!E()&&!_n()))try{let{warnUnbalancedTags:v}=await import("./chunk-ajj56vrw.js");v(l,n)}catch{}try{let{processESImports:v}=await import("./chunk-90pxjq62.js");l=await v(l,t,n,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,v instanceof Error?v.message:v)}let o=l,O=de(o);if(O)o=O.content.trim();let k=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(k)V=`<style${k[1]}>${k[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,K,y)=>{if(!ft(K))return"";return W.push({attrs:K,body:y}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=Se(l,n);for(let[v,K]of Object.entries(I))b[v]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((v,K)=>{let y=(v[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(y)}),M="",T=null,j=!1,tt=!1;for(let v of B){let K=v[1]||"",y=v[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=je(K);if(!X&&!/\bsrc\s*=/i.test(K))Oe(y,n,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-hv0whj8t.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-sq0qc9sk.js"),st=F(y,{filePath:n,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Be(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-sq0qc9sk.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-zssf9fdg.js");if(st(y))y=await bt(y,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-9s4ggstz.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-sq0qc9sk.js"),st=Q(y,F(b));if(st)y=`${st}
48
48
  ${y}`}if(dt&&!X){j=!0,T=ut(n,t);let F=A(y),Q=gt(F,T);M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-zsjw2jgy.js");await F(y,b,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();T=ut(n,t);let Q=A(y),st=gt(Q,T);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}"${F?` ${F}`:""}>${st}</script>
50
- `}}if(W.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-1aent61q.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,y)=>{let X=W[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(T){let v=It(o,T);if(o=v.html,v.mergedIntoExisting){let y=T,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),T=X}else if(!v.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(j||tt)&&!pt.has(n)){let y=Af(o);if(y.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=v.stamped&&v.root!==null&&kr(v.root);M=Rt(M,K?T:null)}if(o.includes("@include")||o.includes("@partial"))o=await os(o,b,n,i,S,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-22z2cwhv.js"),G=nt(o,b,n,void 0,!0);G=se(G,b,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-g6smtcc0.js");if(G=ht(G,b,n,i),G=_t(G,b,n),G=xt(G,b,n,i),G=_(G,b,n),V)G+=`
49
+ `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-k2brrhf8.js");await F(y,b,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();T=ut(n,t);let Q=A(y),st=gt(Q,T);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}"${F?` ${F}`:""}>${st}</script>
50
+ `}}if(W.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-hv0whj8t.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,y)=>{let X=W[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(T){let v=It(o,T);if(o=v.html,v.mergedIntoExisting){let y=T,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),T=X}else if(!v.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(j||tt)&&!pt.has(n)){let y=Af(o);if(y.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=v.stamped&&v.root!==null&&kr(v.root);M=Rt(M,K?T:null)}if(o.includes("@include")||o.includes("@partial"))o=await os(o,b,n,i,S,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-xmae29mn.js"),G=nt(o,b,n,void 0,!0);G=se(G,b,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-g6smtcc0.js");if(G=ht(G,b,n,i),G=_t(G,b,n),G=xt(G,b,n,i),G=_(G,b,n),V)G+=`
51
51
  `+V;if(M)G+=`
52
52
  `+M;return G}catch(l){if(l instanceof q)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(e))!==null){let m=H.index,I=m+H[0].length-1,x=1,p=I+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let n=e.substring(m,p),w=e.substring(I+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,P=w.substring(l[0].length),k=ct(P,0);if(k!==-1)O=P.substring(k+1).trim();let V={};if(O)try{V=R(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(n,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let W=await et(o,V,a,m);e=e.substring(0,m)+W+e.substring(p),Y.lastIndex=0}return e}function is(a,t){let c=a;function i(S,s,g,e){let D=S,Z=!0;while(Z){Z=!1;let rt=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(rt);if(!N||N.index===void 0)break;let et=N.index,Y=N[1],H=et+N[0].length,m=new RegExp(`@${s}\\(`),I=new RegExp(`@${g}(?![a-z])`),x=1,p=H,n=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(I),P=o?p+o.index:1/0,k=O?p+O.index:1/0;if(P<k)x++,p=P+(o[0].length||1);else if(k<1/0){if(x--,x===0){n=k;break}p=k+g.length+1}else break}if(n===-1)break;let w=D.slice(H,n);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(n+`@${g}`.length),Z=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function as(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
53
53
  `)})}