@stacksjs/stx 0.2.685 → 0.2.686

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 (100) hide show
  1. package/dist/{chunk-2ajbhefk.js → chunk-078as147.js} +1 -1
  2. package/dist/{chunk-r8cn9qhr.js → chunk-0nt17nas.js} +1 -1
  3. package/dist/{chunk-9wd31tc6.js → chunk-0y2hkbc6.js} +1 -1
  4. package/dist/{chunk-mxbp4vyy.js → chunk-1rgjy80j.js} +2 -2
  5. package/dist/{chunk-6nhsvb9x.js → chunk-1x0pf3sw.js} +1 -1
  6. package/dist/chunk-31jvtxpx.js +2 -0
  7. package/dist/{chunk-jsac71cy.js → chunk-4cksc4n3.js} +1 -1
  8. package/dist/{chunk-ppxfsqwh.js → chunk-4dzh6g52.js} +1 -1
  9. package/dist/{chunk-9xp9hs7t.js → chunk-4j9p27kn.js} +1 -1
  10. package/dist/chunk-4ntt6d6q.js +2 -0
  11. package/dist/{chunk-7st0prz9.js → chunk-51fqvchq.js} +2 -2
  12. package/dist/{chunk-fbdmsw5j.js → chunk-58m0kfb3.js} +1 -1
  13. package/dist/{chunk-kgcwx6nt.js → chunk-5ahrdnm0.js} +1 -1
  14. package/dist/{chunk-fb84n8kz.js → chunk-67v3rh14.js} +2 -2
  15. package/dist/{chunk-7grjwpdq.js → chunk-6te346zf.js} +1 -1
  16. package/dist/chunk-71d927c6.js +2 -0
  17. package/dist/{chunk-xpch3mq8.js → chunk-7gprzmd9.js} +1 -1
  18. package/dist/chunk-7w7e24e9.js +2 -0
  19. package/dist/{chunk-f5s2h2y8.js → chunk-840waqpm.js} +1 -1
  20. package/dist/{chunk-km6ggz8n.js → chunk-90ggz2m1.js} +1 -1
  21. package/dist/{chunk-px7ryjd9.js → chunk-9c3x72qy.js} +1 -1
  22. package/dist/{chunk-6qn368e7.js → chunk-a7hcwkjz.js} +2 -2
  23. package/dist/{chunk-yhba2f9d.js → chunk-av02901t.js} +1 -1
  24. package/dist/{chunk-8x34g2ad.js → chunk-bg6t69qq.js} +1 -1
  25. package/dist/chunk-c0fkhe6t.js +2 -0
  26. package/dist/{chunk-d0g4zndy.js → chunk-cge9pgyb.js} +1 -1
  27. package/dist/{chunk-dpghx4z6.js → chunk-d26nb6zy.js} +1 -1
  28. package/dist/{chunk-nsvnxkyb.js → chunk-d9esaahz.js} +2 -2
  29. package/dist/{chunk-qjmvcqfh.js → chunk-dbxq6fd7.js} +1 -1
  30. package/dist/{chunk-4k3jx9mm.js → chunk-dnbdxbkb.js} +6 -6
  31. package/dist/{chunk-gn98ha90.js → chunk-dv8a3gp8.js} +1 -1
  32. package/dist/{chunk-qgs69nds.js → chunk-dxcn65hq.js} +1 -1
  33. package/dist/chunk-ebmcecyh.js +2 -0
  34. package/dist/chunk-ejphs9fs.js +2 -0
  35. package/dist/chunk-em77nd40.js +2 -0
  36. package/dist/chunk-exbs8qm6.js +2 -0
  37. package/dist/{chunk-bnggav14.js → chunk-f4fxj7xg.js} +1 -1
  38. package/dist/{chunk-6zzg889q.js → chunk-ffwvbqkp.js} +1 -1
  39. package/dist/{chunk-eykbcntx.js → chunk-fndg9ar3.js} +1 -1
  40. package/dist/{chunk-4ht54p3j.js → chunk-fw12pvmr.js} +4 -4
  41. package/dist/chunk-gyye3mcb.js +2 -0
  42. package/dist/{chunk-wt6f9pk9.js → chunk-hx787tfa.js} +1 -1
  43. package/dist/{chunk-mf8yzpyy.js → chunk-hxnvcvkz.js} +1 -1
  44. package/dist/{chunk-bxr4c8rg.js → chunk-j7phk6kh.js} +1 -1
  45. package/dist/chunk-jdhdae0h.js +2 -0
  46. package/dist/{chunk-5t9ndqfm.js → chunk-jgxzbthg.js} +1 -1
  47. package/dist/{chunk-gwqw8r2e.js → chunk-jq4h969v.js} +1 -1
  48. package/dist/chunk-k8b4fme9.js +2 -0
  49. package/dist/{chunk-6e60jp4a.js → chunk-kq1hmpgb.js} +1 -1
  50. package/dist/{chunk-4r8c96a0.js → chunk-kqzrm2ym.js} +5 -5
  51. package/dist/{chunk-4rj9746b.js → chunk-n4qp4q2x.js} +1 -1
  52. package/dist/{chunk-49c5v5fh.js → chunk-n93krbsx.js} +1 -1
  53. package/dist/{chunk-e5kz0y03.js → chunk-pf25jb54.js} +4 -4
  54. package/dist/chunk-q4jpjjdc.js +2 -0
  55. package/dist/{chunk-3tp7r57c.js → chunk-r0ys9aqa.js} +1 -1
  56. package/dist/{chunk-9wa3t87n.js → chunk-r21m7gsd.js} +1 -1
  57. package/dist/chunk-rz0kkfd3.js +2 -0
  58. package/dist/{chunk-718rkxa7.js → chunk-s84zv8ky.js} +1 -1
  59. package/dist/chunk-t2eadw9a.js +2 -0
  60. package/dist/{chunk-nqvex98n.js → chunk-v6wa51js.js} +3 -3
  61. package/dist/{chunk-zhcb33s1.js → chunk-vewm4kr8.js} +1 -1
  62. package/dist/{chunk-gccwjjzw.js → chunk-vnnwp1cg.js} +1 -1
  63. package/dist/{chunk-zf6kmw9q.js → chunk-w0zrp51m.js} +1 -1
  64. package/dist/{chunk-w6frg42f.js → chunk-x828kq22.js} +1 -1
  65. package/dist/{chunk-jrche9k7.js → chunk-xp2cn23j.js} +1 -1
  66. package/dist/{chunk-t3e5tv4h.js → chunk-xw0cqb5m.js} +6 -6
  67. package/dist/{chunk-gkmh0xys.js → chunk-ydad3kq5.js} +1 -1
  68. package/dist/{chunk-w3q5czk5.js → chunk-yf42bhjw.js} +2 -2
  69. package/dist/{chunk-r7csb300.js → chunk-ygb33q5w.js} +1 -1
  70. package/dist/{chunk-cnvwrv5a.js → chunk-ymjpqt50.js} +1 -1
  71. package/dist/{chunk-01bd9hrj.js → chunk-yqgrjf9q.js} +1 -1
  72. package/dist/{chunk-qz314za9.js → chunk-ywpyxqn5.js} +1 -1
  73. package/dist/chunk-z0r4vm2m.js +2 -0
  74. package/dist/{chunk-244tyyhx.js → chunk-z10ffhzy.js} +1 -1
  75. package/dist/cli.js +7 -7
  76. package/dist/craft-entry.js +1 -1
  77. package/dist/craft.js +1 -1
  78. package/dist/env.d.ts +1 -1
  79. package/dist/env.js +2 -2
  80. package/dist/process.js +2 -2
  81. package/dist/pwa.js +2 -2
  82. package/dist/ssg.js +5 -5
  83. package/dist/types/config-types.d.ts +1 -0
  84. package/package.json +5 -5
  85. package/dist/chunk-42c308vk.js +0 -2
  86. package/dist/chunk-8y7tpjfs.js +0 -2
  87. package/dist/chunk-bhm9sdnv.js +0 -2
  88. package/dist/chunk-bpk0qy53.js +0 -2
  89. package/dist/chunk-cxvka6g3.js +0 -2
  90. package/dist/chunk-fzfa35ft.js +0 -2
  91. package/dist/chunk-kxqvfdm9.js +0 -2
  92. package/dist/chunk-m1cwgzqy.js +0 -2
  93. package/dist/chunk-mn9xw0fe.js +0 -2
  94. package/dist/chunk-sy19th0w.js +0 -2
  95. package/dist/chunk-t8djd28a.js +0 -2
  96. package/dist/chunk-tfhhxpda.js +0 -2
  97. package/dist/chunk-v3mmxk1y.js +0 -2
  98. package/dist/chunk-x519ewtq.js +0 -2
  99. package/dist/chunk-xe40yhcw.js +0 -2
  100. package/dist/chunk-xs8228sa.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Be,yn,xs,Uo,A}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-8x34g2ad.js";import{xr,S,dc,st,Zo,pc}from"./chunk-gtktv6nn.js";import{T}from"./chunk-6beg47t4.js";import{Ss,l,p,Dt,u,U,D,y,Es,Se,ze,Ts}from"./chunk-3tp7r57c.js";import{r,fe}from"./chunk-9tg4995v.js";import{f}from"./chunk-b7e07ybq.js";import{W}from"./chunk-2ajbhefk.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as uo}from"async_hooks";var or=new uo;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(":"),K=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(K&&!a.has(K))o.push(K),a.add(K)});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 is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function fo(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 as(e,i){let t=`{ ${fo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Cn from"fs";import Te 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 cs(e,i=!0){let t=mr.get(e);if(i&&t)return t;let o=new Map,a=[Te.join(e,"src"),Te.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=Te.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 ls(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Te.join(t,"node_modules",e);try{if(Cn.statSync(o).isDirectory())return o}catch{}let a=Te.dirname(t);if(a===t)return null;t=a}}function us(e,i,t={}){return[Te.resolve(Te.dirname(i),`${e}.stx`),Te.resolve(Te.dirname(i),e),Te.resolve(t.componentsDir||"components",`${e}.stx`),Te.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 To(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*$o(e,i,t={},o){let a=hr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Te.resolve(Te.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Te.join(Te.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Te.join(Te.dirname(i),"components"),Te.resolve(c,"src/components"),Te.resolve(c,"components"),...import.meta.dir?[Te.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Te.join(E,R);try{for(let R of Cn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Te.join(E,R.name,C)}catch{}}}function br(e,i,t={},o){let a=To(e,o);if(a!==void 0)return a;for(let h of $o(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 mt from"path";import Ht from"fs";var po=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ns(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return po.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"},go=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(go.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,K=q.split("."),Q=K[0];if(!yr.has(Q))continue;M.push({attribute:`@${q}`,event:Q,handler:Z,modifiers:wr(K.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,K=q.split("."),Q=K[0];if(!yr.has(Q))continue;M.push({attribute:`@${q}`,event:Q,handler:Z,modifiers:wr(K.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function mo(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 ho(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 xo(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=mo(e),a=ho(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,xs,Uo,A}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-bg6t69qq.js";import{xr,S,dc,st,Zo,pc}from"./chunk-gtktv6nn.js";import{T}from"./chunk-6beg47t4.js";import{Ss,l,p,Dt,u,U,D,y,Es,Se,ze,Ts}from"./chunk-r0ys9aqa.js";import{r,fe}from"./chunk-9tg4995v.js";import{f}from"./chunk-b7e07ybq.js";import{W}from"./chunk-078as147.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as uo}from"async_hooks";var or=new uo;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(":"),K=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(K&&!a.has(K))o.push(K),a.add(K)});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 is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function fo(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 as(e,i){let t=`{ ${fo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Cn from"fs";import Te 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 cs(e,i=!0){let t=mr.get(e);if(i&&t)return t;let o=new Map,a=[Te.join(e,"src"),Te.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=Te.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 ls(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Te.join(t,"node_modules",e);try{if(Cn.statSync(o).isDirectory())return o}catch{}let a=Te.dirname(t);if(a===t)return null;t=a}}function us(e,i,t={}){return[Te.resolve(Te.dirname(i),`${e}.stx`),Te.resolve(Te.dirname(i),e),Te.resolve(t.componentsDir||"components",`${e}.stx`),Te.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 To(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*$o(e,i,t={},o){let a=hr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Te.resolve(Te.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Te.join(Te.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Te.join(Te.dirname(i),"components"),Te.resolve(c,"src/components"),Te.resolve(c,"components"),...import.meta.dir?[Te.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Te.join(E,R);try{for(let R of Cn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Te.join(E,R.name,C)}catch{}}}function br(e,i,t={},o){let a=To(e,o);if(a!==void 0)return a;for(let h of $o(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 mt from"path";import Ht from"fs";var po=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ns(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return po.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"},go=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(go.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,K=q.split("."),Q=K[0];if(!yr.has(Q))continue;M.push({attribute:`@${q}`,event:Q,handler:Z,modifiers:wr(K.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,K=q.split("."),Q=K[0];if(!yr.has(Q))continue;M.push({attribute:`@${q}`,event:Q,handler:Z,modifiers:wr(K.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function mo(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 ho(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 xo(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=mo(e),a=ho(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 bo(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 Aa(e,i,t){if(pc(e))return e;if(i.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=bo(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=Ro(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,lt=/^[A-Za-z_$][\w$]*$/,yo=new Set(["if","for","while","switch","with"]),Rr=["(","[","{"],Cr=[")","]","}"],_o=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function wo(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}=wo(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 K=I;K<P;K++){if(["(","[","{"].includes(t[K].text)&&(o.get(K)??P)<P){K=o.get(K);continue}if(t[K].text===",")q.push([Z,K]),Z=K+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 K=t[I].text;if(lt.test(K)){if(q.add(K),q===C)c.push({name:K,token:I,functionScoped:Z});return}if(K!=="{"&&K!=="[")return;let Q=o.get(I);if(Q===void 0||Q>=P)return;for(let[te,ne]of h(I+1,Q)){let ae=te;if(K==="{")for(let me=te;me<ne;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,ne,q,Z)}}function E(I,P){let q=new Set;for(let[Z,K]of h(I,P))v(Z,K,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]&&lt.test(t[P].text))Z=new Set([t[P].text]);else continue;let K=I+1,Q=t[K]?.text==="{"&&o.has(K)?t[o.get(K)].end:R(K);O.push({start:t[q].start,end:Q,bodyStart:t[K]?.start??Q,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||yo.has(P)||!lt.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&&_o.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))&&lt.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,K=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Q=t[K]?.text===";"||t[K]?.text==="}"?t[K].end:t[Math.max(Z,K-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Q})}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),K=I+1,Q=!1,te=!1,ne=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===":"&&!te)Q=!0;else if(ae<Z&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<Z&&Q&&me==="<")ne++;else if(ae<Z&&Q&&me===">"&&ne>0)ne--;else if(ae===Z||me===","&&ne===0)v(K,ae,C,P==="var"),K=ae+1,Q=!1,te=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&lt.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 K=t[Z]?.text;if(K&&lt.test(K)&&K!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(K),c.push({name:K,token:Z,file:!0});let Q=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Q!==-1&&o.has(Q)){let te=o.get(Q);for(let[ne,ae]of h(Q+1,te)){let me=ae-1;while(me>=ne&&!lt.test(t[me].text))me--;if(me>=ne&&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 os(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,K=t.filter((Q)=>Q.functionBody&&Z>=Q.bodyStart&&Z<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];P=K?[K.bodyStart,K.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((K)=>N.token>K.headStart&&N.token<K.headEnd).sort((K,Q)=>K.headEnd-K.headStart-(Q.headEnd-Q.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]&&lt.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,K])=>q>=Z&&q<K))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.685";var Tr=Symbol.for(`stx.lazy-module-promises.${Ae}`);function vo(){let e=globalThis;return e[Tr]??=new Map,e[Tr]}function s(e,i){let t=vo(),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 Eo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Eo,"<\\/$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,lt=/^[A-Za-z_$][\w$]*$/,yo=new Set(["if","for","while","switch","with"]),Rr=["(","[","{"],Cr=[")","]","}"],_o=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function wo(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}=wo(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 K=I;K<P;K++){if(["(","[","{"].includes(t[K].text)&&(o.get(K)??P)<P){K=o.get(K);continue}if(t[K].text===",")q.push([Z,K]),Z=K+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 K=t[I].text;if(lt.test(K)){if(q.add(K),q===C)c.push({name:K,token:I,functionScoped:Z});return}if(K!=="{"&&K!=="[")return;let Q=o.get(I);if(Q===void 0||Q>=P)return;for(let[te,ne]of h(I+1,Q)){let ae=te;if(K==="{")for(let me=te;me<ne;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,ne,q,Z)}}function E(I,P){let q=new Set;for(let[Z,K]of h(I,P))v(Z,K,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]&&lt.test(t[P].text))Z=new Set([t[P].text]);else continue;let K=I+1,Q=t[K]?.text==="{"&&o.has(K)?t[o.get(K)].end:R(K);O.push({start:t[q].start,end:Q,bodyStart:t[K]?.start??Q,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||yo.has(P)||!lt.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&&_o.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))&&lt.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,K=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Q=t[K]?.text===";"||t[K]?.text==="}"?t[K].end:t[Math.max(Z,K-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Q})}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),K=I+1,Q=!1,te=!1,ne=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===":"&&!te)Q=!0;else if(ae<Z&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<Z&&Q&&me==="<")ne++;else if(ae<Z&&Q&&me===">"&&ne>0)ne--;else if(ae===Z||me===","&&ne===0)v(K,ae,C,P==="var"),K=ae+1,Q=!1,te=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&lt.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 K=t[Z]?.text;if(K&&lt.test(K)&&K!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(K),c.push({name:K,token:Z,file:!0});let Q=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Q!==-1&&o.has(Q)){let te=o.get(Q);for(let[ne,ae]of h(Q+1,te)){let me=ae-1;while(me>=ne&&!lt.test(t[me].text))me--;if(me>=ne&&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 os(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,K=t.filter((Q)=>Q.functionBody&&Z>=Q.bodyStart&&Z<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];P=K?[K.bodyStart,K.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((K)=>N.token>K.headStart&&N.token<K.headEnd).sort((K,Q)=>K.headEnd-K.headStart-(Q.headEnd-Q.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]&&lt.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,K])=>q>=Z&&q<K))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.686";var Tr=Symbol.for(`stx.lazy-module-promises.${Ae}`);function vo(){let e=globalThis;return e[Tr]??=new Map,e[Tr]}function s(e,i){let t=vo(),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 Eo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Eo,"<\\/$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)=>aa(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 la=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 ua(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(!la.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=Lo(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=jo(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-01bd9hrj.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Q=Xa(t);t=Q.code,o=Ja(Q.stxImports,Q.browserImports.filter((te)=>!h.includes(te)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=ca(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 Q=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${I}${Q?` ${Q}`:""}`;return`${v}<script ${te}>
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 la=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 ua(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(!la.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=Lo(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=jo(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-yqgrjf9q.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Q=Xa(t);t=Q.code,o=Ja(Q.stxImports,Q.browserImports.filter((te)=>!h.includes(te)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=ca(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 Q=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${I}${Q?` ${Q}`:""}`;return`${v}<script ${te}>
197
197
  ${an(`${o}${t}
198
198
  ${O}`)}
199
199
  </script>`}let P=Zo(e),q=/function __stx_setup_/.test(t),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function K(Q){let te=Q.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 hl(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 xl(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 bl(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 hl(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=xl(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 yl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function iu(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(!yl.has(o))return null;let a=new RegExp(`<\\/?${o}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=z(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=(ne)=>ne.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),v=t.__importedComponents;if(v){for(let ne of[h,h.toLowerCase(),c(h),j(h)])if(v.has(ne))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=(ne)=>{if(ne&&!O.includes(ne))O.push(ne)},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((ne)=>ne.toLowerCase()===h.toLowerCase());if(!I)for(let ne of a._targetComponentDirs??[])M(ne);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 ne of a._layerComponentDirs??[])M(ne);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let ne of P)M(typeof ne==="string"?ne:null);if(M(a.fallbackComponentsDir),I)for(let ne of a._targetComponentDirs??[])M(ne);if(h.startsWith("./")||h.startsWith("../"))return n(le.resolve(le.dirname(o),`${h}.stx`));let q=Fi(le.resolve(import.meta.dir,"components")),Z=O.map((ne)=>le.isAbsolute(ne)?ne:le.resolve(C,ne)),K=`${E.join("\x00")}\x00\x00${Z.join("\x00")}`,Q=Us.get(K);if(Q!==void 0)return Q;let te=!1;e:for(let ne of Z){if(Fi(ne)===q)continue;for(let ae of E)if(await n(le.join(ne,ae))){te=!0;break e}}return Us.set(K,te),te}function Fi(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 au(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ya(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 _l(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 Vi=new Set;function Ui(e,i,t,o){let a=`${e}\x00${i}\x00${o??""}`;if(!process.env.STX_DEBUG&&Vi.has(a))return;Vi.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 Hi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fo(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-xpch3mq8.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"&&au(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),K=O.endsWith(".stx")?O.slice(0,-4):O,Q=null,te=a.__importedComponents;if(te){let ce=[K,K.toLowerCase(),Z(K),j(K)];for(let ie of ce)if(te.has(ie)){Q=te.get(ie);break}}let ne=[];if(!Q){let ce=[`${K}.stx`,`${Z(K)}.stx`,`${j(K)}.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 Ce=le.join(le.dirname(h),"components");if(!xe.includes(Ce))xe.push(Ce);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let at=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(K),ct=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),nt=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),_t=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),bn=!ct.includes("valuechange")&&(nt||ct.includes("change")&&!_t),Gn=c._nativeHostAttrs&&/^textinput$/i.test(K),_n=ct.includes("update:value")&&!ct.includes("input"),gt=c._nativeHostAttrs&&/^video$/i.test(K),wn=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=gt&&wn&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Ut=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===K.toLowerCase())&&(!at||bn)&&(!Gn||_n)&&(!gt||$n);for(let _e of Ut?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let rt=typeof c.root==="string"?le.resolve(c.root):void 0,ao=rt??le.dirname(h),wt=[];if(rt)wt.push(le.resolve(rt,"resources/views/components")),wt.push(le.resolve(rt,"resources/components")),wt.push(le.resolve(rt,"src/components")),wt.push(le.resolve(rt,"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(Ut){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(ao,_e)}))];xe.length=0,xe.push(...nr);let Yn=`${K}\x00${h}\x00${nr.join("\x00")}`,Qn=Un.get(Yn);if(Qn)if(await n(Qn))Q=Qn;else Un.delete(Yn);if(!Q&&(K.startsWith("./")||K.startsWith("../")))Q=le.resolve(le.dirname(h),`${K}.stx`),ne.push(Q);else if(!Q)for(let _e of xe){if(!_e)continue;for(let vn of ie){let En=le.join(_e,vn);if(ne.push(En),await n(En)){Q=En;break}}if(Q)break;if(!Q)try{let vn=await import("fs");if(!vn.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let co=8,es=[{path:_e,depth:0}];while(es.length>0&&!Q){let kn=es.pop();if(kn.depth>=co)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 lo of ie){let ts=le.join(rr,lo);if(ne.push(ts),await n(ts)){Q=ts;break}}if(Q)break;es.push({path:rr,depth:kn.depth+1})}}}catch{}if(Q)break}if(Q)Un.set(Yn,Q)}if(!Q||!await n(Q))return Ui(e,h,ne),Hi(e);E.add(Q);let ae;if(Yt.has(Q))ae=Yt.get(Q);else try{ae=await Bun.file(Q).text(),Yt.set(Q,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Ui(e,h,[Q],ie),Hi(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",Pn,"__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]}:{},Ue=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-yhba2f9d.js"));Ue=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ue)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-xs8228sa.js"));Ue=await ce(Ue,{...a,__processedComponents:N,...Re},h,c,E)}let We=[];if(Ya(Ue)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-qjmvcqfh.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ue=ce(Ue,ie,h);for(let he of Ue.matchAll(/\{\{([\s\S]*?)\}\}/g))We.push(he[1].trim())}let Ze=G(Ue),Ye=[],xt=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(),Ce=!Ke||["module","text/javascript","application/javascript"].includes(Ke),at=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&Ce&&!at)return Ye.push(he),"";return he}),{extractSlotContent:Zn}=await s("stx/slots",()=>import("./chunk-sy19th0w.js")),ut=Zn(xt),ft={};if(ut.defaultSlot?.trim())ft.default=ut.defaultSlot;for(let[ce,ie]of ut.namedSlots)ft[ce]=ie.content;let pt=a.__stx_scope_seq??={n:0,key:vs(String(a.__filename??h))},Mt=Zi(e,process.cwd()),it=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Fe={...ke,$uid:it,$native:c._nativeHostAttrs===!0,...i,props:i,slot:xt,$slots:ft,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Ya(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...We]};bl(ae,Fe);let jt=ae,en=ue(jt);if(en)jt=en.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,Q,c.strict);let Je=[],Lt=null,Xn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),bt=null,Qe=null,Bt=null,tn=0,zt=null;if(fl(c),Xn&&Ks>0){let ce=pl({props:i,slot:Ue,slotContext:t.trim()?dl(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:it});if(ce!==null){bt=`${Q}\x00${w(ae)}\x00${ce}`;let ie=Hn.get(bt);if(ie){for(let he of ie.dependencies)E.add(he);if(Hr(a,ie.clientFactories),pt.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=Vr(a),tn=pt.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 Ce of Oe(he))Wt.add(Ce);try{await M(he,Fe,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Lt=Ce.kind}})}catch(Ce){}}if(!xe){let Ce=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),at=Ce.includes("{{")&&Ce.includes("}}"),ct=Ce.includes("{!!")&&Ce.includes("!!}");if(at||ct)Ce=Ho(Ce,Fe,Q);let nt=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${nt}>${Ce}</script>`)}}let qe=G(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Jn=qe?qe[2]:"",tt="",ee=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${_l(Jn,Fe,Q)}</style>`;let re=jt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(re=re.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""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
290
- `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-sy19th0w.js")),{defaultSlot:ye,namedSlots:Ee}=ut,Ve=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)),dt=(ce)=>Ve?xi(ce,it):ce,er=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:dt(ie.content)}]));re=await ge(re,dt(ye),er,Fe,Ve?it:"");let nn=Fo(Je),sn=(Array.isArray(Fe.__stx_client_signal_names)?Fe.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(nn.length>0||sn.length>0)Fe.__stx_client_signal_names=[...new Set([...sn,...nn])];else delete Fe.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Fe[Bn]=Vt;let rn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ve||Je.length===0,defaultLayout:void 0};Fe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:xn}=await s("stx/process",()=>import("./chunk-tfhhxpda.js")),ot=await xn(re,Fe,Q,rn,E),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of ot.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ce[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let Xe=it,He=ot;if(Ve){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(ft).map(([nt,_t])=>[nt,Boolean(_t)])),xe=Object.keys(he).length>0?` data-stx-slots="${Fs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ot),at=Ce?"span":"div";He=iu(ot,Ke)??`<${at}${Ke} data-stx-component-wrapper${Ce?' style="display:contents"':""}>${ot}</${at}>`;let ct=await Promise.all(Je.map(async(nt)=>{let _t=nt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return nt;let[,bn,Gn]=_t,_n=Bi(nt,Fe,Q);if(_n!==null)return _n;let gt=await $l(Gn,Q,c.buildMode==="compile"),wn=fn(gt.clientCode,Ne(Fe)),{vendorStyleTags:Sn}=gt,$n=wn?`function(__scopeId) {
289
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Hi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fo(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-7gprzmd9.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"&&au(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),K=O.endsWith(".stx")?O.slice(0,-4):O,Q=null,te=a.__importedComponents;if(te){let ce=[K,K.toLowerCase(),Z(K),j(K)];for(let ie of ce)if(te.has(ie)){Q=te.get(ie);break}}let ne=[];if(!Q){let ce=[`${K}.stx`,`${Z(K)}.stx`,`${j(K)}.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 Ce=le.join(le.dirname(h),"components");if(!xe.includes(Ce))xe.push(Ce);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let at=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(K),ct=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),nt=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),_t=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),bn=!ct.includes("valuechange")&&(nt||ct.includes("change")&&!_t),Gn=c._nativeHostAttrs&&/^textinput$/i.test(K),_n=ct.includes("update:value")&&!ct.includes("input"),gt=c._nativeHostAttrs&&/^video$/i.test(K),wn=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=gt&&wn&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Ut=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===K.toLowerCase())&&(!at||bn)&&(!Gn||_n)&&(!gt||$n);for(let _e of Ut?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let rt=typeof c.root==="string"?le.resolve(c.root):void 0,ao=rt??le.dirname(h),wt=[];if(rt)wt.push(le.resolve(rt,"resources/views/components")),wt.push(le.resolve(rt,"resources/components")),wt.push(le.resolve(rt,"src/components")),wt.push(le.resolve(rt,"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(Ut){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(ao,_e)}))];xe.length=0,xe.push(...nr);let Yn=`${K}\x00${h}\x00${nr.join("\x00")}`,Qn=Un.get(Yn);if(Qn)if(await n(Qn))Q=Qn;else Un.delete(Yn);if(!Q&&(K.startsWith("./")||K.startsWith("../")))Q=le.resolve(le.dirname(h),`${K}.stx`),ne.push(Q);else if(!Q)for(let _e of xe){if(!_e)continue;for(let vn of ie){let En=le.join(_e,vn);if(ne.push(En),await n(En)){Q=En;break}}if(Q)break;if(!Q)try{let vn=await import("fs");if(!vn.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let co=8,es=[{path:_e,depth:0}];while(es.length>0&&!Q){let kn=es.pop();if(kn.depth>=co)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 lo of ie){let ts=le.join(rr,lo);if(ne.push(ts),await n(ts)){Q=ts;break}}if(Q)break;es.push({path:rr,depth:kn.depth+1})}}}catch{}if(Q)break}if(Q)Un.set(Yn,Q)}if(!Q||!await n(Q))return Ui(e,h,ne),Hi(e);E.add(Q);let ae;if(Yt.has(Q))ae=Yt.get(Q);else try{ae=await Bun.file(Q).text(),Yt.set(Q,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Ui(e,h,[Q],ie),Hi(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",Pn,"__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]}:{},Ue=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-av02901t.js"));Ue=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ue)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-em77nd40.js"));Ue=await ce(Ue,{...a,__processedComponents:N,...Re},h,c,E)}let We=[];if(Ya(Ue)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-dbxq6fd7.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ue=ce(Ue,ie,h);for(let he of Ue.matchAll(/\{\{([\s\S]*?)\}\}/g))We.push(he[1].trim())}let Ze=G(Ue),Ye=[],xt=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(),Ce=!Ke||["module","text/javascript","application/javascript"].includes(Ke),at=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&Ce&&!at)return Ye.push(he),"";return he}),{extractSlotContent:Zn}=await s("stx/slots",()=>import("./chunk-jdhdae0h.js")),ut=Zn(xt),ft={};if(ut.defaultSlot?.trim())ft.default=ut.defaultSlot;for(let[ce,ie]of ut.namedSlots)ft[ce]=ie.content;let pt=a.__stx_scope_seq??={n:0,key:vs(String(a.__filename??h))},Mt=Zi(e,process.cwd()),it=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Fe={...ke,$uid:it,$native:c._nativeHostAttrs===!0,...i,props:i,slot:xt,$slots:ft,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Ya(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...We]};bl(ae,Fe);let jt=ae,en=ue(jt);if(en)jt=en.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,Q,c.strict);let Je=[],Lt=null,Xn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),bt=null,Qe=null,Bt=null,tn=0,zt=null;if(fl(c),Xn&&Ks>0){let ce=pl({props:i,slot:Ue,slotContext:t.trim()?dl(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:it});if(ce!==null){bt=`${Q}\x00${w(ae)}\x00${ce}`;let ie=Hn.get(bt);if(ie){for(let he of ie.dependencies)E.add(he);if(Hr(a,ie.clientFactories),pt.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=Vr(a),tn=pt.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 Ce of Oe(he))Wt.add(Ce);try{await M(he,Fe,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Lt=Ce.kind}})}catch(Ce){}}if(!xe){let Ce=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),at=Ce.includes("{{")&&Ce.includes("}}"),ct=Ce.includes("{!!")&&Ce.includes("!!}");if(at||ct)Ce=Ho(Ce,Fe,Q);let nt=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${nt}>${Ce}</script>`)}}let qe=G(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Jn=qe?qe[2]:"",tt="",ee=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${_l(Jn,Fe,Q)}</style>`;let re=jt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(re=re.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""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
290
+ `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-jdhdae0h.js")),{defaultSlot:ye,namedSlots:Ee}=ut,Ve=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)),dt=(ce)=>Ve?xi(ce,it):ce,er=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:dt(ie.content)}]));re=await ge(re,dt(ye),er,Fe,Ve?it:"");let nn=Fo(Je),sn=(Array.isArray(Fe.__stx_client_signal_names)?Fe.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(nn.length>0||sn.length>0)Fe.__stx_client_signal_names=[...new Set([...sn,...nn])];else delete Fe.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Fe[Bn]=Vt;let rn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ve||Je.length===0,defaultLayout:void 0};Fe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:xn}=await s("stx/process",()=>import("./chunk-k8b4fme9.js")),ot=await xn(re,Fe,Q,rn,E),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of ot.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ce[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let Xe=it,He=ot;if(Ve){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(ft).map(([nt,_t])=>[nt,Boolean(_t)])),xe=Object.keys(he).length>0?` data-stx-slots="${Fs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ot),at=Ce?"span":"div";He=iu(ot,Ke)??`<${at}${Ke} data-stx-component-wrapper${Ce?' style="display:contents"':""}>${ot}</${at}>`;let ct=await Promise.all(Je.map(async(nt)=>{let _t=nt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return nt;let[,bn,Gn]=_t,_n=Bi(nt,Fe,Q);if(_n!==null)return _n;let gt=await $l(Gn,Q,c.buildMode==="compile"),wn=fn(gt.clientCode,Ne(Fe)),{vendorStyleTags:Sn}=gt,$n=wn?`function(__scopeId) {
291
291
  ${wn}
292
292
  return (${gt.factoryBody})(__scopeId);
293
293
  }`:gt.factoryBody,Ut=q?null:As(a,$n),rt=Ut?`window.__stxComponentFactories[${JSON.stringify(Ut)}](${JSON.stringify(Xe)});`:`(${$n})(${JSON.stringify(Xe)});`;if(q)return`${Sn}<script type="stx/island" data-stx-island="${Xe}" data-stx-scoped data-stx-owner="${Xe}"${bn}>${rt}</script>`;return`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Xe}"${bn}>${rt}</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(){Yt.clear(),Un.clear(),Us.clear(),Hs.clear(),Hn.clear()}function Np(){return{size:Yt.size,maxSize:500}}var Vs=b(128);async function $l(e,i,t){let o=w(e,i,t),a=Vs.get(o);if(a){if(ds(a.deps))return a;Vs.delete(o)}let h=Lo(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=jo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-01bd9hrj.js")),C=[],O=!1;if(E(c)){let K=c;c=await R(K,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===K}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-9xp9hs7t.js"));c=M(c);let N=T(c),I=ml(N),P=new Set(L(N,!0).split(",").map((K)=>K.trim())),q=`function(__scopeId) {
316
+ `;return C}function pe(){Yt.clear(),Un.clear(),Us.clear(),Hs.clear(),Hn.clear()}function Np(){return{size:Yt.size,maxSize:500}}var Vs=b(128);async function $l(e,i,t){let o=w(e,i,t),a=Vs.get(o);if(a){if(ds(a.deps))return a;Vs.delete(o)}let h=Lo(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=jo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-yqgrjf9q.js")),C=[],O=!1;if(E(c)){let K=c;c=await R(K,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===K}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-4j9p27kn.js"));c=M(c);let N=T(c),I=ml(N),P=new Set(L(N,!0).split(",").map((K)=>K.trim())),q=`function(__scopeId) {
317
317
  ${st("const",[...dc,...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{As,Bt,kc,vu}from"./chunk-6e60jp4a.js";export{As as generateServiceWorker,vu as generateServiceWorkerAuto,Bt as getServiceWorkerFileName,kc as isWorkboxEnabled};
2
+ import{As,Bt,kc,vu}from"./chunk-kq1hmpgb.js";export{As as generateServiceWorker,vu as generateServiceWorkerAuto,Bt as getServiceWorkerFileName,kc as isWorkboxEnabled};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ue,Fa,hs,dn,g,Ne,De}from"./chunk-t3e5tv4h.js";import{er,Je,N}from"./chunk-mxbp4vyy.js";import{Un,o}from"./chunk-4k3jx9mm.js";import{ye}from"./chunk-4ht54p3j.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:m}=er(s),a=await(e.renderer??((n)=>Je(n)))(m);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=ue(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(s))!==null){let i=u[1],l=u[2],d=u[0],f=i.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=i.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let i of c)t=t.replace(i,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
2
+ import{ue,Fa,hs,dn,g,Ne,De}from"./chunk-xw0cqb5m.js";import{er,Je,N}from"./chunk-1rgjy80j.js";import{Un,o}from"./chunk-dnbdxbkb.js";import{ye}from"./chunk-fw12pvmr.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:m}=er(s),a=await(e.renderer??((n)=>Je(n)))(m);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=ue(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(s))!==null){let i=u[1],l=u[2],d=u[0],f=i.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=i.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let i of c)t=t.replace(i,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await De(h[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})})),x=[await Un(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
16
16
  $1`);else t+=`
17
- ${x}`}t=await ye(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-6nhsvb9x.js");t=await i(t)}catch{}return t}
17
+ ${x}`}t=await ye(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-1x0pf3sw.js");t=await i(t)}catch{}return t}
18
18
  export{Zi};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,a,Mt,Lt,jt,Fe,nt,P,Cs,br,ze}from"./chunk-3tp7r57c.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>P(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function wo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Mt(e,O,(s,c)=>{let o=br(Lt(s),r);if(o.kind==="tag")return N(o.tag);if(o.kind==="empty")return"";return P("Meta",c,o.message,n,o.code)},_("Meta",n));return i=Mt(i,I,(s,c)=>{let o=jt(s,r);if(!o.ok)return P("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!nt(o.value))return P("MetaTag",c,`expected an object such as { name, content }, got ${Fe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return P("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(nt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(nt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function xo(e,r,n){if(!e.includes("@structuredData"))return e;return Mt(e,C,(g,i)=>{let s=jt(g,r);if(!s.ok)return P("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=b(s.value);if(!c)return P("StructuredData",i,`expected an object or an array of objects, got ${Fe(s.value)}`,n,t.TYPE_ERROR);try{return E(c)}catch(o){let u=o instanceof Error?o.message:String(o);return P("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function So(e,r,n,g){if(!e.includes("@seo"))return e;return Mt(e,k,(i,s)=>{if(!i.trim())return P("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=jt(i,r);if(!c.ok)return P("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!nt(c.value))return P("SEO",s,`expected an object such as { title, description }, got ${Fe(c.value)}`,n,t.TYPE_ERROR);try{return L(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return P("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(nt(i))return i;Cs(n,`${r} must be an object, got ${Fe(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((o)=>!j.has(o));if(g.length>0){let o=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Cs(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
2
+ import{t,a,Mt,Lt,jt,Fe,nt,P,Cs,br,ze}from"./chunk-r0ys9aqa.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>P(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function wo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Mt(e,O,(s,c)=>{let o=br(Lt(s),r);if(o.kind==="tag")return N(o.tag);if(o.kind==="empty")return"";return P("Meta",c,o.message,n,o.code)},_("Meta",n));return i=Mt(i,I,(s,c)=>{let o=jt(s,r);if(!o.ok)return P("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!nt(o.value))return P("MetaTag",c,`expected an object such as { name, content }, got ${Fe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return P("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(nt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(nt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function xo(e,r,n){if(!e.includes("@structuredData"))return e;return Mt(e,C,(g,i)=>{let s=jt(g,r);if(!s.ok)return P("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=b(s.value);if(!c)return P("StructuredData",i,`expected an object or an array of objects, got ${Fe(s.value)}`,n,t.TYPE_ERROR);try{return E(c)}catch(o){let u=o instanceof Error?o.message:String(o);return P("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function So(e,r,n,g){if(!e.includes("@seo"))return e;return Mt(e,k,(i,s)=>{if(!i.trim())return P("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=jt(i,r);if(!c.ok)return P("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!nt(c.value))return P("SEO",s,`expected an object such as { title, description }, got ${Fe(c.value)}`,n,t.TYPE_ERROR);try{return L(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return P("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(nt(i))return i;Cs(n,`${r} must be an object, got ${Fe(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((o)=>!j.has(o));if(g.length>0){let o=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Cs(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
3
3
  `,i+=`<meta name="title" content="${l(e.title)}">
4
4
  `;if(e.description)i+=`<meta name="description" content="${l(e.description)}">
5
5
  `;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${l(o)}">
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-3tp7r57c.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-t3e5tv4h.js";import"./chunk-t6m5d64b.js";import"./chunk-8x34g2ad.js";import"./chunk-tenbwcts.js";import"./chunk-9wd31tc6.js";import{c}from"./chunk-xvs84gas.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-xw0cqb5m.js";import"./chunk-t6m5d64b.js";import"./chunk-bg6t69qq.js";import"./chunk-tenbwcts.js";import"./chunk-0y2hkbc6.js";import{c}from"./chunk-xvs84gas.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gl,ml,Ee,hl,ra,Xt,Jt,cp,sa,Yt,Hn,yl,bl,vl,Js,Zt,wl,Qt,xl}from"./chunk-6zzg889q.js";import"./chunk-r8cn9qhr.js";import"./chunk-374nhgyf.js";import"./chunk-mxbp4vyy.js";import"./chunk-9wd31tc6.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-r7csb300.js";import"./chunk-kypwg2ws.js";import"./chunk-t3e5tv4h.js";import"./chunk-8x34g2ad.js";import"./chunk-t6m5d64b.js";import"./chunk-3tp7r57c.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Hn as MODULE_SPECIFIER_PREFIX,gl as bundleCacheDir,ml as bundleCacheEntryLimit,Qt as bundleClientScript,Jt as clearBundleFailures,Ee as clientBundleDependencies,Xt as getBundleFailures,Yt as hasUserImports,Zt as moduleSubstitutionKey,bl as normalizeRegistrySpecifiers,wl as queueClientBundleBuild,ra as recordBundleFailure,yl as registryIdForPath,sa as resolveBundlerFallback,vl as rewriteRegistryImports,cp as setBundlerFallbackMode,hl as shouldLogBundlerDiagnostics,xl as tempBuildName,Js as withModuleSubstitutes};
2
+ import{gl,ml,Ee,hl,ra,Xt,Jt,cp,sa,Yt,Hn,yl,bl,vl,Js,Zt,wl,Qt,xl}from"./chunk-ffwvbqkp.js";import"./chunk-0nt17nas.js";import"./chunk-374nhgyf.js";import"./chunk-1rgjy80j.js";import"./chunk-0y2hkbc6.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-xw0cqb5m.js";import"./chunk-bg6t69qq.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Hn as MODULE_SPECIFIER_PREFIX,gl as bundleCacheDir,ml as bundleCacheEntryLimit,Qt as bundleClientScript,Jt as clearBundleFailures,Ee as clientBundleDependencies,Xt as getBundleFailures,Yt as hasUserImports,Zt as moduleSubstitutionKey,bl as normalizeRegistrySpecifiers,wl as queueClientBundleBuild,ra as recordBundleFailure,yl as registryIdForPath,sa as resolveBundlerFallback,vl as rewriteRegistryImports,cp as setBundlerFallbackMode,hl as shouldLogBundlerDiagnostics,xl as tempBuildName,Js as withModuleSubstitutes};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,k,J}from"./chunk-t3e5tv4h.js";import{i}from"./chunk-mxbp4vyy.js";import{Ee,Yt,Zt,Qt}from"./chunk-6zzg889q.js";import{ht}from"./chunk-7st0prz9.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-2ajbhefk.js";import h from"path";var x=new Map,D=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Ws(t){let{files:n}=await G(t),a=J({loader:"ts",target:"browser",define:k()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function L(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=L(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of L(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function qd(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(x,e,c,""),null;s.sort();let m=J({loader:"ts",target:"browser",define:k()}),p=qt(D,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((X)=>X!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(D,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),B=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(x,B,c);if(F!==void 0)return F||null;let M=[],v=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")v.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),M.push(`// Composable: ${g}
2
+ import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,k,J}from"./chunk-xw0cqb5m.js";import{i}from"./chunk-1rgjy80j.js";import{Ee,Yt,Zt,Qt}from"./chunk-ffwvbqkp.js";import{ht}from"./chunk-51fqvchq.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-078as147.js";import h from"path";var x=new Map,D=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Ws(t){let{files:n}=await G(t),a=J({loader:"ts",target:"browser",define:k()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function L(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=L(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of L(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function qd(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(x,e,c,""),null;s.sort();let m=J({loader:"ts",target:"browser",define:k()}),p=qt(D,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((X)=>X!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(D,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),B=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(x,B,c);if(F!==void 0)return F||null;let M=[],v=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")v.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),M.push(`// Composable: ${g}
3
3
  ${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(M.length===0||v.size===0)return ae(x,B,c,""),null;let H=[...v].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
4
4
  `),j=JSON.stringify([...v]),N=M.join(`
5
5
 
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Iu}from"./chunk-hxnvcvkz.js";import"./chunk-dnbdxbkb.js";import"./chunk-67v3rh14.js";import"./chunk-9bgb9n12.js";import"./chunk-dxcn65hq.js";import"./chunk-pf25jb54.js";import"./chunk-n4qp4q2x.js";import"./chunk-hx787tfa.js";import"./chunk-51fqvchq.js";import"./chunk-fw12pvmr.js";import"./chunk-jgxzbthg.js";import"./chunk-58m0kfb3.js";import"./chunk-1rgjy80j.js";import"./chunk-0y2hkbc6.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-xw0cqb5m.js";import"./chunk-bg6t69qq.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Iu as startInteractive};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{i}from"./chunk-mxbp4vyy.js";import{Ue,ne}from"./chunk-03xn8244.js";import{Zi}from"./chunk-w3q5czk5.js";import{f}from"./chunk-b7e07ybq.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var ep=`
2
+ import{i}from"./chunk-1rgjy80j.js";import{Ue,ne}from"./chunk-03xn8244.js";import{Zi}from"./chunk-yf42bhjw.js";import{f}from"./chunk-b7e07ybq.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var ep=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import"./chunk-3tp7r57c.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import{Ae,se}from"./chunk-t3e5tv4h.js";import"./chunk-t6m5d64b.js";import"./chunk-8x34g2ad.js";import"./chunk-tenbwcts.js";import"./chunk-kypwg2ws.js";import"./chunk-mxbp4vyy.js";import"./chunk-r7csb300.js";import"./chunk-912r15hr.js";import"./chunk-4k3jx9mm.js";import"./chunk-fbdmsw5j.js";import"./chunk-fb84n8kz.js";import"./chunk-4rj9746b.js";import"./chunk-e5kz0y03.js";import"./chunk-km6ggz8n.js";import"./chunk-xr9a0hcr.js";import"./chunk-03xn8244.js";import"./chunk-brftzqzj.js";import"./chunk-pzxy40a2.js";import"./chunk-xvnrm5c3.js";import"./chunk-km37yrk4.js";import"./chunk-nsvnxkyb.js";import"./chunk-974prn41.js";import"./chunk-bnggav14.js";import"./chunk-ct0ee0fr.js";import"./chunk-5tbey00z.js";import"./chunk-qh7fvr2z.js";import"./chunk-px7ryjd9.js";import"./chunk-58dv14c3.js";import"./chunk-7st0prz9.js";import"./chunk-qgs69nds.js";import"./chunk-9bgb9n12.js";import"./chunk-mf8yzpyy.js";import"./chunk-d1ssvg9k.js";import"./chunk-r8cn9qhr.js";import"./chunk-gn98ha90.js";import"./chunk-zhcb33s1.js";import"./chunk-ry501z40.js";import"./chunk-ae12wgc5.js";import"./chunk-d7js6v1m.js";import"./chunk-374nhgyf.js";import{Xt,Jt}from"./chunk-6zzg889q.js";import"./chunk-qz314za9.js";import"./chunk-gwqw8r2e.js";import"./chunk-cjf01cp4.js";import"./chunk-3zbege39.js";import"./chunk-b7z6rqfg.js";import"./chunk-drabexxq.js";import"./chunk-f4z9w4kc.js";import"./chunk-jrche9k7.js";import"./chunk-kgcwx6nt.js";import{hi,yi,bi,vi,Ns,wi,xi,Si,Ds,Ms,Cr,Er,Tr}from"./chunk-4r8c96a0.js";import"./chunk-w3q5czk5.js";import"./chunk-rspe6qa5.js";import"./chunk-d0g4zndy.js";import"./chunk-wt6f9pk9.js";import"./chunk-4ht54p3j.js";import"./chunk-5t9ndqfm.js";import{va}from"./chunk-9wd31tc6.js";import{f}from"./chunk-b7e07ybq.js";import{spawn as R}from"child_process";import S from"fs";import p from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=p.dirname(h),t=p.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=p.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",p.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
3
+ import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import{Ae,se}from"./chunk-xw0cqb5m.js";import"./chunk-t6m5d64b.js";import"./chunk-bg6t69qq.js";import"./chunk-tenbwcts.js";import"./chunk-kypwg2ws.js";import"./chunk-1rgjy80j.js";import"./chunk-ygb33q5w.js";import"./chunk-912r15hr.js";import"./chunk-dnbdxbkb.js";import"./chunk-58m0kfb3.js";import"./chunk-67v3rh14.js";import"./chunk-n4qp4q2x.js";import"./chunk-pf25jb54.js";import"./chunk-90ggz2m1.js";import"./chunk-xr9a0hcr.js";import"./chunk-03xn8244.js";import"./chunk-brftzqzj.js";import"./chunk-pzxy40a2.js";import"./chunk-xvnrm5c3.js";import"./chunk-km37yrk4.js";import"./chunk-d9esaahz.js";import"./chunk-974prn41.js";import"./chunk-f4fxj7xg.js";import"./chunk-ct0ee0fr.js";import"./chunk-5tbey00z.js";import"./chunk-qh7fvr2z.js";import"./chunk-9c3x72qy.js";import"./chunk-58dv14c3.js";import"./chunk-51fqvchq.js";import"./chunk-dxcn65hq.js";import"./chunk-9bgb9n12.js";import"./chunk-hxnvcvkz.js";import"./chunk-d1ssvg9k.js";import"./chunk-0nt17nas.js";import"./chunk-dv8a3gp8.js";import"./chunk-vewm4kr8.js";import"./chunk-ry501z40.js";import"./chunk-ae12wgc5.js";import"./chunk-d7js6v1m.js";import"./chunk-374nhgyf.js";import{Xt,Jt}from"./chunk-ffwvbqkp.js";import"./chunk-ywpyxqn5.js";import"./chunk-jq4h969v.js";import"./chunk-cjf01cp4.js";import"./chunk-3zbege39.js";import"./chunk-b7z6rqfg.js";import"./chunk-drabexxq.js";import"./chunk-f4z9w4kc.js";import"./chunk-xp2cn23j.js";import"./chunk-5ahrdnm0.js";import{hi,yi,bi,vi,Ns,wi,xi,Si,Ds,Ms,Cr,Er,Tr}from"./chunk-kqzrm2ym.js";import"./chunk-yf42bhjw.js";import"./chunk-rspe6qa5.js";import"./chunk-cge9pgyb.js";import"./chunk-hx787tfa.js";import"./chunk-fw12pvmr.js";import"./chunk-jgxzbthg.js";import{va}from"./chunk-0y2hkbc6.js";import{f}from"./chunk-b7e07ybq.js";import{spawn as R}from"child_process";import S from"fs";import p from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=p.dirname(h),t=p.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=p.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",p.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
4
4
  Test run interrupted`),s.kill("SIGINT"),n.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var U=n.argv.length>=3&&(W(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(U){let h=n.argv[2],m={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<n.argv.length;x++){let t=n.argv[x];if(t==="--port"&&x+1<n.argv.length){let e=E(n.argv[++x]);if(!e.isValid)F(e);m.port=Number.parseInt(n.argv[x],10)}else if(t==="--no-watch")m.watch=!1;else if(t==="--highlight-theme"&&x+1<n.argv.length){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.defaultTheme=n.argv[++x]}else if(t==="--no-highlight"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")m.cache=!1;else if(t==="--native")m.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((s)=>s.endsWith(".stx")):h.endsWith(".md")?x.filter((s)=>s.endsWith(".md")):x.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=p.resolve(e);try{let s=new Bun.Glob("**/*.stx"),i=(await Array.fromAsync(s.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(p.basename(l)));for(let l of i)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),n.exit(1);if(!await Er(t,m))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else Cr(h,m).catch((x)=>{console.error("Failed to start dev server:",x),n.exit(1)})}else{let h=function(t,e){let o=[];for(let r=0;r<=e.length;r++)o[r]=[r];for(let r=0;r<=t.length;r++)o[0][r]=r;for(let r=1;r<=e.length;r++)for(let s=1;s<=t.length;s++)if(e.charAt(r-1)===t.charAt(s-1))o[r][s]=o[r-1][s-1];else o[r][s]=Math.min(o[r-1][s-1]+1,o[r][s-1]+1,o[r-1][s]+1);return o[e.length][t.length]};y.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(t)=>{try{if(await vi(t))console.log("Documentation generated successfully."),n.exit(0);else console.error("Documentation generation failed."),n.exit(1)}catch(e){console.error("Error generating documentation:",e),n.exit(1)}}),y.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(t,e)=>{try{let{fetchCollections:o,generatePackage:r}=await import("./chunk-3850m7ab.js");if(t==="list"){console.log(`
5
5
  \uD83D\uDCDA Fetching available icon collections...
6
6
  `);let s=await o(),c=Object.entries(s).sort((i,l)=>l[1].total-i[1].total);console.log(`Available collections:
7
7
  `);for(let[i,l]of c){let d=l;console.log(` ${i.padEnd(30)} ${d.name} (${d.total} icons)`)}console.log(`
8
8
  Total: ${c.length} collections`)}else if(t.startsWith("generate")){let s=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!s)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),n.exit(1);let c=e.output||p.join(n.cwd(),"packages/collections"),i=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await r(s,c,i),console.log(`
9
9
  \u2713 Package generated successfully!`),console.log(`
10
- To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-g5ep75vp.js"),{loadConfig:s}=await import("./chunk-cxvka6g3.js");console.log(`
10
+ To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-g5ep75vp.js"),{loadConfig:s}=await import("./chunk-7w7e24e9.js");console.log(`
11
11
  \uD83D\uDD0D Running PWA audit...
12
12
  `);let c=await s(),i=e.output||"dist",l=o(c,i);if(console.log(r(l)),l.failed>0)n.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let r=E(e.port);if(!r.isValid)F(r);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let r=I(e.timeout);if(!r.isValid)F(r)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await Tr(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}if(!O(t))try{let r=await import("fs");if(r.existsSync(t)&&r.statSync(t).isDirectory()){if(!await Tr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let r=await se.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),s=t.endsWith(".stx")?r.filter((d)=>d.endsWith(".stx")):t.endsWith(".md")?r.filter((d)=>d.endsWith(".md")):r.filter((d)=>d.endsWith(".stx")||d.endsWith(".md"));if(s.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),n.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",i=p.resolve(c);try{let d=new Bun.Glob("**/*.stx"),u=(await Array.fromAsync(d.scan({cwd:i,onlyFiles:!0,absolute:!0}))).filter((g)=>/\[.+\]/.test(p.basename(g)));for(let g of u)if(!s.includes(g))s.push(g)}catch{}if(console.log(`Found ${s.length} ${s.length===1?"file":"files"} matching ${t}`),!await Er(s,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}else{if(!O(t)){let s=A(t);if(!s.isValid)F(s)}if(!await Cr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}}catch(o){console.error("Error starting dev server:",o),n.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:r,scannedFiles:s}=await va(t,{recursive:e.recursive!==!1,ignorePaths:o});if(s.length===0)console.log(`
13
13
  No .stx files matched ${t}
@@ -69,7 +69,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
69
69
  File not found: ${t}`),n.exit(1);if(!t.endsWith(".stx"))console.error(`
70
70
  File must have .stx extension: ${t}`),n.exit(1)}let r=p.resolve(e.pages),s=p.resolve(e.out);if(!t&&!S.existsSync(r))console.error(`
71
71
  Pages directory not found: ${r}`),console.log(`
72
- Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-t8djd28a.js");Jt();let i=await c({root:t?p.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
72
+ Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-exbs8qm6.js");Jt();let i=await c({root:t?p.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
73
73
  Build complete! (SSR)
74
74
  `),console.log(` Pages compiled: ${i.ssr.pageCount}`),console.log(` Output: ${i.ssr.outputDir}`),console.log(` Duration: ${l}s
75
75
  `);else if(i.ssg){if(console.log(`
@@ -84,7 +84,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
84
84
  Build completed with ${i.ssg.failedCount} error(s). Fix the issues above and try again.
85
85
  `),n.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
86
86
  `)}}catch(o){console.error(`
87
- Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=p.resolve(t.output);if(!S.existsSync(p.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-bpk0qy53.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
87
+ Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=p.resolve(t.output);if(!S.existsSync(p.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-q4jpjjdc.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
88
88
  Failed to start production server:`,e instanceof Error?e.message:String(e)),n.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:r,DeployError:s}=await import("./chunk-2zepd4ps.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${Ae}\x1B[0m`),e.init){console.log(`
89
89
  \uD83D\uDCDD Initializing Netlify configuration...
90
90
  `);let i=await r({directory:t||n.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${i.configPath}`),i.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
124
124
  \uD83D\uDCDD ${p.relative(n.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${p.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${p.relative(n.cwd(),a)}`),l++}catch(u){console.error(`\u274C Error formatting ${p.relative(n.cwd(),a)}:`,u),d++}if(e.check&&d>0)console.log(`
125
125
  ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),n.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){se.clear(),console.log("\u2705 Performance statistics cleared");return}let o=se.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
126
126
  \uD83D\uDCCA STX Performance Statistics
127
- `);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-x519ewtq.js"),{resolveStxTargets:s}=await import("./chunk-mdmwgthz.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
127
+ `);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-ebmcecyh.js"),{resolveStxTargets:s}=await import("./chunk-mdmwgthz.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
128
128
  No .stx files matched ${i.join(", ")}
129
129
  `);return}let d=hi(n.argv,"--lib"),a=d.length>0?d:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],u=await r(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(u.failure)console.error(`
130
130
  Type-check did not run.
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
160
160
  \uD83D\uDCC4 Files with issues:`),d.forEach((a)=>{let u=a.issues.filter((g)=>s[g.type]>=c).length;if(u>0)console.log(` ${p.relative(n.cwd(),a.file)} (${u} issues)`)});if(e.saveReport){let a={summary:l,results:d,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
161
161
  \uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
162
162
  \u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),n.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-8d0rqqyx.js"),r=t||"dist";try{let s=await o(r,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of s)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
163
- \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Ae)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-fzfa35ft.js"),o={};if(t.context){let r=p.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?p.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-v3mmxk1y.js"),c=p.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
163
+ \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Ae)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-z0r4vm2m.js"),o={};if(t.context){let r=p.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?p.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-t2eadw9a.js"),c=p.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
164
164
  \uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
165
165
  `);let a=await o({input:c,output:p.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?p.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:M(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
166
166
  \uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
167
- \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-6qn368e7.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-2hh6g3y1.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-1e79xcc8.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-cnvwrv5a.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-nqvex98n.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${p.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-zwawqx5q.js"),r=p.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
167
+ \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-a7hcwkjz.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-2hh6g3y1.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-1e79xcc8.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-ymjpqt50.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-v6wa51js.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${p.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-zwawqx5q.js"),r=p.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
168
168
  \uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
169
169
  `);let i=S.readFileSync(r,"utf-8"),l=await o(i,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),d=p.resolve(e.output);if(!S.existsSync(d))S.mkdirSync(d,{recursive:!0});let a=p.basename(t,p.extname(t)),u=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",g=p.join(d,`${a}.${u}`);S.writeFileSync(g,l.code);let b=p.join(d,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=p.join(d,`${a}.${u}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=p.join(d,`${a}.${w}.${u}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${g}`),console.log(` Manifest: ${b}`),console.log(`
170
170
  \uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`