@stacksjs/stx 0.2.881 → 0.2.883

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 (94) hide show
  1. package/dist/{chunk-8nqyyj1h.js → chunk-0f6k5r31.js} +3 -3
  2. package/dist/chunk-0fmrrsbp.js +2 -0
  3. package/dist/chunk-0rc5tg89.js +2 -0
  4. package/dist/{chunk-h2tq6cbr.js → chunk-0rdh8bw3.js} +1 -1
  5. package/dist/{chunk-002zrse4.js → chunk-1r1kfskk.js} +1 -1
  6. package/dist/{chunk-bhc25n2n.js → chunk-21tx0mbz.js} +1 -1
  7. package/dist/{chunk-k52126rh.js → chunk-24f59184.js} +1 -1
  8. package/dist/{chunk-smkerejj.js → chunk-26yzqev3.js} +5 -5
  9. package/dist/{chunk-86nsbxep.js → chunk-295bykzd.js} +26 -26
  10. package/dist/{chunk-gmbw1xhm.js → chunk-29btwpda.js} +2 -2
  11. package/dist/chunk-2d170z61.js +2 -0
  12. package/dist/{chunk-sq6werer.js → chunk-32z3g0y1.js} +1 -1
  13. package/dist/{chunk-dfbbkjz6.js → chunk-3ahqdb2n.js} +1 -1
  14. package/dist/{chunk-q1jjgg4w.js → chunk-3mepf96h.js} +1 -1
  15. package/dist/{chunk-fwhr3jda.js → chunk-6dq3qdg2.js} +1 -1
  16. package/dist/{chunk-xfhxfcvk.js → chunk-7hf1xyrb.js} +1 -1
  17. package/dist/{chunk-etavf6mr.js → chunk-7psdag9t.js} +1 -1
  18. package/dist/{chunk-ekdhjm8p.js → chunk-8a09r8xy.js} +4 -4
  19. package/dist/chunk-8cnavhtr.js +2 -0
  20. package/dist/{chunk-asv4b65m.js → chunk-8hc7mec0.js} +1 -1
  21. package/dist/{chunk-wfthd3n5.js → chunk-90zpw7zw.js} +1 -1
  22. package/dist/{chunk-czzehcxs.js → chunk-99956f90.js} +4 -4
  23. package/dist/{chunk-jc74097x.js → chunk-9y2n8wm6.js} +1 -1
  24. package/dist/chunk-a6cwm61q.js +2 -0
  25. package/dist/chunk-a6mjqetx.js +2 -0
  26. package/dist/{chunk-ym0cdk7m.js → chunk-an4vtgem.js} +2 -2
  27. package/dist/{chunk-w53p65hy.js → chunk-av1acvah.js} +2 -2
  28. package/dist/chunk-awywwbc5.js +3 -0
  29. package/dist/{chunk-v1s838fe.js → chunk-cb0c6959.js} +1 -1
  30. package/dist/{chunk-345waetq.js → chunk-cb2gzs3m.js} +9 -9
  31. package/dist/chunk-ckb8yk6a.js +2 -0
  32. package/dist/{chunk-t94y8g35.js → chunk-d2pexm3z.js} +1 -1
  33. package/dist/{chunk-kyh32kma.js → chunk-dzpm2n8g.js} +1 -1
  34. package/dist/{chunk-dze7f9vv.js → chunk-e5kygw75.js} +1 -1
  35. package/dist/chunk-fb5vv2q5.js +2 -0
  36. package/dist/{chunk-xf6snj8e.js → chunk-fk45k15v.js} +1 -1
  37. package/dist/{chunk-f6ac0gbe.js → chunk-gc65patn.js} +1 -1
  38. package/dist/{chunk-r32ddrvn.js → chunk-gw6v6n8y.js} +2 -2
  39. package/dist/{chunk-4frh1qg5.js → chunk-hnnargm3.js} +1 -1
  40. package/dist/{chunk-nnynrb97.js → chunk-htrptrn9.js} +1 -1
  41. package/dist/chunk-jr61mjwn.js +2 -0
  42. package/dist/{chunk-2cvwjtjh.js → chunk-kyb5nyt8.js} +2 -2
  43. package/dist/{chunk-ypsf5y5g.js → chunk-myfsnf67.js} +1 -1
  44. package/dist/{chunk-1jk46ve0.js → chunk-p5qac909.js} +1 -1
  45. package/dist/chunk-pnw1n18p.js +2 -0
  46. package/dist/{chunk-2gg3vjks.js → chunk-ptg2karz.js} +5 -5
  47. package/dist/{chunk-m91jj8nq.js → chunk-r04j085h.js} +1 -1
  48. package/dist/chunk-rf5tatrc.js +2 -0
  49. package/dist/{chunk-9yx7cbhz.js → chunk-rk98082b.js} +1 -1
  50. package/dist/{chunk-d8qt6hjg.js → chunk-rxm46f9z.js} +2 -2
  51. package/dist/{chunk-fxhgj8tp.js → chunk-se53e743.js} +1 -1
  52. package/dist/{chunk-jqvc2wbz.js → chunk-sqjv4kxc.js} +1 -1
  53. package/dist/{chunk-my3yv4sg.js → chunk-tct0jrp1.js} +1 -1
  54. package/dist/{chunk-gs6geqeg.js → chunk-tzmqvsmf.js} +1 -1
  55. package/dist/{chunk-45jpwbzd.js → chunk-vsraamv3.js} +1 -1
  56. package/dist/{chunk-gad3ebgr.js → chunk-vz6dtfe9.js} +1 -1
  57. package/dist/chunk-w2p9mhef.js +2 -0
  58. package/dist/{chunk-9fvjr9dd.js → chunk-w7476ea6.js} +1 -1
  59. package/dist/{chunk-pm27mcfp.js → chunk-w9zs57z0.js} +1 -1
  60. package/dist/chunk-wxa1w308.js +2 -0
  61. package/dist/{chunk-95j7y1rt.js → chunk-x2a5phpm.js} +1 -1
  62. package/dist/{chunk-njza56wn.js → chunk-x3py9q5v.js} +6 -6
  63. package/dist/{chunk-ndqq991c.js → chunk-x8s9487t.js} +1 -1
  64. package/dist/chunk-xncrk7dz.js +2 -0
  65. package/dist/{chunk-yffqfgjx.js → chunk-xynq9fcr.js} +1 -1
  66. package/dist/{chunk-1zkymrw0.js → chunk-yaenczev.js} +4 -4
  67. package/dist/{chunk-9zj3xztb.js → chunk-yc9bpftb.js} +1 -1
  68. package/dist/{chunk-v5cah9pt.js → chunk-ykzwrxpn.js} +1 -1
  69. package/dist/{chunk-hnxwqamj.js → chunk-ytbed3rp.js} +1 -1
  70. package/dist/{chunk-78zgmqhd.js → chunk-ywnqjqns.js} +1 -1
  71. package/dist/cli.js +7 -7
  72. package/dist/component-renderer.js +15 -2
  73. package/dist/craft-entry.js +1 -1
  74. package/dist/craft.js +1 -1
  75. package/dist/pwa.js +1 -1
  76. package/dist/safe-evaluator.d.ts +0 -8
  77. package/dist/safe-evaluator.js +14 -1
  78. package/dist/ssg.js +2 -2
  79. package/package.json +5 -5
  80. package/dist/chunk-51qyxm0y.js +0 -2
  81. package/dist/chunk-5hrx1p6g.js +0 -2
  82. package/dist/chunk-5mwzea5d.js +0 -2
  83. package/dist/chunk-8qr3cmpb.js +0 -2
  84. package/dist/chunk-909tgpxp.js +0 -2
  85. package/dist/chunk-brp8np3t.js +0 -2
  86. package/dist/chunk-dv0cpmat.js +0 -2
  87. package/dist/chunk-g5q0wgzk.js +0 -2
  88. package/dist/chunk-h26mpqrh.js +0 -2
  89. package/dist/chunk-k7ffxfgp.js +0 -3
  90. package/dist/chunk-nj1ssjtd.js +0 -2
  91. package/dist/chunk-pstbfz5g.js +0 -2
  92. package/dist/chunk-pw9qqcw3.js +0 -2
  93. package/dist/chunk-v8ea76j6.js +0 -2
  94. package/dist/chunk-vxw92h3q.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ye,Nn,ao,Ui,F}from"./chunk-6t04tqvh.js";import{On}from"./chunk-yffqfgjx.js";import{Kr,E,Ll,wt,Qi,jl}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{T,R}from"./chunk-s29hp1qw.js";import{qr,mo,Zi,Nl,De}from"./chunk-a60ztvnp.js";import{co,d,m,Xt,p,ee,q,k,fo,Me,Qe,go}from"./chunk-86nsbxep.js";import{b}from"./chunk-94mpe1ny.js";import{te}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{c}from"./chunk-xpbakn6t.js";import St from"path";import on from"process";import{AsyncLocalStorage as Ua}from"async_hooks";var Jr=new Ua;function $n(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Xr(e,n){return Jr.run($n(e),n)}async function Gr(e,n){let r=Jr.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Lr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,x=()=>{if(l!==0)return;let v=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(n&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((z)=>{let N=z.trim();if(!N)return;let H=N.indexOf(":"),U=(H>=0?N.slice(H+1).trim():N).split(/[\s=]/)[0];if(U&&!a.has(U))i.push(U),a.add(U)});return}let D=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&r.slice(u).startsWith("const"))return;D[1].split(",").forEach((z)=>{let N=z.trim().replace(/^\.\.\./,"");if(!N)return;let H=N.split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}if(n)return;let W=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!a.has(z))i.push(z),a.add(z);return}let L=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let z=L[1];if(!a.has(z))i.push(z),a.add(z)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))x();u++}return i.join(", ")}function Ws(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ha(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function qs(e,n){let r=`{ ${Ha(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import en from"fs";import ze from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Yr=new Map;function Ar(e,n=!0){let r=Yr.get(e);if(n&&r)return r;let i=new Map,a=[ze.join(e,"src"),ze.join(e,"dist"),e];function l(u,f){if(f>6)return;let x;try{x=en.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of x){let I=ze.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(I,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,I);let W=D.toLowerCase();if(!i.has(W))i.set(W,I);let L=X(D);if(!i.has(L))i.set(L,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)Yr.set(e,i);return i}function Ks(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=ze.join(r,"node_modules",e);try{if(en.statSync(i).isDirectory())return i}catch{}let a=ze.dirname(r);if(a===r)return null;r=a}}function Gs(e,n,r={}){return[ze.resolve(ze.dirname(n),`${e}.stx`),ze.resolve(ze.dirname(n),e),ze.resolve(r.componentsDir||"components",`${e}.stx`),ze.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Qr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(n);return[n,r,i]}function _i(e,n){let[r,i,a]=Qr(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ci(e,n){let r=n?ze.resolve(n):void 0,i=ze.dirname(ze.resolve(e));for(;;){if(en.existsSync(ze.join(i,"package.json")))return r&&i===r?void 0:i;let a=ze.dirname(i);if(a===i)return;i=a}}var Ka=["src/ui","src/components","components","dist"];function Qn(e,n){let r=ze.resolve(e);if(!n&&!r.split(ze.sep).includes("node_modules"))return[];let i=Ci(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(en.readFileSync(ze.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let l=a.length?a:Ka;return[ze.dirname(ze.resolve(e)),...l.map((u)=>ze.resolve(i,u))]}function*Ei(e,n,r={},i){let a=Qr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ze.resolve(ze.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((x)=>`${x}.stx`))],u=r.projectRoot||process.cwd(),f=[...Qn(n,r.projectRoot),...i?.__originalFilePath?[ze.join(ze.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],ze.join(ze.dirname(n),"components"),ze.resolve(u,"src/components"),ze.resolve(u,"components"),...import.meta.dir?[ze.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of l)yield ze.join(x,v);try{for(let v of en.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let I of l)yield ze.join(x,v.name,I)}catch{}}}function ei(e,n,r={},i){let a=_i(e,i);if(a!==void 0)return a;for(let l of Ei(e,n,r,i))try{if(en.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Xs(e,n=[],r={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([v,I])=>[v.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),x=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...n].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import Ss from"fs";import fe from"path";import Dt from"path";import hn from"fs";var qa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ms(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return qa.has(e.toLowerCase())}var ti=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"]),ni={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"},Za=new Set(["ctrl","alt","shift","meta"]),ii={left:0,middle:1,right:2};function si(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Za.has(i))n.systemKeys.push(i);else if(i in ii)n.mouse=i;else if(i in ni||/^[a-z]$/.test(i))n.keys.push(ni[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function oi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,x]=l,v=l.index,I=v+u.length,D=`__stx_evt_${n}${i++}`,W=[],L=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=L.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}let N=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=N.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}if(W.length>0)r.push({originalTag:u,elementId:D,events:W,startIndex:v,endIndex:I})}return r}function Ja(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=ii[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Xa(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Ds(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ga(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ja(e),a=Xa(Ds(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Ms(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Ye,Nn,ao,Ui,F}from"./chunk-6t04tqvh.js";import{On}from"./chunk-xynq9fcr.js";import{Kr,E,Ll,wt,Qi,jl}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{T,R}from"./chunk-s29hp1qw.js";import{qr,mo,Zi,Nl,De}from"./chunk-a60ztvnp.js";import{co,d,m,Xt,p,ee,q,k,fo,Me,Qe,go}from"./chunk-295bykzd.js";import{b}from"./chunk-94mpe1ny.js";import{te}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{c}from"./chunk-xpbakn6t.js";import St from"path";import on from"process";import{AsyncLocalStorage as Ua}from"async_hooks";var Jr=new Ua;function $n(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Xr(e,n){return Jr.run($n(e),n)}async function Gr(e,n){let r=Jr.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Lr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,x=()=>{if(l!==0)return;let v=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(n&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((z)=>{let N=z.trim();if(!N)return;let H=N.indexOf(":"),U=(H>=0?N.slice(H+1).trim():N).split(/[\s=]/)[0];if(U&&!a.has(U))i.push(U),a.add(U)});return}let D=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&r.slice(u).startsWith("const"))return;D[1].split(",").forEach((z)=>{let N=z.trim().replace(/^\.\.\./,"");if(!N)return;let H=N.split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}if(n)return;let W=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!a.has(z))i.push(z),a.add(z);return}let L=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let z=L[1];if(!a.has(z))i.push(z),a.add(z)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))x();u++}return i.join(", ")}function Ws(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ha(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function qs(e,n){let r=`{ ${Ha(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import en from"fs";import ze from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Yr=new Map;function Ar(e,n=!0){let r=Yr.get(e);if(n&&r)return r;let i=new Map,a=[ze.join(e,"src"),ze.join(e,"dist"),e];function l(u,f){if(f>6)return;let x;try{x=en.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of x){let I=ze.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(I,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,I);let W=D.toLowerCase();if(!i.has(W))i.set(W,I);let L=X(D);if(!i.has(L))i.set(L,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)Yr.set(e,i);return i}function Ks(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=ze.join(r,"node_modules",e);try{if(en.statSync(i).isDirectory())return i}catch{}let a=ze.dirname(r);if(a===r)return null;r=a}}function Gs(e,n,r={}){return[ze.resolve(ze.dirname(n),`${e}.stx`),ze.resolve(ze.dirname(n),e),ze.resolve(r.componentsDir||"components",`${e}.stx`),ze.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Qr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(n);return[n,r,i]}function _i(e,n){let[r,i,a]=Qr(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ci(e,n){let r=n?ze.resolve(n):void 0,i=ze.dirname(ze.resolve(e));for(;;){if(en.existsSync(ze.join(i,"package.json")))return r&&i===r?void 0:i;let a=ze.dirname(i);if(a===i)return;i=a}}var Ka=["src/ui","src/components","components","dist"];function Qn(e,n){let r=ze.resolve(e);if(!n&&!r.split(ze.sep).includes("node_modules"))return[];let i=Ci(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(en.readFileSync(ze.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let l=a.length?a:Ka;return[ze.dirname(ze.resolve(e)),...l.map((u)=>ze.resolve(i,u))]}function*Ei(e,n,r={},i){let a=Qr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ze.resolve(ze.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((x)=>`${x}.stx`))],u=r.projectRoot||process.cwd(),f=[...Qn(n,r.projectRoot),...i?.__originalFilePath?[ze.join(ze.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],ze.join(ze.dirname(n),"components"),ze.resolve(u,"src/components"),ze.resolve(u,"components"),...import.meta.dir?[ze.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of l)yield ze.join(x,v);try{for(let v of en.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let I of l)yield ze.join(x,v.name,I)}catch{}}}function ei(e,n,r={},i){let a=_i(e,i);if(a!==void 0)return a;for(let l of Ei(e,n,r,i))try{if(en.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Xs(e,n=[],r={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([v,I])=>[v.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),x=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...n].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import Ss from"fs";import fe from"path";import Dt from"path";import hn from"fs";var qa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ms(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return qa.has(e.toLowerCase())}var ti=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"]),ni={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"},Za=new Set(["ctrl","alt","shift","meta"]),ii={left:0,middle:1,right:2};function si(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Za.has(i))n.systemKeys.push(i);else if(i in ii)n.mouse=i;else if(i in ni||/^[a-z]$/.test(i))n.keys.push(ni[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function oi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,x]=l,v=l.index,I=v+u.length,D=`__stx_evt_${n}${i++}`,W=[],L=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=L.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}let N=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=N.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}if(W.length>0)r.push({originalTag:u,elementId:D,events:W,startIndex:v,endIndex:I})}return r}function Ja(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=ii[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Xa(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Ds(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ga(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ja(e),a=Xa(Ds(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Ms(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=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('${r}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function Ya(e,n=""){let r=oi(e,n);if(r.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=r.length-1;l>=0;l--){let u=r[l],f=u.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of u.events)v.elementId=x[1]}for(let x of u.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(D,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function ri(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Qc(e,n,r){if(jl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=Ya(e,ri(n)),v=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...v,...x],f}let i=oi(e,ri(n));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let I=v.match(/id=["']([^"']+)["']/);if(I)for(let D of x.events)D.elementId=I[1]}for(let I of x.events){let D=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),L=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(W,""),v=v.replace(L,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let l=Ti(i.flatMap((f)=>f.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
115
- `+a.slice(u);else a+=l;return a}function ai(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function zt(e,n){let r=t(e),{depths:i,balanced:a}=C(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let x=(f.index??0)+f[0].length-f[1].length;if(l(x))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&ai(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&ai(f[1],!1).has(n))return!0;return!1}var Ve="0.2.881";var ci=Symbol.for(`stx.lazy-module-promises.${Ve}`);function ec(){let e=globalThis;return e[ci]??=new Map,e[ci]}function o(e,n){let r=ec(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var tc=/<\/(script)/gi;function ge(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(tc,"<\\/$1")}import li from"fs";var ui=[];function S(e){let n=new T(e);return ui.push(n),n}function el(){for(let e of ui)e.clear()}function _(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Pr(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:li.statSync(r).mtimeMs})}catch{}return n}function Js(e){for(let n of e)try{if(li.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ae=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var nc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function sc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function rc(e,n){let r=n;while(!0){let i=Dt.join(r,"node_modules",e,"package.json");if(hn.existsSync(i))return Dt.dirname(i);let a=Dt.dirname(r);if(a===r)return null;r=a}}function ic(e,n){if(!e||typeof e!=="object")return null;let r=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function oc(e,n){let r=sc(e);if(!r||!r.subpath)return null;let i=rc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(hn.readFileSync(Dt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=ic(a.exports,l);if(!u)return null;let f=Dt.resolve(i,u);return hn.existsSync(f)?f:null}function Li(e,n){let r=n.filePath?Dt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(nc,(x,v)=>{let I;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(I=v.startsWith("/")?v:Dt.resolve(r,v),!hn.existsSync(I))throw Error(`file not found: ${I}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=oc(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);I=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${n.filePath||"<unknown>"}): ${D?.message||D}`),u.push(v),""}if(a.has(I))return"";a.add(I);try{let D=hn.readFileSync(I,"utf8");l.push({source:v,resolvedPath:I,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${I}: ${D?.message||D}`),u.push(v)}return""}),styles:l,unresolved:u}}function ac(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ji(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${ac(n.source)}" data-stx-layer="vendor">
115
+ `+a.slice(u);else a+=l;return a}function ai(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function zt(e,n){let r=t(e),{depths:i,balanced:a}=C(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let x=(f.index??0)+f[0].length-f[1].length;if(l(x))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&ai(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&ai(f[1],!1).has(n))return!0;return!1}var Ve="0.2.883";var ci=Symbol.for(`stx.lazy-module-promises.${Ve}`);function ec(){let e=globalThis;return e[ci]??=new Map,e[ci]}function o(e,n){let r=ec(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var tc=/<\/(script)/gi;function ge(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(tc,"<\\/$1")}import li from"fs";var ui=[];function S(e){let n=new T(e);return ui.push(n),n}function el(){for(let e of ui)e.clear()}function _(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Pr(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:li.statSync(r).mtimeMs})}catch{}return n}function Js(e){for(let n of e)try{if(li.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ae=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var nc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function sc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function rc(e,n){let r=n;while(!0){let i=Dt.join(r,"node_modules",e,"package.json");if(hn.existsSync(i))return Dt.dirname(i);let a=Dt.dirname(r);if(a===r)return null;r=a}}function ic(e,n){if(!e||typeof e!=="object")return null;let r=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function oc(e,n){let r=sc(e);if(!r||!r.subpath)return null;let i=rc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(hn.readFileSync(Dt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=ic(a.exports,l);if(!u)return null;let f=Dt.resolve(i,u);return hn.existsSync(f)?f:null}function Li(e,n){let r=n.filePath?Dt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(nc,(x,v)=>{let I;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(I=v.startsWith("/")?v:Dt.resolve(r,v),!hn.existsSync(I))throw Error(`file not found: ${I}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=oc(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);I=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${n.filePath||"<unknown>"}): ${D?.message||D}`),u.push(v),""}if(a.has(I))return"";a.add(I);try{let D=hn.readFileSync(I,"utf8");l.push({source:v,resolvedPath:I,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${I}: ${D?.message||D}`),u.push(v)}return""}),styles:l,unresolved:u}}function ac(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ji(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${ac(n.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${n.contents}
118
118
  }
@@ -182,7 +182,7 @@ else {
182
182
  // STX: auto-generated event bindings
183
183
  ${e.map((r,i)=>bc(r,i)).join(`
184
184
  `)}`}function gi(e){let n=[],r=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,u=0;while(u<l){let f=i[u];if(f==="'"||f==='"'||f==="`"){let x=f;if(u++,x==="`"){let v=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&v===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){v++,u+=2;continue}if(i[u]==="}"&&v>0){v--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===x){u++;break}u++}continue}if(f==="/"&&i[u+1]==="/"){while(u<l&&i[u]!==`
185
- `)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let x=i.slice(u),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let W=v[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=v[0].length;continue}let I=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((W)=>{let L=W.trim(),z=L.indexOf(":"),N=z>=0?L.slice(z+1).trim().split(/[\s=]/)[0]:L.split(/[\s=]/)[0];if(N&&!N.startsWith("_")&&!r.has(N))n.push(N),r.add(N)}),u+=I[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let W=D[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=D[0].length;continue}}u++}return n}var _c=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 wc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(W){let L;while((L=r.exec(W))!==null){let z=L[0];if(!_c.has(z))n.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=x.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=v.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Ke(e,n={}){let r=e,i="",a=!1,l=[],u=Li(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=ji(u.styles),x=Kt(r);r=x.code,l=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-95j7y1rt.js"));if(v(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let V=bl(r);r=V.code,i=wl(V.stxImports,V.browserImports.filter((K)=>!l.includes(K)))}if(i=`${Rn(r,n.serverData)}${i}`,r=M(r),!a&&Ge(n.attrs||""))r=Xe(r);let D=yc(n.eventBindings||[]),W=(n.attrs||"").trim(),L=/\btype\s*=\s*["']module["']/i.test(W),z=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(L){let V=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),K=`type="module" data-stx-scoped${z}${V?` ${V}`:""}`;return`${f}<script ${K}>
185
+ `)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let x=i.slice(u),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let W=v[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=v[0].length;continue}let I=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((W)=>{let L=W.trim(),z=L.indexOf(":"),N=z>=0?L.slice(z+1).trim().split(/[\s=]/)[0]:L.split(/[\s=]/)[0];if(N&&!N.startsWith("_")&&!r.has(N))n.push(N),r.add(N)}),u+=I[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let W=D[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=D[0].length;continue}}u++}return n}var _c=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 wc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(W){let L;while((L=r.exec(W))!==null){let z=L[0];if(!_c.has(z))n.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=x.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=v.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Ke(e,n={}){let r=e,i="",a=!1,l=[],u=Li(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=ji(u.styles),x=Kt(r);r=x.code,l=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-x2a5phpm.js"));if(v(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let V=bl(r);r=V.code,i=wl(V.stxImports,V.browserImports.filter((K)=>!l.includes(K)))}if(i=`${Rn(r,n.serverData)}${i}`,r=M(r),!a&&Ge(n.attrs||""))r=Xe(r);let D=yc(n.eventBindings||[]),W=(n.attrs||"").trim(),L=/\btype\s*=\s*["']module["']/i.test(W),z=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(L){let V=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),K=`type="module" data-stx-scoped${z}${V?` ${V}`:""}`;return`${f}<script ${K}>
186
186
  ${ge(`${i}${r}
187
187
  ${D}`)}
188
188
  </script>`}let N=Qi(e),H=/function __stx_setup_/.test(r),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function U(V){let K=V.length>0?`
@@ -1059,8 +1059,8 @@ ${v.join(`
1059
1059
  `){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")L=!0;else if(z==="]")L=!1;else if(z==="/"&&!L){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},W=()=>{if(i!==0)return;let L=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(L){let Z=L[2].split(",").map((U)=>{let V=U.trim().split(":");return V[V.length-1].trim()});for(let U of Z)if(U&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(U)&&!r.has(U))n.push(U),r.add(U);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let Z=z[2];if(!r.has(Z))n.push(Z),r.add(Z);return}let N=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let Z=N[1];if(!r.has(Z))n.push(Z),r.add(Z);return}let H=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let Z=H[1];if(!r.has(Z))n.push(Z),r.add(Z)}};while(a<l){if(x())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))W();a++}return n}function _p(e){let n=[],r=0,i=0,a=null;for(let l=0;l<e.length;l++){let u=e[l];if(a){if(u==="\\"){l++;continue}if(u===a)a=null;continue}if(u==='"'||u==="'"||u==="`"){a=u;continue}if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function wp(e){let n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a==="\\"){i++;continue}if(a===r)r=null;continue}if(a==='"'||a==="'"||a==="`"){r=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],u=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(u==="="||u===">")continue;return i}}return-1}function Sp(e,n){try{let r=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!r)return;let i=r.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,u=-1;for(;i>=0;i--){let x=e[i];if(x==="}")l++;else if(x==="{"){if(l--,l===0){u=i;break}}}if(u===-1)return;let f=e.slice(u+1,a);for(let x of _p(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let I=wp(v);if(I===-1)continue;let D=v.slice(0,I).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(n[D]!==void 0)continue;let W=v.slice(I+1).trim();if(!W)continue;try{let L=Object.keys(n).filter(Xt),z=Function(...L,`"use strict"; return (${W});`);n[D]=z(...L.map((N)=>n[N]))}catch{}}}catch{}}var vp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Hg(e,n){let r=Ht(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!vp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=w(e,(I,D)=>(l.lastIndex=D,l.exec(I)?.index===D?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,x=!1;for(let I of u){if(f+=I.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(I.end).trim())return null;x=!0;break}}if(!x)return null;let v=r+i[0].length;return e.slice(0,v)+n+e.slice(v)}function Ra(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=fe.relative(fe.resolve(i),fe.resolve(e));return!a.startsWith("..")&&!fe.isAbsolute(a)})}async function jr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ae)=>ae.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ae of[l,l.toLowerCase(),u(l),X(l)])if(f.has(ae))return!0}let x=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${X(l)}.stx`])],v=typeof a.root==="string"?fe.resolve(a.root):void 0,I=v??fe.dirname(i),D=[],W=(ae)=>{if(ae&&!D.includes(ae))D.push(ae)};for(let ae of Qn(i,v))W(ae);let L=r.__originalFilePath;if(L)W(fe.join(fe.dirname(L),"components"));if(Ra(n,a))W(a._rootComponentsDir);W(n),W(a._rootComponentsDir),W(fe.join(fe.dirname(i),"components")),W(a.componentsDir);for(let ae of a.additionalComponentsDirs??[])W(ae);let z=a._targetComponentFallbackNames?.some((ae)=>ae.toLowerCase()===l.toLowerCase());if(!z)for(let ae of a._targetComponentDirs??[])W(ae);if(v)W(fe.resolve(v,"resources/views/components")),W(fe.resolve(v,"resources/components")),W(fe.resolve(v,"src/components")),W(fe.resolve(v,"components"));for(let ae of a._layerComponentDirs??[])W(ae);let N=a._pluginComponentDirs;if(Array.isArray(N))for(let ae of N)W(typeof ae==="string"?ae:null);if(W(a.fallbackComponentsDir),z)for(let ae of a._targetComponentDirs??[])W(ae);let H=a._nativePrimitivesFallback;if(H&&!H.except.some((ae)=>ae.toLowerCase()===l.toLowerCase()))W(H.dir);if(l.startsWith("./")||l.startsWith("../"))return s(fe.resolve(fe.dirname(i),`${l}.stx`));let Z=_a(fe.resolve(import.meta.dir,"components")),U=D.map((ae)=>fe.isAbsolute(ae)?ae:fe.resolve(I,ae)),V=`${x.join("\x00")}\x00\x00${U.join("\x00")}`,K=Er.get(V);if(K!==void 0)return K;let ne=!1;e:for(let ae of U){if(_a(ae)===Z)continue;for(let de of x)if(await s(fe.join(ae,de))){ne=!0;break e}}return Er.set(V,ne),ne}function _a(e){let n=kr.get(e);if(n!==void 0)return n;let r=e;try{r=Ss.realpathSync(e)}catch{}return kr.set(e,r),r}function Vg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function vl(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function $p(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=O(a,n)}catch{return l}if(u===void 0||u===null)return"";let f=String(u);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${r??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var wa=new Set;function Sa(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&wa.has(a))return;wa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
1060
1060
  searched:
1061
1061
  ${r.map((x)=>` - ${x}`).join(`
1062
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function va(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ep=new Set(["for","if","show","key","ref","class","className","style"]),$a=new Set,Aa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",xl=new RegExp(`\\b(?:${Aa})\\s*(?:<[^>]*>)?\\s*\\(`);function Bi(e){let n=new Set,r=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Aa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Je(e,n,r,i,a,l,u,f=new Set,x,v=gt(a),I,D=e){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-k52126rh.js")),L=f??new Set;if(L.has(e))return`[Circular component reference: ${e}]`;let z=new Set(L);z.add(e);let N=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let H=N&&N!=="load"&&Vg(N)?N:"";try{let Z=(le)=>le.split("-").map((be)=>be.charAt(0).toUpperCase()+be.slice(1)).join(""),U=D.endsWith(".stx")?D.slice(0,-4):D,V=null,K=a.__importedComponents;if(K){let le=[U,U.toLowerCase(),Z(U),X(U)];for(let be of le)if(K.has(be)){V=K.get(be);break}}let ne=[];if(!V){let le=[`${U}.stx`,`${Z(U)}.stx`,`${X(U)}.stx`],be=[...new Set(le)],Ne=a.__originalFilePath,we=[];for(let ve of Qn(l))if(!we.includes(ve))we.push(ve);let ot=we.length;for(let ve of u._layerComponentDirs??[])if(!we.includes(ve))we.push(ve);if(Ne){let ve=fe.join(fe.dirname(Ne),"components");we.push(ve)}let Fe=u._rootComponentsDir;if(typeof Fe==="string"&&Ra(i,u)&&!we.includes(Fe))we.push(Fe);if(i&&!we.includes(i))we.push(i);if(typeof Fe==="string"&&!we.includes(Fe))we.push(Fe);let Ct=fe.join(fe.dirname(l),"components");if(!we.includes(Ct))we.push(Ct);if(u.componentsDir&&u.componentsDir!==i&&!we.includes(u.componentsDir))we.push(u.componentsDir);for(let ve of u.additionalComponentsDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Zt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(U),It=(I?.events??[]).map((ve)=>ve.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Vn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Rs=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),As=!It.includes("valuechange")&&(Vn||It.includes("change")&&!Rs),jt=u._nativeHostAttrs&&/^textinput$/i.test(U),Jt=It.includes("update:value")&&!It.includes("input"),mn=u._nativeHostAttrs&&/^video$/i.test(U),Ts=u._nativeHostAttrs&&/^image$/i.test(U),Un=Xs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),Gt=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Hn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Kn=mn&&(Gt||Hn)&&(I?.events??[]).every((ve)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ve.replace(/^@/,"").split(".")[0])),qn=new Set(["","primary","secondary","outline","ghost","danger"]),Zn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",Jn=u._nativeHostAttrs&&/^button$/i.test(U)&&!qn.has(Zn),Fr=u._targetComponentFallbackNames?.some((ve)=>ve.toLowerCase()===U.toLowerCase())??!1,Is=Fr&&(!Zt||As)&&(!jt||Jt)&&(!mn||Kn)&&(!Ts||Un)&&!Jn;for(let ve of Is?[]:u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Yt=typeof u.root==="string"?fe.resolve(u.root):void 0,Vr=Yt??fe.dirname(l),Qt=[];if(Yt)Qt.push(fe.resolve(Yt,"resources/views/components")),Qt.push(fe.resolve(Yt,"resources/components")),Qt.push(fe.resolve(Yt,"src/components")),Qt.push(fe.resolve(Yt,"components"));Qt.push(fe.resolve(import.meta.dir,"components"));for(let ve of Qt)if(!we.includes(ve))we.push(ve);if(Fr){let ve=(u._componentPackageDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0),Rt=(Is?ve.length?ve:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0);if(Rt.length){let ft=we.slice(ot).map((lt)=>fe.isAbsolute(lt)?lt:fe.resolve(Vr,lt)).filter((lt)=>!Rt.includes(lt)),Gn=`${U}\x00${ft.join("\x00")}`,_t=$r.get(Gn);if(_t===void 0){_t=!1;for(let lt of ft){for(let Mt of be)if(await s(fe.join(lt,Mt))){_t=!0;break}if(_t)break}$r.set(Gn,_t)}if(!_t){for(let lt of Rt){let Mt=we.indexOf(lt);if(Mt>=0)we.splice(Mt,1)}we.splice(ot,0,...Rt)}}}let Ur=u._pluginComponentDirs;if(Array.isArray(Ur)){for(let ve of Ur)if(typeof ve==="string"&&!we.includes(ve))we.push(ve)}if(u.fallbackComponentsDir&&!we.includes(u.fallbackComponentsDir))we.push(u.fallbackComponentsDir);if(Is){for(let ve of u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve)}let Xn=u._nativePrimitivesFallback;if(Xn&&!Xn.except.some((ve)=>ve.toLowerCase()===U.toLowerCase())&&!we.includes(Xn.dir))we.push(Xn.dir);let Hr=[...new Set(we.map((ve)=>{if(!ve)return ve;return fe.isAbsolute(ve)?ve:fe.resolve(Vr,ve)}))];we.length=0,we.push(...Hr);let Ps=`${U}\x00${l}\x00${Hr.join("\x00")}`,Os=_s.get(Ps);if(Os)if(await s(Os))V=Os;else _s.delete(Ps);if(!V&&(U.startsWith("./")||U.startsWith("../")))V=fe.resolve(fe.dirname(l),`${U}.stx`),ne.push(V);else if(!V)for(let ve of we){if(!ve)continue;for(let Rt of be){let ft=fe.join(ve,Rt);if(ne.push(ft),await s(ft)){V=ft;break}}if(V)break;if(!V)try{let Rt=await import("fs");if(!Rt.statSync(ve,{throwIfNoEntry:!1})?.isDirectory())continue;let Gn=8,_t=[{path:ve,depth:0}];while(_t.length>0&&!V){let lt=_t.pop();if(lt.depth>=Gn)continue;let Mt;try{Mt=Rt.readdirSync(lt.path,{withFileTypes:!0})}catch{continue}for(let Yn of Mt){if(!Yn.isDirectory())continue;if(Yn.name==="node_modules"||Yn.name.startsWith("."))continue;let Zr=fe.join(lt.path,Yn.name);for(let Va of be){let js=fe.join(Zr,Va);if(ne.push(js),await s(js)){V=js;break}}if(V)break;_t.push({path:Zr,depth:lt.depth+1})}}}catch{}if(V)break}if(V)_s.set(Ps,V)}if(!V||!await s(V))return Sa(e,l,ne),va(e);x.add(V);let ae;if(Dn.has(V)&&vr.get(V)===xa(V))ae=Dn.get(V);else try{let le=xa(V);ae=await Bun.file(V).text(),Dn.set(V,ae),vr.set(V,le)}catch(le){let be=le instanceof Error?le.message:String(le);return Sa(e,l,[V],be),va(e)}if(I)for(let le of new Set([...Object.keys(n),...I.reactiveProps??[]])){let be=le.toLowerCase();if(be.startsWith("aria-")||be.startsWith("data-"))continue;let Ne=le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Ne}\\b`).test(ae))I.declaredProps.add(le);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Ne}\\b|\\[\\s*['"]${Ne}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Ne}['"]`).test(ae))I.consumedProps?.add(le)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ae))for(let le of I.reactiveProps){if(Ep.has(le)||I.consumedProps?.has(le))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ae))continue;let be=`${V}\x00${le}`;if($a.has(be))continue;$a.add(be),console.warn(`[stx] ${fe.basename(V)} reads \`${le}\` with defineProps(), which is not live, but ${fe.basename(l)} binds it (:${le}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${le}').`)}let de=new Set(["__originalFilePath","__importedComponents",rs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[le,be]of Object.entries(a))if(!le.startsWith("__")||de.has(le))pe[le]=be;let Ee=v.length>0?{[us]:[...v]}:{},Ce=r;if(r.includes("@include")){let{processIncludes:le}=await o("stx/includes",()=>import("./chunk-5hrx1p6g.js"));Ce=await le(r,a,l,u,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ce)){let{processComponents:le}=await o("stx/component-renderer",()=>import("./chunk-q1jjgg4w.js")),be={...a,__processedComponents:L,...Ee};Ce=await le(Ce,be,l,u,x);let Ne=be.__stx_preserved_client_expressions;if(Array.isArray(Ne)&&Ne.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ne])]}let $e=[];if(vl(Ce)){let{processExpressions:le}=await o("stx/expressions",()=>import("./chunk-gs6geqeg.js")),be=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:v.length>0?{...a,...Ee}:a;Ce=le(Ce,be,l);for(let Ne of Ce.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(Ne[1].trim())}let ye=re(Ce),He=[],tt=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(le,be)=>{let Ne=ye.scripts[Number(be)]||"",we=Ne.match(/^<script\b([^>]*)>/i)?.[1]||"",ot=we.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Fe=!ot||["module","text/javascript","application/javascript"].includes(ot),Ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${we}`);if(!/\bserver\b/i.test(we)&&Fe&&!Ct)return He.push(Ne),"";return Ne}),{extractSlotContent:ct}=await o("stx/slots",()=>import("./chunk-f6ac0gbe.js")),nt=ct(tt),ht={};if(nt.defaultSlot?.trim())ht.default=nt.defaultSlot;for(let[le,be]of nt.namedSlots)ht[le]=be.content;let ut=a.__stx_scope_seq??={n:0,key:oo(String(a.__filename??l))},st=Ca(e,process.cwd()),je=`stx_${(st.endsWith(".stx")?st.slice(0,-4):st).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Te={...pe,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:tt,$slots:ht,__processedComponents:z,__sections:{},__stx_signals_gate:Oe(ae)||vl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};if(/import\s/.test(ae)){Te.__importedComponents=new Map(Te.__importedComponents);let{processESImports:le}=await o("stx/component-renderer",()=>import("./chunk-q1jjgg4w.js"));ae=await le(ae,Te,V,u,x)}Sp(ae,Te);let pt=ae,et=j(pt);if(et)pt=et.content.trim();let an=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,At=[...ae.matchAll(an)];for(let[,le,be]of At)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(le))Ue(be,V,u.strict);let xt=[],cn=null,$s=At.some((le)=>/\bserver\b/.test(le[1]||"")&&/\bcache\b/.test(le[1]||"")),Ft=null,vt=null,ln=null,zn=0,un=null;if(mp(u),$s&&Cr>0){let le=hp({props:n,slot:Ce,slotContext:r.trim()?xp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:u._layerGraph?.layers.map((be)=>be.configFile),uid:je});if(le!==null){Ft=`${V}\x00${_(ae)}\x00${le}`;let be=ws.get(Ft);if(be){for(let Ne of be.dependencies)x.add(Ne);if(vi(a,be.clientFactories),ut.n+=be.uidsConsumed,be.preservedClientExpressions.length>0){let Ne=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let we of be.preservedClientExpressions)Ne.add(we);a.__stx_preserved_client_expressions=[...Ne]}return be.output}vt=new Set(x),ln=wi(a),zn=ut.n,un=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let pn=new Set;for(let le of At){let be=le[1]||"",Ne=le[2]||"",we=be.includes("server");if(Ge(be)&&Ne.trim())Ne=Xe(Ne);if(we&&Ne){for(let Fe of he(Ne))pn.add(Fe);try{await W(Ne,Te,V,{onFailure:(Fe)=>{if(Fe.kind!=="unknown")cn=Fe.kind}})}catch(Fe){}}if(!we){let Fe=Ne.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ct=Fe.includes("{{")&&Fe.includes("}}"),Zt=Fe.includes("{!!")&&Fe.includes("!!}");if(Ct||Zt)Fe=zi(Fe,Te,V);let It=be.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${It}>${Fe}</script>`)}}let bt=re(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=bt?bt[1]:"",Es=bt?bt[2]:"",$t="",ce=fn&&/\bscoped\b/i.test(fn);if(bt)$t=`<style${fn}>${$p(Es,Te,V)}</style>`;let ue=pt;if(ue=ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),bt)ue=ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let le=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,be=[];if(ue=ue.replace(le,(Ne,we)=>{let ot=we.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(ot)be.push(`<style${ot[1]}>${ot[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),be.length>0)$t=`${$t}${be.join(`
1063
- `)}`}if(r&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:_e}=await o("stx/slots",()=>import("./chunk-f6ac0gbe.js")),{defaultSlot:Le,namedSlots:Ze}=nt,rt=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(tt),yt=xt.length>0&&or(ue)||u._nativeHostAttrs===!0&&xt.length>0||rt&&xt.length>0||xt.some((le)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(le)),ks=(le)=>yt?Mo(le,je):le,Cs=new Map([...Ze].map(([le,be])=>[le,{...be,content:ks(be.content)}]));ue=await _e(ue,yt?jo(ks(Le),je):Le,Cs,Te,yt?je:"");let Bn=Bi(xt),dn=(Array.isArray(Te.__stx_client_signal_names)?Te.__stx_client_signal_names:[]).filter((le)=>!pn.has(le));if(Bn.length>0||dn.length>0)Te.__stx_client_signal_names=[...new Set([...dn,...Bn])];else delete Te.__stx_client_signal_names;let gn=v.filter((le)=>!pn.has(le)&&!(le in n));if(gn.length>0)Te[us]=gn;let Wn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:fe.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||yt||xt.length===0,defaultLayout:void 0};Te.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Fn}=await o("stx/process",()=>import("./chunk-8qr3cmpb.js")),Et=await Fn(ue,Te,V,Wn,x),Tt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let le of Et.matchAll(/\{\{([\s\S]*?)\}\}/g))Tt.add(le[1].trim());if(Tt.size>0)a.__stx_preserved_client_expressions=[...Tt];let kt=je,it=Et;if(yt){let le="";if(Object.keys(n).length>0)try{le=` data-stx-props="${wr(JSON.stringify(n))}"`}catch{}let be=H?` stx-hydrate="${wr(H)}"`:"",Ne=Object.fromEntries(Object.entries(ht).map(([jt,Jt])=>[jt,Boolean(Jt)])),we=Object.keys(Ne).length>0?` data-stx-slots="${wr(JSON.stringify(Ne))}"`:"",ot=` data-stx-scope="${kt}"${le}${we}${be}`,Fe=Et.slice(Ht(Et)),Ct=/^<span(?=[\s/>])/i.test(Fe),Zt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Fe),It=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Fe),Vn=Ct?"span":"div",Rs=Zt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':It&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ct||Zt?' style="display:contents"':"";it=Hg(Et,ot)??`<${Vn}${ot} data-stx-component-wrapper${Rs}>${Et}</${Vn}>`;let As=await Promise.all(xt.map(async(jt)=>{let Jt=jt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Jt)return jt;let[,mn,Ts]=Jt,Un=ha(jt,Te,V);if(Un!==null)return Un;let Gt=await Cp(Ts,V,u.buildMode==="compile"),Hn=Rn(Gt.clientCode,qe(Te)),{vendorStyleTags:Kn}=Gt,qn=Hn?`function(__scopeId) {
1062
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function va(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ep=new Set(["for","if","show","key","ref","class","className","style"]),$a=new Set,Aa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",xl=new RegExp(`\\b(?:${Aa})\\s*(?:<[^>]*>)?\\s*\\(`);function Bi(e){let n=new Set,r=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Aa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Je(e,n,r,i,a,l,u,f=new Set,x,v=gt(a),I,D=e){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-24f59184.js")),L=f??new Set;if(L.has(e))return`[Circular component reference: ${e}]`;let z=new Set(L);z.add(e);let N=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let H=N&&N!=="load"&&Vg(N)?N:"";try{let Z=(le)=>le.split("-").map((be)=>be.charAt(0).toUpperCase()+be.slice(1)).join(""),U=D.endsWith(".stx")?D.slice(0,-4):D,V=null,K=a.__importedComponents;if(K){let le=[U,U.toLowerCase(),Z(U),X(U)];for(let be of le)if(K.has(be)){V=K.get(be);break}}let ne=[];if(!V){let le=[`${U}.stx`,`${Z(U)}.stx`,`${X(U)}.stx`],be=[...new Set(le)],Ne=a.__originalFilePath,we=[];for(let ve of Qn(l))if(!we.includes(ve))we.push(ve);let ot=we.length;for(let ve of u._layerComponentDirs??[])if(!we.includes(ve))we.push(ve);if(Ne){let ve=fe.join(fe.dirname(Ne),"components");we.push(ve)}let Fe=u._rootComponentsDir;if(typeof Fe==="string"&&Ra(i,u)&&!we.includes(Fe))we.push(Fe);if(i&&!we.includes(i))we.push(i);if(typeof Fe==="string"&&!we.includes(Fe))we.push(Fe);let Ct=fe.join(fe.dirname(l),"components");if(!we.includes(Ct))we.push(Ct);if(u.componentsDir&&u.componentsDir!==i&&!we.includes(u.componentsDir))we.push(u.componentsDir);for(let ve of u.additionalComponentsDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Zt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(U),It=(I?.events??[]).map((ve)=>ve.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Vn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Rs=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),As=!It.includes("valuechange")&&(Vn||It.includes("change")&&!Rs),jt=u._nativeHostAttrs&&/^textinput$/i.test(U),Jt=It.includes("update:value")&&!It.includes("input"),mn=u._nativeHostAttrs&&/^video$/i.test(U),Ts=u._nativeHostAttrs&&/^image$/i.test(U),Un=Xs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),Gt=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Hn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Kn=mn&&(Gt||Hn)&&(I?.events??[]).every((ve)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ve.replace(/^@/,"").split(".")[0])),qn=new Set(["","primary","secondary","outline","ghost","danger"]),Zn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",Jn=u._nativeHostAttrs&&/^button$/i.test(U)&&!qn.has(Zn),Fr=u._targetComponentFallbackNames?.some((ve)=>ve.toLowerCase()===U.toLowerCase())??!1,Is=Fr&&(!Zt||As)&&(!jt||Jt)&&(!mn||Kn)&&(!Ts||Un)&&!Jn;for(let ve of Is?[]:u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Yt=typeof u.root==="string"?fe.resolve(u.root):void 0,Vr=Yt??fe.dirname(l),Qt=[];if(Yt)Qt.push(fe.resolve(Yt,"resources/views/components")),Qt.push(fe.resolve(Yt,"resources/components")),Qt.push(fe.resolve(Yt,"src/components")),Qt.push(fe.resolve(Yt,"components"));Qt.push(fe.resolve(import.meta.dir,"components"));for(let ve of Qt)if(!we.includes(ve))we.push(ve);if(Fr){let ve=(u._componentPackageDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0),Rt=(Is?ve.length?ve:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0);if(Rt.length){let ft=we.slice(ot).map((lt)=>fe.isAbsolute(lt)?lt:fe.resolve(Vr,lt)).filter((lt)=>!Rt.includes(lt)),Gn=`${U}\x00${ft.join("\x00")}`,_t=$r.get(Gn);if(_t===void 0){_t=!1;for(let lt of ft){for(let Mt of be)if(await s(fe.join(lt,Mt))){_t=!0;break}if(_t)break}$r.set(Gn,_t)}if(!_t){for(let lt of Rt){let Mt=we.indexOf(lt);if(Mt>=0)we.splice(Mt,1)}we.splice(ot,0,...Rt)}}}let Ur=u._pluginComponentDirs;if(Array.isArray(Ur)){for(let ve of Ur)if(typeof ve==="string"&&!we.includes(ve))we.push(ve)}if(u.fallbackComponentsDir&&!we.includes(u.fallbackComponentsDir))we.push(u.fallbackComponentsDir);if(Is){for(let ve of u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve)}let Xn=u._nativePrimitivesFallback;if(Xn&&!Xn.except.some((ve)=>ve.toLowerCase()===U.toLowerCase())&&!we.includes(Xn.dir))we.push(Xn.dir);let Hr=[...new Set(we.map((ve)=>{if(!ve)return ve;return fe.isAbsolute(ve)?ve:fe.resolve(Vr,ve)}))];we.length=0,we.push(...Hr);let Ps=`${U}\x00${l}\x00${Hr.join("\x00")}`,Os=_s.get(Ps);if(Os)if(await s(Os))V=Os;else _s.delete(Ps);if(!V&&(U.startsWith("./")||U.startsWith("../")))V=fe.resolve(fe.dirname(l),`${U}.stx`),ne.push(V);else if(!V)for(let ve of we){if(!ve)continue;for(let Rt of be){let ft=fe.join(ve,Rt);if(ne.push(ft),await s(ft)){V=ft;break}}if(V)break;if(!V)try{let Rt=await import("fs");if(!Rt.statSync(ve,{throwIfNoEntry:!1})?.isDirectory())continue;let Gn=8,_t=[{path:ve,depth:0}];while(_t.length>0&&!V){let lt=_t.pop();if(lt.depth>=Gn)continue;let Mt;try{Mt=Rt.readdirSync(lt.path,{withFileTypes:!0})}catch{continue}for(let Yn of Mt){if(!Yn.isDirectory())continue;if(Yn.name==="node_modules"||Yn.name.startsWith("."))continue;let Zr=fe.join(lt.path,Yn.name);for(let Va of be){let js=fe.join(Zr,Va);if(ne.push(js),await s(js)){V=js;break}}if(V)break;_t.push({path:Zr,depth:lt.depth+1})}}}catch{}if(V)break}if(V)_s.set(Ps,V)}if(!V||!await s(V))return Sa(e,l,ne),va(e);x.add(V);let ae;if(Dn.has(V)&&vr.get(V)===xa(V))ae=Dn.get(V);else try{let le=xa(V);ae=await Bun.file(V).text(),Dn.set(V,ae),vr.set(V,le)}catch(le){let be=le instanceof Error?le.message:String(le);return Sa(e,l,[V],be),va(e)}if(I)for(let le of new Set([...Object.keys(n),...I.reactiveProps??[]])){let be=le.toLowerCase();if(be.startsWith("aria-")||be.startsWith("data-"))continue;let Ne=le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Ne}\\b`).test(ae))I.declaredProps.add(le);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Ne}\\b|\\[\\s*['"]${Ne}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Ne}['"]`).test(ae))I.consumedProps?.add(le)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ae))for(let le of I.reactiveProps){if(Ep.has(le)||I.consumedProps?.has(le))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ae))continue;let be=`${V}\x00${le}`;if($a.has(be))continue;$a.add(be),console.warn(`[stx] ${fe.basename(V)} reads \`${le}\` with defineProps(), which is not live, but ${fe.basename(l)} binds it (:${le}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${le}').`)}let de=new Set(["__originalFilePath","__importedComponents",rs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[le,be]of Object.entries(a))if(!le.startsWith("__")||de.has(le))pe[le]=be;let Ee=v.length>0?{[us]:[...v]}:{},Ce=r;if(r.includes("@include")){let{processIncludes:le}=await o("stx/includes",()=>import("./chunk-wxa1w308.js"));Ce=await le(r,a,l,u,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ce)){let{processComponents:le}=await o("stx/component-renderer",()=>import("./chunk-3mepf96h.js")),be={...a,__processedComponents:L,...Ee};Ce=await le(Ce,be,l,u,x);let Ne=be.__stx_preserved_client_expressions;if(Array.isArray(Ne)&&Ne.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ne])]}let $e=[];if(vl(Ce)){let{processExpressions:le}=await o("stx/expressions",()=>import("./chunk-tzmqvsmf.js")),be=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:v.length>0?{...a,...Ee}:a;Ce=le(Ce,be,l);for(let Ne of Ce.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(Ne[1].trim())}let ye=re(Ce),He=[],tt=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(le,be)=>{let Ne=ye.scripts[Number(be)]||"",we=Ne.match(/^<script\b([^>]*)>/i)?.[1]||"",ot=we.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Fe=!ot||["module","text/javascript","application/javascript"].includes(ot),Ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${we}`);if(!/\bserver\b/i.test(we)&&Fe&&!Ct)return He.push(Ne),"";return Ne}),{extractSlotContent:ct}=await o("stx/slots",()=>import("./chunk-gc65patn.js")),nt=ct(tt),ht={};if(nt.defaultSlot?.trim())ht.default=nt.defaultSlot;for(let[le,be]of nt.namedSlots)ht[le]=be.content;let ut=a.__stx_scope_seq??={n:0,key:oo(String(a.__filename??l))},st=Ca(e,process.cwd()),je=`stx_${(st.endsWith(".stx")?st.slice(0,-4):st).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Te={...pe,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:tt,$slots:ht,__processedComponents:z,__sections:{},__stx_signals_gate:Oe(ae)||vl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};if(/import\s/.test(ae)){Te.__importedComponents=new Map(Te.__importedComponents);let{processESImports:le}=await o("stx/component-renderer",()=>import("./chunk-3mepf96h.js"));ae=await le(ae,Te,V,u,x)}Sp(ae,Te);let pt=ae,et=j(pt);if(et)pt=et.content.trim();let an=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,At=[...ae.matchAll(an)];for(let[,le,be]of At)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(le))Ue(be,V,u.strict);let xt=[],cn=null,$s=At.some((le)=>/\bserver\b/.test(le[1]||"")&&/\bcache\b/.test(le[1]||"")),Ft=null,vt=null,ln=null,zn=0,un=null;if(mp(u),$s&&Cr>0){let le=hp({props:n,slot:Ce,slotContext:r.trim()?xp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:u._layerGraph?.layers.map((be)=>be.configFile),uid:je});if(le!==null){Ft=`${V}\x00${_(ae)}\x00${le}`;let be=ws.get(Ft);if(be){for(let Ne of be.dependencies)x.add(Ne);if(vi(a,be.clientFactories),ut.n+=be.uidsConsumed,be.preservedClientExpressions.length>0){let Ne=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let we of be.preservedClientExpressions)Ne.add(we);a.__stx_preserved_client_expressions=[...Ne]}return be.output}vt=new Set(x),ln=wi(a),zn=ut.n,un=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let pn=new Set;for(let le of At){let be=le[1]||"",Ne=le[2]||"",we=be.includes("server");if(Ge(be)&&Ne.trim())Ne=Xe(Ne);if(we&&Ne){for(let Fe of he(Ne))pn.add(Fe);try{await W(Ne,Te,V,{onFailure:(Fe)=>{if(Fe.kind!=="unknown")cn=Fe.kind}})}catch(Fe){}}if(!we){let Fe=Ne.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ct=Fe.includes("{{")&&Fe.includes("}}"),Zt=Fe.includes("{!!")&&Fe.includes("!!}");if(Ct||Zt)Fe=zi(Fe,Te,V);let It=be.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${It}>${Fe}</script>`)}}let bt=re(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=bt?bt[1]:"",Es=bt?bt[2]:"",$t="",ce=fn&&/\bscoped\b/i.test(fn);if(bt)$t=`<style${fn}>${$p(Es,Te,V)}</style>`;let ue=pt;if(ue=ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),bt)ue=ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let le=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,be=[];if(ue=ue.replace(le,(Ne,we)=>{let ot=we.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(ot)be.push(`<style${ot[1]}>${ot[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),be.length>0)$t=`${$t}${be.join(`
1063
+ `)}`}if(r&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:_e}=await o("stx/slots",()=>import("./chunk-gc65patn.js")),{defaultSlot:Le,namedSlots:Ze}=nt,rt=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(tt),yt=xt.length>0&&or(ue)||u._nativeHostAttrs===!0&&xt.length>0||rt&&xt.length>0||xt.some((le)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(le)),ks=(le)=>yt?Mo(le,je):le,Cs=new Map([...Ze].map(([le,be])=>[le,{...be,content:ks(be.content)}]));ue=await _e(ue,yt?jo(ks(Le),je):Le,Cs,Te,yt?je:"");let Bn=Bi(xt),dn=(Array.isArray(Te.__stx_client_signal_names)?Te.__stx_client_signal_names:[]).filter((le)=>!pn.has(le));if(Bn.length>0||dn.length>0)Te.__stx_client_signal_names=[...new Set([...dn,...Bn])];else delete Te.__stx_client_signal_names;let gn=v.filter((le)=>!pn.has(le)&&!(le in n));if(gn.length>0)Te[us]=gn;let Wn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:fe.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||yt||xt.length===0,defaultLayout:void 0};Te.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Fn}=await o("stx/process",()=>import("./chunk-rf5tatrc.js")),Et=await Fn(ue,Te,V,Wn,x),Tt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let le of Et.matchAll(/\{\{([\s\S]*?)\}\}/g))Tt.add(le[1].trim());if(Tt.size>0)a.__stx_preserved_client_expressions=[...Tt];let kt=je,it=Et;if(yt){let le="";if(Object.keys(n).length>0)try{le=` data-stx-props="${wr(JSON.stringify(n))}"`}catch{}let be=H?` stx-hydrate="${wr(H)}"`:"",Ne=Object.fromEntries(Object.entries(ht).map(([jt,Jt])=>[jt,Boolean(Jt)])),we=Object.keys(Ne).length>0?` data-stx-slots="${wr(JSON.stringify(Ne))}"`:"",ot=` data-stx-scope="${kt}"${le}${we}${be}`,Fe=Et.slice(Ht(Et)),Ct=/^<span(?=[\s/>])/i.test(Fe),Zt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Fe),It=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Fe),Vn=Ct?"span":"div",Rs=Zt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':It&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ct||Zt?' style="display:contents"':"";it=Hg(Et,ot)??`<${Vn}${ot} data-stx-component-wrapper${Rs}>${Et}</${Vn}>`;let As=await Promise.all(xt.map(async(jt)=>{let Jt=jt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Jt)return jt;let[,mn,Ts]=Jt,Un=ha(jt,Te,V);if(Un!==null)return Un;let Gt=await Cp(Ts,V,u.buildMode==="compile"),Hn=Rn(Gt.clientCode,qe(Te)),{vendorStyleTags:Kn}=Gt,qn=Hn?`function(__scopeId) {
1064
1064
  ${Hn}
1065
1065
  return (${Gt.factoryBody})(__scopeId);
1066
1066
  }`:Gt.factoryBody,Zn=H?null:Hs(a,qn),Jn=Zn?`window.__stxComponentFactories[${JSON.stringify(Zn)}](${JSON.stringify(kt)});`:`(${qn})(${JSON.stringify(kt)});`;if(H)return`${Kn}<script type="stx/island" data-stx-island="${kt}" data-stx-scoped data-stx-owner="${kt}"${mn}>${ge(Jn)}</script>`;return`${Kn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${kt}"${mn}>${ge(Jn)}</script>`}));if(it=it+`
@@ -1086,7 +1086,7 @@ ${Be.yellow}${Be.bold}Message:${Be.reset} ${n}
1086
1086
  `,f)I+=`
1087
1087
  ${Be.blue}${Be.bold}Context:${Be.reset}
1088
1088
  ${Be.dim}${f}${Be.reset}
1089
- `;return I}function ke(){Dn.clear(),vr.clear(),_s.clear(),$r.clear(),Er.clear(),kr.clear(),ws.clear()}function Ey(){return{size:Dn.size,maxSize:500}}var Sr=S(128);async function Cp(e,n,r){let i=_(e,n,r),a=Sr.get(i);if(a){if(Js(a.deps))return a;Sr.delete(i)}let l=Li(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=ji(l.styles);u=Kt(u).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-95j7y1rt.js")),I=[],D=!1;if(x(u)){let U=u;u=await v(U,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),D=u===U}let{stripStxRuntimeImports:W}=await o("stx/signal-processing",()=>import("./chunk-my3yv4sg.js"));u=W(u);let L=M(u),z=yp(L),N=new Set(G(L,!0).split(",").map((U)=>U.trim())),H=`function(__scopeId) {
1089
+ `;return I}function ke(){Dn.clear(),vr.clear(),_s.clear(),$r.clear(),Er.clear(),kr.clear(),ws.clear()}function Ey(){return{size:Dn.size,maxSize:500}}var Sr=S(128);async function Cp(e,n,r){let i=_(e,n,r),a=Sr.get(i);if(a){if(Js(a.deps))return a;Sr.delete(i)}let l=Li(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=ji(l.styles);u=Kt(u).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-x2a5phpm.js")),I=[],D=!1;if(x(u)){let U=u;u=await v(U,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),D=u===U}let{stripStxRuntimeImports:W}=await o("stx/signal-processing",()=>import("./chunk-tct0jrp1.js"));u=W(u);let L=M(u),z=yp(L),N=new Set(G(L,!0).split(",").map((U)=>U.trim())),H=`function(__scopeId) {
1090
1090
  ${wt("const",[...Ll,...z],L)}
1091
1091
  const __scope = window.stx._scopes = window.stx._scopes || {};
1092
1092
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ae,mt,Ut,Ys,Zs,Se,$i,Cn,rl,sl,Ri,ol,il,eo,Pi,Ii,al,Oi}from"./chunk-njza56wn.js";import{E}from"./chunk-00tq7ghn.js";import{a}from"./chunk-w53p65hy.js";import{Lo}from"./chunk-xf6snj8e.js";import{l}from"./chunk-s7xywsqd.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var ke=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=mt.filter((e)=>!ke.has(e)).sort(),ce=[...E].sort(),ve=[...new Set([...oe,...ce])].sort(),$e=new Set(oe),De=new Set(ce),Te=new Set(ve),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Ce(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?$e:De;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!Te.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
2
+ import{Ae,mt,Ut,Ys,Zs,Se,$i,Cn,rl,sl,Ri,ol,il,eo,Pi,Ii,al,Oi}from"./chunk-x3py9q5v.js";import{E}from"./chunk-00tq7ghn.js";import{a}from"./chunk-av1acvah.js";import{Lo}from"./chunk-fk45k15v.js";import{l}from"./chunk-s7xywsqd.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var ke=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=mt.filter((e)=>!ke.has(e)).sort(),ce=[...E].sort(),ve=[...new Set([...oe,...ce])].sort(),$e=new Set(oe),De=new Set(ce),Te=new Set(ve),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Ce(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?$e:De;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!Te.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
3
3
  `).length;o.push({line:v,column:u-(g.lastIndexOf(`
4
4
  `)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Ce(s,d.kind)})}}}return o}import M from"path";var Ee="@stacksjs/stx-typescript-plugin";function Oe(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Oe(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ee),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function Ra(e,t="",o="",d=t,i){let c=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",m=$i(Pi(e)+e.code,d),f=e.kind==="client"&&i?i.project(m.code):void 0,k=Cn(f?.code??m.code),S=e.kind==="client"||e.kind==="plain"?ol(t,e.code):"",s=(c+k).split(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ga,Xa,Ja,Ya,Yh}from"./chunk-32z3g0y1.js";import"./chunk-e362e615.js";import"./chunk-29btwpda.js";import"./chunk-kee5a3ce.js";import"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ga as buildNative,Yh as default,Xa as findCraftBinary,Ya as getAvailableFormats,Ja as getAvailableTargets};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Nn,F}from"./chunk-6t04tqvh.js";import m from"fs";import e from"path";async function On(r,o,i){if(r.__stx_runtime_config)return;let n=Nn();if(n||i){r.__stx_runtime_config=n??F(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-51qyxm0y.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=F(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Vi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Nn,F}from"./chunk-6t04tqvh.js";import m from"fs";import e from"path";async function On(r,o,i){if(r.__stx_runtime_config)return;let n=Nn();if(n||i){r.__stx_runtime_config=n??F(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-jr61mjwn.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=F(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Vi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{Er}from"./chunk-agd2b928.js";import{Fr}from"./chunk-86nsbxep.js";import{a}from"./chunk-w53p65hy.js";import{U,ct}from"./chunk-care745q.js";import{Mc}from"./chunk-ezna4dhj.js";import{D,c}from"./chunk-xpbakn6t.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function vr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function ne(e,r={}){return new Er(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=ne(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function Te(e){return e.includes("data-stx-runtime")}function Oc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function p(e,r){let t=vr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{Er}from"./chunk-agd2b928.js";import{Fr}from"./chunk-295bykzd.js";import{a}from"./chunk-av1acvah.js";import{U,ct}from"./chunk-care745q.js";import{Mc}from"./chunk-ezna4dhj.js";import{D,c}from"./chunk-xpbakn6t.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function vr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function ne(e,r={}){return new Er(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=ne(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function Te(e){return e.includes("data-stx-runtime")}function Oc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function p(e,r){let t=vr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=Fr(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=D(e);return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(U(e))return ct(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function xr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-wfthd3n5.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-wfthd3n5.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Nc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Mc()}</script>`,t=c(e);if(t===-1)return`${e}
7
+ ${e}`}async function xr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-90zpw7zw.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-90zpw7zw.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Nc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Mc()}</script>`,t=c(e);if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function $e(e,r){if(!e.includes("</body>"))return e;if(M(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-wfthd3n5.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
9
+ ${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function $e(e,r){if(!e.includes("</body>"))return e;if(M(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-90zpw7zw.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
12
- `}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-wfthd3n5.js"),d=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
12
+ `}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-90zpw7zw.js"),d=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
13
13
  </body>`+e.slice(g+7)}
14
14
  export{vr,ne,Te,Oc,xr,Nc,$e};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Q,We}from"./chunk-njza56wn.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function fn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=We(t,s);if(p>s){c=p;continue}let a=Q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{Q,We}from"./chunk-x3py9q5v.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function fn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=We(t,s);if(p>s){c=p;continue}let a=Q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{fn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ae,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke}from"./chunk-njza56wn.js";import"./chunk-yffqfgjx.js";import"./chunk-6t04tqvh.js";import"./chunk-86nsbxep.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Dl,t}from"./chunk-yh2hnt3m.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ae as BROWSER_CORE_IMPORTS,Ng as STX_AUTO_IMPORTS,Li as extractAndStripCssImports,qe as extractBridgeData,Dl as findInterpolationEnd,wl as generateAutoImportDestructuring,Cy as generateBrowserAutoImportDestructuring,Rn as generateServerDataBridge,Kt as injectBrowserCoreAutoImports,Ke as processClientScript,Mg as referencesName,ji as renderVendorStyleTags,t as stripCommentsAndLiterals,bl as transformAutoImports};
2
+ import{Ae,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke}from"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Dl,t}from"./chunk-yh2hnt3m.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ae as BROWSER_CORE_IMPORTS,Ng as STX_AUTO_IMPORTS,Li as extractAndStripCssImports,qe as extractBridgeData,Dl as findInterpolationEnd,wl as generateAutoImportDestructuring,Cy as generateBrowserAutoImportDestructuring,Rn as generateServerDataBridge,Kt as injectBrowserCoreAutoImports,Ke as processClientScript,Mg as referencesName,ji as renderVendorStyleTags,t as stripCommentsAndLiterals,bl as transformAutoImports};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{De}from"./chunk-a60ztvnp.js";import{E}from"./chunk-00tq7ghn.js";import{M,jn}from"./chunk-hxhmhw23.js";import{A,oe}from"./chunk-njza56wn.js";import{a}from"./chunk-w53p65hy.js";import{Ce,hn,yn,bn}from"./chunk-kyh32kma.js";import{Pt}from"./chunk-ym0cdk7m.js";import{Tt,er,ln,be}from"./chunk-97kgrevs.js";import{I,et}from"./chunk-ws2h92mm.js";import C from"fs";import b from"path";import x from"process";function B(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=I()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${yn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return be(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>Ce(l))])],f=Tt(i()),u=ln(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return be(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=oe({loader:"ts",target:"browser",define:A()});for(let l of p)try{let c=await Bun.file(l).text(),k=b.basename(l,".ts"),_=new Set;B(c,_);let y=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((U)=>U[2]),N=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(hn(c))c=await bn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=Pt(c),c=M(c),c=jn(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:k,ids:y.length===N?y:[],declared:_,code:`// Store: ${k}
2
+ import{De}from"./chunk-a60ztvnp.js";import{E}from"./chunk-00tq7ghn.js";import{M,jn}from"./chunk-hxhmhw23.js";import{A,oe}from"./chunk-x3py9q5v.js";import{a}from"./chunk-av1acvah.js";import{Ce,hn,yn,bn}from"./chunk-dzpm2n8g.js";import{Pt}from"./chunk-an4vtgem.js";import{Tt,er,ln,be}from"./chunk-97kgrevs.js";import{I,et}from"./chunk-ws2h92mm.js";import C from"fs";import b from"path";import x from"process";function B(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=I()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${yn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return be(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>Ce(l))])],f=Tt(i()),u=ln(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return be(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=oe({loader:"ts",target:"browser",define:A()});for(let l of p)try{let c=await Bun.file(l).text(),k=b.basename(l,".ts"),_=new Set;B(c,_);let y=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((U)=>U[2]),N=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(hn(c))c=await bn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=Pt(c),c=M(c),c=jn(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:k,ids:y.length===N?y:[],declared:_,code:`// Store: ${k}
3
3
  ${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return be(h,t,f,{chunks:[]}),null;f=Tt(i());let S={chunks:g};return be(h,t,f,S),S}function R(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
4
4
 
5
5
  `),n=`;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{yi,bi,wi,vi,js,Bs,vy,xy,Sy,ky,Fs,_y}from"./chunk-h2tq6cbr.js";import"./chunk-86nsbxep.js";import"./chunk-s29hp1qw.js";export{_y as generateDefaultRobotsTxt,Fs as generateRobotsTxt,xy as generateSitemap,Sy as generateSitemapIndex,vi as injectSeoTags,js as metaDirective,yi as processMetaDirectives,wi as processSeoDirective,bi as processStructuredData,vy as registerSeoDirectives,ky as scanForSitemapEntries,Bs as structuredDataDirective};
2
+ import{yi,bi,wi,vi,js,Bs,vy,xy,Sy,ky,Fs,_y}from"./chunk-0rdh8bw3.js";import"./chunk-295bykzd.js";import"./chunk-s29hp1qw.js";export{_y as generateDefaultRobotsTxt,Fs as generateRobotsTxt,xy as generateSitemap,Sy as generateSitemapIndex,vi as injectSeoTags,js as metaDirective,yi as processMetaDirectives,wi as processSeoDirective,bi as processStructuredData,vy as registerSeoDirectives,ky as scanForSitemapEntries,Bs as structuredDataDirective};
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{ye}from"./chunk-s29hp1qw.js";import"./chunk-86nsbxep.js";import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Ve,nl}from"./chunk-njza56wn.js";import"./chunk-6t04tqvh.js";import"./chunk-yffqfgjx.js";import"./chunk-h63ma36g.js";import"./chunk-agd2b928.js";import"./chunk-w53p65hy.js";import"./chunk-h2tq6cbr.js";import"./chunk-ssg6ne5b.js";import"./chunk-2gg3vjks.js";import"./chunk-jc74097x.js";import"./chunk-2cvwjtjh.js";import"./chunk-345waetq.js";import"./chunk-ekdhjm8p.js";import"./chunk-pm27mcfp.js";import"./chunk-4n45qa0b.js";import"./chunk-kee5a3ce.js";import"./chunk-q74affc4.js";import"./chunk-gbncp2gp.js";import"./chunk-q1mb0fbt.js";import"./chunk-czcx3nbx.js";import"./chunk-8nqyyj1h.js";import"./chunk-yp4tn4zn.js";import"./chunk-ypsf5y5g.js";import"./chunk-4fkcn6z5.js";import"./chunk-2r0nrvqe.js";import"./chunk-aaea157p.js";import"./chunk-94ctmp0j.js";import"./chunk-ym0cdk7m.js";import"./chunk-9yx7cbhz.js";import"./chunk-c0g30cjs.js";import"./chunk-gad3ebgr.js";import"./chunk-8va3fs07.js";import"./chunk-45jpwbzd.js";import"./chunk-9fvjr9dd.js";import"./chunk-002zrse4.js";import"./chunk-jqvc2wbz.js";import"./chunk-a0q0kb0s.js";import"./chunk-8e1cv1hh.js";import"./chunk-ybjgnnyf.js";import"./chunk-9f31gs4m.js";import{gn,mn}from"./chunk-kyh32kma.js";import"./chunk-xf6snj8e.js";import"./chunk-ndqq991c.js";import"./chunk-sv7fdqmc.js";import"./chunk-a7ryj8z8.js";import"./chunk-463weehv.js";import"./chunk-shcnt6aa.js";import"./chunk-pdprhg5k.js";import"./chunk-hnxwqamj.js";import"./chunk-m91jj8nq.js";import{ba,wa,va,_o,xa,Sa,ka,Co,Eo,es,ts,ns}from"./chunk-smkerejj.js";import"./chunk-gmbw1xhm.js";import"./chunk-59er0fc7.js";import"./chunk-9zj3xztb.js";import"./chunk-k7ffxfgp.js";import"./chunk-t94y8g35.js";import"./chunk-1zkymrw0.js";import"./chunk-v1s838fe.js";import"./chunk-nb6erf75.js";import{Hc}from"./chunk-nnynrb97.js";import{b}from"./chunk-94mpe1ny.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(f){let m=typeof f==="string"?Number.parseInt(f,10):f;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(f){try{if(!S.existsSync(f)){let h=p.dirname(f),t=p.basename(f);if(S.existsSync(h)){let o=S.readdirSync(h).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 ${h}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${h} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${f}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${f}`,suggestion:"Check the file path and try again"}}if(S.statSync(f).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${f}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${f}`,suggestion:"Check file permissions and path"}}}function I(f){let m=typeof f==="string"?Number.parseInt(f,10):f;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=(f)=>f.includes("*")||f.includes("?")||f.includes("{")||f.includes("["),W=(f)=>f.endsWith(".stx")||f.endsWith(".md");function F(f,m=1){if(console.error(`\u274C ${f.error}`),f.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${f.suggestion}`);n.exit(m)}function M(f){if(!f)return;let m;try{m=JSON.parse(f)}catch(h){console.error(`\u274C --info-plist is not valid JSON: ${h.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[h,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${h}" must be a string, number or boolean`),n.exit(1);return m}async function V(f,m){try{let h=["test"],t=[];if(f&&f.length>0)for(let c of f)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(h.push(...t),m.filter)h.push("--pattern",m.filter);if(m.timeout)h.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=p.resolve("stx-test-report.xml");h.push("--reporter",m.reporter),h.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)h.push("--coverage");if(m.watch)h.push("--watch");h.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} ${h.join(" ")}`);let r=performance.now(),s=R(o,h,{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{ye}from"./chunk-s29hp1qw.js";import"./chunk-295bykzd.js";import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import{Ve,nl}from"./chunk-x3py9q5v.js";import"./chunk-6t04tqvh.js";import"./chunk-xynq9fcr.js";import"./chunk-h63ma36g.js";import"./chunk-agd2b928.js";import"./chunk-av1acvah.js";import"./chunk-0rdh8bw3.js";import"./chunk-ssg6ne5b.js";import"./chunk-ptg2karz.js";import"./chunk-9y2n8wm6.js";import"./chunk-kyb5nyt8.js";import"./chunk-cb2gzs3m.js";import"./chunk-8a09r8xy.js";import"./chunk-w9zs57z0.js";import"./chunk-4n45qa0b.js";import"./chunk-kee5a3ce.js";import"./chunk-q74affc4.js";import"./chunk-gbncp2gp.js";import"./chunk-q1mb0fbt.js";import"./chunk-czcx3nbx.js";import"./chunk-0f6k5r31.js";import"./chunk-yp4tn4zn.js";import"./chunk-myfsnf67.js";import"./chunk-4fkcn6z5.js";import"./chunk-2r0nrvqe.js";import"./chunk-aaea157p.js";import"./chunk-94ctmp0j.js";import"./chunk-an4vtgem.js";import"./chunk-rk98082b.js";import"./chunk-c0g30cjs.js";import"./chunk-vz6dtfe9.js";import"./chunk-8va3fs07.js";import"./chunk-vsraamv3.js";import"./chunk-w7476ea6.js";import"./chunk-1r1kfskk.js";import"./chunk-sqjv4kxc.js";import"./chunk-a0q0kb0s.js";import"./chunk-8e1cv1hh.js";import"./chunk-ybjgnnyf.js";import"./chunk-9f31gs4m.js";import{gn,mn}from"./chunk-dzpm2n8g.js";import"./chunk-fk45k15v.js";import"./chunk-x8s9487t.js";import"./chunk-sv7fdqmc.js";import"./chunk-a7ryj8z8.js";import"./chunk-463weehv.js";import"./chunk-shcnt6aa.js";import"./chunk-pdprhg5k.js";import"./chunk-ytbed3rp.js";import"./chunk-r04j085h.js";import{ba,wa,va,_o,xa,Sa,ka,Co,Eo,es,ts,ns}from"./chunk-26yzqev3.js";import"./chunk-29btwpda.js";import"./chunk-59er0fc7.js";import"./chunk-yc9bpftb.js";import"./chunk-awywwbc5.js";import"./chunk-d2pexm3z.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-nb6erf75.js";import{Hc}from"./chunk-htrptrn9.js";import{b}from"./chunk-94mpe1ny.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(f){let m=typeof f==="string"?Number.parseInt(f,10):f;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(f){try{if(!S.existsSync(f)){let h=p.dirname(f),t=p.basename(f);if(S.existsSync(h)){let o=S.readdirSync(h).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 ${h}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${h} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${f}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${f}`,suggestion:"Check the file path and try again"}}if(S.statSync(f).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${f}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${f}`,suggestion:"Check file permissions and path"}}}function I(f){let m=typeof f==="string"?Number.parseInt(f,10):f;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=(f)=>f.includes("*")||f.includes("?")||f.includes("{")||f.includes("["),W=(f)=>f.endsWith(".stx")||f.endsWith(".md");function F(f,m=1){if(console.error(`\u274C ${f.error}`),f.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${f.suggestion}`);n.exit(m)}function M(f){if(!f)return;let m;try{m=JSON.parse(f)}catch(h){console.error(`\u274C --info-plist is not valid JSON: ${h.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[h,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${h}" must be a string, number or boolean`),n.exit(1);return m}async function V(f,m){try{let h=["test"],t=[];if(f&&f.length>0)for(let c of f)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(h.push(...t),m.filter)h.push("--pattern",m.filter);if(m.timeout)h.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=p.resolve("stx-test-report.xml");h.push("--reporter",m.reporter),h.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)h.push("--coverage");if(m.watch)h.push("--watch");h.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} ${h.join(" ")}`);let r=performance.now(),s=R(o,h,{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(h){return console.error("Error running tests:",h instanceof Error?h.message:String(h)),!1}}var U=n.argv.length>=3&&(W(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(U){let f=n.argv[2],m={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let h=3;h<n.argv.length;h++){let t=n.argv[h];if(t==="--port"&&h+1<n.argv.length){let e=E(n.argv[++h]);if(!e.isValid)F(e);m.port=Number.parseInt(n.argv[h],10)}else if(t==="--no-watch")m.watch=!1;else if(t==="--highlight-theme"&&h+1<n.argv.length){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.defaultTheme=n.argv[++h]}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(f))try{let h=await Array.fromAsync(new Bun.Glob(f).scan({onlyFiles:!0,absolute:!0})),t=f.endsWith(".stx")?h.filter((s)=>s.endsWith(".stx")):f.endsWith(".md")?h.filter((s)=>s.endsWith(".md")):h.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=f.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: ${f}`),n.exit(1);if(!await ts(t,m))n.exit(1)}catch(h){console.error("Failed to process files:",h),n.exit(1)}else es(f,m).catch((h)=>{console.error("Failed to start dev server:",h),n.exit(1)})}else{let f=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 va(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-brzjass3.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-8h5nje66.js"),{loadConfig:s}=await import("./chunk-51qyxm0y.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-8h5nje66.js"),{loadConfig:s}=await import("./chunk-jr61mjwn.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 ns(".",{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 ns(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 ye.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 ts(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 es(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 Hc(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-brp8np3t.js");mn();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-w2p9mhef.js");mn();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-g5q0wgzk.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-pnw1n18p.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-pa6kgbmw.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${Ve}\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,x),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){ye.clear(),console.log("\u2705 Performance statistics cleared");return}let o=ye.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-vxw92h3q.js"),{resolveStxTargets:s}=await import("./chunk-z7k1xn6k.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-0rc5tg89.js"),{resolveStxTargets:s}=await import("./chunk-z7k1xn6k.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=ba(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-cv1vm1w0.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(Ve)}),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-909tgpxp.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-h26mpqrh.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(Ve)}),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-a6cwm61q.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-xncrk7dz.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-d8qt6hjg.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-zch65qrd.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-wbmx0rge.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-dfbbkjz6.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-czzehcxs.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-h3fv0q25.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-rxm46f9z.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-zch65qrd.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-wbmx0rge.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-3ahqdb2n.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-99956f90.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-h3fv0q25.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 x=p.join(d,`${a}.manifest.json`);if(S.writeFileSync(x,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: ${x}`),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(`