@stacksjs/stx 0.2.676 → 0.2.677

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 (81) hide show
  1. package/dist/{chunk-q1jcf6vm.js → chunk-01cx2p82.js} +1 -1
  2. package/dist/chunk-08d4wb3x.js +2 -0
  3. package/dist/{chunk-4rk5qnqf.js → chunk-0rpr2aax.js} +1 -1
  4. package/dist/{chunk-rnws0dh3.js → chunk-0wmcs0w3.js} +1 -1
  5. package/dist/{chunk-p27ptd9f.js → chunk-1nrz39tr.js} +6 -6
  6. package/dist/{chunk-245sas8r.js → chunk-2t51tpkc.js} +2 -2
  7. package/dist/{chunk-kn34esxw.js → chunk-3rde002j.js} +1 -1
  8. package/dist/{chunk-dmd7mgjw.js → chunk-4tn437tn.js} +1 -1
  9. package/dist/{chunk-z7ghjs7w.js → chunk-569s7hg6.js} +1 -1
  10. package/dist/{chunk-x63f2ywm.js → chunk-69qhykgz.js} +1 -1
  11. package/dist/{chunk-z35ftpqp.js → chunk-7dnpjrqp.js} +6 -6
  12. package/dist/{chunk-jk7chxkt.js → chunk-8z8w9rxc.js} +1 -1
  13. package/dist/{chunk-cdbaanmx.js → chunk-adyseb6y.js} +1 -1
  14. package/dist/{chunk-qbzqary0.js → chunk-aypmc7qg.js} +1 -1
  15. package/dist/{chunk-krcd3039.js → chunk-b4709e09.js} +5 -5
  16. package/dist/chunk-br3cde1t.js +2 -0
  17. package/dist/{chunk-78d5tn4r.js → chunk-cep5ba7w.js} +1 -1
  18. package/dist/{chunk-mq915g3j.js → chunk-dckjv2vk.js} +2 -2
  19. package/dist/{chunk-4jnv2v5e.js → chunk-dx037j0p.js} +1 -1
  20. package/dist/chunk-dzbn56tx.js +2 -0
  21. package/dist/chunk-e0fhfnee.js +2 -0
  22. package/dist/{chunk-fbrgz3s8.js → chunk-efpd1yyg.js} +1 -1
  23. package/dist/{chunk-526mf3fr.js → chunk-fjtffqf9.js} +1 -1
  24. package/dist/{chunk-zwkc8yge.js → chunk-fka2073f.js} +48 -48
  25. package/dist/chunk-fp3a3gmr.js +2 -0
  26. package/dist/{chunk-j60jye3e.js → chunk-gjdpdvw5.js} +1 -1
  27. package/dist/{chunk-d4ch6exz.js → chunk-hejx7gbs.js} +1 -1
  28. package/dist/{chunk-vay5v6sj.js → chunk-hg9dxba9.js} +1 -1
  29. package/dist/{chunk-5v7vm8cv.js → chunk-hh2dcnsx.js} +4 -4
  30. package/dist/{chunk-c4enpsj8.js → chunk-hkfabb1e.js} +1 -1
  31. package/dist/chunk-j9pwgyf1.js +2 -0
  32. package/dist/{chunk-fd72t30s.js → chunk-je8t9yka.js} +1 -1
  33. package/dist/chunk-jkw89s1t.js +2 -0
  34. package/dist/{chunk-1rztwjdj.js → chunk-k65zz7t3.js} +3 -3
  35. package/dist/{chunk-pwn0j1vq.js → chunk-kas6xn08.js} +1 -1
  36. package/dist/{chunk-bpj387yx.js → chunk-m46bj8c8.js} +2 -2
  37. package/dist/{chunk-rxxajm31.js → chunk-mgk7bwb3.js} +2 -2
  38. package/dist/{chunk-n94ts3t9.js → chunk-mhacarm5.js} +2 -2
  39. package/dist/{chunk-sptewgky.js → chunk-mzcf1dr1.js} +1 -1
  40. package/dist/{chunk-g12ht81a.js → chunk-n1d2t5h4.js} +1 -1
  41. package/dist/{chunk-s73z8zss.js → chunk-n46pv8kp.js} +1 -1
  42. package/dist/{chunk-b23vscaq.js → chunk-phdd7jxx.js} +1 -1
  43. package/dist/{chunk-cs8wq7nv.js → chunk-qjv5tjmy.js} +1 -1
  44. package/dist/chunk-r16n5dc4.js +2 -0
  45. package/dist/{chunk-whzvx5w5.js → chunk-r1v1496g.js} +1 -1
  46. package/dist/{chunk-ehzd1yc6.js → chunk-r9p7r6mx.js} +1 -1
  47. package/dist/chunk-reqdy80m.js +2 -0
  48. package/dist/{chunk-fdvfzknd.js → chunk-rza3yydb.js} +1 -1
  49. package/dist/{chunk-be2rswkw.js → chunk-scgn8dmx.js} +1 -1
  50. package/dist/{chunk-etz2dmec.js → chunk-sqv40sqk.js} +1 -1
  51. package/dist/{chunk-n63r9b4f.js → chunk-tjqyhgh2.js} +1 -1
  52. package/dist/{chunk-304dbbsw.js → chunk-tqc86aaw.js} +4 -4
  53. package/dist/{chunk-ghm9f13q.js → chunk-vdsf1yrt.js} +1 -1
  54. package/dist/{chunk-6bwca55g.js → chunk-wbz32ffd.js} +1 -1
  55. package/dist/{chunk-sqh3tvtw.js → chunk-wkkmk4aa.js} +1 -1
  56. package/dist/{chunk-rfc5pdv2.js → chunk-wwgh5ae7.js} +1 -1
  57. package/dist/{chunk-551s7ha0.js → chunk-x5sjsf3b.js} +2 -2
  58. package/dist/{chunk-707sx5sk.js → chunk-x5v3rqbn.js} +1 -1
  59. package/dist/chunk-yaej3mgj.js +2 -0
  60. package/dist/chunk-zbp10hjz.js +2 -0
  61. package/dist/{chunk-q3nnaxf9.js → chunk-zeyfefpc.js} +1 -1
  62. package/dist/{chunk-xk7cp691.js → chunk-ztebv7c0.js} +1 -1
  63. package/dist/{chunk-34e8e8te.js → chunk-zvr3r5p0.js} +1 -1
  64. package/dist/cli.js +7 -7
  65. package/dist/craft-entry.js +1 -1
  66. package/dist/craft.js +1 -1
  67. package/dist/desktop.d.ts +5 -0
  68. package/dist/pwa.js +1 -1
  69. package/dist/ssg.js +2 -2
  70. package/package.json +3 -3
  71. package/dist/chunk-1e73whqh.js +0 -2
  72. package/dist/chunk-3gdt16xa.js +0 -2
  73. package/dist/chunk-b18x0v21.js +0 -2
  74. package/dist/chunk-d2xf5hh9.js +0 -2
  75. package/dist/chunk-dda8pdya.js +0 -2
  76. package/dist/chunk-ds91e0fe.js +0 -2
  77. package/dist/chunk-g6gqja52.js +0 -2
  78. package/dist/chunk-gz5rvwgx.js +0 -2
  79. package/dist/chunk-jjet6qxq.js +0 -2
  80. package/dist/chunk-vewt3464.js +0 -2
  81. package/dist/chunk-wk1gt95z.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Be,yn,ws,Ho,A}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-sqh3tvtw.js";import{xr,x,lc,st,Jo,uc}from"./chunk-78yjmbbs.js";import{T}from"./chunk-6beg47t4.js";import{xs,l,p,Dt,u,V,D,y,Cs,Se,ze,Es}from"./chunk-qwdcts9w.js";import{r,fe}from"./chunk-tst8p27s.js";import{f}from"./chunk-b7e07ybq.js";import{U}from"./chunk-hh58k0nh.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as lo}from"async_hooks";var or=new lo;function dn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function fr(e,i){return or.run(dn(e),i)}async function gr(e,i){let t=or.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 o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(i).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function dr(e){let i=e.__stx_server_data;if(!i?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(i.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,i=!1){let t=r(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(i&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(i&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let q=P.indexOf(":"),W=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(W&&!a.has(W))o.push(W),a.add(W)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(i&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let q=P.split(/[\s=]/)[0];if(q&&!a.has(q))o.push(q),a.add(q)});return}if(i)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function uo(e,i=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return i.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function is(e,i){let t=`{ ${uo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Cn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var mr=new Map;function as(e,i=!0){let t=mr.get(e);if(i&&t)return t;let o=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=Cn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(i)mr.set(e,o);return o}function cs(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Ce.join(t,"node_modules",e);try{if(Cn.statSync(o).isDirectory())return o}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function ls(e,i,t={}){return[Ce.resolve(Ce.dirname(i),`${e}.stx`),Ce.resolve(Ce.dirname(i),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function hr(e){let i=e.endsWith(".stx")?e.slice(0,-4):e,t=i.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(i);return[i,t,o]}function Co(e,i){let[t,o,a]=hr(e);for(let h of[t,t.toLowerCase(),o,a]){let c=i?.__importedComponents?.get(h);if(c!==void 0)return c}}function*Eo(e,i,t={},o){let a=hr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Ce.join(Ce.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(i),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of Cn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function br(e,i,t={},o){let a=Co(e,o);if(a!==void 0)return a;for(let h of Eo(e,i,t,o))try{if(Cn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import qs from"fs";import le from"path";import dt from"path";import Kt from"fs";var fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ns(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return fo.has(e.toLowerCase())}var yr=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"]),_r={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"},po=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function wr(e){let i={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 o=t.toLowerCase();if(o==="prevent")i.prevent=!0;else if(o==="stop")i.stop=!0;else if(o==="once")i.once=!0;else if(o==="capture")i.capture=!0;else if(o==="self")i.self=!0;else if(o==="passive")i.passive=!0;else if(o==="nonpassive")i.nonpassive=!0;else if(po.has(o))i.systemKeys.push(o);else if(o in $r)i.mouse=o;else if(o in _r||/^[a-z]$/.test(o))i.keys.push(_r[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);i.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);i.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return i}function vr(e,i=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${i}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function go(e){let i=[],{modifiers:t}=e;if(t.self)i.push("if ($event.target !== $el) return");for(let o of t.systemKeys)i.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");i.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=$r[t.mouse];i.push(`if ($event.button !== ${o}) return`)}if(t.prevent)i.push("$event.preventDefault()");if(t.stop)i.push("$event.stopPropagation()");return i.join("; ")}function mo(e,i){let t=e;if(i.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${i.debounce})`;else if(i.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${i.throttle})`;return t}function ss(e){let i=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i))return e;return`if (typeof ${i} === 'function' && !${i}._isSignal) ${i}($event);`}function ho(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=go(e),a=mo(ss(e.handler),i),h=[];if(i.once)h.push("once: true");if(i.capture)h.push("capture: true");if(ns(e.event,i))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Be,yn,ws,Ho,A}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-wkkmk4aa.js";import{xr,x,lc,st,Jo,uc}from"./chunk-78yjmbbs.js";import{T}from"./chunk-6beg47t4.js";import{xs,l,p,Dt,u,V,D,y,Cs,Se,ze,Es}from"./chunk-qwdcts9w.js";import{r,fe}from"./chunk-tst8p27s.js";import{f}from"./chunk-b7e07ybq.js";import{U}from"./chunk-hh58k0nh.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as lo}from"async_hooks";var or=new lo;function dn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function fr(e,i){return or.run(dn(e),i)}async function gr(e,i){let t=or.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 o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(i).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function dr(e){let i=e.__stx_server_data;if(!i?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(i.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,i=!1){let t=r(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(i&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(i&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let q=P.indexOf(":"),W=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(W&&!a.has(W))o.push(W),a.add(W)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(i&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let q=P.split(/[\s=]/)[0];if(q&&!a.has(q))o.push(q),a.add(q)});return}if(i)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function uo(e,i=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return i.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function is(e,i){let t=`{ ${uo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Cn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var mr=new Map;function as(e,i=!0){let t=mr.get(e);if(i&&t)return t;let o=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=Cn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(i)mr.set(e,o);return o}function cs(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Ce.join(t,"node_modules",e);try{if(Cn.statSync(o).isDirectory())return o}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function ls(e,i,t={}){return[Ce.resolve(Ce.dirname(i),`${e}.stx`),Ce.resolve(Ce.dirname(i),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function hr(e){let i=e.endsWith(".stx")?e.slice(0,-4):e,t=i.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(i);return[i,t,o]}function Co(e,i){let[t,o,a]=hr(e);for(let h of[t,t.toLowerCase(),o,a]){let c=i?.__importedComponents?.get(h);if(c!==void 0)return c}}function*Eo(e,i,t={},o){let a=hr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Ce.join(Ce.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(i),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of Cn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function br(e,i,t={},o){let a=Co(e,o);if(a!==void 0)return a;for(let h of Eo(e,i,t,o))try{if(Cn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import qs from"fs";import le from"path";import dt from"path";import Kt from"fs";var fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ns(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return fo.has(e.toLowerCase())}var yr=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"]),_r={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"},po=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function wr(e){let i={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 o=t.toLowerCase();if(o==="prevent")i.prevent=!0;else if(o==="stop")i.stop=!0;else if(o==="once")i.once=!0;else if(o==="capture")i.capture=!0;else if(o==="self")i.self=!0;else if(o==="passive")i.passive=!0;else if(o==="nonpassive")i.nonpassive=!0;else if(po.has(o))i.systemKeys.push(o);else if(o in $r)i.mouse=o;else if(o in _r||/^[a-z]$/.test(o))i.keys.push(_r[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);i.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);i.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return i}function vr(e,i=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${i}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function go(e){let i=[],{modifiers:t}=e;if(t.self)i.push("if ($event.target !== $el) return");for(let o of t.systemKeys)i.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");i.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=$r[t.mouse];i.push(`if ($event.button !== ${o}) return`)}if(t.prevent)i.push("$event.preventDefault()");if(t.stop)i.push("$event.stopPropagation()");return i.join("; ")}function mo(e,i){let t=e;if(i.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${i.debounce})`;else if(i.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${i.throttle})`;return t}function ss(e){let i=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i))return e;return`if (typeof ${i} === 'function' && !${i}._isSignal) ${i}($event);`}function ho(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=go(e),a=mo(ss(e.handler),i),h=[];if(i.once)h.push("once: true");if(i.capture)h.push("capture: true");if(ns(e.event,i))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=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,i=""){let t=vr(e,i);if(t.length===0)return{template:e,bindings:[]};let o=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],v=c.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let E=v.match(/id=["']([^"']+)["']/);if(E)for(let R of c.events)R.elementId=E[1]}for(let E of c.events){let R=E.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),C=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");v=v.replace(C,""),v=v.replace(O,"")}o=o.slice(0,c.startIndex)+v+o.slice(c.endIndex),a.push(...c.events)}return{template:o,bindings:a}}function Sr(e){let i=e.$uid;return typeof i==="string"&&i?`${i}_`:""}function $a(e,i,t){if(uc(e))return e;if(i.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=xo(e,Sr(i)),R=i.__stx_event_bindings||[];return i.__stx_event_bindings=[...R,...E],v}let o=vr(e,Sr(i));if(o.length===0)return e;let a=e;for(let v=o.length-1;v>=0;v--){let E=o[v],R=E.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${E.elementId}"`);else{let C=R.match(/id=["']([^"']+)["']/);if(C)for(let O of E.events)O.elementId=C[1]}for(let C of E.events){let O=C.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");R=R.replace(M,""),R=R.replace(N,"")}a=a.slice(0,E.startIndex)+R+a.slice(E.endIndex)}let h=To(o.flatMap((v)=>v.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
115
- `+a.slice(c);else a+=h;return a}function Er(e,i){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(i){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Et(e,i){let t=r(e),{depths:o,balanced:a}=fe(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${i}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&Er(v[1],!0).has(i))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&Er(v[1],!1).has(i))return!0;return!1}var kr="",Tn,ct=/^[A-Za-z_$][\w$]*$/,bo=new Set(["if","for","while","switch","with"]),Rr=["(","[","{"],Cr=[")","]","}"],yo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _o(e){let i=r(e),t=[];for(let o of i.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:i,tokens:t}}function rs(e){if(Tn&&e===kr)return Tn;let{code:i,tokens:t}=_o(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let q=a.at(-1);if(q!==void 0&&["()","[]","{}"].includes(t[q].text+P))a.pop(),o.set(q,I),o.set(I,q)}}function h(I,P){let q=[],Z=I;for(let W=I;W<P;W++){if(["(","[","{"].includes(t[W].text)&&(o.get(W)??P)<P){W=o.get(W);continue}if(t[W].text===",")q.push([Z,W]),Z=W+1}return q.push([Z,P]),q}let c=[];function v(I,P,q,Z=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let W=t[I].text;if(ct.test(W)){if(q.add(W),q===C)c.push({name:W,token:I,functionScoped:Z});return}if(W!=="{"&&W!=="[")return;let Y=o.get(I);if(Y===void 0||Y>=P)return;for(let[ee,te]of h(I+1,Y)){let ae=ee;if(W==="{")for(let me=ee;me<te;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&o.has(me))me=o.get(me)}v(ae,te,q,Z)}}function E(I,P){let q=new Set;for(let[Z,W]of h(I,P))v(Z,W,q);return q}function R(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(["(","[","{"].includes(q)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(q))break}return t[Math.max(I,P-1)]?.end??i.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,q=P,Z;if(t[P]?.text===")"&&o.has(P))q=o.get(P),Z=E(q+1,P);else if(t[P]&&ct.test(t[P].text))Z=new Set([t[P].text]);else continue;let W=I+1,Y=t[W]?.text==="{"&&o.has(W)?t[o.get(W)].end:R(W);O.push({start:t[q].start,end:Y,bodyStart:t[W]?.start??Y,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||bo.has(P)||!ct.test(P)&&P!=="*"&&P!=="]")continue;let q=o.get(I),Z=q+1;if(t[Z]?.text===":"){Z++;while(Z<t.length&&!["{","=>",";","="].includes(t[Z].text))Z++}if(t[Z]?.text!=="{"||!o.has(Z))continue;O.push({start:t[I].start,end:t[o.get(Z)].end,bodyStart:t[Z].start,functionBody:P!=="catch",names:E(I+1,q)})}function M(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(Rr.includes(q)&&o.has(P)){P=o.get(P);continue}if(q===";"||Cr.includes(q))break;let Z=t[P-1];if(P>I&&yo.has(q)&&Z.text!==".")break;if(P>I&&/[\n\r]/.test(i.slice(Z.end,t[P].start))&&(/^[\w$]+$/.test(Z.text)||Cr.includes(Z.text)||['"',"'","`"].includes(Z.text))&&ct.test(q)&&!["in","of","instanceof"].includes(q))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let q=o.get(P),Z=q+1,W=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Y=t[W]?.text===";"||t[W]?.text==="}"?t[W].end:t[Math.max(Z,W-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Y})}for(let I=0;I<t.length;I++){let P=t[I].text,q=t[I-1]?.text;if(q==="."||t[I+1]?.text===":")continue;if(q==="as"||q==="<")continue;if(P==="const"||P==="let"||P==="var"){let Z=M(I+1),W=I+1,Y=!1,ee=!1,te=0;for(let ae=I+1;ae<=Z;ae++){let me=t[ae]?.text;if(ae<Z&&Rr.includes(me)&&o.has(ae)&&o.get(ae)<Z){ae=o.get(ae);continue}if(ae<Z&&me===":"&&!ee)Y=!0;else if(ae<Z&&me==="="&&te===0)Y=!1,ee=!0;else if(ae<Z&&Y&&me==="<")te++;else if(ae<Z&&Y&&me===">"&&te>0)te--;else if(ae===Z||me===","&&te===0)v(W,ae,C,P==="var"),W=ae+1,Y=!1,ee=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&ct.test(t[Z].text)&&t[Z].text!=="extends")C.add(t[Z].text),c.push({name:t[Z].text,token:Z})}else if(P==="import"){let Z=I+1;if(t[Z]?.text==="*"&&t[Z+1]?.text==="as")Z+=2;let W=t[Z]?.text;if(W&&ct.test(W)&&W!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(W),c.push({name:W,token:Z,file:!0});let Y=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Y!==-1&&o.has(Y)){let ee=o.get(Y);for(let[te,ae]of h(Y+1,ee)){let me=ae-1;while(me>=te&&!ct.test(t[me].text))me--;if(me>=te&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return kr=e,Tn={code:i,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},Tn}function fs(e){let i=rs(e);return{code:i.code,shadows:(t,o)=>i.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function An(e){return new Set(rs(e).declarations)}function on(e,i){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=rs(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!i.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let Z=h[N.token].start,W=t.filter((Y)=>Y.functionBody&&Z>=Y.bodyStart&&Z<Y.end).sort((Y,ee)=>Y.end-Y.bodyStart-(ee.end-ee.bodyStart))[0];P=W?[W.bodyStart,W.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((W)=>N.token>W.headStart&&N.token<W.headEnd).sort((W,Y)=>W.headEnd-W.headStart-(Y.headEnd-Y.headStart))[0];if(Z)P=[Z.start,Z.end]}let q=C.get(N.name);if(q)q.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&ct.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!i.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let q=h[N].start;if(C.get(I)?.some(([Z,W])=>q>=Z&&q<W))continue;if(t.some((Z)=>q>=Z.start&&q<Z.end&&Z.names.has(I)))continue;M.add(I)}return M}var Ae="0.2.676";var Tr=Symbol.for(`stx.lazy-module-promises.${Ae}`);function So(){let e=globalThis;return e[Tr]??=new Map,e[Tr]}function s(e,i){let t=So(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=i();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var vo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(vo,"<\\/$1")}import Or from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,i){this.maxSize=e,this.options=i??null,this.sizes=i?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 i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}set(e,i){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(i):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 o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,i),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let i=this.sizes.get(e);if(i!==void 0)this.bytes-=i,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,ko=500;function Tt(e,i){if(i?.includes("g"))return new RegExp(e,i);let t=`${e}:${i||""}`;if(!St.has(t)){if(St.size>=ko){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,i))}return St.get(t)}class Ar{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let i=Array.from(new Set(e)),t=i.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...i,`
115
+ `+a.slice(c);else a+=h;return a}function Er(e,i){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(i){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Et(e,i){let t=r(e),{depths:o,balanced:a}=fe(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${i}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&Er(v[1],!0).has(i))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&Er(v[1],!1).has(i))return!0;return!1}var kr="",Tn,ct=/^[A-Za-z_$][\w$]*$/,bo=new Set(["if","for","while","switch","with"]),Rr=["(","[","{"],Cr=[")","]","}"],yo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _o(e){let i=r(e),t=[];for(let o of i.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:i,tokens:t}}function rs(e){if(Tn&&e===kr)return Tn;let{code:i,tokens:t}=_o(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let q=a.at(-1);if(q!==void 0&&["()","[]","{}"].includes(t[q].text+P))a.pop(),o.set(q,I),o.set(I,q)}}function h(I,P){let q=[],Z=I;for(let W=I;W<P;W++){if(["(","[","{"].includes(t[W].text)&&(o.get(W)??P)<P){W=o.get(W);continue}if(t[W].text===",")q.push([Z,W]),Z=W+1}return q.push([Z,P]),q}let c=[];function v(I,P,q,Z=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let W=t[I].text;if(ct.test(W)){if(q.add(W),q===C)c.push({name:W,token:I,functionScoped:Z});return}if(W!=="{"&&W!=="[")return;let Y=o.get(I);if(Y===void 0||Y>=P)return;for(let[ee,te]of h(I+1,Y)){let ae=ee;if(W==="{")for(let me=ee;me<te;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&o.has(me))me=o.get(me)}v(ae,te,q,Z)}}function E(I,P){let q=new Set;for(let[Z,W]of h(I,P))v(Z,W,q);return q}function R(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(["(","[","{"].includes(q)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(q))break}return t[Math.max(I,P-1)]?.end??i.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,q=P,Z;if(t[P]?.text===")"&&o.has(P))q=o.get(P),Z=E(q+1,P);else if(t[P]&&ct.test(t[P].text))Z=new Set([t[P].text]);else continue;let W=I+1,Y=t[W]?.text==="{"&&o.has(W)?t[o.get(W)].end:R(W);O.push({start:t[q].start,end:Y,bodyStart:t[W]?.start??Y,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||bo.has(P)||!ct.test(P)&&P!=="*"&&P!=="]")continue;let q=o.get(I),Z=q+1;if(t[Z]?.text===":"){Z++;while(Z<t.length&&!["{","=>",";","="].includes(t[Z].text))Z++}if(t[Z]?.text!=="{"||!o.has(Z))continue;O.push({start:t[I].start,end:t[o.get(Z)].end,bodyStart:t[Z].start,functionBody:P!=="catch",names:E(I+1,q)})}function M(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(Rr.includes(q)&&o.has(P)){P=o.get(P);continue}if(q===";"||Cr.includes(q))break;let Z=t[P-1];if(P>I&&yo.has(q)&&Z.text!==".")break;if(P>I&&/[\n\r]/.test(i.slice(Z.end,t[P].start))&&(/^[\w$]+$/.test(Z.text)||Cr.includes(Z.text)||['"',"'","`"].includes(Z.text))&&ct.test(q)&&!["in","of","instanceof"].includes(q))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let q=o.get(P),Z=q+1,W=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Y=t[W]?.text===";"||t[W]?.text==="}"?t[W].end:t[Math.max(Z,W-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Y})}for(let I=0;I<t.length;I++){let P=t[I].text,q=t[I-1]?.text;if(q==="."||t[I+1]?.text===":")continue;if(q==="as"||q==="<")continue;if(P==="const"||P==="let"||P==="var"){let Z=M(I+1),W=I+1,Y=!1,ee=!1,te=0;for(let ae=I+1;ae<=Z;ae++){let me=t[ae]?.text;if(ae<Z&&Rr.includes(me)&&o.has(ae)&&o.get(ae)<Z){ae=o.get(ae);continue}if(ae<Z&&me===":"&&!ee)Y=!0;else if(ae<Z&&me==="="&&te===0)Y=!1,ee=!0;else if(ae<Z&&Y&&me==="<")te++;else if(ae<Z&&Y&&me===">"&&te>0)te--;else if(ae===Z||me===","&&te===0)v(W,ae,C,P==="var"),W=ae+1,Y=!1,ee=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&ct.test(t[Z].text)&&t[Z].text!=="extends")C.add(t[Z].text),c.push({name:t[Z].text,token:Z})}else if(P==="import"){let Z=I+1;if(t[Z]?.text==="*"&&t[Z+1]?.text==="as")Z+=2;let W=t[Z]?.text;if(W&&ct.test(W)&&W!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(W),c.push({name:W,token:Z,file:!0});let Y=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Y!==-1&&o.has(Y)){let ee=o.get(Y);for(let[te,ae]of h(Y+1,ee)){let me=ae-1;while(me>=te&&!ct.test(t[me].text))me--;if(me>=te&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return kr=e,Tn={code:i,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},Tn}function fs(e){let i=rs(e);return{code:i.code,shadows:(t,o)=>i.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function An(e){return new Set(rs(e).declarations)}function on(e,i){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=rs(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!i.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let Z=h[N.token].start,W=t.filter((Y)=>Y.functionBody&&Z>=Y.bodyStart&&Z<Y.end).sort((Y,ee)=>Y.end-Y.bodyStart-(ee.end-ee.bodyStart))[0];P=W?[W.bodyStart,W.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((W)=>N.token>W.headStart&&N.token<W.headEnd).sort((W,Y)=>W.headEnd-W.headStart-(Y.headEnd-Y.headStart))[0];if(Z)P=[Z.start,Z.end]}let q=C.get(N.name);if(q)q.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&ct.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!i.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let q=h[N].start;if(C.get(I)?.some(([Z,W])=>q>=Z&&q<W))continue;if(t.some((Z)=>q>=Z.start&&q<Z.end&&Z.names.has(I)))continue;M.add(I)}return M}var Ae="0.2.677";var Tr=Symbol.for(`stx.lazy-module-promises.${Ae}`);function So(){let e=globalThis;return e[Tr]??=new Map,e[Tr]}function s(e,i){let t=So(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=i();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var vo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(vo,"<\\/$1")}import Or from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,i){this.maxSize=e,this.options=i??null,this.sizes=i?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 i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}set(e,i){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(i):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 o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,i),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let i=this.sizes.get(e);if(i!==void 0)this.bytes-=i,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,ko=500;function Tt(e,i){if(i?.includes("g"))return new RegExp(e,i);let t=`${e}:${i||""}`;if(!St.has(t)){if(St.size>=ko){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,i))}return St.get(t)}class Ar{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let i=Array.from(new Set(e)),t=i.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...i,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${E};
@@ -193,7 +193,7 @@ else {
193
193
  // STX: auto-generated event bindings
194
194
  ${e.map((t,o)=>oa(t,o)).join(`
195
195
  `)}`}function Nr(e){let i=[],t=new Set,o=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=o.length,c=0;while(c<h){let v=o[c];if(v==="'"||v==='"'||v==="`"){let E=v;if(c++,E==="`"){let R=0;while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]==="`"&&R===0){c++;break}if(o[c]==="$"&&o[c+1]==="{"){R++,c+=2;continue}if(o[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]===E){c++;break}c++}continue}if(v==="/"&&o[c+1]==="/"){while(c<h&&o[c]!==`
196
- `)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))i.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=O[0].length;continue}}c++}return i}var ca=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 la(e){let i=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ca.has(I))i.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return i}async function De(e,i={}){let t=e,o="",a=!1,h=[],c=Do(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=Mo(c.styles),E=It(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await s("stx/client-script-bundler",()=>import("./chunk-cs8wq7nv.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Y=Ka(t);t=Y.code,o=Ga(Y.stxImports,Y.browserImports.filter((ee)=>!h.includes(ee)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=aa(i.eventBindings||[]),M=(i.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=i.instanceId?` data-stx-instance="${i.instanceId}"`:"";if(N){let Y=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${Y?` ${Y}`:""}`;return`${v}<script ${ee}>
196
+ `)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))i.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=O[0].length;continue}}c++}return i}var ca=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 la(e){let i=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ca.has(I))i.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return i}async function De(e,i={}){let t=e,o="",a=!1,h=[],c=Do(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=Mo(c.styles),E=It(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await s("stx/client-script-bundler",()=>import("./chunk-qjv5tjmy.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Y=Ka(t);t=Y.code,o=Ga(Y.stxImports,Y.browserImports.filter((ee)=>!h.includes(ee)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=aa(i.eventBindings||[]),M=(i.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=i.instanceId?` data-stx-instance="${i.instanceId}"`:"";if(N){let Y=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${Y?` ${Y}`:""}`;return`${v}<script ${ee}>
197
197
  ${an(`${o}${t}
198
198
  ${O}`)}
199
199
  </script>`}let P=Jo(e),q=/function __stx_setup_/.test(t),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function W(Y){let ee=Y.length>0?`
@@ -286,8 +286,8 @@ ${R.join(`
286
286
  `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(o!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let q=P.trim().split(":");return q[q.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))i.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))i.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))i.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))i.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){o++,a++;continue}if(e[a]==="}"){o--,a++;continue}if(o===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return i}function ml(e){let i=[],t=0,o=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)i.push(e.slice(o,h)),o=h+1}if(o<e.length)i.push(e.slice(o));return i}function hl(e){let i=0,t=null;for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a==="="&&i===0){let h=e[o-1],c=e[o+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return o}}return-1}function xl(e,i){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let o=t.index-1;while(o>=0&&/\s/.test(e[o]))o--;if(e[o]!=="}")return;let a=o,h=0,c=-1;for(;o>=0;o--){let E=e[o];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=o;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of ml(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=hl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(i[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(i).filter(Dt),I=Function(...N,`"use strict"; return (${M});`);i[O]=I(...N.map((P)=>i[P]))}catch{}}}catch{}}var bl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function su(e,i){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 o=t[2].toLowerCase();if(!bl.has(o))return null;let a=new RegExp(`<\\/?${o}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=se(e,(R,C)=>(a.lastIndex=C,a.exec(R)?.index===C?a.lastIndex:-1));if(o==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,v=!1;for(let R of h){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;v=!0;break}}if(!v)return null;let E=t[0].length;return e.slice(0,E)+i+e.slice(E)}async function pr(e,i,t,o,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),v=t.__importedComponents;if(v){for(let te of[h,h.toLowerCase(),c(h),j(h)])if(v.has(te))return!0}let E=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],R=typeof a.root==="string"?le.resolve(a.root):void 0,C=R??le.dirname(o),O=[],M=(te)=>{if(te&&!O.includes(te))O.push(te)},N=t.__originalFilePath;if(N)M(le.join(le.dirname(N),"components"));M(i),M(a._rootComponentsDir),M(le.join(le.dirname(o),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===h.toLowerCase());if(!I)for(let te of a._targetComponentDirs??[])M(te);if(R)M(le.resolve(R,"resources/views/components")),M(le.resolve(R,"resources/components")),M(le.resolve(R,"src/components")),M(le.resolve(R,"components"));for(let te of a._layerComponentDirs??[])M(te);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let te of P)M(typeof te==="string"?te:null);if(M(a.fallbackComponentsDir),I)for(let te of a._targetComponentDirs??[])M(te);if(h.startsWith("./")||h.startsWith("../"))return n(le.resolve(le.dirname(o),`${h}.stx`));let q=Wi(le.resolve(import.meta.dir,"components")),Z=O.map((te)=>le.isAbsolute(te)?te:le.resolve(C,te)),W=`${E.join("\x00")}\x00\x00${Z.join("\x00")}`,Y=Us.get(W);if(Y!==void 0)return Y;let ee=!1;e:for(let te of Z){if(Wi(te)===q)continue;for(let ae of E)if(await n(le.join(te,ae))){ee=!0;break e}}return Us.set(W,ee),ee}function Wi(e){let i=Hs.get(e);if(i!==void 0)return i;let t=e;try{t=qs.realpathSync(e)}catch{}return Hs.set(e,t),t}function ou(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Xa(e){if(!e)return!1;let i=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(i)}function yl(e,i,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let o=(a,h)=>{let c;try{c=_(a,i)}catch{return h}if(c===void 0||c===null)return"";let v=String(c);if(/<\/style/i.test(v))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 v};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>o(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>o(h,a))}var Fi=new Set;function Vi(e,i,t,o){let a=`${e}\x00${i}\x00${o??""}`;if(!process.env.STX_DEBUG&&Fi.has(a))return;Fi.add(a);let h=i?` used in ${i}`:"",c=o?` Cause: ${o}.`:"",v=t.length>0?`
287
287
  searched:
288
288
  ${t.map((E)=>` - ${E}`).join(`
289
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Ui(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function jo(e){let i=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)i.add(a[1]);t.lastIndex=0}return[...i]}async function je(e,i,t,o,a,h,c,v=new Set,E,R=et(a),C,O=e){let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-whzvx5w5.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof i.client==="string"?i.client.trim():"";if("client"in i)delete i.client;let q=P&&P!=="load"&&ou(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),W=O.endsWith(".stx")?O.slice(0,-4):O,Y=null,ee=a.__importedComponents;if(ee){let ce=[W,W.toLowerCase(),Z(W),j(W)];for(let ie of ce)if(ee.has(ie)){Y=ee.get(ie);break}}let te=[];if(!Y){let ce=[`${W}.stx`,`${Z(W)}.stx`,`${j(W)}.stx`],ie=[...new Set(ce)],he=a.__originalFilePath,xe=[];if(xe.push(...c._layerComponentDirs??[]),he){let _e=le.join(le.dirname(he),"components");xe.push(_e)}if(o)xe.push(o);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!xe.includes(Ke))xe.push(Ke);let We=le.join(le.dirname(h),"components");if(!xe.includes(We))xe.push(We);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(W),ot=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),at=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),bt=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!ot.includes("valuechange")&&(at||ot.includes("change")&&!bt),Gn=c._nativeHostAttrs&&/^textinput$/i.test(W),yt=ot.includes("update:value")&&!ot.includes("input"),Ut=c._nativeHostAttrs&&/^video$/i.test(W),wn=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=Ut&&wn&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Ht=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===W.toLowerCase())&&(!it||_n)&&(!Gn||yt)&&(!Ut||$n);for(let _e of Ht?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let _t=typeof c.root==="string"?le.resolve(c.root):void 0,oo=_t??le.dirname(h),wt=[];if(_t)wt.push(le.resolve(_t,"resources/views/components")),wt.push(le.resolve(_t,"resources/components")),wt.push(le.resolve(_t,"src/components")),wt.push(le.resolve(_t,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let _e of wt)if(!xe.includes(_e))xe.push(_e);let tr=c._pluginComponentDirs;if(Array.isArray(tr)){for(let _e of tr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(c.fallbackComponentsDir&&!xe.includes(c.fallbackComponentsDir))xe.push(c.fallbackComponentsDir);if(Ht){for(let _e of c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let nr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(oo,_e)}))];xe.length=0,xe.push(...nr);let Yn=`${W}\x00${h}\x00${nr.join("\x00")}`,Qn=Un.get(Yn);if(Qn)if(await n(Qn))Y=Qn;else Un.delete(Yn);if(!Y&&(W.startsWith("./")||W.startsWith("../")))Y=le.resolve(le.dirname(h),`${W}.stx`),te.push(Y);else if(!Y)for(let _e of xe){if(!_e)continue;for(let vn of ie){let En=le.join(_e,vn);if(te.push(En),await n(En)){Y=En;break}}if(Y)break;if(!Y)try{let vn=await import("fs");if(!vn.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let ao=8,es=[{path:_e,depth:0}];while(es.length>0&&!Y){let kn=es.pop();if(kn.depth>=ao)continue;let sr;try{sr=vn.readdirSync(kn.path,{withFileTypes:!0})}catch{continue}for(let Rn of sr){if(!Rn.isDirectory())continue;if(Rn.name==="node_modules"||Rn.name.startsWith("."))continue;let rr=le.join(kn.path,Rn.name);for(let co of ie){let ts=le.join(rr,co);if(te.push(ts),await n(ts)){Y=ts;break}}if(Y)break;es.push({path:rr,depth:kn.depth+1})}}}catch{}if(Y)break}if(Y)Un.set(Yn,Y)}if(!Y||!await n(Y))return Vi(e,h,te),Ui(e);E.add(Y);let ae;if(Qt.has(Y))ae=Qt.get(Y);else try{ae=await Bun.file(Y).text(),Qt.set(Y,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Vi(e,h,[Y],ie),Ui(e)}if(C)for(let ce of new Set([...Object.keys(i),...C.reactiveProps??[]])){let ie=ce.toLowerCase();if(ie.startsWith("aria-")||ie.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))C.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))C.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",In,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ke={};for(let[ce,ie]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))ke[ce]=ie;let Re=R.length>0?{[Bn]:[...R]}:{},Ve=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-jk7chxkt.js"));Ve=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ve)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-n63r9b4f.js"));Ve=await ce(Ve,{...a,__processedComponents:N,...Re},h,c,E)}let Te=[];if(Xa(Ve)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-q1jcf6vm.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ve=ce(Ve,ie,h);for(let he of Ve.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(he[1].trim())}let Ze=K(Ve),Ye=[],mt=Ze.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,ie)=>{let he=Ze.scripts[Number(ie)]||"",xe=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),We=!Ke||["module","text/javascript","application/javascript"].includes(Ke),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&We&&!it)return Ye.push(he),"";return he}),{extractSlotContent:Zn}=await s("stx/slots",()=>import("./chunk-cdbaanmx.js")),lt=Zn(mt),ut={};if(lt.defaultSlot?.trim())ut.default=lt.defaultSlot;for(let[ce,ie]of lt.namedSlots)ut[ce]=ie.content;let ft=a.__stx_scope_seq??={n:0,key:bs(String(a.__filename??h))},Mt=Ki(e,process.cwd()),nt=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ue={...ke,$uid:nt,$native:c._nativeHostAttrs===!0,...i,props:i,slot:mt,$slots:ut,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Xa(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};xl(ae,Ue);let jt=ae,tn=ue(jt);if(tn)jt=tn.content.trim();let qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Nt=[...ae.matchAll(qn)];for(let[,ce,ie]of Nt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Pe(ie,Y,c.strict);let Je=[],Lt=null,Xn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),ht=null,Qe=null,Bt=null,nn=0,zt=null;if(ul(c),Xn&&Ks>0){let ce=fl({props:i,slot:Ve,slotContext:t.trim()?pl(ke):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ie)=>ie.configFile),uid:nt});if(ce!==null){ht=`${Y}\x00${w(ae)}\x00${ce}`;let ie=Hn.get(ht);if(ie){for(let he of ie.dependencies)E.add(he);if(Fr(a,ie.clientFactories),ft.n+=ie.uidsConsumed,ie.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of ie.preservedClientExpressions)he.add(xe);a.__stx_preserved_client_expressions=[...he]}return ie.output}Qe=new Set(E),Bt=zr(a),nn=ft.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of Nt){let ie=ce[1]||"",he=ce[2]||"",xe=ie.includes("server");if(Me(ie)&&he.trim())he=Le(he);if(xe&&he){for(let We of Oe(he))Wt.add(We);try{await M(he,Ue,Y,{onFailure:(We)=>{if(We.kind!=="unknown")Lt=We.kind}})}catch(We){}}if(!xe){let We=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=We.includes("{{")&&We.includes("}}"),ot=We.includes("{!!")&&We.includes("!!}");if(it||ot)We=Fo(We,Ue,Y);let at=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${at}>${We}</script>`)}}let qe=K(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Jn=qe?qe[2]:"",tt="",Q=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${yl(Jn,Ue,Y)}</style>`;let ne=jt;if(ne=ne.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)ne=ne.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(ne=ne.replace(ce,(he,xe)=>{let Ke=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)ie.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),ne=ne.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
290
- `)}`}if(t&&ne.includes("{{ text || slot }}"))ne=ne.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-cdbaanmx.js")),{defaultSlot:ye,namedSlots:Ee}=lt,Fe=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),pt=(ce)=>Fe?xi(ce,nt):ce,er=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:pt(ie.content)}]));ne=await ge(ne,pt(ye),er,Ue,Fe?nt:"");let sn=jo(Je),rn=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(sn.length>0||rn.length>0)Ue.__stx_client_signal_names=[...new Set([...rn,...sn])];else delete Ue.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Ue[Bn]=Vt;let xn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Y),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Fe||Je.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:bn}=await s("stx/process",()=>import("./chunk-wk1gt95z.js")),rt=await bn(ne,Ue,Y,xn,E),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of rt.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ce[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let Xe=nt,He=rt;if(Fe){let ce="";if(Object.keys(i).length>0)try{ce=` data-stx-props="${Fs(JSON.stringify(i))}"`}catch{}let ie=q?` stx-hydrate="${Fs(q)}"`:"",he=Object.fromEntries(Object.entries(ut).map(([at,bt])=>[at,Boolean(bt)])),xe=Object.keys(he).length>0?` data-stx-slots="${Fs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,We=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(rt),it=We?"span":"div";He=su(rt,Ke)??`<${it}${Ke} data-stx-component-wrapper${We?' style="display:contents"':""}>${rt}</${it}>`;let ot=await Promise.all(Je.map(async(at)=>{let bt=at.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!bt)return at;let[,_n,Gn]=bt,yt=await Sl(Gn,Y,c.buildMode==="compile"),Ut=fn(yt.clientCode,Ne(Ue)),{vendorStyleTags:wn}=yt,Sn=Ut?`function(__scopeId) {
289
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Ui(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function jo(e){let i=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)i.add(a[1]);t.lastIndex=0}return[...i]}async function je(e,i,t,o,a,h,c,v=new Set,E,R=et(a),C,O=e){let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-r1v1496g.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof i.client==="string"?i.client.trim():"";if("client"in i)delete i.client;let q=P&&P!=="load"&&ou(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),W=O.endsWith(".stx")?O.slice(0,-4):O,Y=null,ee=a.__importedComponents;if(ee){let ce=[W,W.toLowerCase(),Z(W),j(W)];for(let ie of ce)if(ee.has(ie)){Y=ee.get(ie);break}}let te=[];if(!Y){let ce=[`${W}.stx`,`${Z(W)}.stx`,`${j(W)}.stx`],ie=[...new Set(ce)],he=a.__originalFilePath,xe=[];if(xe.push(...c._layerComponentDirs??[]),he){let _e=le.join(le.dirname(he),"components");xe.push(_e)}if(o)xe.push(o);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!xe.includes(Ke))xe.push(Ke);let We=le.join(le.dirname(h),"components");if(!xe.includes(We))xe.push(We);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(W),ot=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),at=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),bt=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!ot.includes("valuechange")&&(at||ot.includes("change")&&!bt),Gn=c._nativeHostAttrs&&/^textinput$/i.test(W),yt=ot.includes("update:value")&&!ot.includes("input"),Ut=c._nativeHostAttrs&&/^video$/i.test(W),wn=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=Ut&&wn&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Ht=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===W.toLowerCase())&&(!it||_n)&&(!Gn||yt)&&(!Ut||$n);for(let _e of Ht?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let _t=typeof c.root==="string"?le.resolve(c.root):void 0,oo=_t??le.dirname(h),wt=[];if(_t)wt.push(le.resolve(_t,"resources/views/components")),wt.push(le.resolve(_t,"resources/components")),wt.push(le.resolve(_t,"src/components")),wt.push(le.resolve(_t,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let _e of wt)if(!xe.includes(_e))xe.push(_e);let tr=c._pluginComponentDirs;if(Array.isArray(tr)){for(let _e of tr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(c.fallbackComponentsDir&&!xe.includes(c.fallbackComponentsDir))xe.push(c.fallbackComponentsDir);if(Ht){for(let _e of c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let nr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(oo,_e)}))];xe.length=0,xe.push(...nr);let Yn=`${W}\x00${h}\x00${nr.join("\x00")}`,Qn=Un.get(Yn);if(Qn)if(await n(Qn))Y=Qn;else Un.delete(Yn);if(!Y&&(W.startsWith("./")||W.startsWith("../")))Y=le.resolve(le.dirname(h),`${W}.stx`),te.push(Y);else if(!Y)for(let _e of xe){if(!_e)continue;for(let vn of ie){let En=le.join(_e,vn);if(te.push(En),await n(En)){Y=En;break}}if(Y)break;if(!Y)try{let vn=await import("fs");if(!vn.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let ao=8,es=[{path:_e,depth:0}];while(es.length>0&&!Y){let kn=es.pop();if(kn.depth>=ao)continue;let sr;try{sr=vn.readdirSync(kn.path,{withFileTypes:!0})}catch{continue}for(let Rn of sr){if(!Rn.isDirectory())continue;if(Rn.name==="node_modules"||Rn.name.startsWith("."))continue;let rr=le.join(kn.path,Rn.name);for(let co of ie){let ts=le.join(rr,co);if(te.push(ts),await n(ts)){Y=ts;break}}if(Y)break;es.push({path:rr,depth:kn.depth+1})}}}catch{}if(Y)break}if(Y)Un.set(Yn,Y)}if(!Y||!await n(Y))return Vi(e,h,te),Ui(e);E.add(Y);let ae;if(Qt.has(Y))ae=Qt.get(Y);else try{ae=await Bun.file(Y).text(),Qt.set(Y,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Vi(e,h,[Y],ie),Ui(e)}if(C)for(let ce of new Set([...Object.keys(i),...C.reactiveProps??[]])){let ie=ce.toLowerCase();if(ie.startsWith("aria-")||ie.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))C.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))C.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",In,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ke={};for(let[ce,ie]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))ke[ce]=ie;let Re=R.length>0?{[Bn]:[...R]}:{},Ve=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-8z8w9rxc.js"));Ve=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ve)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-tjqyhgh2.js"));Ve=await ce(Ve,{...a,__processedComponents:N,...Re},h,c,E)}let Te=[];if(Xa(Ve)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-01cx2p82.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ve=ce(Ve,ie,h);for(let he of Ve.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(he[1].trim())}let Ze=K(Ve),Ye=[],mt=Ze.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,ie)=>{let he=Ze.scripts[Number(ie)]||"",xe=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),We=!Ke||["module","text/javascript","application/javascript"].includes(Ke),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&We&&!it)return Ye.push(he),"";return he}),{extractSlotContent:Zn}=await s("stx/slots",()=>import("./chunk-adyseb6y.js")),lt=Zn(mt),ut={};if(lt.defaultSlot?.trim())ut.default=lt.defaultSlot;for(let[ce,ie]of lt.namedSlots)ut[ce]=ie.content;let ft=a.__stx_scope_seq??={n:0,key:bs(String(a.__filename??h))},Mt=Ki(e,process.cwd()),nt=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ue={...ke,$uid:nt,$native:c._nativeHostAttrs===!0,...i,props:i,slot:mt,$slots:ut,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Xa(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};xl(ae,Ue);let jt=ae,tn=ue(jt);if(tn)jt=tn.content.trim();let qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Nt=[...ae.matchAll(qn)];for(let[,ce,ie]of Nt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Pe(ie,Y,c.strict);let Je=[],Lt=null,Xn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),ht=null,Qe=null,Bt=null,nn=0,zt=null;if(ul(c),Xn&&Ks>0){let ce=fl({props:i,slot:Ve,slotContext:t.trim()?pl(ke):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ie)=>ie.configFile),uid:nt});if(ce!==null){ht=`${Y}\x00${w(ae)}\x00${ce}`;let ie=Hn.get(ht);if(ie){for(let he of ie.dependencies)E.add(he);if(Fr(a,ie.clientFactories),ft.n+=ie.uidsConsumed,ie.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of ie.preservedClientExpressions)he.add(xe);a.__stx_preserved_client_expressions=[...he]}return ie.output}Qe=new Set(E),Bt=zr(a),nn=ft.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of Nt){let ie=ce[1]||"",he=ce[2]||"",xe=ie.includes("server");if(Me(ie)&&he.trim())he=Le(he);if(xe&&he){for(let We of Oe(he))Wt.add(We);try{await M(he,Ue,Y,{onFailure:(We)=>{if(We.kind!=="unknown")Lt=We.kind}})}catch(We){}}if(!xe){let We=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=We.includes("{{")&&We.includes("}}"),ot=We.includes("{!!")&&We.includes("!!}");if(it||ot)We=Fo(We,Ue,Y);let at=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${at}>${We}</script>`)}}let qe=K(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Jn=qe?qe[2]:"",tt="",Q=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${yl(Jn,Ue,Y)}</style>`;let ne=jt;if(ne=ne.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)ne=ne.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(ne=ne.replace(ce,(he,xe)=>{let Ke=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)ie.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),ne=ne.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
290
+ `)}`}if(t&&ne.includes("{{ text || slot }}"))ne=ne.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-adyseb6y.js")),{defaultSlot:ye,namedSlots:Ee}=lt,Fe=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),pt=(ce)=>Fe?xi(ce,nt):ce,er=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:pt(ie.content)}]));ne=await ge(ne,pt(ye),er,Ue,Fe?nt:"");let sn=jo(Je),rn=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(sn.length>0||rn.length>0)Ue.__stx_client_signal_names=[...new Set([...rn,...sn])];else delete Ue.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Ue[Bn]=Vt;let xn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Y),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Fe||Je.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:bn}=await s("stx/process",()=>import("./chunk-yaej3mgj.js")),rt=await bn(ne,Ue,Y,xn,E),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of rt.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ce[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let Xe=nt,He=rt;if(Fe){let ce="";if(Object.keys(i).length>0)try{ce=` data-stx-props="${Fs(JSON.stringify(i))}"`}catch{}let ie=q?` stx-hydrate="${Fs(q)}"`:"",he=Object.fromEntries(Object.entries(ut).map(([at,bt])=>[at,Boolean(bt)])),xe=Object.keys(he).length>0?` data-stx-slots="${Fs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,We=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(rt),it=We?"span":"div";He=su(rt,Ke)??`<${it}${Ke} data-stx-component-wrapper${We?' style="display:contents"':""}>${rt}</${it}>`;let ot=await Promise.all(Je.map(async(at)=>{let bt=at.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!bt)return at;let[,_n,Gn]=bt,yt=await Sl(Gn,Y,c.buildMode==="compile"),Ut=fn(yt.clientCode,Ne(Ue)),{vendorStyleTags:wn}=yt,Sn=Ut?`function(__scopeId) {
291
291
  ${Ut}
292
292
  return (${yt.factoryBody})(__scopeId);
293
293
  }`:yt.factoryBody,$n=q?null:Ss(a,Sn),Ht=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(Xe)});`:`(${Sn})(${JSON.stringify(Xe)});`;if(q)return`${wn}<script type="stx/island" data-stx-island="${Xe}" data-stx-scoped data-stx-owner="${Xe}"${_n}>${Ht}</script>`;return`${wn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Xe}"${_n}>${Ht}</script>`}));if(He=He+`
@@ -313,7 +313,7 @@ ${$e.yellow}${$e.bold}Message:${$e.reset} ${i}
313
313
  `,v)C+=`
314
314
  ${$e.blue}${$e.bold}Context:${$e.reset}
315
315
  ${$e.dim}${v}${$e.reset}
316
- `;return C}function pe(){Qt.clear(),Un.clear(),Us.clear(),Hs.clear(),Hn.clear()}function Ip(){return{size:Qt.size,maxSize:500}}var Vs=b(128);async function Sl(e,i,t){let o=w(e,i,t),a=Vs.get(o);if(a){if(us(a.deps))return a;Vs.delete(o)}let h=Do(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=Mo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-cs8wq7nv.js")),C=[],O=!1;if(E(c)){let W=c;c=await R(W,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===W}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-fd72t30s.js"));c=M(c);let N=T(c),I=gl(N),P=new Set(L(N,!0).split(",").map((W)=>W.trim())),q=`function(__scopeId) {
316
+ `;return C}function pe(){Qt.clear(),Un.clear(),Us.clear(),Hs.clear(),Hn.clear()}function Ip(){return{size:Qt.size,maxSize:500}}var Vs=b(128);async function Sl(e,i,t){let o=w(e,i,t),a=Vs.get(o);if(a){if(us(a.deps))return a;Vs.delete(o)}let h=Do(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=Mo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-qjv5tjmy.js")),C=[],O=!1;if(E(c)){let W=c;c=await R(W,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===W}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-je8t9yka.js"));c=M(c);let N=T(c),I=gl(N),P=new Set(L(N,!0).split(",").map((W)=>W.trim())),q=`function(__scopeId) {
317
317
  ${st("const",[...lc,...I],N)}
318
318
  const __scope = window.stx._scopes = window.stx._scopes || {};
319
319
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{pp,Cl,Ke,ia,fp,jr,Br,Fr}from"./chunk-304dbbsw.js";import"./chunk-ehzd1yc6.js";import"./chunk-xnx06qqt.js";import"./chunk-dxh45gve.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{fp as clearOnceStore,ia as onceStore,Ke as partialsCache,jr as processIncludes,Br as processStackPushDirectives,Fr as processStackReplacements,pp as resetUnscopedSignalWarnings,Cl as topLevelElements};
2
+ import{pp,Cl,Ke,ia,fp,jr,Br,Fr}from"./chunk-tqc86aaw.js";import"./chunk-r9p7r6mx.js";import"./chunk-xnx06qqt.js";import"./chunk-dxh45gve.js";import"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{fp as clearOnceStore,ia as onceStore,Ke as partialsCache,jr as processIncludes,Br as processStackPushDirectives,Fr as processStackReplacements,pp as resetUnscopedSignalWarnings,Cl as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Fc,Qu,zc,Hc,ed,td}from"./chunk-fbrgz3s8.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{td as applySlots,ed as extractSlotContent,Qu as parseSlotElement,Fc as parseSlots,Hc as processSlots,zc as renderSlot};
2
+ import{Fc,Qu,zc,Hc,ed,td}from"./chunk-efpd1yyg.js";import"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{td as applySlots,ed as extractSlotContent,Qu as parseSlotElement,Fc as parseSlots,Hc as processSlots,zc as renderSlot};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{le}from"./chunk-f26n6y9p.js";import{Be,A}from"./chunk-9wdd7eq6.js";import{wa}from"./chunk-q3gactm1.js";import{c}from"./chunk-mf19qxgv.js";import S from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function en(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!S.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((y)=>y.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((y,I)=>{let v=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(y);if(v){if(r.has(v[2])||v[1]&&I!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(v[2]),`:${v[2]}${v[1]?"*":""}`}if(!/^[\w-]+$/.test(y))throw Error(`Unsupported API path segment ${y} in ${e}`);return y}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(o,e);P.add(m.resolve(R)),P.add(S.realpathSync(R)),i.push({pattern:w,method:g,filePath:R})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Js(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=le(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
3
  `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Ys(s,l,o={}){let i=en(s,o);await Js(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Zs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function ap(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Js(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Js(s,t);let{loadStxConfig:e}=await import("./chunk-xk7cp691.js"),a=A((await e(s)).runtimeConfig);return await Be(a,()=>j(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
4
+ `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Zs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function ap(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Js(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Js(s,t);let{loadStxConfig:e}=await import("./chunk-ztebv7c0.js"),a=A((await e(s)).runtimeConfig);return await Be(a,()=>j(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Qs(s,l,o){if(wa(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(S.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return S.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
6
6
  export{en,Js,Ys,Zs,ap,Qs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{To,$a,s,Tt,re,S,Pe,cn,Ie,de,K,cr,ln,gs,Ba,dn,dr,hs,ys,Fa,Oo,za,Ha,Va,Ua,Ne,De,bs,je,n,gn,m,d,H,J,we,k,_}from"./chunk-z35ftpqp.js";import{l,p,E,t,ie,V,a,xe,Uo,D,bn,Wo,Lt,qo,rc,mr,sc,rt,oc,hr,ic,vn,Ko,ac,yr,vr,Se,Go}from"./chunk-qwdcts9w.js";import{Nt}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-sqh3tvtw.js";import{h}from"./chunk-551s7ha0.js";import{rr,ss}from"./chunk-f26n6y9p.js";import{pa,fa,er,Je,ga,R}from"./chunk-245sas8r.js";import{bo,vo,wo,xo}from"./chunk-y34tyrpb.js";import{aa,Hr}from"./chunk-ehzd1yc6.js";import{jr,Br,Fr}from"./chunk-304dbbsw.js";import{Vr,lo,uo,Ur,Wr,po}from"./chunk-n94ts3t9.js";import{Lr,Gn}from"./chunk-j60jye3e.js";import{to}from"./chunk-078qg8r5.js";import{ne,oo,io,ao}from"./chunk-xnx06qqt.js";import{Jn,he,la,Yn,ua}from"./chunk-5v7vm8cv.js";import{q,Ge}from"./chunk-a2zb5fgg.js";import{ma,ha}from"./chunk-d4ch6exz.js";import{C,wn,Xo}from"./chunk-hh58k0nh.js";import ds from"fs";import ce from"path";function lt(){return`
2
+ import{To,$a,s,Tt,re,S,Pe,cn,Ie,de,K,cr,ln,gs,Ba,dn,dr,hs,ys,Fa,Oo,za,Ha,Va,Ua,Ne,De,bs,je,n,gn,m,d,H,J,we,k,_}from"./chunk-7dnpjrqp.js";import{l,p,E,t,ie,V,a,xe,Uo,D,bn,Wo,Lt,qo,rc,mr,sc,rt,oc,hr,ic,vn,Ko,ac,yr,vr,Se,Go}from"./chunk-qwdcts9w.js";import{Nt}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-wkkmk4aa.js";import{h}from"./chunk-x5sjsf3b.js";import{rr,ss}from"./chunk-f26n6y9p.js";import{pa,fa,er,Je,ga,R}from"./chunk-2t51tpkc.js";import{bo,vo,wo,xo}from"./chunk-y34tyrpb.js";import{aa,Hr}from"./chunk-r9p7r6mx.js";import{jr,Br,Fr}from"./chunk-tqc86aaw.js";import{Vr,lo,uo,Ur,Wr,po}from"./chunk-mhacarm5.js";import{Lr,Gn}from"./chunk-gjdpdvw5.js";import{to}from"./chunk-078qg8r5.js";import{ne,oo,io,ao}from"./chunk-xnx06qqt.js";import{Jn,he,la,Yn,ua}from"./chunk-hh2dcnsx.js";import{q,Ge}from"./chunk-a2zb5fgg.js";import{ma,ha}from"./chunk-hejx7gbs.js";import{C,wn,Xo}from"./chunk-hh58k0nh.js";import ds from"fs";import ce from"path";function lt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -854,13 +854,13 @@ ${I}
854
854
  </style>`;i=i.replace(x,P),v.lastIndex=0}catch(I){}}}return i}import it from"path";var cs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ls=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function us(c,e){if(!e||!c.includes("/"))return c;let u=it.dirname(e);return c.replace(cs,(i,g,r,f)=>{let v=it.resolve(u,f);return`${g}${r}${v.split(it.sep).join("/")}${r}`})}function un(c,e){if(!e||!c.includes("<script"))return c;return c.replace(ls,(u,i,g,r)=>`${i}${us(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function pn(c){return c.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sn(c,e){let u=c.length,i=e,g=!0,r=[],f=(v)=>v+9<=u&&c[v]==="<"&&c[v+1]==="/"&&(c[v+2]==="s"||c[v+2]==="S")&&(c[v+3]==="c"||c[v+3]==="C")&&(c[v+4]==="r"||c[v+4]==="R")&&(c[v+5]==="i"||c[v+5]==="I")&&(c[v+6]==="p"||c[v+6]==="P")&&(c[v+7]==="t"||c[v+7]==="T")&&(c[v+8]===">"||/\s/.test(c[v+8]));while(i<u){let v=c[i];if(f(i))return i;if(v==="/"&&c[i+1]==="/"){if(i=c.indexOf(`
855
855
  `,i+2),i===-1)return-1;i+=1,g=!0;continue}if(v==="/"&&c[i+1]==="*"){let y=c.indexOf("*/",i+2);if(y===-1)return-1;i=y+2,g=!0;continue}if(v==="/"&&g){let y=i+1,x=!1;while(y<u){let b=c[y];if(b==="\\"){y+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){y++;break}else if(b===`
856
856
  `){y=-1;break}y++}if(y===-1){i++,g=!1;continue}while(y<u&&/[a-z]/.test(c[y]))y++;i=y,g=!1;continue}if(v==="'"||v==='"'){let y=v;i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]===y){i++;break}if(c[i]===`
857
- `)break;i++}g=!1;continue}if(v==="`"){i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++,g=!1;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;i++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!i)return null;let g=i.index+i[0].length,r=c.indexOf("</script>",g);if(r===-1)return null;let f=c.indexOf(">",r);if(f===-1)return null;return{start:i.index,end:f+1}}var ps=4096;async function fn(c,e,u){if(u.buildMode!=="serve"||e.length<ps)return null;let{registerServeModuleBundle:i}=await import("./chunk-c4enpsj8.js");return`<script ${c} src="${i(e)}"></script>`}async function Un(c,e,u){try{let{registeredModuleIdsIn:i,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-sptewgky.js")),r=[],f=await g(i(...c),{minify:Xo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-c4enpsj8.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function fs(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let i=Jn(c);if(i===-1||i===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(i<u.start)return c.slice(0,i)+c.slice(u.start,u.end)+e+`
857
+ `)break;i++}g=!1;continue}if(v==="`"){i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++,g=!1;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;i++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!i)return null;let g=i.index+i[0].length,r=c.indexOf("</script>",g);if(r===-1)return null;let f=c.indexOf(">",r);if(f===-1)return null;return{start:i.index,end:f+1}}var ps=4096;async function fn(c,e,u){if(u.buildMode!=="serve"||e.length<ps)return null;let{registerServeModuleBundle:i}=await import("./chunk-hkfabb1e.js");return`<script ${c} src="${i(e)}"></script>`}async function Un(c,e,u){try{let{registeredModuleIdsIn:i,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-mzcf1dr1.js")),r=[],f=await g(i(...c),{minify:Xo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-hkfabb1e.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function fs(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let i=Jn(c);if(i===-1||i===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(i<u.start)return c.slice(0,i)+c.slice(u.start,u.end)+e+`
858
858
  `+c.slice(i,u.start)+c.slice(u.end);let g=c.slice(u.start,u.end),r=c.slice(0,u.start)+c.slice(u.end),f=Jn(r);if(f===-1)return g+e+`
859
859
  `+r;return r.slice(0,f)+g+e+`
860
860
  `+r.slice(f)}function ms(c){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return c.replace(e,(u,i,g)=>{let r=c.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${i}}}`:`{<!--stx-literal-->{${i}}}`})}async function o(c,e,u,i,g){if(i.ssr===!1&&!i.autoShell&&i.buildMode==="spa")return c;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(c,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of i._layerGraph?.configDependencies??[])g.add(f);if(r&&i.runtimeConfig)await hn(e,u,i.runtimeConfig);if(r)Va(e),e.__stx_scope_seq??={n:0,key:bs(String(e.__filename??u))},e.__stx_head_injections=qo(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((i.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))to(c,u);try{return await re.timeAsync("template-processing",async()=>{let f=await vs(c,e,u,i,g);if(r)f=Oo(f);if(r&&i.autoShell&&i.buildMode!=="compile"){let v=Se(i.app?.head,{known:vr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Go(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?k(A,e,u):void 0,M=x.title||w||O,I=!x.title&&(!!w||!!O),P=x.meta||[],N=new Set(P.map((X)=>rt(X)).filter(Boolean)),U={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((X)=>!N.has(rt(X))),...P],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
861
861
  `),...x.htmlAttrs&&{htmlAttrs:oc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},W=Ko(f);if(f=yr(f,U,{...I&&{titleIsHtml:!0},...i.app?.colorMode&&{colorMode:i.app.colorMode}},W),W)f=ac(f,v),f=hr(f,U.htmlAttrs);let L=f.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&f.includes("<head")){let X=L[1],G=ss(X);f=f.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
862
862
  <meta name="stx-layout" content="${pn(X)}">
863
- <meta name="stx-layout-group" content="${pn(G)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),B=j?q(f):null;if(j&&B&&!/\bdata-stx=/.test(B.tag)){f=Ge(f,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let X=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(X,"$1")}}if(r){let v=e.__stx_head_injections??qo(),y=ic(f);if(y!==null)v.beforeClose.push(y);let x=tn(f);if(x!==null)v.afterOpen.push(x);if(i.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=rc(f,v);let b=i.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-jjet6qxq.js")),M=i.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await fn("data-stx-stores",I,i)??b}catch{}y=await Un([f,b],i,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-g12ht81a.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-1e73whqh.js")),M=i.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(i._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,i)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
863
+ <meta name="stx-layout-group" content="${pn(G)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),B=j?q(f):null;if(j&&B&&!/\bdata-stx=/.test(B.tag)){f=Ge(f,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let X=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(X,"$1")}}if(r){let v=e.__stx_head_injections??qo(),y=ic(f);if(y!==null)v.beforeClose.push(y);let x=tn(f);if(x!==null)v.afterOpen.push(x);if(i.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=rc(f,v);let b=i.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-08d4wb3x.js")),M=i.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await fn("data-stx-stores",I,i)??b}catch{}y=await Un([f,b],i,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-n1d2t5h4.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-j9pwgyf1.js")),M=i.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(i._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,i)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
864
864
  ${O}`).join("");f=fs(f,A)}else{let y=await Un([f],i,g);if(y){let x=f.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)f=f.slice(0,x)+y+`
865
865
  `+f.slice(x)}}if(r)f=sc(f);if(r&&e.__stx_inject_css!==!1)f=await h(f,void 0,i.buildMode==="serve",!0);else if(r)f=ln(f);if(f=f.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),f=ms(f),r&&e.__stx_runtime_config)f=Nt(f,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let v=dr(e);if(v){let y=/<head\b[^>]*>/i.exec(f),x=y?y.index+y[0].length:0;f=f.slice(0,x)+v+f.slice(x)}}return f})}catch(f){if(f instanceof V)throw f;let v=f instanceof Error?f.message:String(f),y=new ie(`Template processing failed: ${v}`,u,void 0,void 0,c.substring(0,200)+(c.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),bn.logDetailedError(y,{filePath:u,template:c.substring(0,500)}),C()&&!i.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(i.debug)throw y;return Uo.createFallbackContent("Template Processing",y)}}async function vs(c,e,u,i,g){let r=process.cwd(),f={...i,partialsDir:i.partialsDir&&!ce.isAbsolute(i.partialsDir)?ce.resolve(r,i.partialsDir):i.partialsDir,componentsDir:i.componentsDir&&!ce.isAbsolute(i.componentsDir)?ce.resolve(r,i.componentsDir):i.componentsDir,layoutsDir:i.layoutsDir&&!ce.isAbsolute(i.layoutsDir)?ce.resolve(r,i.layoutsDir):i.layoutsDir},v=f,y=c;await ks(u,e),xs(e,v),y=await xe(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=de(y,Ie,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=x.output;let b=x.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,B)=>b[Number(B)]??""),T="\x00STX_ESCAPED_AT\x00",A="\x00STX_ESC_MUSTACHE_OPEN\x00",O="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,T),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(L,j)=>`${A}${j}${O}`),y=Jt(y),y=await an(y,u,g);let M={};y=Br(y,M);let I={...e.__sections||{}},P="",N=mt(gt(c)),U=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let W=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)P=W[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
866
866
  ${y.trim()}
@@ -869,7 +869,7 @@ ${y.trim()}
869
869
  @endsection`}}if(P&&y.includes("<script")){let L=K(y),j=L.scripts.map((B)=>mn(B,u)??B);y=cr(L.output,j)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,j,B)=>(I[j]=B,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,j,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return L;try{let X=l(B.trim(),e);if(X===void 0)return L;let Y=(e.__stx_inline_section_values??=[]).push(X)-1;return I[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,B)=>{if(B.includes("@parent"))I[j]=B.replace("@parent",Te);else I[j]=B.trim();return""}),e.__sections=I,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,j,B)=>I[j]||B||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||"");if(y=Fr(y,M),P){let L=[],j=K(y),B=de(j.output,cn,(X,G)=>`\x00STX_ORPHAN_STYLE_${G}\x00`);if(y=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,G,Y)=>{let ee=G==="SCRIPT"?mn(j.scripts[Number(Y)],u):B.tokens[Number(Y)];if(ee)L.push(ee);return""}),L.length>0){let X=L.join(`
870
870
  `);I.content=I.content?`${I.content}
871
871
  ${X}`:X,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await xe(()=>gn(P,u,f,g),null,()=>{throw new ie(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ee=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return ds.readdirSync(ae).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(f.layoutsDir),...ee(f.fallbackLayoutsDir)].filter((oe,ae,le)=>le.indexOf(oe)===ae).sort(),ue=`Layout not found: ${P} (referenced from ${u})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:f.layoutsDir?`. No .stx layouts found in ${f.layoutsDir}`:"");if(D.log(Error(ue),{layoutPath:P,filePath:u,available:te},"error"),console.error(`[stx] ${ue}`),f.debug)throw new ie(ue,u);return y}let j=await xe(()=>Bun.file(L).text(),"",()=>{throw new ie(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=un(j,L);let B=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(f.debug)console.log(`Found nested layout: ${B[1]} in ${L}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,le,be)=>(ee[le]=be.trim(),""));for(let[ae,le]of Object.entries(ee))if(I[ae]&&I[ae].includes(Te)){let be=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,be)+le+I[ae].slice(be+Te.length)}else if(!I[ae])I[ae]=le;let ue={...e,__sections:I},oe=`@layout('${B[1]}')${te}`;return await o(oe,ue,L,f,g)}let X=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Br(X,M),Y={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(I[te]){let oe=I[te];if(oe.includes(Te)){let ae=Y[te]||"",le=oe.indexOf(Te);oe=oe.slice(0,le)+ae+oe.slice(le+Te.length)}return oe}return ue||""}),G=ws(G,I),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),G=Fr(G,M),e.__originalFilePath=u,y=await kn(G,e,L,f,g),y=`<!-- stx-layout: ${P} -->
872
- ${y}`,w(y)}catch(L){if(L instanceof V)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,i,g)=>{let r=e[i];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",i={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)i[g]=r;c.$env=i}async function ks(c,e){await xe(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function mn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function yn(c){return c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(c)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function $s(c,e,u,i){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-fd72t30s.js")),r=[],f=!C()&&!wn();for(let y of g(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-whzvx5w5.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(i?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return c;let v=c;for(let y of r.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:i}=await s("stx/expressions",()=>import("./chunk-q1jcf6vm.js"));return i(c,e,{skipServer:!0})}catch(i){let g=i instanceof Error?i:Error(String(i));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),c}}async function kn(c,e,u,i,g){let r=c,f=i;if(r=await $s(r,e,u,i),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Es(r,e,u),r=await At(r,e,u,f),we(r))r=lo(r,e),r=Wr(r,e),r=Ur(r,e);r=uo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-vewt3464.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Hr(r,e,u,f,g),r=pa(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-3xx9d934.js"));r=y(r,e,u);let{processTeleportDirectives:x}=await s("stx/teleport",()=>import("./chunk-tz09earb.js"));r=x(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-ggwvnpwj.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-3wsm9g9c.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-swxznm5v.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-s8qe247r.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await s("stx/virtual-scrolling",()=>import("./chunk-ft3f9nj0.js"));r=P(r,e,u),r=N(r,e,u),r=U(r,e,u);let{processPartialHydrationDirectives:W,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-3bfegbpw.js"));r=W(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:B}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=B(r,e,u);let{processFormValidationDirectives:X}=await s("stx/forms-validation",()=>import("./chunk-etz2dmec.js"));r=X(r,e,u);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-909ymsjz.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
872
+ ${y}`,w(y)}catch(L){if(L instanceof V)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,i,g)=>{let r=e[i];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",i={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)i[g]=r;c.$env=i}async function ks(c,e){await xe(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function mn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function yn(c){return c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(c)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function $s(c,e,u,i){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-je8t9yka.js")),r=[],f=!C()&&!wn();for(let y of g(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-r1v1496g.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(i?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return c;let v=c;for(let y of r.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:i}=await s("stx/expressions",()=>import("./chunk-01cx2p82.js"));return i(c,e,{skipServer:!0})}catch(i){let g=i instanceof Error?i:Error(String(i));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),c}}async function kn(c,e,u,i,g){let r=c,f=i;if(r=await $s(r,e,u,i),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Es(r,e,u),r=await At(r,e,u,f),we(r))r=lo(r,e),r=Wr(r,e),r=Ur(r,e);r=uo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-fp3a3gmr.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Hr(r,e,u,f,g),r=pa(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-3xx9d934.js"));r=y(r,e,u);let{processTeleportDirectives:x}=await s("stx/teleport",()=>import("./chunk-tz09earb.js"));r=x(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-ggwvnpwj.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-3wsm9g9c.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-swxznm5v.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-s8qe247r.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await s("stx/virtual-scrolling",()=>import("./chunk-ft3f9nj0.js"));r=P(r,e,u),r=N(r,e,u),r=U(r,e,u);let{processPartialHydrationDirectives:W,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-3bfegbpw.js"));r=W(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:B}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=B(r,e,u);let{processFormValidationDirectives:X}=await s("stx/forms-validation",()=>import("./chunk-sqv40sqk.js"));r=X(r,e,u);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-909ymsjz.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
873
873
  `;if(r=Y(r,e),r=ee(r,e,u),r=Xt(r),r=oo(r,e),r=Ct(r),r=Ut(r),r=await jr(r,e,u,f,g),r=await Hr(r,e,u,f,g),e.__stxProcessingDepth===1)r=Ua(r,e);if(r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=Oo(r),r=ne(r,e,u),r=Lr(r),r=Ba(r,e,{filePath:u,buildMode:f.buildMode}),r=io(r,e),r=ao(r,e),r=ze(r,e),r=jt(r,e),r=Ht(r,e),r=await bt(r,e,u,f),r=await ga(r,e,u),r=await ma(r,e,u,f),r=ha(r,e,u,f),r=bo(r,e,u,f),r=vo(r,e,u),r=wo(r,e,u,f),r=Et(r,e,u,f),r=hs(r,e),r=ys(r),r=Fa(r),!f.skipEventDirectives)r=$a(r,e,u);if(r=vt(r,e,u),f.debug){let F=/\bx-data\s*=/.test(r),z=Vr(c);if(F&&z)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
874
874
  Both work on the same page, but they manage separate scopes.
875
875
  Prefer signals (state/derived/effect) for new components.`)}r=aa(r,e),r=await k(r,e,u),r=za(r),r=Ha(r),r=pt(r);let{processXElementDirectives:oe}=await s("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=oe(r);let ae=e.__originalFilePath||u,le=Ne(e);if(r=await po(r,f,ae,le),r=It(r,e),r=await Wt(r,e,u,f),f.media?.image?.autoSiblings){let F=f.publicDir||"public",{rewriteImagesWithSiblings:z}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gx6wxmbv.js"));r=await z(r,{publicDir:F})}if(f.seo?.enabled)r=xo(r,e,f);let be=(F,z,Z=!0)=>{if(!z)return F;let me=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),se=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=se?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(se[0]):null;if(me&&se&&fe){if(Z){let Ce=se.index+fe.index;F=F.slice(0,Ce)+me[0]+F.slice(Ce+fe[0].length)}if(z=z.replace(me[0],"").trim(),!z)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${z}
@@ -883,6 +883,6 @@ ${lt()}
883
883
  `+Ce}else r=r.replace("</head>",`${z}
884
884
  </head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
885
885
  ${z}`);else r=z+`
886
- `+r}{let{scanScriptTags:F}=await s("stx/signal-processing",()=>import("./chunk-fd72t30s.js")),z=[];for(let Z of F(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,se=Sn(r,me);if(se===-1)continue;let fe=se+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;z.push({start:Z.start,end:fe})}if(z.length>0){let Z=Array(z.length+1),me=0;for(let se=0;se<z.length;se++){let{start:fe,end:Ce}=z[se];Z[se]=r.slice(me,fe),me=Ce}Z[z.length]=r.slice(me),r=Z.join("")}}let at=gs(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-fd72t30s.js"));for(let F of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:Z}of ct){Xe=!0;let me=Z;Pe(Z,u,i.strict,e.__originalFilePath);let se=await De(Z,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:Xo(i.buildMode),serverData:le});r=r.replace(F,()=>se)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=To(F);if(z){let Z=r.lastIndexOf("</body>");r=Z===-1?r+z:r.slice(0,Z)+z+`
886
+ `+r}{let{scanScriptTags:F}=await s("stx/signal-processing",()=>import("./chunk-je8t9yka.js")),z=[];for(let Z of F(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,se=Sn(r,me);if(se===-1)continue;let fe=se+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;z.push({start:Z.start,end:fe})}if(z.length>0){let Z=Array(z.length+1),me=0;for(let se=0;se<z.length;se++){let{start:fe,end:Ce}=z[se];Z[se]=r.slice(me,fe),me=Ce}Z[z.length]=r.slice(me),r=Z.join("")}}let at=gs(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-je8t9yka.js"));for(let F of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:Z}of ct){Xe=!0;let me=Z;Pe(Z,u,i.strict,e.__originalFilePath);let se=await De(Z,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:Xo(i.buildMode),serverData:le});r=r.replace(F,()=>se)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=To(F);if(z){let Z=r.lastIndexOf("</body>");r=Z===-1?r+z:r.slice(0,Z)+z+`
887
887
  `+r.slice(Z)}e.__stx_event_bindings=[]}}if(!he(r)&&la(r))r=await Yn(r,f);if(r=ua(r),f.csp?.enabled&&f.csp.useNonce&&typeof e.cspNonce==="string")r=$t(r,e.cspNonce);return r}
888
888
  export{gt,$e,ra,eo,Un,o};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Nc,Ei,Du,Dc,Mc,Mu,Lu}from"./chunk-hg9dxba9.js";import"./chunk-vdsf1yrt.js";import"./chunk-x5v3rqbn.js";import"./chunk-aypmc7qg.js";import"./chunk-374nhgyf.js";import"./chunk-mhacarm5.js";import"./chunk-hh2dcnsx.js";import"./chunk-dxh45gve.js";import"./chunk-2t51tpkc.js";import"./chunk-hejx7gbs.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import{Rt,Vl}from"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Nc as buildVirtualSource,Rt as extractScriptBlocks,Vl as extractTemplateExpressions,Dc as findRuntimeTypeDeclarations,Mc as findStxModuleDeclarations,Lu as formatTypecheckDiagnostics,Du as sourcePathFor,Mu as typecheckStxFiles,Ei as virtualPathFor};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{cp,sa,lp,oa,wl,xl,nn,Kn,up,Sl,kl,dp,h}from"./chunk-551s7ha0.js";import"./chunk-be2rswkw.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{nn as buildCss,Sl as extractClassNames,xl as fingerprintConfig,kl as generateCss,up as getCachedCSS,cp as getCssServeAsset,h as injectCss,sa as loadCssEngine,oa as loadCssEngineConfig,Kn as rebuildCss,lp as resetCssCache,wl as resolveUserCssConfig,dp as withLinkedModuleBundles};
2
+ import{cp,sa,lp,oa,wl,xl,nn,Kn,up,Sl,kl,dp,h}from"./chunk-x5sjsf3b.js";import"./chunk-scgn8dmx.js";import"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{nn as buildCss,Sl as extractClassNames,xl as fingerprintConfig,kl as generateCss,up as getCachedCSS,cp as getCssServeAsset,h as injectCss,sa as loadCssEngine,oa as loadCssEngineConfig,Kn as rebuildCss,lp as resetCssCache,wl as resolveUserCssConfig,dp as withLinkedModuleBundles};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{it,at,ct}from"./chunk-tp4eqfxq.js";import"./chunk-78yjmbbs.js";import"./chunk-6beg47t4.js";import{g}from"./chunk-z35ftpqp.js";import"./chunk-qwdcts9w.js";import"./chunk-9wdd7eq6.js";import"./chunk-sqh3tvtw.js";import{Ft,Ps,zt,ui,ot,di,Is,Ht,fi,Vt}from"./chunk-028e9fty.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{di("Config file changed, restarting...");try{await e.onChange()}catch(p){ot(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var st=".stx/story/analytics.json",dt=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,st),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:dt,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:pt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function pt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var lt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{it,at,ct}from"./chunk-tp4eqfxq.js";import"./chunk-78yjmbbs.js";import"./chunk-6beg47t4.js";import{g}from"./chunk-7dnpjrqp.js";import"./chunk-qwdcts9w.js";import"./chunk-9wdd7eq6.js";import"./chunk-wkkmk4aa.js";import{Ft,Ps,zt,ui,ot,di,Is,Ht,fi,Vt}from"./chunk-028e9fty.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{di("Config file changed, restarting...");try{await e.onChange()}catch(p){ot(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var st=".stx/story/analytics.json",dt=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,st),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:dt,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:pt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function pt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var lt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,7 +556,7 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-wk1gt95z.js"),p={},u=h(n);if(u)try{await g(u,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await g(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-wk1gt95z.js"),c={...r},n=h(e);if(n)try{await g(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-yaej3mgj.js"),p={},u=h(n);if(u)try{await g(u,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await g(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-yaej3mgj.js"),c={...r},n=h(e);if(n)try{await g(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
561
  `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await Ht(t);at(t,r);let s=Vt(t.config,r);ct(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=fi(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await Ht(t);at(t,m);let f=Vt(t.config,m);if(ct(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,y);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{g,m,d}from"./chunk-z35ftpqp.js";import{N}from"./chunk-245sas8r.js";import{o}from"./chunk-krcd3039.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],i=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function id(e,t={},i={}){let n={...N,...i,streaming:{...q,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=H(c),u=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let p=await o(c,h,e,n,u);for(let b=0;b<p.length;b+=s)r.enqueue(p.slice(b,b+s)),await new Promise((y)=>setTimeout(y,0))}else{let p=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)p.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await o(I,h,e,n,u);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await o(_.content,h,e,n,u);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await o(_,h,e,n,u);r.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await o(l.content,h,e,n,u);r.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;r.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
2
+ import{g,m,d}from"./chunk-7dnpjrqp.js";import{N}from"./chunk-2t51tpkc.js";import{o}from"./chunk-b4709e09.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],i=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function id(e,t={},i={}){let n={...N,...i,streaming:{...q,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=H(c),u=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let p=await o(c,h,e,n,u);for(let b=0;b<p.length;b+=s)r.enqueue(p.slice(b,b+s)),await new Promise((y)=>setTimeout(y,0))}else{let p=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)p.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await o(I,h,e,n,u);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await o(_.content,h,e,n,u);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await o(_,h,e,n,u);r.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await o(l.content,h,e,n,u);r.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;r.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(l.name,o(l.content,h,e,n,u))}r.enqueue(`
5
5
  <script>
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bu}from"./chunk-fjtffqf9.js";import"./chunk-mgk7bwb3.js";import"./chunk-tmqrbs98.js";import"./chunk-4tn437tn.js";import"./chunk-aypmc7qg.js";import"./chunk-b4709e09.js";import"./chunk-x5sjsf3b.js";import"./chunk-078qg8r5.js";import"./chunk-gjdpdvw5.js";import"./chunk-tqc86aaw.js";import"./chunk-r9p7r6mx.js";import"./chunk-xnx06qqt.js";import"./chunk-mhacarm5.js";import"./chunk-hh2dcnsx.js";import"./chunk-dxh45gve.js";import"./chunk-scgn8dmx.js";import"./chunk-2t51tpkc.js";import"./chunk-hejx7gbs.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Bu as buildForProduction};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pu}from"./chunk-rza3yydb.js";import"./chunk-mgk7bwb3.js";import"./chunk-4tn437tn.js";import"./chunk-aypmc7qg.js";import"./chunk-hh2dcnsx.js";import"./chunk-2t51tpkc.js";import"./chunk-hejx7gbs.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Pu as startProductionServer};