@stacksjs/stx 0.2.894 → 0.2.896

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 (125) hide show
  1. package/dist/{chunk-qn45rk5n.js → chunk-0k437z3q.js} +1 -1
  2. package/dist/{chunk-4s3ts344.js → chunk-142n73c3.js} +1 -1
  3. package/dist/{chunk-0waheg6m.js → chunk-18gfzvn5.js} +1 -1
  4. package/dist/{chunk-pg3yatv3.js → chunk-19v28wj2.js} +2 -2
  5. package/dist/{chunk-5zs5hrgz.js → chunk-1bft48gk.js} +2 -2
  6. package/dist/{chunk-s32gsz18.js → chunk-1y4ad3ma.js} +5 -5
  7. package/dist/{chunk-z8sv926e.js → chunk-2nqmw4dv.js} +1 -1
  8. package/dist/{chunk-gk0h2hp7.js → chunk-35j7gaj5.js} +1 -1
  9. package/dist/chunk-38gz54d6.js +182 -0
  10. package/dist/{chunk-j1mr34da.js → chunk-3jrn01rc.js} +1 -1
  11. package/dist/{chunk-tc94atxh.js → chunk-3sc1w0dz.js} +1 -1
  12. package/dist/{chunk-mj0dnha4.js → chunk-3wz8eys3.js} +1 -1
  13. package/dist/{chunk-90qwzwsm.js → chunk-4akw3bym.js} +1 -1
  14. package/dist/{chunk-vya7cck4.js → chunk-4d85str1.js} +1 -1
  15. package/dist/{chunk-hxm31y5q.js → chunk-54dk6rbc.js} +3 -3
  16. package/dist/chunk-55w7a5tt.js +3 -0
  17. package/dist/{chunk-8qgcvc9r.js → chunk-5zztnr63.js} +1 -1
  18. package/dist/{chunk-ae0qvjkz.js → chunk-66qwkxrv.js} +1 -1
  19. package/dist/{chunk-pjpf21y9.js → chunk-690518hw.js} +1 -1
  20. package/dist/{chunk-5spnw5zr.js → chunk-6s81gd2p.js} +1 -1
  21. package/dist/{chunk-ccecyvwf.js → chunk-6shfk0tt.js} +1 -1
  22. package/dist/{chunk-xdn58ea6.js → chunk-6yqeqesa.js} +4 -4
  23. package/dist/{chunk-0hfn4cek.js → chunk-7vr7nw7p.js} +1 -1
  24. package/dist/{chunk-khaem3zq.js → chunk-7xk40zsm.js} +1 -1
  25. package/dist/{chunk-xvprhdcb.js → chunk-80ky40mm.js} +1 -1
  26. package/dist/chunk-8abrg1v2.js +2 -0
  27. package/dist/{chunk-gzc16hs8.js → chunk-8ccgty8s.js} +2 -2
  28. package/dist/chunk-8e38dzxv.js +2 -0
  29. package/dist/{chunk-n64zbwzr.js → chunk-9rjgq8k4.js} +1 -1
  30. package/dist/{chunk-c5q6jdm9.js → chunk-9tngkmry.js} +4 -4
  31. package/dist/{chunk-s9a9kda4.js → chunk-9v2bpwgb.js} +2 -2
  32. package/dist/chunk-9vpcsn2f.js +2 -0
  33. package/dist/{chunk-kd7k31x3.js → chunk-aj5tsksz.js} +4 -4
  34. package/dist/{chunk-mdrdp6c4.js → chunk-avn3panj.js} +2 -2
  35. package/dist/chunk-b35t77m0.js +2 -0
  36. package/dist/chunk-c8hyr9vb.js +2 -0
  37. package/dist/{chunk-9f8fda1j.js → chunk-ch9028z3.js} +1 -1
  38. package/dist/{chunk-z012vpdz.js → chunk-cmg9x1ka.js} +3 -3
  39. package/dist/chunk-cp5x6kx1.js +2 -0
  40. package/dist/{chunk-x9036mfd.js → chunk-cphc60zw.js} +2 -2
  41. package/dist/chunk-e8szp5wa.js +2 -0
  42. package/dist/{chunk-wk36dj2m.js → chunk-er0hgd96.js} +1 -1
  43. package/dist/{chunk-p06tqhp9.js → chunk-exb4wc0c.js} +1 -1
  44. package/dist/{chunk-j5m4hy3m.js → chunk-fjpaxmvv.js} +2 -2
  45. package/dist/{chunk-yrjm6zyh.js → chunk-fnpq78k3.js} +1 -1
  46. package/dist/{chunk-e9c56r58.js → chunk-g71ppt0e.js} +4 -4
  47. package/dist/{chunk-3mdg7w2d.js → chunk-gxpcdhr3.js} +1 -1
  48. package/dist/{chunk-v6ja6a65.js → chunk-h19fp8g8.js} +2 -2
  49. package/dist/{chunk-d8ptv989.js → chunk-h91ry9p1.js} +4 -4
  50. package/dist/chunk-hn679t1s.js +2 -0
  51. package/dist/{chunk-gjqdp0zx.js → chunk-jrbkvptj.js} +1 -1
  52. package/dist/chunk-jre984qm.js +2 -0
  53. package/dist/chunk-jyd9trff.js +2 -0
  54. package/dist/{chunk-8a71xvx1.js → chunk-knhf7dkn.js} +16 -16
  55. package/dist/{chunk-t79khbtp.js → chunk-m136gh80.js} +2 -2
  56. package/dist/chunk-n2d0jzyv.js +2 -0
  57. package/dist/{chunk-y54vpvy0.js → chunk-n8mfvqqz.js} +1 -1
  58. package/dist/{chunk-cbjvabsa.js → chunk-p1wqyf10.js} +43 -43
  59. package/dist/{chunk-8n5bjars.js → chunk-q671arjn.js} +1 -1
  60. package/dist/chunk-qe3z3x39.js +2 -0
  61. package/dist/{chunk-1a8ev0eh.js → chunk-rr0wvqa3.js} +1 -1
  62. package/dist/chunk-rspsbhcv.js +2 -0
  63. package/dist/{chunk-66qt9q6e.js → chunk-rvn63nv2.js} +19 -19
  64. package/dist/{chunk-c9xg8rc2.js → chunk-s5xfmr87.js} +2 -2
  65. package/dist/chunk-snbhzrfy.js +2 -0
  66. package/dist/{chunk-na92k4va.js → chunk-srsb2zvm.js} +1 -1
  67. package/dist/{chunk-kfbw96c5.js → chunk-t0ttxayz.js} +2 -2
  68. package/dist/chunk-t31twwh0.js +2 -0
  69. package/dist/{chunk-qrk535j6.js → chunk-t3zmfh8w.js} +4 -4
  70. package/dist/{chunk-60z8rka9.js → chunk-t6sdtsf8.js} +5 -5
  71. package/dist/{chunk-gcjqxvbb.js → chunk-ta07gj66.js} +2 -2
  72. package/dist/chunk-tbh7r1wh.js +2 -0
  73. package/dist/chunk-tspz0z7d.js +2 -0
  74. package/dist/chunk-tznd1egg.js +2 -0
  75. package/dist/{chunk-hdqy5v4v.js → chunk-w5kq4k7f.js} +1 -1
  76. package/dist/{chunk-mxf6cfbg.js → chunk-whcrca58.js} +6 -6
  77. package/dist/chunk-x57p5bay.js +2 -0
  78. package/dist/{chunk-6yy54yyp.js → chunk-xbqt53jj.js} +1 -1
  79. package/dist/{chunk-ac3e6nhg.js → chunk-xmg6bmh6.js} +3 -3
  80. package/dist/{chunk-hxq5tsqa.js → chunk-xtq8swr2.js} +1 -1
  81. package/dist/chunk-xvmd0aja.js +2 -0
  82. package/dist/{chunk-2eq3aret.js → chunk-xwrjre34.js} +1 -1
  83. package/dist/{chunk-h7yme97q.js → chunk-xy8smv5e.js} +2 -2
  84. package/dist/{chunk-z3ar05m3.js → chunk-xzj4jyhy.js} +5 -5
  85. package/dist/chunk-ycge4wfk.js +2 -0
  86. package/dist/chunk-z1dym2re.js +2 -0
  87. package/dist/{chunk-1csmm3f6.js → chunk-z3kvxk73.js} +1 -1
  88. package/dist/{chunk-8y39f6z3.js → chunk-zf68afyh.js} +3 -3
  89. package/dist/{chunk-qv4qwa61.js → chunk-zkq66keq.js} +1 -1
  90. package/dist/cli.js +14 -14
  91. package/dist/craft-entry.js +2 -2
  92. package/dist/craft.js +2 -2
  93. package/dist/native/accessibility.d.ts +0 -15
  94. package/dist/native/accessibility.js +2 -6
  95. package/dist/native/compiler/html-to-ir.js +1 -27
  96. package/dist/offline/app-service-worker.d.ts +4 -1
  97. package/dist/offline/app-service-worker.js +23 -5
  98. package/dist/process.js +4 -3
  99. package/dist/pwa.js +1 -1
  100. package/dist/ssg.js +10 -10
  101. package/package.json +5 -5
  102. package/dist/chunk-0d14783x.js +0 -2
  103. package/dist/chunk-0yw075t7.js +0 -2
  104. package/dist/chunk-3ngbdap1.js +0 -2
  105. package/dist/chunk-484x27q5.js +0 -2
  106. package/dist/chunk-4eyyshsq.js +0 -2
  107. package/dist/chunk-4fcb8rmm.js +0 -2
  108. package/dist/chunk-4mmy5pfh.js +0 -2
  109. package/dist/chunk-4pq32bt3.js +0 -2
  110. package/dist/chunk-5kfe3smn.js +0 -2
  111. package/dist/chunk-b4kbj9kq.js +0 -2
  112. package/dist/chunk-b77t5zy2.js +0 -2
  113. package/dist/chunk-brmmkfnq.js +0 -2
  114. package/dist/chunk-btjhb71k.js +0 -2
  115. package/dist/chunk-dz1mkvdw.js +0 -2
  116. package/dist/chunk-dz2zehsh.js +0 -2
  117. package/dist/chunk-eenw264a.js +0 -2
  118. package/dist/chunk-erka2w6z.js +0 -2
  119. package/dist/chunk-gd5a11h2.js +0 -2
  120. package/dist/chunk-jjz64ac2.js +0 -2
  121. package/dist/chunk-jqnfvdx5.js +0 -182
  122. package/dist/chunk-nqarmx3w.js +0 -3
  123. package/dist/chunk-nxjfdtc0.js +0 -2
  124. package/dist/chunk-vm57848v.js +0 -2
  125. package/dist/chunk-xv471ek2.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ze,Mn,uo,Ki,z}from"./chunk-41z7f41b.js";import{Nn}from"./chunk-8qgcvc9r.js";import{Jr,C,Bl,xt,ta,Fl}from"./chunk-x9036mfd.js";import{D}from"./chunk-vk2jy6mn.js";import{T,R}from"./chunk-0jdz31q1.js";import{Xr,bo,Fn,Dl,Le}from"./chunk-3b3mkgpj.js";import{po,d,m,zr,p,te,K,be,_,bt,ho,De,et,yo}from"./chunk-ac3e6nhg.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-a0aqs5a8.js";import{t,h}from"./chunk-neg6ckjg.js";import{c}from"./chunk-hxws025y.js";import Ct from"path";import un from"process";import{AsyncLocalStorage as sc}from"async_hooks";var ni=new sc;function Rn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function si(e,n){return ni.run(Rn(e),n)}async function ri(e,n){let r=ni.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,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),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 Br(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 X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);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((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),G=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};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])))v();u++}return i.join(", ")}function Gs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function rc(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(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 Xs(e,n){let r=`{ ${rc(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import sn from"fs";import Ue from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ii=new Map;function Ir(e,n=!0){let r=ii.get(e);if(n&&r)return r;let i=new Map,a=[Ue.join(e,"src"),Ue.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=sn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ue.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ii.set(e,i);return i}function Js(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ue.join(r,"node_modules",e);try{if(sn.statSync(i).isDirectory())return i}catch{}let a=Ue.dirname(r);if(a===r)return null;r=a}}function Ys(e,n,r={}){return[Ue.resolve(Ue.dirname(n),`${e}.stx`),Ue.resolve(Ue.dirname(n),e),Ue.resolve(r.componentsDir||"components",`${e}.stx`),Ue.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function oi(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=J(n);return[n,r,i]}function Ti(e,n){let[r,i,a]=oi(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function $i(e,n){let r=n?Ue.resolve(n):void 0,i=Ue.dirname(Ue.resolve(e));for(;;){if(sn.existsSync(Ue.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ue.dirname(i);if(a===i)return;i=a}}var ic=["src/ui","src/components","components","dist"];function rs(e,n){let r=Ue.resolve(e);if(!n&&!r.split(Ue.sep).includes("node_modules"))return[];let i=$i(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(sn.readFileSync(Ue.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ic;return[Ue.dirname(Ue.resolve(e)),...l.map((u)=>Ue.resolve(i,u))]}function*Ri(e,n,r={},i){let a=oi(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ue.resolve(Ue.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...rs(n,r.projectRoot),...i?.__originalFilePath?[Ue.join(Ue.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ue.join(Ue.dirname(n),"components"),Ue.resolve(u,"src/components"),Ue.resolve(u,"components"),...import.meta.dir?[Ue.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ue.join(v,S);try{for(let S of sn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ue.join(v,S.name,I)}catch{}}}function ai(e,n,r={},i){let a=Ti(e,i);if(a!==void 0)return a;for(let l of Ri(e,n,r,i))try{if(sn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Zs(e,n=[],r={}){let i=new Set([...e].map((S)=>S.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(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.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((S)=>i.has(S))}import Is from"fs";import xe from"path";import Bt from"path";import _n from"fs";var oc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return oc.has(e.toLowerCase())}var ci=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"]),li={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"},ac=new Set(["ctrl","alt","shift","meta"]),fi={left:0,middle:1,right:2};function ui(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(ac.has(i))n.systemKeys.push(i);else if(i in fi)n.mouse=i;else if(i in li||/^[a-z]$/.test(i))n.keys.push(li[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 di(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,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function cc(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=fi[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 lc(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 Hs(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 uc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=cc(e),a=lc(Hs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Us(e.event,n))l.push("passive: true");let 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{Ze,Mn,uo,Ki,z}from"./chunk-41z7f41b.js";import{Nn}from"./chunk-5zztnr63.js";import{Jr,C,Bl,xt,ta,Fl}from"./chunk-cphc60zw.js";import{D}from"./chunk-vk2jy6mn.js";import{T,R}from"./chunk-0jdz31q1.js";import{Xr,bo,Fn,Dl,Le}from"./chunk-3b3mkgpj.js";import{po,d,m,zr,p,te,K,be,_,bt,ho,De,et,yo}from"./chunk-xmg6bmh6.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-a0aqs5a8.js";import{t,h}from"./chunk-neg6ckjg.js";import{c}from"./chunk-hxws025y.js";import Ct from"path";import un from"process";import{AsyncLocalStorage as sc}from"async_hooks";var ni=new sc;function Rn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function si(e,n){return ni.run(Rn(e),n)}async function ri(e,n){let r=ni.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,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),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 Br(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 X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);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((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),G=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};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])))v();u++}return i.join(", ")}function Gs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function rc(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(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 Xs(e,n){let r=`{ ${rc(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import sn from"fs";import Ve from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ii=new Map;function Ir(e,n=!0){let r=ii.get(e);if(n&&r)return r;let i=new Map,a=[Ve.join(e,"src"),Ve.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=sn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ve.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ii.set(e,i);return i}function Js(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ve.join(r,"node_modules",e);try{if(sn.statSync(i).isDirectory())return i}catch{}let a=Ve.dirname(r);if(a===r)return null;r=a}}function Ys(e,n,r={}){return[Ve.resolve(Ve.dirname(n),`${e}.stx`),Ve.resolve(Ve.dirname(n),e),Ve.resolve(r.componentsDir||"components",`${e}.stx`),Ve.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function oi(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=J(n);return[n,r,i]}function Ti(e,n){let[r,i,a]=oi(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function $i(e,n){let r=n?Ve.resolve(n):void 0,i=Ve.dirname(Ve.resolve(e));for(;;){if(sn.existsSync(Ve.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ve.dirname(i);if(a===i)return;i=a}}var ic=["src/ui","src/components","components","dist"];function rs(e,n){let r=Ve.resolve(e);if(!n&&!r.split(Ve.sep).includes("node_modules"))return[];let i=$i(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(sn.readFileSync(Ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ic;return[Ve.dirname(Ve.resolve(e)),...l.map((u)=>Ve.resolve(i,u))]}function*Ri(e,n,r={},i){let a=oi(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ve.resolve(Ve.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...rs(n,r.projectRoot),...i?.__originalFilePath?[Ve.join(Ve.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ve.join(Ve.dirname(n),"components"),Ve.resolve(u,"src/components"),Ve.resolve(u,"components"),...import.meta.dir?[Ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ve.join(v,S);try{for(let S of sn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ve.join(v,S.name,I)}catch{}}}function ai(e,n,r={},i){let a=Ti(e,i);if(a!==void 0)return a;for(let l of Ri(e,n,r,i))try{if(sn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Zs(e,n=[],r={}){let i=new Set([...e].map((S)=>S.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(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.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((S)=>i.has(S))}import Is from"fs";import xe from"path";import Bt from"path";import _n from"fs";var oc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return oc.has(e.toLowerCase())}var ci=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"]),li={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"},ac=new Set(["ctrl","alt","shift","meta"]),fi={left:0,middle:1,right:2};function ui(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(ac.has(i))n.systemKeys.push(i);else if(i in fi)n.mouse=i;else if(i in li||/^[a-z]$/.test(i))n.keys.push(li[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 di(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,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ci.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:ui(G.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function cc(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=fi[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 lc(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 Hs(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 uc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=cc(e),a=lc(Hs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Us(e.event,n))l.push("passive: true");let 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 pc(e,n=""){let r=di(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 v=f.match(/id=["']([^"']+)["']/);if(v)for(let S of u.events)S.elementId=v[1]}for(let v of u.events){let S=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${S}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${S}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(j,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function pi(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function tl(e,n,r){if(Fl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:v}=pc(e,pi(n)),S=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...S,...v],f}let i=di(e,pi(n));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let v=i[f],S=v.originalTag;if(!S.includes(" id="))S=S.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let I=S.match(/id=["']([^"']+)["']/);if(I)for(let j of v.events)j.elementId=I[1]}for(let I of v.events){let j=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");S=S.replace(L,""),S=S.replace(M,"")}a=a.slice(0,v.startIndex)+S+a.slice(v.endIndex)}let l=Ai(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 gi(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 Ut(e,n){let r=t(e),{depths:i,balanced:a}=h(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 v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&gi(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&gi(f[1],!1).has(n))return!0;return!1}var Ve="0.2.894";var mi=Symbol.for(`stx.lazy-module-promises.${Ve}`);function dc(){let e=globalThis;return e[mi]??=new Map,e[mi]}function o(e,n){let r=dc(),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 gc=/<\/(script)/gi;function me(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(gc,"<\\/$1")}import hi from"fs";var xi=[];function k(e){let n=new T(e);return xi.push(n),n}function nl(){for(let e of xi)e.clear()}function E(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Or(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:hi.statSync(r).mtimeMs})}catch{}return n}function Qs(e){for(let n of e)try{if(hi.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ie=["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 mc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function hc(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 xc(e,n){let r=n;while(!0){let i=Bt.join(r,"node_modules",e,"package.json");if(_n.existsSync(i))return Bt.dirname(i);let a=Bt.dirname(r);if(a===r)return null;r=a}}function bc(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 yc(e,n){let r=hc(e);if(!r||!r.subpath)return null;let i=xc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(_n.readFileSync(Bt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=bc(a.exports,l);if(!u)return null;let f=Bt.resolve(i,u);return _n.existsSync(f)?f:null}function Fi(e,n){let r=n.filePath?Bt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(mc,(v,S)=>{let I;try{if(S.startsWith("./")||S.startsWith("../")||S.startsWith("/")){if(I=S.startsWith("/")?S:Bt.resolve(r,S),!_n.existsSync(I))throw Error(`file not found: ${I}`)}else{let j=null;try{j=Bun.resolveSync(S,i)}catch{j=yc(S,i)}if(!j)throw Error(`could not resolve ${S} (Bun.resolveSync + exports fallback both failed)`);I=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(S)} (from ${n.filePath||"<unknown>"}): ${j?.message||j}`),u.push(S),""}if(a.has(I))return"";a.add(I);try{let j=_n.readFileSync(I,"utf8");l.push({source:S,resolvedPath:I,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${I}: ${j?.message||j}`),u.push(S)}return""}),styles:l,unresolved:u}}function _c(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${_c(n.source)}" data-stx-layer="vendor">
115
+ `+a.slice(u);else a+=l;return a}function gi(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 Vt(e,n){let r=t(e),{depths:i,balanced:a}=h(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 v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&gi(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&gi(f[1],!1).has(n))return!0;return!1}var Ue="0.2.896";var mi=Symbol.for(`stx.lazy-module-promises.${Ue}`);function dc(){let e=globalThis;return e[mi]??=new Map,e[mi]}function o(e,n){let r=dc(),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 gc=/<\/(script)/gi;function me(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(gc,"<\\/$1")}import hi from"fs";var xi=[];function k(e){let n=new T(e);return xi.push(n),n}function nl(){for(let e of xi)e.clear()}function E(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Or(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:hi.statSync(r).mtimeMs})}catch{}return n}function Qs(e){for(let n of e)try{if(hi.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ie=["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 mc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function hc(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 xc(e,n){let r=n;while(!0){let i=Bt.join(r,"node_modules",e,"package.json");if(_n.existsSync(i))return Bt.dirname(i);let a=Bt.dirname(r);if(a===r)return null;r=a}}function bc(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 yc(e,n){let r=hc(e);if(!r||!r.subpath)return null;let i=xc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(_n.readFileSync(Bt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=bc(a.exports,l);if(!u)return null;let f=Bt.resolve(i,u);return _n.existsSync(f)?f:null}function Fi(e,n){let r=n.filePath?Bt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(mc,(v,S)=>{let I;try{if(S.startsWith("./")||S.startsWith("../")||S.startsWith("/")){if(I=S.startsWith("/")?S:Bt.resolve(r,S),!_n.existsSync(I))throw Error(`file not found: ${I}`)}else{let j=null;try{j=Bun.resolveSync(S,i)}catch{j=yc(S,i)}if(!j)throw Error(`could not resolve ${S} (Bun.resolveSync + exports fallback both failed)`);I=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(S)} (from ${n.filePath||"<unknown>"}): ${j?.message||j}`),u.push(S),""}if(a.has(I))return"";a.add(I);try{let j=_n.readFileSync(I,"utf8");l.push({source:S,resolvedPath:I,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${I}: ${j?.message||j}`),u.push(S)}return""}),styles:l,unresolved:u}}function _c(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${_c(n.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${n.contents}
118
118
  }
@@ -132,7 +132,7 @@ ${kc(e,n)}`;return""}function Ty(e,n=[]){let{browserImports:r}=vl(e),i=new Set(n
132
132
  + 'or it should be imported from a relative path so the bundler includes it.'
133
133
  );
134
134
  });
135
- `}function Ke(e){let n=e.__stxClientPayload;if(n&&typeof n==="object"){let i={};for(let a in n){let l=n[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let r={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;r[i]=a}return r}var Cc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,_i=new Set;function Rc(e,n){let r=Cc.test(e),i=n.length>32768;if(!r&&!i)return;if(_i.has(e))return;if(_i.add(e),r)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(n.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function An(e,n){if(!n)return"";let r=Le(e,new Set(Object.keys(n))),i=n.__stxDeclaredPayload===!0,a=[],l=Object.entries(n).sort(([u],[f])=>u<f?-1:u>f?1:0);for(let[u,f]of l){if(!/^[A-Za-z_$][\w$]*$/.test(u))continue;if(u.startsWith("__")||u.startsWith("$"))continue;if(!i&&!r.has(u))continue;if(Ut(e,u)){if(i)console.warn(`[stx] defineClientPayload declares "${u}", but this client block also declares "${u}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${u}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(f)}catch{continue}if(v===void 0)continue;Rc(u,v),a.push(` var ${u} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
135
+ `}function Ke(e){let n=e.__stxClientPayload;if(n&&typeof n==="object"){let i={};for(let a in n){let l=n[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let r={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;r[i]=a}return r}var Cc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,_i=new Set;function Rc(e,n){let r=Cc.test(e),i=n.length>32768;if(!r&&!i)return;if(_i.has(e))return;if(_i.add(e),r)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(n.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function An(e,n){if(!n)return"";let r=Le(e,new Set(Object.keys(n))),i=n.__stxDeclaredPayload===!0,a=[],l=Object.entries(n).sort(([u],[f])=>u<f?-1:u>f?1:0);for(let[u,f]of l){if(!/^[A-Za-z_$][\w$]*$/.test(u))continue;if(u.startsWith("__")||u.startsWith("$"))continue;if(!i&&!r.has(u))continue;if(Vt(e,u)){if(i)console.warn(`[stx] defineClientPayload declares "${u}", but this client block also declares "${u}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${u}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(f)}catch{continue}if(v===void 0)continue;Rc(u,v),a.push(` var ${u} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
136
136
  ${a.join(`
137
137
  `)}
138
138
  `}var Tc={left:0,middle:1,right:2};function Ac(e){let n=[];if(e.self)n.push("if ($event.target !== $el) return");for(let r of e.systemKeys)n.push(`if (!$event.${r}Key) return`);if(e.keys.length>0){let r=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");n.push(`if (!(${r})) return`)}if(e.mouse!==null){let r=Tc[e.mouse];n.push(`if ($event.button !== ${r}) return`)}if(e.prevent)n.push("$event.preventDefault()");if(e.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Ic(e,n){let{elementId:r,event:i,modifiers:a}=e,l=Hs(e.handler),u=Ac(a),f=[];if(a.once)f.push("once: true");if(a.capture)f.push("capture: true");if(Us(i,a))f.push("passive: true");let v=f.length>0?`, { ${f.join(", ")} }`:"",S="";if(u)S+=`${u}; `;let I=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),j=`var $emit = function(name, detail) {
@@ -182,7 +182,7 @@ else {
182
182
  // STX: auto-generated event bindings
183
183
  ${e.map((r,i)=>Ic(r,i)).join(`
184
184
  `)}`}function wi(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 v=f;if(u++,v==="`"){let S=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&S===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){S++,u+=2;continue}if(i[u]==="}"&&S>0){S--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===v){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 v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var jc=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 Pc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!jc.has(V))n.add(V)}}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 v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Ge(e,n={}){let r=e,i="",a=!1,l=[],u=Fi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=zi(u.styles),v=Xt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-yrjm6zyh.js"));if(S(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let U=vl(r);r=U.code,i=xl(U.stxImports,U.browserImports.filter((H)=>!l.includes(H)))}if(i=`${An(r,n.serverData)}${i}`,r=D(r),!a&&Xe(n.attrs||""))r=Je(r);let j=Oc(n.eventBindings||[]),L=(n.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(L),V=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(M){let U=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),H=`type="module" data-stx-scoped${V}${U?` ${U}`:""}`;return`${f}<script ${H}>
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 v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var jc=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 Pc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!jc.has(V))n.add(V)}}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 v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Ge(e,n={}){let r=e,i="",a=!1,l=[],u=Fi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=zi(u.styles),v=Xt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-fnpq78k3.js"));if(S(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let U=vl(r);r=U.code,i=xl(U.stxImports,U.browserImports.filter((H)=>!l.includes(H)))}if(i=`${An(r,n.serverData)}${i}`,r=D(r),!a&&Xe(n.attrs||""))r=Je(r);let j=Oc(n.eventBindings||[]),L=(n.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(L),V=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(M){let U=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),H=`type="module" data-stx-scoped${V}${U?` ${U}`:""}`;return`${f}<script ${H}>
186
186
  ${me(`${i}${r}
187
187
  ${j}`)}
188
188
  </script>`}let W=ta(e),Z=/function __stx_setup_/.test(r),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(U){let H=U.length>0?`
@@ -205,7 +205,7 @@ ${j}`)}
205
205
  } catch (error) {
206
206
  console.error(${JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`)}, error);
207
207
  }
208
- })()</script>`}import{createHash as Fc}from"crypto";var qs=/\s*/y,er=/\x00STX_HTML_COMMENT_\d+\x00/y;function Vt(e){let n=0;while(n<e.length){if(qs.lastIndex=n,qs.exec(e),n=qs.lastIndex,e.startsWith("<!--",n)){let r=e.indexOf("-->",n+4);if(r===-1)return n;n=r+3;continue}if(er.lastIndex=n,er.test(e)){n=er.lastIndex;continue}return n}return n}var tr=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Mc=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Oe(e){let n=[],r=0;while(r<e.length){let i=e.indexOf("<",r);if(i===-1)break;if(e.startsWith("<!--",i)){let L=e.indexOf("-->",i+4);if(L===-1)break;r=L+3;continue}tr.lastIndex=i;let a=tr.exec(e);if(!a){r=i+1;continue}let l=tr.lastIndex,u=l,f=null;for(;u<e.length;u++){let L=e[u];if(f){if(L===f)f=null}else if(L==='"'||L==="'")f=L;else if(L===">")break}if(u===e.length)break;let v=a[1]==="/",S=e[u-1]==="/";n.push({start:i,end:u+1,name:a[2],attributes:e.slice(l,S?u-1:u),closing:v,selfClosing:S}),r=u+1;let I=a[2].toLowerCase();if(!v&&I==="plaintext")break;let j=Mc.get(I);if(!v&&(I==="script"||I==="style"||j)){let L=j??(I==="script"?as:cs);L.lastIndex=r;let M=L.exec(e);if(!M)break;r=M.index}}return n}var is=/<script\b[^>]*>/iy,as=/<\/script\s*>/ig,os=/<style\b[^>]*>/iy,cs=/<\/style\s*>/ig;function Si(e,n,r,i){r.lastIndex=n;let a=r.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=r.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function Q(e,n){return Si(e,n,is,as)}function Cn(e,n){return Si(e,n,os,cs)}function qe(e,n){if(!e.startsWith("<!--",n))return-1;let r=e.indexOf("-->",n+4);if(r===-1)return-1;return r+3}function Ei(e,n){if(e.startsWith("<!--",n)){let a=qe(e,n);return a===-1?e.length:a}if(is.lastIndex=n,is.exec(e)?.index===n){as.lastIndex=is.lastIndex;let a=as.exec(e);return a?a.index+a[0].length:e.length}if(os.lastIndex=n,os.exec(e)?.index===n){cs.lastIndex=os.lastIndex;let a=cs.exec(e);return a?a.index+a[0].length:e.length}return-1}function x(e,n){let r=[],i=0,a=e.length,l=!1,u=null;while(i<a){let f=e[i];if(l){if(u){if(f===u)u=null}else if(f==='"'||f==="'")u=f;else if(f===">")l=!1;i++;continue}if(f!=="<"){let j=e.indexOf("<",i+1);if(j===-1)break;i=j;continue}let v=n(e,i);if(v>i){r.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let S=Ei(e,i);if(S>i){i=S;continue}let I=e.charCodeAt(i+1);if(I>=65&&I<=90||I>=97&&I<=122)l=!0;i++}return r}function ki(e){let n=0,r=0,i=0,a=!1,l=null;while(i<e.length){if(a){let j=e[i];if(l){if(j===l)l=null}else if(j==='"'||j==="'")l=j;else if(j===">")a=!1;i++;continue}let u=e.indexOf("<",i),f=u===-1?e.length:u;while(i<f){let j=e[i++];if(j==="{")n++;else if(j==="}")r++;if(n>=2&&r>=2)return!0}if(u===-1)break;let v=Ei(e,u);if(v>u){i=v;continue}let S=e.charCodeAt(u+1),I=S===47?e.charCodeAt(u+2):S;if(I>=65&&I<=90||I>=97&&I<=122)a=!0;i=u+1}return!1}function rl(e,n){while(e.size>=n){let r=e.keys().next();if(r.done)return;e.delete(r.value)}}var Dc=1024,Nc=16777216,rn=new Map,nr=0;function Lc(e,n){rn.set(e,n),nr+=e.length+n.output.length;for(let[r,i]of rn){if(nr<=Nc)break;rn.delete(r),nr-=r.length+i.output.length}}function ke(e,n,r,i){let a=i!==void 0&&e.length>=Dc,l=a?`${i}\x00${e}`:"";if(a){let I=rn.get(l);if(I)return rn.delete(l),rn.set(l,I),{output:I.output,tokens:I.tokens.slice()}}let u=x(e,n);if(u.length===0)return{output:e,tokens:[]};let f=u.map((I)=>I.token),v="",S=0;for(let I=0;I<u.length;I++){let j=u[I];v+=e.slice(S,j.start),v+=r(j.token,I),S=j.end}if(v+=e.slice(S),a)return Lc(l,{output:v,tokens:f}),{output:v,tokens:f.slice()};return{output:v,tokens:f}}var zc=1024,Bc=16777216,on=new Map,sr=0;function Wc(e,n){on.set(e,n),sr+=e.length+n.output.length;for(let[r,i]of on){if(sr<=Bc)break;on.delete(r),sr-=r.length+i.output.length}}function rr(e,n,r){return{output:n,scripts:r,restore:(i)=>i===n?e:Nr(i,r)}}function se(e){let n=e.length>=zc;if(n){let a=on.get(e);if(a)return on.delete(e),on.set(e,a),rr(e,a.output,a.scripts.slice())}let{output:r,tokens:i}=ke(e,Q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return Wc(e,{output:r,scripts:i}),rr(e,r,i.slice());return rr(e,r,i)}function Nr(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,i)=>n[+i]??"")}function ee(e){let n=Oe(e),r=[];for(let i=0;i<n.length;i++){let a=n[i],l=n[i+1];if(a.name.toLowerCase()!=="script"||a.closing||l?.name.toLowerCase()!=="script"||!l.closing)continue;r.push({start:a.start,end:l.end,bodyStart:a.end,bodyEnd:l.start,attrs:a.attributes})}return r}var ls="__stx_component_client_factories";function us(e){let n=e[ls];return n instanceof Map?n:null}function hl(e){e[ls]=new Map}function ir(e,n){let r=us(e);if(!r)return null;let i=Fc("sha256").update(n).digest("hex").slice(0,16),a=r.get(i);if(a)a.instances++;else r.set(i,{body:n,instances:1});return i}function yl(e,n){let r=us(n);if(!r?.size)return e;let i=new Map;for(let[I,j]of r)if(j.instances===1)i.set(I,j.body);let a=[];if(i.size>0){let I=[...i.keys()].map((M)=>JSON.stringify(M).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),j=new RegExp(`window\\.__stxComponentFactories\\[(${I})\\]\\(("[^"]+")\\);`,"g"),L=j.exec(e);while(L!==null){let M=i.get(JSON.parse(L[1]));if(M!==void 0)a.push({start:L.index,end:L.index+L[0].length,replacement:me(`(${M})(${L[2]});`)});L=j.exec(e)}}let l=[...r].filter(([,I])=>I.instances>1);if(l.length===0)return Ci(e,a);let u=l.map(([I,j])=>` try { factories[${JSON.stringify(I)}] = factories[${JSON.stringify(I)}] || ${j.body}; }
208
+ })()</script>`}import{createHash as Fc}from"crypto";var qs=/\s*/y,er=/\x00STX_HTML_COMMENT_\d+\x00/y;function Ut(e){let n=0;while(n<e.length){if(qs.lastIndex=n,qs.exec(e),n=qs.lastIndex,e.startsWith("<!--",n)){let r=e.indexOf("-->",n+4);if(r===-1)return n;n=r+3;continue}if(er.lastIndex=n,er.test(e)){n=er.lastIndex;continue}return n}return n}var tr=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Mc=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Oe(e){let n=[],r=0;while(r<e.length){let i=e.indexOf("<",r);if(i===-1)break;if(e.startsWith("<!--",i)){let L=e.indexOf("-->",i+4);if(L===-1)break;r=L+3;continue}tr.lastIndex=i;let a=tr.exec(e);if(!a){r=i+1;continue}let l=tr.lastIndex,u=l,f=null;for(;u<e.length;u++){let L=e[u];if(f){if(L===f)f=null}else if(L==='"'||L==="'")f=L;else if(L===">")break}if(u===e.length)break;let v=a[1]==="/",S=e[u-1]==="/";n.push({start:i,end:u+1,name:a[2],attributes:e.slice(l,S?u-1:u),closing:v,selfClosing:S}),r=u+1;let I=a[2].toLowerCase();if(!v&&I==="plaintext")break;let j=Mc.get(I);if(!v&&(I==="script"||I==="style"||j)){let L=j??(I==="script"?as:cs);L.lastIndex=r;let M=L.exec(e);if(!M)break;r=M.index}}return n}var is=/<script\b[^>]*>/iy,as=/<\/script\s*>/ig,os=/<style\b[^>]*>/iy,cs=/<\/style\s*>/ig;function Si(e,n,r,i){r.lastIndex=n;let a=r.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=r.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function Q(e,n){return Si(e,n,is,as)}function Cn(e,n){return Si(e,n,os,cs)}function qe(e,n){if(!e.startsWith("<!--",n))return-1;let r=e.indexOf("-->",n+4);if(r===-1)return-1;return r+3}function Ei(e,n){if(e.startsWith("<!--",n)){let a=qe(e,n);return a===-1?e.length:a}if(is.lastIndex=n,is.exec(e)?.index===n){as.lastIndex=is.lastIndex;let a=as.exec(e);return a?a.index+a[0].length:e.length}if(os.lastIndex=n,os.exec(e)?.index===n){cs.lastIndex=os.lastIndex;let a=cs.exec(e);return a?a.index+a[0].length:e.length}return-1}function x(e,n){let r=[],i=0,a=e.length,l=!1,u=null;while(i<a){let f=e[i];if(l){if(u){if(f===u)u=null}else if(f==='"'||f==="'")u=f;else if(f===">")l=!1;i++;continue}if(f!=="<"){let j=e.indexOf("<",i+1);if(j===-1)break;i=j;continue}let v=n(e,i);if(v>i){r.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let S=Ei(e,i);if(S>i){i=S;continue}let I=e.charCodeAt(i+1);if(I>=65&&I<=90||I>=97&&I<=122)l=!0;i++}return r}function ki(e){let n=0,r=0,i=0,a=!1,l=null;while(i<e.length){if(a){let j=e[i];if(l){if(j===l)l=null}else if(j==='"'||j==="'")l=j;else if(j===">")a=!1;i++;continue}let u=e.indexOf("<",i),f=u===-1?e.length:u;while(i<f){let j=e[i++];if(j==="{")n++;else if(j==="}")r++;if(n>=2&&r>=2)return!0}if(u===-1)break;let v=Ei(e,u);if(v>u){i=v;continue}let S=e.charCodeAt(u+1),I=S===47?e.charCodeAt(u+2):S;if(I>=65&&I<=90||I>=97&&I<=122)a=!0;i=u+1}return!1}function rl(e,n){while(e.size>=n){let r=e.keys().next();if(r.done)return;e.delete(r.value)}}var Dc=1024,Nc=16777216,rn=new Map,nr=0;function Lc(e,n){rn.set(e,n),nr+=e.length+n.output.length;for(let[r,i]of rn){if(nr<=Nc)break;rn.delete(r),nr-=r.length+i.output.length}}function ke(e,n,r,i){let a=i!==void 0&&e.length>=Dc,l=a?`${i}\x00${e}`:"";if(a){let I=rn.get(l);if(I)return rn.delete(l),rn.set(l,I),{output:I.output,tokens:I.tokens.slice()}}let u=x(e,n);if(u.length===0)return{output:e,tokens:[]};let f=u.map((I)=>I.token),v="",S=0;for(let I=0;I<u.length;I++){let j=u[I];v+=e.slice(S,j.start),v+=r(j.token,I),S=j.end}if(v+=e.slice(S),a)return Lc(l,{output:v,tokens:f}),{output:v,tokens:f.slice()};return{output:v,tokens:f}}var zc=1024,Bc=16777216,on=new Map,sr=0;function Wc(e,n){on.set(e,n),sr+=e.length+n.output.length;for(let[r,i]of on){if(sr<=Bc)break;on.delete(r),sr-=r.length+i.output.length}}function rr(e,n,r){return{output:n,scripts:r,restore:(i)=>i===n?e:Nr(i,r)}}function se(e){let n=e.length>=zc;if(n){let a=on.get(e);if(a)return on.delete(e),on.set(e,a),rr(e,a.output,a.scripts.slice())}let{output:r,tokens:i}=ke(e,Q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return Wc(e,{output:r,scripts:i}),rr(e,r,i.slice());return rr(e,r,i)}function Nr(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,i)=>n[+i]??"")}function ee(e){let n=Oe(e),r=[];for(let i=0;i<n.length;i++){let a=n[i],l=n[i+1];if(a.name.toLowerCase()!=="script"||a.closing||l?.name.toLowerCase()!=="script"||!l.closing)continue;r.push({start:a.start,end:l.end,bodyStart:a.end,bodyEnd:l.start,attrs:a.attributes})}return r}var ls="__stx_component_client_factories";function us(e){let n=e[ls];return n instanceof Map?n:null}function hl(e){e[ls]=new Map}function ir(e,n){let r=us(e);if(!r)return null;let i=Fc("sha256").update(n).digest("hex").slice(0,16),a=r.get(i);if(a)a.instances++;else r.set(i,{body:n,instances:1});return i}function yl(e,n){let r=us(n);if(!r?.size)return e;let i=new Map;for(let[I,j]of r)if(j.instances===1)i.set(I,j.body);let a=[];if(i.size>0){let I=[...i.keys()].map((M)=>JSON.stringify(M).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),j=new RegExp(`window\\.__stxComponentFactories\\[(${I})\\]\\(("[^"]+")\\);`,"g"),L=j.exec(e);while(L!==null){let M=i.get(JSON.parse(L[1]));if(M!==void 0)a.push({start:L.index,end:L.index+L[0].length,replacement:me(`(${M})(${L[2]});`)});L=j.exec(e)}}let l=[...r].filter(([,I])=>I.instances>1);if(l.length===0)return Ci(e,a);let u=l.map(([I,j])=>` try { factories[${JSON.stringify(I)}] = factories[${JSON.stringify(I)}] || ${j.body}; }
209
209
  catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(I)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
210
210
  `),f=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
211
211
  (function() {
@@ -213,8 +213,8 @@ ${j}`)}
213
213
  ${me(u)}
214
214
  })();
215
215
  </script>`,v,S=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return x(e,(I,j)=>{if(v===void 0){if(S.lastIndex=j,S.test(I))v=j}return-1}),a.push({start:v??0,end:v??0,replacement:`${f}
216
- `}),Ci(e,a)}function Ci(e,n){if(n.length===0)return e;n.sort((l,u)=>l.start-u.start||l.end-u.end);let r=Array(n.length*2+1),i=0,a=0;for(let l of n)r[a++]=e.slice(i,l.start),r[a++]=l.replacement,i=l.end;return r[a]=e.slice(i),r.join("")}function qi(e){let n=us(e),r=new Map;if(n)for(let[i,a]of n)r.set(i,a.instances);return r}function Zi(e,n){let r=us(e);if(!r)return[];let i=[];for(let[a,l]of r){let u=l.instances-(n.get(a)??0);if(u>0)i.push({body:l.body,count:u})}return i}function Ji(e,n){for(let{body:r,count:i}of n)for(let a=0;a<i;a++)ir(e,r)}function Pe(e,n,r=2){let i=0,a=null;for(let l=n+r;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==="{"){i++;continue}if(u==="}"){if(i>0){i--;continue}let f=0;while(e[l+f]==="}")f++;if(f>=r)return l}}return-1}import xo from"fs";var Xi=0,or=new Map;function Cl(){Xi=0,or.clear()}function ps(e,n){let r=Xi++,i=`<!--__STX_${e.toUpperCase()}_${r}__-->`;return or.set(i,{type:e,expression:n}),i}function El(){let e={};for(let[n,r]of or)e[n]={type:r.type,expression:r.expression};return e}function Tl(e,n){let r=e;for(let[i,a]of n)r=r.split(i).join(a);return r}function Ui(e){return e.includes("<!--__STX_")}var Vc=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function Uc(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Gi(e){return e.replace(/\{{2,}/g,(n)=>Uc(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Vc,"&#64;")}function Dr(e,n,r=!1){let{openTag:i,tail:a}=r?Hc(e,n):Kc(e).at(n);return Zc(a,i,r)}function Hc(e,n){let r="",i=0;for(let u=0;u<n;u++){if(!e.startsWith("{{",u))continue;let f=Pe(e,u);if(f<0||f+2>n)break;r+=e.slice(i,u)+"x",u=f+1,i=f+2}r+=e.slice(i,n);let a=-1,l=null;for(let u=0;u<r.length;u++){let f=r[u];if(l){if(f===l)l=null;continue}if(f==='"'||f==="'"){l=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=u}return{openTag:a,tail:a>=0?r.slice(a+1):r}}var fs=null;function Kc(e){if(fs&&fs.source===e)return fs.scanner;let n=qc(e);return fs={source:e,scanner:n},n}function qc(e){let n=0,r=-1,i=null,a=-1,l=(f,v)=>{let S=e[f];if(v.quote){if(S===v.quote)v.quote=null;return}if(v.openTag>=0){if(S==='"'||S==="'"){v.quote=S;return}if(S===">"){v.openTag=-1;return}}if(S==="<")v.openTag=f},u=(f,v)=>{if(v.openTag>=0||!e.startsWith("<!--",f))return-1;let S=e.indexOf("-->",f+4);return S<0?e.length:S+3};return{at(f){if(f<n)n=0,r=-1,i=null,a=-1;let v={openTag:r,quote:i},S=!1;while(n<f){if(a<0&&e.startsWith("{{",n)){let W=Pe(e,n);if(W<0)a=n;else if(W+2<=f){n=W+2;continue}else break}let V=u(n,v);if(V>=0){if(V>f){S=!0;break}n=V;continue}l(n,v),n++}if(r=v.openTag,i=v.quote,S)return{openTag:-1,tail:""};let I=a>=0?a:n,j={openTag:r,quote:i};for(let V=n;V<f;V++){let W=u(V,j);if(W>=0){if(W>f)return{openTag:-1,tail:""};V=W-1;continue}l(V,j)}if(j.openTag<0)return{openTag:-1,tail:""};let L="",M=j.openTag+1;for(let V=M;V<Math.min(f,I);V++){if(!e.startsWith("{{",V))continue;let W=Pe(e,V);L+=e.slice(M,V)+"x",V=W+1,M=W+2}return L+=e.slice(M,f),{openTag:j.openTag,tail:L}}}}function Zc(e,n,r){if(n<0&&!r)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let u=e[i];if(u==='"'||u==="'"){let f=++i,v=e.indexOf(u,i);if(v===-1)return{kind:"attribute",name:l,quote:u,valuePrefix:e.slice(f)};i=v+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class he extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Yi="unsafe:";var Jc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Xc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Gc=/^data:(?:text\/html|application\/xhtml\+xml)/,Yc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Qc(e){return e.replace(Yc,"").toLowerCase()}function ar(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function ds(e,n="navigable"){let r=Qc(e);if(Jc.test(r))return!0;return n==="navigable"?Xc.test(r):Gc.test(r)}function Mr(e,n="navigable"){return ds(e,n)?"unsafe:"+e:e}function el(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return ar(n[1])}function Qi(e,n,r=256){if(n<=r)return e.slice(0,n);let i=e.slice(n-r,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function fo(e,n,r=n){let i=el(e);return i&&ds(n,i)?"unsafe:"+r:r}function Wt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),u=e.slice(n+4).trim();return l&&u?{arrayExpr:l,itemVar:u}:null}let r=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!r)return null;let i=r[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=r[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function gs(e){let n=[],r=0,i="",a=0;for(let l=0;l<e.length;l++){let u=e[l];if(i){if(u==="\\")l++;else if(u===i)i="";continue}if(u==="'"||u==='"'||u==="`")i=u;else if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function go(e,n){let r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===n&&r===0)return i}return-1}function mo(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return r}return-1}function Ft(e,n){let r=e.trim().replace(/^\.\.\./,"").trim(),i=go(r,"=");if(i!==-1&&r[i+1]!==">")r=r.slice(0,i).trim();if(!r)return;if(r.startsWith("{")&&r.endsWith("}")){for(let a of gs(r.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){Ft(l,n);continue}let u=go(l,":");Ft(u===-1?l:l.slice(u+1),n)}return}if(r.startsWith("[")&&r.endsWith("]")){for(let a of gs(r.slice(1,-1)))Ft(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(r))n.push(r)}function oe(e){let n=e.trim(),r=[],i=0;for(let l=0;l<n.length;l++){let u=n[l];if(u==="("||u==="["||u==="{")i++;else if(u===")"||u==="]"||u==="}")i--;else if(i===0&&/\s/.test(u)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let v=n.slice(0,l).trim();if(v.startsWith("(")&&mo(v)===v.length-1)v=v.slice(1,-1);for(let S of gs(v))Ft(S,r);if(r.length>0)return r;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&mo(l)===l.length-1)l=l.slice(1,-1);let u=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(u)Ft(u[2],r),Ft(u[1],r);else for(let f of gs(l))Ft(f,r)}return r}function F(e,n){let r=n instanceof Set?n:new Set(n);if(r.size===0)return!1;let u=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of u.match(/[a-zA-Z_$][\w$]*/g)||[])if(r.has(f))return!0;return!1}var ms="__stx_client_loop_names";function mt(e){let n=e?.[ms];return Array.isArray(n)?n:[]}function hs(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],r=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let u=r.pop();if(u)u.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let f=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((I)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(I[1])),v=(f?.[2]??f?.[3])?.trim();if(v&&f?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let S=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(r.push(S),S)n.push(S)}}return n}var vn={},_o=new Map;function $l(e){let n=_o.get(e);if(!n){let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${r}(?!\\w)`,"g"),_o.set(e,n)}return n.lastIndex=0,n}var lo={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let r=String(e);return r.charAt(0).toUpperCase()+r.slice(1)},number:(e,n,r=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(r),10))}catch{return""}},fmt:(e,n,r="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(r)}catch{return String(e)}},join:(e,n,r=",")=>{if(!Array.isArray(e))return"";return e.join(String(r))},escape:(e,n)=>{if(e===void 0||e===null)return"";return Y(String(e))},translate:(e,n,r={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),u=i;for(let v of l){if(u===void 0||u===null)break;u=u[v]}if(u===void 0||u===null)return a?e:"";let f=String(u);return Object.entries(r).forEach(([v,S])=>{f=f.replace($l(v),()=>String(S))}),f},t:(e,n,r={})=>lo.translate(e,n,r),truncate:(e,n,r=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=r)return a;if(r<=i.length)return i.substring(0,r);return a.substring(0,r-i.length)+i},date:(e,n,r="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(r==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[r]||l.short).format(a)}catch{return String(e)}},currency:(e,n,r="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:r}).format(a)}catch{return String(e)}},pluralize:(e,n,r,i)=>{let a=Number(e);if(Number.isNaN(a))return r;let l=i||`${r}s`;return a===1?r:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let r=String(e);return r.charAt(r.length-1)},length:(e,n)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,n,r=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return r?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,r="")=>e===void 0||e===null||e===""?r:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,r=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(r,i);return e},replace:(e,n,r,i="")=>{if(e===void 0||e===null)return"";let a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let r=Number(e);return Number.isNaN(r)?0:Math.abs(r)},round:(e,n,r=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**r;return Math.round(i*a)/a}};function qg(e,n){if(e in lo)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);vn[e]=n}function Ry(e){for(let[n,r]of Object.entries(e))qg(n,r)}function Kg(){return{...lo,...vn}}function Ay(){for(let e of Object.keys(vn))delete vn[e]}function ko(e){let n=e.next();while(!n.done)n=e.next();return n.value}function*Co(e,n,r,i){let a="{".repeat(r);if(!e.includes(a))return e;let l="",u=0,f=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let S=e.indexOf(a,u);if(S===-1)break;let I=Pe(e,S,r);if(I===-1)break;if(l+=e.slice(u,S)+n(e.slice(S,I+r),e.slice(S+r,I),S),u=I+r,++f>=64){f=0;let j=performance.now();if(j-v>=i)v=j,yield}}return u===0?e:l+e.slice(u)}function In(e,n,r=2){return ko(Co(e,n,r,Number.POSITIVE_INFINITY))}function Rl(e,n,r){let i=r[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=Dr(e,n);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let u=0;u<a.valuePrefix.length;u++)if(a.valuePrefix[u]==="\\")u++;else if(a.valuePrefix[u]===i)l++;return l%2===1}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Y(e){return Gi(g(e))}function Al(e){return e.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Il(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,r)=>String.fromCodePoint(Number.parseInt(r,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Ol(e,n){let r=Il(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(r))throw new he(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(r))!==null){let l=a[1].replace(/^["']|["']$/g,""),u=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!u&&!f)throw new he(n,"CSS URLs must be local paths or base64 raster images")}}function ae(e,n,r,i=!1,a=0){try{return jl(e,n,r,i,a)}catch(l){if(l instanceof he)l.locate(e,n);throw l}}function jl(e,n,r,i,a){let l=Dr(e,n,i),u=Y(r);if(!l)return u;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(r))throw new he("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return r}if(l.kind==="tag"){let S=e.slice(n+a).trimStart(),I=r.trim();if(!S.startsWith("=")&&(I===""||I.split(/\s+/).every((j)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(j))))return I;throw new he("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=l.name.toLowerCase();if(/^on[a-z]/.test(f))throw new he(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")u=Y(u);if(f==="style")Ol(r,l.name);if(l.quote===null)u=Al(u);let v=ar(f);if(v&&l.valuePrefix.trim()===""&&ds(r,v))return Yi+u;return fo(Qi(e,n),r,u)}function On(e,n){let r=` ${e}="`;return ae(r,r.length,n,!0)}function Ro(e){return e.flatMap((n)=>{let r=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!r||/\bserver\b|\bsrc\s*=/.test(r[1])?[]:[r[2]]})}function Ne(e,n){let{scripts:r}=se(e);for(let i of Ro(r)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||kl.test(i))return!0;if(Jr(i,n))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Gg(e){let n=[],r=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=r.exec(e);i;i=r.exec(e)){let a=i[1].toLowerCase(),l=new Set(oe(i[3]));if(l.size===0)continue;let u=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:u,names:l});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=u;let v=1,S=e.length;for(let I=f.exec(e);I;I=f.exec(e)){if(I[2]==="/")continue;if(v+=I[1]==="/"?-1:1,v===0){S=I.index+I[0].length;break}}n.push({start:i.index,end:S,names:l})}return n}function wo(e,n,r){let i=t(r);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function vo(e,n){let r=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,u=0;for(let S=0;S<i.length;S++){let I=i[S];if(!l&&I==="`"){l=!0,u=0;continue}if(l){if(I==="`"&&u===0){l=!1;continue}if(I==="$"&&i[S+1]==="{"){u++,S++,a+=" ";continue}if(I==="}"&&u>0){u--;continue}if(u>0){a+=I;continue}continue}a+=I}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=f.exec(i))!==null){let S=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!r.includes(S)&&!(S in n))return!1}}return!0}function Pl(e,n){let r=t(e);for(let i of r.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function Ml(e,n){let r=n.__stx_serverDeclared;if(!r||r.size===0)return!1;let i=t(e);for(let a of r)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var So=new Set;function $o(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function Nl(e,n,r){let i=r[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
- `,n-1)+1;l<n;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Eo(e,n){let r=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!So.has(r))So.add(r),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Vi(e,n,r){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let u=N(l,n);if(u===void 0)return $o(l)?Eo(l.trim(),r):a;return u===null?"":String(u)}catch{return a}}),i=In(i,(a,l,u)=>{let f=l.trim();if(Nl(i,u,l))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let v=N(l,n);if(v===void 0)return $o(f)?Eo(f,r):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(S)=>"\\u007b".repeat(S.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Xg(e,n){if(!e.includes("{"))return e;let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=N(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),r=In(r,(i,a,l)=>{let u=a.trim();if(/^__[A-Z_]+__$/.test(u))return i;try{let f=N(a,n);if(f===void 0)return i;if(f===null)return"";let v=String(f);return ae(r,l,v,!0,i.length)}catch(f){if(f instanceof he)throw f;return i}}),r}function Py(e,n,r={}){let{output:i,scripts:a}=se(e),l=a.map((u)=>{let f=u.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=u.search(/<\/script\s*>$/i);if(!f||v===-1)return u;let S=f[1],I=u.slice(f[0].length,v);if(/\bdata-raw\b/.test(S))return u;if(r.skipServer&&/\bserver\b/.test(S))return u;let L=`<script${Xg(S,n)}>`;if(/\bsrc\s*=/.test(S)||/\btype\s*=\s*["']application\/json["']/.test(S))return L+I+u.slice(v);return L+Vi(I,n)+u.slice(v)});return Nr(i,l)}function*To(e,n,r,i){let a=e,l=(W,Z)=>{let q=Cn(W,Z);if(q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(Z,q))?-1:q},u=(W,Z,q,G)=>{let U=q.length,{output:H,tokens:re}=ke(W,Z,(ce,le)=>G(U+le));return q.push(...re),H},f=[];a=u(a,l,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let v=[];a=u(a,Q,v,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let S=n?.__stx_signals_gate===!0||Ne(e),I=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...Hi(Ro(v))]),j=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);a=In(a,(W,Z,q)=>{if(F(Z,I))return W;try{let G=N(Z,n,!1,(U)=>cr(U,W,r,e));return G!==void 0&&G!==null?String(G):""}catch(G){let U=G instanceof Error?G.message:String(G);return b("Expression",`Error evaluating: {{{ ${Z.trim()}}}}: ${U}`,r,e,q,W)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(W,Z,q)=>{if(F(Z,I))return W;try{let G=N(Z,n,!1,(U)=>cr(U,W,r,e));if(G===void 0&&n.__stx_buildMode==="compile")return ps("raw",Z.trim());return G!==void 0&&G!==null?String(G):""}catch(G){if(n.__stx_buildMode==="compile")return ps("raw",Z.trim());let U=G instanceof Error?G.message:String(G);return b("Expression",`Error evaluating: {!! ${Z.trim()} !!}: ${U}`,r,e,q,W)}}),a=u(a,Q,v,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),a=u(a,l,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let L=S?Gg(a):[],M=hs(a).map((W)=>({...W,names:new Set(oe(`${W.binding} in __slot`))})),V=new Set(mt(n));if(a=yield*Co(a,(W,Z,q)=>{let G=Z.trim();if(Rl(a,q,Z))return W;if(wo(M,q,G))return W;if(F(G,V))return W;if(L.length>0&&wo(L,q,G))return W;if(j.has(G))return W;let U=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ce=G.match(H)?.[1],le=ce&&((ce in n)||U.includes(ce)),de=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=G.match(de),Re=Ee&&!U.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(G))return"";if(F(G,I))return W;if(n.__stx_native_screen===!0&&Pl(G,n))return W;let we;try{let ge=N(Z,n,!1,(Fe)=>{we=Fe});if(S&&!vo(G,n))return W;if(we)cr(we,W,r,e);if(n.__stx_buildMode==="compile"&&!S&&(ge===void 0||Ml(G,n)))return ps("expr",G);if(ge===void 0||ge===null)return"";let ze=String(ge);return ae(a,q,ze,!1,W.length)}catch(ge){if(ge instanceof he)throw ge;if(S&&!vo(G,n))return W;if(Re)return W;let ze=ge instanceof Error?ge.message:String(ge);return b("Expression",`Error evaluating: {{ ${G} }}: ${ze}`,r,e,q,W)}},2,i),v.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,Z)=>v[Number(Z)]??W);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,Z)=>f[Number(Z)]??W);return a}function P(e,n,r){return ko(To(e,n,r,Number.POSITIVE_INFINITY))}var Ll=100;async function Wi(e,n,r,i=Ll){let a=To(e,n,r,i),l=a.next();while(!l.done)await R(),l=a.next();return l.value}function Jg(e,n,r){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let u=l[1];a=a.substring(u.length).trim();let f=vn[u]||lo[u];if(!f)throw Error(`Filter not found: ${u}. Available filters: ${Object.keys(Kg()).join(", ")}`);let v=[];if(a.startsWith(":")){let S=a.match(/^:([^|\s]+)/);if(S){let I=S[1].trim();try{let j=Number(I);v=[Number.isNaN(j)?I:j]}catch{v=[I]}a=a.substring(S[0].length).trim()}}else if(a.startsWith("(")){let S=1,I=1;while(S>0&&I<a.length){if(a[I]==="(")S++;if(a[I]===")")S--;I++}if(S===0){let j=a.substring(1,I-1).trim();if(j)try{if(j.startsWith("{")&&j.endsWith("}"))v=[N(`(${j})`,r,!0)];else{let L=[],M="",V=null,W=0,Z=0,q=0,G=!1;for(let U=0;U<j.length;U++){let H=j[U];if(G){M+=H,G=!1;continue}if(H==="\\"){M+=H,G=!0;continue}if(V){if(M+=H,H===V)V=null;continue}if(H==='"'||H==="'"||H==="`"){V=H,M+=H;continue}if(H==="(")W++;else if(H===")")W--;else if(H==="[")Z++;else if(H==="]")Z--;else if(H==="{")q++;else if(H==="}")q--;if(H===","&&W===0&&Z===0&&q===0){L.push(M),M="";continue}M+=H}if(M)L.push(M);v=L.map((U)=>{let H=U.trim();return N(H,r,!0)})}}catch{v=[j]}a=a.substring(I).trim()}}try{i=f(i,r,...v)}catch(S){let I=S instanceof Error?S.message:String(S);throw Error(`Error applying filter '${u}': ${I}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function zl(e){let n=!1,r="",i=0,a=0,l=0,u=!1;for(let f=0;f<e.length;f++){let v=e[f],S=e[f+1];if(n&&u){u=!1;continue}if(n&&v==="\\"){u=!0;continue}if(u=!1,(v==='"'||v==="'"||v==="`")&&!u){if(!n)n=!0,r=v;else if(v===r)n=!1,r="";continue}if(n&&r==="`"&&v==="$"&&S==="{"){let I=1;f+=2;while(f<e.length&&I>0){if(e[f]==="{")I++;else if(e[f]==="}")I--;if(I>0)f++}continue}if(n)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(S==="|"){f++;continue}if(S==="="){f++;continue}return f}}return-1}var wn=new Set,Wl=1000;function Iy(){wn.clear()}function cr(e,n,r,i){if(!ne())return;let a=`${r}\x00${e.expression}`;if(wn.has(a))return;if(wn.size>=Wl)wn.clear();wn.add(a);let l=r,u=i;try{if(r&&xo.existsSync(r))u=xo.readFileSync(r,"utf8")}catch{}let f=u.indexOf(n);if(f>=0)l=`${r}:${u.slice(0,f).split(`
216
+ `}),Ci(e,a)}function Ci(e,n){if(n.length===0)return e;n.sort((l,u)=>l.start-u.start||l.end-u.end);let r=Array(n.length*2+1),i=0,a=0;for(let l of n)r[a++]=e.slice(i,l.start),r[a++]=l.replacement,i=l.end;return r[a]=e.slice(i),r.join("")}function qi(e){let n=us(e),r=new Map;if(n)for(let[i,a]of n)r.set(i,a.instances);return r}function Zi(e,n){let r=us(e);if(!r)return[];let i=[];for(let[a,l]of r){let u=l.instances-(n.get(a)??0);if(u>0)i.push({body:l.body,count:u})}return i}function Ji(e,n){for(let{body:r,count:i}of n)for(let a=0;a<i;a++)ir(e,r)}function Pe(e,n,r=2){let i=0,a=null;for(let l=n+r;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==="{"){i++;continue}if(u==="}"){if(i>0){i--;continue}let f=0;while(e[l+f]==="}")f++;if(f>=r)return l}}return-1}import xo from"fs";var Xi=0,or=new Map;function Cl(){Xi=0,or.clear()}function ps(e,n){let r=Xi++,i=`<!--__STX_${e.toUpperCase()}_${r}__-->`;return or.set(i,{type:e,expression:n}),i}function El(){let e={};for(let[n,r]of or)e[n]={type:r.type,expression:r.expression};return e}function Tl(e,n){let r=e;for(let[i,a]of n)r=r.split(i).join(a);return r}function Vi(e){return e.includes("<!--__STX_")}var Vc=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function Uc(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Gi(e){return e.replace(/\{{2,}/g,(n)=>Uc(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Vc,"&#64;")}function Dr(e,n,r=!1){let{openTag:i,tail:a}=r?Hc(e,n):Kc(e).at(n);return Zc(a,i,r)}function Hc(e,n){let r="",i=0;for(let u=0;u<n;u++){if(!e.startsWith("{{",u))continue;let f=Pe(e,u);if(f<0||f+2>n)break;r+=e.slice(i,u)+"x",u=f+1,i=f+2}r+=e.slice(i,n);let a=-1,l=null;for(let u=0;u<r.length;u++){let f=r[u];if(l){if(f===l)l=null;continue}if(f==='"'||f==="'"){l=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=u}return{openTag:a,tail:a>=0?r.slice(a+1):r}}var fs=null;function Kc(e){if(fs&&fs.source===e)return fs.scanner;let n=qc(e);return fs={source:e,scanner:n},n}function qc(e){let n=0,r=-1,i=null,a=-1,l=(f,v)=>{let S=e[f];if(v.quote){if(S===v.quote)v.quote=null;return}if(v.openTag>=0){if(S==='"'||S==="'"){v.quote=S;return}if(S===">"){v.openTag=-1;return}}if(S==="<")v.openTag=f},u=(f,v)=>{if(v.openTag>=0||!e.startsWith("<!--",f))return-1;let S=e.indexOf("-->",f+4);return S<0?e.length:S+3};return{at(f){if(f<n)n=0,r=-1,i=null,a=-1;let v={openTag:r,quote:i},S=!1;while(n<f){if(a<0&&e.startsWith("{{",n)){let W=Pe(e,n);if(W<0)a=n;else if(W+2<=f){n=W+2;continue}else break}let V=u(n,v);if(V>=0){if(V>f){S=!0;break}n=V;continue}l(n,v),n++}if(r=v.openTag,i=v.quote,S)return{openTag:-1,tail:""};let I=a>=0?a:n,j={openTag:r,quote:i};for(let V=n;V<f;V++){let W=u(V,j);if(W>=0){if(W>f)return{openTag:-1,tail:""};V=W-1;continue}l(V,j)}if(j.openTag<0)return{openTag:-1,tail:""};let L="",M=j.openTag+1;for(let V=M;V<Math.min(f,I);V++){if(!e.startsWith("{{",V))continue;let W=Pe(e,V);L+=e.slice(M,V)+"x",V=W+1,M=W+2}return L+=e.slice(M,f),{openTag:j.openTag,tail:L}}}}function Zc(e,n,r){if(n<0&&!r)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let u=e[i];if(u==='"'||u==="'"){let f=++i,v=e.indexOf(u,i);if(v===-1)return{kind:"attribute",name:l,quote:u,valuePrefix:e.slice(f)};i=v+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class he extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Yi="unsafe:";var Jc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Xc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Gc=/^data:(?:text\/html|application\/xhtml\+xml)/,Yc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Qc(e){return e.replace(Yc,"").toLowerCase()}function ar(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function ds(e,n="navigable"){let r=Qc(e);if(Jc.test(r))return!0;return n==="navigable"?Xc.test(r):Gc.test(r)}function Mr(e,n="navigable"){return ds(e,n)?"unsafe:"+e:e}function el(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return ar(n[1])}function Qi(e,n,r=256){if(n<=r)return e.slice(0,n);let i=e.slice(n-r,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function fo(e,n,r=n){let i=el(e);return i&&ds(n,i)?"unsafe:"+r:r}function Wt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),u=e.slice(n+4).trim();return l&&u?{arrayExpr:l,itemVar:u}:null}let r=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!r)return null;let i=r[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=r[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function gs(e){let n=[],r=0,i="",a=0;for(let l=0;l<e.length;l++){let u=e[l];if(i){if(u==="\\")l++;else if(u===i)i="";continue}if(u==="'"||u==='"'||u==="`")i=u;else if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function go(e,n){let r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===n&&r===0)return i}return-1}function mo(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return r}return-1}function Ft(e,n){let r=e.trim().replace(/^\.\.\./,"").trim(),i=go(r,"=");if(i!==-1&&r[i+1]!==">")r=r.slice(0,i).trim();if(!r)return;if(r.startsWith("{")&&r.endsWith("}")){for(let a of gs(r.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){Ft(l,n);continue}let u=go(l,":");Ft(u===-1?l:l.slice(u+1),n)}return}if(r.startsWith("[")&&r.endsWith("]")){for(let a of gs(r.slice(1,-1)))Ft(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(r))n.push(r)}function oe(e){let n=e.trim(),r=[],i=0;for(let l=0;l<n.length;l++){let u=n[l];if(u==="("||u==="["||u==="{")i++;else if(u===")"||u==="]"||u==="}")i--;else if(i===0&&/\s/.test(u)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let v=n.slice(0,l).trim();if(v.startsWith("(")&&mo(v)===v.length-1)v=v.slice(1,-1);for(let S of gs(v))Ft(S,r);if(r.length>0)return r;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&mo(l)===l.length-1)l=l.slice(1,-1);let u=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(u)Ft(u[2],r),Ft(u[1],r);else for(let f of gs(l))Ft(f,r)}return r}function F(e,n){let r=n instanceof Set?n:new Set(n);if(r.size===0)return!1;let u=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of u.match(/[a-zA-Z_$][\w$]*/g)||[])if(r.has(f))return!0;return!1}var ms="__stx_client_loop_names";function mt(e){let n=e?.[ms];return Array.isArray(n)?n:[]}function hs(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],r=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let u=r.pop();if(u)u.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let f=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((I)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(I[1])),v=(f?.[2]??f?.[3])?.trim();if(v&&f?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let S=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(r.push(S),S)n.push(S)}}return n}var vn={},_o=new Map;function $l(e){let n=_o.get(e);if(!n){let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${r}(?!\\w)`,"g"),_o.set(e,n)}return n.lastIndex=0,n}var lo={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let r=String(e);return r.charAt(0).toUpperCase()+r.slice(1)},number:(e,n,r=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(r),10))}catch{return""}},fmt:(e,n,r="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(r)}catch{return String(e)}},join:(e,n,r=",")=>{if(!Array.isArray(e))return"";return e.join(String(r))},escape:(e,n)=>{if(e===void 0||e===null)return"";return Y(String(e))},translate:(e,n,r={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),u=i;for(let v of l){if(u===void 0||u===null)break;u=u[v]}if(u===void 0||u===null)return a?e:"";let f=String(u);return Object.entries(r).forEach(([v,S])=>{f=f.replace($l(v),()=>String(S))}),f},t:(e,n,r={})=>lo.translate(e,n,r),truncate:(e,n,r=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=r)return a;if(r<=i.length)return i.substring(0,r);return a.substring(0,r-i.length)+i},date:(e,n,r="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(r==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[r]||l.short).format(a)}catch{return String(e)}},currency:(e,n,r="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:r}).format(a)}catch{return String(e)}},pluralize:(e,n,r,i)=>{let a=Number(e);if(Number.isNaN(a))return r;let l=i||`${r}s`;return a===1?r:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let r=String(e);return r.charAt(r.length-1)},length:(e,n)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,n,r=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return r?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,r="")=>e===void 0||e===null||e===""?r:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,r=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(r,i);return e},replace:(e,n,r,i="")=>{if(e===void 0||e===null)return"";let a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let r=Number(e);return Number.isNaN(r)?0:Math.abs(r)},round:(e,n,r=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**r;return Math.round(i*a)/a}};function qg(e,n){if(e in lo)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);vn[e]=n}function Ry(e){for(let[n,r]of Object.entries(e))qg(n,r)}function Kg(){return{...lo,...vn}}function Ay(){for(let e of Object.keys(vn))delete vn[e]}function ko(e){let n=e.next();while(!n.done)n=e.next();return n.value}function*Co(e,n,r,i){let a="{".repeat(r);if(!e.includes(a))return e;let l="",u=0,f=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let S=e.indexOf(a,u);if(S===-1)break;let I=Pe(e,S,r);if(I===-1)break;if(l+=e.slice(u,S)+n(e.slice(S,I+r),e.slice(S+r,I),S),u=I+r,++f>=64){f=0;let j=performance.now();if(j-v>=i)v=j,yield}}return u===0?e:l+e.slice(u)}function In(e,n,r=2){return ko(Co(e,n,r,Number.POSITIVE_INFINITY))}function Rl(e,n,r){let i=r[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=Dr(e,n);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let u=0;u<a.valuePrefix.length;u++)if(a.valuePrefix[u]==="\\")u++;else if(a.valuePrefix[u]===i)l++;return l%2===1}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Y(e){return Gi(g(e))}function Al(e){return e.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Il(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,r)=>String.fromCodePoint(Number.parseInt(r,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Ol(e,n){let r=Il(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(r))throw new he(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(r))!==null){let l=a[1].replace(/^["']|["']$/g,""),u=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!u&&!f)throw new he(n,"CSS URLs must be local paths or base64 raster images")}}function ae(e,n,r,i=!1,a=0){try{return jl(e,n,r,i,a)}catch(l){if(l instanceof he)l.locate(e,n);throw l}}function jl(e,n,r,i,a){let l=Dr(e,n,i),u=Y(r);if(!l)return u;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(r))throw new he("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return r}if(l.kind==="tag"){let S=e.slice(n+a).trimStart(),I=r.trim();if(!S.startsWith("=")&&(I===""||I.split(/\s+/).every((j)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(j))))return I;throw new he("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=l.name.toLowerCase();if(/^on[a-z]/.test(f))throw new he(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")u=Y(u);if(f==="style")Ol(r,l.name);if(l.quote===null)u=Al(u);let v=ar(f);if(v&&l.valuePrefix.trim()===""&&ds(r,v))return Yi+u;return fo(Qi(e,n),r,u)}function On(e,n){let r=` ${e}="`;return ae(r,r.length,n,!0)}function Ro(e){return e.flatMap((n)=>{let r=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!r||/\bserver\b|\bsrc\s*=/.test(r[1])?[]:[r[2]]})}function Ne(e,n){let{scripts:r}=se(e);for(let i of Ro(r)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||kl.test(i))return!0;if(Jr(i,n))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Gg(e){let n=[],r=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=r.exec(e);i;i=r.exec(e)){let a=i[1].toLowerCase(),l=new Set(oe(i[3]));if(l.size===0)continue;let u=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:u,names:l});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=u;let v=1,S=e.length;for(let I=f.exec(e);I;I=f.exec(e)){if(I[2]==="/")continue;if(v+=I[1]==="/"?-1:1,v===0){S=I.index+I[0].length;break}}n.push({start:i.index,end:S,names:l})}return n}function wo(e,n,r){let i=t(r);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function vo(e,n){let r=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,u=0;for(let S=0;S<i.length;S++){let I=i[S];if(!l&&I==="`"){l=!0,u=0;continue}if(l){if(I==="`"&&u===0){l=!1;continue}if(I==="$"&&i[S+1]==="{"){u++,S++,a+=" ";continue}if(I==="}"&&u>0){u--;continue}if(u>0){a+=I;continue}continue}a+=I}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=f.exec(i))!==null){let S=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!r.includes(S)&&!(S in n))return!1}}return!0}function Pl(e,n){let r=t(e);for(let i of r.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function Ml(e,n){let r=n.__stx_serverDeclared;if(!r||r.size===0)return!1;let i=t(e);for(let a of r)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var So=new Set;function $o(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function Nl(e,n,r){let i=r[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
+ `,n-1)+1;l<n;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Eo(e,n){let r=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!So.has(r))So.add(r),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Ui(e,n,r){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let u=N(l,n);if(u===void 0)return $o(l)?Eo(l.trim(),r):a;return u===null?"":String(u)}catch{return a}}),i=In(i,(a,l,u)=>{let f=l.trim();if(Nl(i,u,l))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let v=N(l,n);if(v===void 0)return $o(f)?Eo(f,r):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(S)=>"\\u007b".repeat(S.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Xg(e,n){if(!e.includes("{"))return e;let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=N(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),r=In(r,(i,a,l)=>{let u=a.trim();if(/^__[A-Z_]+__$/.test(u))return i;try{let f=N(a,n);if(f===void 0)return i;if(f===null)return"";let v=String(f);return ae(r,l,v,!0,i.length)}catch(f){if(f instanceof he)throw f;return i}}),r}function Py(e,n,r={}){let{output:i,scripts:a}=se(e),l=a.map((u)=>{let f=u.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=u.search(/<\/script\s*>$/i);if(!f||v===-1)return u;let S=f[1],I=u.slice(f[0].length,v);if(/\bdata-raw\b/.test(S))return u;if(r.skipServer&&/\bserver\b/.test(S))return u;let L=`<script${Xg(S,n)}>`;if(/\bsrc\s*=/.test(S)||/\btype\s*=\s*["']application\/json["']/.test(S))return L+I+u.slice(v);return L+Ui(I,n)+u.slice(v)});return Nr(i,l)}function*To(e,n,r,i){let a=e,l=(W,Z)=>{let q=Cn(W,Z);if(q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(Z,q))?-1:q},u=(W,Z,q,G)=>{let U=q.length,{output:H,tokens:re}=ke(W,Z,(ce,le)=>G(U+le));return q.push(...re),H},f=[];a=u(a,l,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let v=[];a=u(a,Q,v,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let S=n?.__stx_signals_gate===!0||Ne(e),I=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...Hi(Ro(v))]),j=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);a=In(a,(W,Z,q)=>{if(F(Z,I))return W;try{let G=N(Z,n,!1,(U)=>cr(U,W,r,e));return G!==void 0&&G!==null?String(G):""}catch(G){let U=G instanceof Error?G.message:String(G);return b("Expression",`Error evaluating: {{{ ${Z.trim()}}}}: ${U}`,r,e,q,W)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(W,Z,q)=>{if(F(Z,I))return W;try{let G=N(Z,n,!1,(U)=>cr(U,W,r,e));if(G===void 0&&n.__stx_buildMode==="compile")return ps("raw",Z.trim());return G!==void 0&&G!==null?String(G):""}catch(G){if(n.__stx_buildMode==="compile")return ps("raw",Z.trim());let U=G instanceof Error?G.message:String(G);return b("Expression",`Error evaluating: {!! ${Z.trim()} !!}: ${U}`,r,e,q,W)}}),a=u(a,Q,v,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),a=u(a,l,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let L=S?Gg(a):[],M=hs(a).map((W)=>({...W,names:new Set(oe(`${W.binding} in __slot`))})),V=new Set(mt(n));if(a=yield*Co(a,(W,Z,q)=>{let G=Z.trim();if(Rl(a,q,Z))return W;if(wo(M,q,G))return W;if(F(G,V))return W;if(L.length>0&&wo(L,q,G))return W;if(j.has(G))return W;let U=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ce=G.match(H)?.[1],le=ce&&((ce in n)||U.includes(ce)),de=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=G.match(de),Re=Ee&&!U.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(G))return"";if(F(G,I))return W;if(n.__stx_native_screen===!0&&Pl(G,n))return W;let we;try{let ge=N(Z,n,!1,(Fe)=>{we=Fe});if(S&&!vo(G,n))return W;if(we)cr(we,W,r,e);if(n.__stx_buildMode==="compile"&&!S&&(ge===void 0||Ml(G,n)))return ps("expr",G);if(ge===void 0||ge===null)return"";let ze=String(ge);return ae(a,q,ze,!1,W.length)}catch(ge){if(ge instanceof he)throw ge;if(S&&!vo(G,n))return W;if(Re)return W;let ze=ge instanceof Error?ge.message:String(ge);return b("Expression",`Error evaluating: {{ ${G} }}: ${ze}`,r,e,q,W)}},2,i),v.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,Z)=>v[Number(Z)]??W);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,Z)=>f[Number(Z)]??W);return a}function P(e,n,r){return ko(To(e,n,r,Number.POSITIVE_INFINITY))}var Ll=100;async function Wi(e,n,r,i=Ll){let a=To(e,n,r,i),l=a.next();while(!l.done)await R(),l=a.next();return l.value}function Jg(e,n,r){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let u=l[1];a=a.substring(u.length).trim();let f=vn[u]||lo[u];if(!f)throw Error(`Filter not found: ${u}. Available filters: ${Object.keys(Kg()).join(", ")}`);let v=[];if(a.startsWith(":")){let S=a.match(/^:([^|\s]+)/);if(S){let I=S[1].trim();try{let j=Number(I);v=[Number.isNaN(j)?I:j]}catch{v=[I]}a=a.substring(S[0].length).trim()}}else if(a.startsWith("(")){let S=1,I=1;while(S>0&&I<a.length){if(a[I]==="(")S++;if(a[I]===")")S--;I++}if(S===0){let j=a.substring(1,I-1).trim();if(j)try{if(j.startsWith("{")&&j.endsWith("}"))v=[N(`(${j})`,r,!0)];else{let L=[],M="",V=null,W=0,Z=0,q=0,G=!1;for(let U=0;U<j.length;U++){let H=j[U];if(G){M+=H,G=!1;continue}if(H==="\\"){M+=H,G=!0;continue}if(V){if(M+=H,H===V)V=null;continue}if(H==='"'||H==="'"||H==="`"){V=H,M+=H;continue}if(H==="(")W++;else if(H===")")W--;else if(H==="[")Z++;else if(H==="]")Z--;else if(H==="{")q++;else if(H==="}")q--;if(H===","&&W===0&&Z===0&&q===0){L.push(M),M="";continue}M+=H}if(M)L.push(M);v=L.map((U)=>{let H=U.trim();return N(H,r,!0)})}}catch{v=[j]}a=a.substring(I).trim()}}try{i=f(i,r,...v)}catch(S){let I=S instanceof Error?S.message:String(S);throw Error(`Error applying filter '${u}': ${I}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function zl(e){let n=!1,r="",i=0,a=0,l=0,u=!1;for(let f=0;f<e.length;f++){let v=e[f],S=e[f+1];if(n&&u){u=!1;continue}if(n&&v==="\\"){u=!0;continue}if(u=!1,(v==='"'||v==="'"||v==="`")&&!u){if(!n)n=!0,r=v;else if(v===r)n=!1,r="";continue}if(n&&r==="`"&&v==="$"&&S==="{"){let I=1;f+=2;while(f<e.length&&I>0){if(e[f]==="{")I++;else if(e[f]==="}")I--;if(I>0)f++}continue}if(n)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(S==="|"){f++;continue}if(S==="="){f++;continue}return f}}return-1}var wn=new Set,Wl=1000;function Iy(){wn.clear()}function cr(e,n,r,i){if(!ne())return;let a=`${r}\x00${e.expression}`;if(wn.has(a))return;if(wn.size>=Wl)wn.clear();wn.add(a);let l=r,u=i;try{if(r&&xo.existsSync(r))u=xo.readFileSync(r,"utf8")}catch{}let f=u.indexOf(n);if(f>=0)l=`${r}:${u.slice(0,f).split(`
218
218
  `).length}`;console.warn(`${l}: stx warning: ${n} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function N(e,n,r=!1,i){try{let a=e.trim(),l=zl(a);if(l>0){let f=a.substring(0,l).trim(),v=a.substring(l+1).trim(),S=N(f,n,!0,i);return Jg(S,v,n)}let u=po(a);if(u!==null){i?.({expression:a,rule:u});return}try{let f=Object.keys(n),v=Object.values(n);return p(a,f)(...v)}catch{return d(a,n)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let u=l[1],f=Vl(u,Object.keys(n));if(f&&f!==u)a.message=`${a.message} \u2014 did you mean '${f}'?`}}if(!r)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Vl(e,n){let r=null;for(let a of n){if(a===e)continue;let l=Ul(e,a);if(r===null||l<r.dist)r={key:a,dist:l}}if(!r)return null;let i=Math.max(e.length,r.key.length);if(r.dist<=2||r.dist/i<=0.35)return r.key;return null}function Ul(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let[r,i]=e.length<n.length?[e,n]:[n,e],a=Array(r.length+1),l=Array(r.length+1);for(let u=0;u<=r.length;u++)a[u]=u;for(let u=1;u<=i.length;u++){l[0]=u;for(let f=1;f<=r.length;f++){let v=r[f-1]===i[u-1]?0:1;l[f]=Math.min(l[f-1]+1,a[f]+1,a[f-1]+v)}for(let f=0;f<=r.length;f++)a[f]=l[f]}return a[r.length]}function Oy(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Hl from"process";function A(e="STX_PUBLIC_"){let n={},r={};for(let[i,a]of Object.entries(Hl.env)){if(!i.startsWith(e)||a===void 0)continue;n[`import.meta.env.${i}`]=JSON.stringify(a),r[i]=a}return n["import.meta.env"]=JSON.stringify(r),n}function Ao(e,n=""){let r=`${e}${n}`,i=0;for(let a=0;a<r.length;a++){let l=r.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Io(e,n,r={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:u=!1}=r;if(!e.trim())return"";let f=lr(e),v=[],S=new Map;if(l)for(let I of f){let j=I.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(j){let L=j[1],M=`${n}_${L}`;S.set(L,M)}}for(let I of f){let j=Oo(I,n,i,a,S,u);v.push(j)}return v.join(`
219
219
 
220
220
  `)}function lr(e){let n=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,u="";for(let f=0;f<r.length;f++){let v=r[f];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){u+=v;let S=u.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(S){let[,I,j,L]=S;if(I==="keyframes")n.push({selector:`@keyframes ${j.trim()}`,declarations:L.trim()});else if(I==="media"||I==="supports"||I==="container"){let M=lr(L);n.push({selector:`@${I} ${j.trim()}`,declarations:M.map((V)=>`${V.selector} { ${V.declarations} }`).join(`
@@ -505,7 +505,7 @@ window.__stx_reactive = (function() {
505
505
  ${cu()}
506
506
  ${i}
507
507
  </script>`}function pl(e,n,r,i=!1){if(!fr(e))return e;let a=ru(e);if(a.length===0)return e;let l=uu(e,a),u=lu(a,n,i),f=c(l);if(f!==-1)l=l.slice(0,f)+u+`
508
- `+l.slice(f);else l+=u;return l}function uu(e,n){let r=[],i=0;for(let[l,u]of Lo(e).entries()){let f=n[l];if(!f)break;r.push(e.slice(i,u.startIndex));let v=xs(u.attributes,"data-stx-scope");if(v)f.id=v,f.selector=`[data-stx-scope="${f.id}"]`,r.push(u.fullMatch);else r.push(`<${u.tagName} data-stx-scope="${f.id}"${u.attributes}>`);i=u.endIndex}r.push(e.slice(i));let a=r.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function fr(e){return/x-data\s*=\s*["']/.test(e)}function io(e,n){let r=e,i=/@json\s*\(/g,a;while((a=i.exec(r))!==null){let l=a.index,u=l+a[0].length-1,f=1,v=u+1,S=null,I=!1;while(v<r.length&&f>0){let U=r[v];if(I){I=!1,v++;continue}if(U==="\\"&&S){I=!0,v++;continue}if(S){if(U===S)S=null;v++;continue}if(U==='"'||U==="'"||U==="`"){S=U,v++;continue}if(U==="(")f++;else if(U===")"){if(f--,f===0)break}v++}if(f!==0)break;let j=r.substring(u+1,v).trim(),L=r.substring(l,v+1),M=-1,V=0,W=null,Z=!1;for(let U=0;U<j.length;U++){let H=j[U];if(Z){Z=!1;continue}if(H==="\\"&&W){Z=!0;continue}if(W){if(H===W)W=null;continue}if(H==='"'||H==="'"||H==="`"){W=H;continue}if(H==="("||H==="["||H==="{")V++;else if(H===")"||H==="]"||H==="}")V--;if(H===","&&V===0){M=U;break}}let q=M>=0?j.substring(0,M).trim():j,G=M>=0?j.substring(M+1).trim():void 0;try{let U=q.trim(),H;if(m(U))H=p(U,Object.keys(n))(...Object.values(n));else H=void 0;let re;if(G==="true")re=JSON.stringify(H,null,2);else re=JSON.stringify(H);let ce=re.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,l)+ce+r.substring(v+1),i.lastIndex=l+ce.length}catch(U){K.log(U instanceof Error?U:Error(String(U)),{directive:"@json"},"error"),i.lastIndex=l+L.length}}return r}function ao(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function fl(e){let n=e,r=/@memo\s*\(/g,i,a=[];while((i=r.exec(n))!==null){let l=i.index,u=l+i[0].length,f=1,v=u;while(v<n.length&&f>0){if(n[v]==="(")f++;else if(n[v]===")")f--;v++}if(f!==0)continue;let S=n.slice(u,v-1).trim(),I=v,j=n.slice(I),L=j.indexOf("@endmemo");if(L===-1)continue;let M=j.slice(0,L),V=I+L+8,W=Vt(M),Z=M.slice(W),q=M.match(/(\s*)$/),G=q?q[0].length:0,U=Z.slice(0,Z.length-G),H=U.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(H){let[ce,le,de="",Ee]=H,Re=`<${le}${de} data-stx-memo="${S}"${Ee}>`;re=M.slice(0,W)+Re+U.slice(ce.length)+M.slice(W+U.length)}else re=`${M.slice(0,W)}<div data-stx-memo="${S}">${U}</div>${M.slice(W+U.length)}`;a.push({start:l,end:V,replacement:re}),r.lastIndex=V}for(let l=a.length-1;l>=0;l--){let u=a[l];n=n.slice(0,u.start)+u.replacement+n.slice(u.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function ji(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function Fo(e,n){let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=x(e,(f,v)=>{r.lastIndex=v;let S=r.exec(f);if(!S||/^(?:script|style)$/i.test(S[1]))return-1;return r.lastIndex}),a=[],l=0,u=[];for(let{start:f,end:v,token:S}of i){let I=/^<\/?([\w-]+)/.exec(S)[1].toLowerCase();if(S.startsWith("</")){while(a.length&&a.pop()!==I);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(S))u.push(e.slice(l,f),S.replace(/\s*\/?>$/,(j)=>` data-stx-slot-owner="${n}"${j}`)),l=v;if(!dr.has(I)&&!/\/>$/.test(S))a.push(I)}return u.push(e.slice(l)),u.join("")}function Vo(e,n){if(!/\bref\s*=/.test(e))return e;let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=x(e,(v,S)=>{r.lastIndex=S;let I=r.exec(v);if(!I||/^(?:script|style)$/i.test(I[1]))return-1;return r.lastIndex}),a=[],l=0,u=0,f=[];for(let{start:v,end:S,token:I}of i){let j=/^<\/?([\w-]+)/.exec(I)[1].toLowerCase();if(I.startsWith("</")){let W;while(W=a.pop()){if(W.scoped)l--;if(W.name===j)break}continue}let L=/\sdata-stx-scope\s*=/.test(I),M=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(I),V=a.find((W)=>W.scoped)?.scopeId;if(M&&V&&M[2]===V)f.push(e.slice(u,v),I.replace(M[0],` data-stx-ref-caller="${n}"`)),u=S;else if(!l&&!L&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(I)&&!/\sdata-stx-ref-caller\s*=/.test(I))f.push(e.slice(u,v),I.replace(/\s*\/?>$/,(W)=>` data-stx-ref-caller="${n}"${W}`)),u=S;if(!dr.has(j)&&!/\/>$/.test(I)){let W=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(I);if(a.push({name:j,scoped:L,scopeId:W?.[1]??W?.[2]}),L)l++}}return f.push(e.slice(u)),f.join("")}var dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Uo=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,zo=/<\/?\s*([a-z][\w-]*)/iy,pu=/\s/;function fu(e,n){let r=n-1;while(r>=0&&pu.test(e[r]))r--;return r>=0&&e[r]==="/"}function du(e,n){let r=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(r){if(l==="'")r=!1}else if(i){if(l==='"')i=!1}else if(l==="'")r=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function gu(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let r=0,i=n,a=!1,l=!1,u=!1;while(i<e.length){let f=e.indexOf("<",i),v=f===-1?e.length:f;if(v>i){if(r===0)while(i<v){let j=e.indexOf(l?"}":"{",i);if(j===-1||j>=v){if(l)u=!1;else a=!1;break}if(j>i)if(l)u=!1;else a=!1;if(l){if(u)return!0;u=!0}else if(a)l=!0,u=!1;else a=!0;i=j+1}i=v;continue}if(e.startsWith("<!--",i)){let j=e.indexOf("-->",i);i=j===-1?e.length:j+3;continue}let S=du(e,i);if(S===-1)break;zo.lastIndex=i;let I=zo.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(r===0)break;r--}else if(!fu(e,S)&&!dr.has(I))r++;i=S+1}return!1}var Bo=k(256);function gl(e){if(e.length<1024)return Wo(e);let n=E(e),r=Bo.get(n);if(r!==void 0)return r;let i=Wo(e);return Bo.set(n,i),i}function Wo(e){if(e.length>=32768&&!ki(e))return e;let r=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=r.exec(e))!==null){let u=l.index,f=u+l[0].length,v=!1,S=!1,I=-1;while(f<e.length){let L=e[f];if(v){if(L==="'")v=!1}else if(S){if(L==='"')S=!1}else if(L==="'")v=!0;else if(L==='"')S=!0;else if(L===">"){I=f;break}f++}if(I===-1)continue;let j=e.slice(u,I+1);if(Uo.test(j))continue;if(j.includes("x-cloak"))continue;if(gu(e,I+1))i+=e.slice(a,I)+" x-cloak>",a=I+1}return i+=e.slice(a),i}var mu=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,hu=/<\/script>/gi,xu=/<\/style>/gi;function ml(e){let n=/<[a-z][\w-]*/gi,r="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,u=a[0].slice(1).toLowerCase();if(u==="script"||u==="style"){let V=u==="script"?hu:xu;V.lastIndex=l;let W=V.exec(e);if(W!==null)n.lastIndex=W.index+W[0].length;continue}let f=l+a[0].length,v=!1,S=!1,I=-1;while(f<e.length){let V=e[f];if(v){if(V==="'")v=!1}else if(S){if(V==='"')S=!1}else if(V==="'")v=!0;else if(V==='"')S=!0;else if(V===">"){I=f;break}f++}if(I===-1)continue;let j=e.slice(l+a[0].length,I);if(Uo.test(j))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(j))continue;if(!mu.test(j))continue;let L=e[I-1]==="/",M=L?I-1:I;r+=`${e.slice(i,M)} x-cloak${L?" ":""}`,i=M}return r+=e.slice(i),r}function O(e){let n=new Map;for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))n.set(r[1].toLowerCase(),r[2]??r[3]??r[4]??!0);return n}function $t(e){let n=e.get("type");return typeof n!=="string"||!n.trim()||/^(?:module|(?:text|application)\/(?:javascript|typescript|ecmascript))$/i.test(n.trim())}import xa from"path";import gr from"fs";import jn from"path";function Ho(e,n,r,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===r)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function bu(e){let n=t(e),r=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))r++;else if(")]}".includes(n[l]))r--;else if(n[l]===","&&r===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function kn(e,n,r=!1){let i=t(e),a=new RegExp(`\\b(?:${n.map((u)=>u.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g"),l=r?h(i).depths:void 0;for(let u of i.matchAll(a)){if(l&&l[u.index]!==0)continue;let f=u.index+u[0].length,v="";if(i[f]==="<"){let I=Ho(i,f,"<",">");if(I<0)continue;v=e.slice(f+1,I),f=I+1;while(/\s/.test(i[f]||"")&&f<i.length)f++}if(i[f]!=="(")continue;let S=Ho(i,f,"(",")");if(S>=0)return{type:v,args:bu(e.slice(f+1,S)),start:u.index,end:S+1}}return null}var bs=`
508
+ `+l.slice(f);else l+=u;return l}function uu(e,n){let r=[],i=0;for(let[l,u]of Lo(e).entries()){let f=n[l];if(!f)break;r.push(e.slice(i,u.startIndex));let v=xs(u.attributes,"data-stx-scope");if(v)f.id=v,f.selector=`[data-stx-scope="${f.id}"]`,r.push(u.fullMatch);else r.push(`<${u.tagName} data-stx-scope="${f.id}"${u.attributes}>`);i=u.endIndex}r.push(e.slice(i));let a=r.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function fr(e){return/x-data\s*=\s*["']/.test(e)}function io(e,n){let r=e,i=/@json\s*\(/g,a;while((a=i.exec(r))!==null){let l=a.index,u=l+a[0].length-1,f=1,v=u+1,S=null,I=!1;while(v<r.length&&f>0){let U=r[v];if(I){I=!1,v++;continue}if(U==="\\"&&S){I=!0,v++;continue}if(S){if(U===S)S=null;v++;continue}if(U==='"'||U==="'"||U==="`"){S=U,v++;continue}if(U==="(")f++;else if(U===")"){if(f--,f===0)break}v++}if(f!==0)break;let j=r.substring(u+1,v).trim(),L=r.substring(l,v+1),M=-1,V=0,W=null,Z=!1;for(let U=0;U<j.length;U++){let H=j[U];if(Z){Z=!1;continue}if(H==="\\"&&W){Z=!0;continue}if(W){if(H===W)W=null;continue}if(H==='"'||H==="'"||H==="`"){W=H;continue}if(H==="("||H==="["||H==="{")V++;else if(H===")"||H==="]"||H==="}")V--;if(H===","&&V===0){M=U;break}}let q=M>=0?j.substring(0,M).trim():j,G=M>=0?j.substring(M+1).trim():void 0;try{let U=q.trim(),H;if(m(U))H=p(U,Object.keys(n))(...Object.values(n));else H=void 0;let re;if(G==="true")re=JSON.stringify(H,null,2);else re=JSON.stringify(H);let ce=re.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,l)+ce+r.substring(v+1),i.lastIndex=l+ce.length}catch(U){K.log(U instanceof Error?U:Error(String(U)),{directive:"@json"},"error"),i.lastIndex=l+L.length}}return r}function ao(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function fl(e){let n=e,r=/@memo\s*\(/g,i,a=[];while((i=r.exec(n))!==null){let l=i.index,u=l+i[0].length,f=1,v=u;while(v<n.length&&f>0){if(n[v]==="(")f++;else if(n[v]===")")f--;v++}if(f!==0)continue;let S=n.slice(u,v-1).trim(),I=v,j=n.slice(I),L=j.indexOf("@endmemo");if(L===-1)continue;let M=j.slice(0,L),V=I+L+8,W=Ut(M),Z=M.slice(W),q=M.match(/(\s*)$/),G=q?q[0].length:0,U=Z.slice(0,Z.length-G),H=U.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(H){let[ce,le,de="",Ee]=H,Re=`<${le}${de} data-stx-memo="${S}"${Ee}>`;re=M.slice(0,W)+Re+U.slice(ce.length)+M.slice(W+U.length)}else re=`${M.slice(0,W)}<div data-stx-memo="${S}">${U}</div>${M.slice(W+U.length)}`;a.push({start:l,end:V,replacement:re}),r.lastIndex=V}for(let l=a.length-1;l>=0;l--){let u=a[l];n=n.slice(0,u.start)+u.replacement+n.slice(u.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function ji(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function Fo(e,n){let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=x(e,(f,v)=>{r.lastIndex=v;let S=r.exec(f);if(!S||/^(?:script|style)$/i.test(S[1]))return-1;return r.lastIndex}),a=[],l=0,u=[];for(let{start:f,end:v,token:S}of i){let I=/^<\/?([\w-]+)/.exec(S)[1].toLowerCase();if(S.startsWith("</")){while(a.length&&a.pop()!==I);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(S))u.push(e.slice(l,f),S.replace(/\s*\/?>$/,(j)=>` data-stx-slot-owner="${n}"${j}`)),l=v;if(!dr.has(I)&&!/\/>$/.test(S))a.push(I)}return u.push(e.slice(l)),u.join("")}function Vo(e,n){if(!/\bref\s*=/.test(e))return e;let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=x(e,(v,S)=>{r.lastIndex=S;let I=r.exec(v);if(!I||/^(?:script|style)$/i.test(I[1]))return-1;return r.lastIndex}),a=[],l=0,u=0,f=[];for(let{start:v,end:S,token:I}of i){let j=/^<\/?([\w-]+)/.exec(I)[1].toLowerCase();if(I.startsWith("</")){let W;while(W=a.pop()){if(W.scoped)l--;if(W.name===j)break}continue}let L=/\sdata-stx-scope\s*=/.test(I),M=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(I),V=a.find((W)=>W.scoped)?.scopeId;if(M&&V&&M[2]===V)f.push(e.slice(u,v),I.replace(M[0],` data-stx-ref-caller="${n}"`)),u=S;else if(!l&&!L&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(I)&&!/\sdata-stx-ref-caller\s*=/.test(I))f.push(e.slice(u,v),I.replace(/\s*\/?>$/,(W)=>` data-stx-ref-caller="${n}"${W}`)),u=S;if(!dr.has(j)&&!/\/>$/.test(I)){let W=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(I);if(a.push({name:j,scoped:L,scopeId:W?.[1]??W?.[2]}),L)l++}}return f.push(e.slice(u)),f.join("")}var dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Uo=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,zo=/<\/?\s*([a-z][\w-]*)/iy,pu=/\s/;function fu(e,n){let r=n-1;while(r>=0&&pu.test(e[r]))r--;return r>=0&&e[r]==="/"}function du(e,n){let r=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(r){if(l==="'")r=!1}else if(i){if(l==='"')i=!1}else if(l==="'")r=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function gu(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let r=0,i=n,a=!1,l=!1,u=!1;while(i<e.length){let f=e.indexOf("<",i),v=f===-1?e.length:f;if(v>i){if(r===0)while(i<v){let j=e.indexOf(l?"}":"{",i);if(j===-1||j>=v){if(l)u=!1;else a=!1;break}if(j>i)if(l)u=!1;else a=!1;if(l){if(u)return!0;u=!0}else if(a)l=!0,u=!1;else a=!0;i=j+1}i=v;continue}if(e.startsWith("<!--",i)){let j=e.indexOf("-->",i);i=j===-1?e.length:j+3;continue}let S=du(e,i);if(S===-1)break;zo.lastIndex=i;let I=zo.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(r===0)break;r--}else if(!fu(e,S)&&!dr.has(I))r++;i=S+1}return!1}var Bo=k(256);function gl(e){if(e.length<1024)return Wo(e);let n=E(e),r=Bo.get(n);if(r!==void 0)return r;let i=Wo(e);return Bo.set(n,i),i}function Wo(e){if(e.length>=32768&&!ki(e))return e;let r=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=r.exec(e))!==null){let u=l.index,f=u+l[0].length,v=!1,S=!1,I=-1;while(f<e.length){let L=e[f];if(v){if(L==="'")v=!1}else if(S){if(L==='"')S=!1}else if(L==="'")v=!0;else if(L==='"')S=!0;else if(L===">"){I=f;break}f++}if(I===-1)continue;let j=e.slice(u,I+1);if(Uo.test(j))continue;if(j.includes("x-cloak"))continue;if(gu(e,I+1))i+=e.slice(a,I)+" x-cloak>",a=I+1}return i+=e.slice(a),i}var mu=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,hu=/<\/script>/gi,xu=/<\/style>/gi;function ml(e){let n=/<[a-z][\w-]*/gi,r="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,u=a[0].slice(1).toLowerCase();if(u==="script"||u==="style"){let V=u==="script"?hu:xu;V.lastIndex=l;let W=V.exec(e);if(W!==null)n.lastIndex=W.index+W[0].length;continue}let f=l+a[0].length,v=!1,S=!1,I=-1;while(f<e.length){let V=e[f];if(v){if(V==="'")v=!1}else if(S){if(V==='"')S=!1}else if(V==="'")v=!0;else if(V==='"')S=!0;else if(V===">"){I=f;break}f++}if(I===-1)continue;let j=e.slice(l+a[0].length,I);if(Uo.test(j))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(j))continue;if(!mu.test(j))continue;let L=e[I-1]==="/",M=L?I-1:I;r+=`${e.slice(i,M)} x-cloak${L?" ":""}`,i=M}return r+=e.slice(i),r}function O(e){let n=new Map;for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))n.set(r[1].toLowerCase(),r[2]??r[3]??r[4]??!0);return n}function $t(e){let n=e.get("type");return typeof n!=="string"||!n.trim()||/^(?:module|(?:text|application)\/(?:javascript|typescript|ecmascript))$/i.test(n.trim())}import xa from"path";import gr from"fs";import jn from"path";function Ho(e,n,r,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===r)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function bu(e){let n=t(e),r=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))r++;else if(")]}".includes(n[l]))r--;else if(n[l]===","&&r===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function kn(e,n,r=!1){let i=t(e),a=new RegExp(`\\b(?:${n.map((u)=>u.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g"),l=r?h(i).depths:void 0;for(let u of i.matchAll(a)){if(l&&l[u.index]!==0)continue;let f=u.index+u[0].length,v="";if(i[f]==="<"){let I=Ho(i,f,"<",">");if(I<0)continue;v=e.slice(f+1,I),f=I+1;while(/\s/.test(i[f]||"")&&f<i.length)f++}if(i[f]!=="(")continue;let S=Ho(i,f,"(",")");if(S>=0)return{type:v,args:bu(e.slice(f+1,S)),start:u.index,end:S+1}}return null}var bs=`
509
509
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
510
510
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
511
511
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
@@ -1149,12 +1149,12 @@ return {`});for(let[W,Z]of u.entries())l.push({text:`value${W}: (`}),l.push({tex
1149
1149
  `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,j-40),j)))){S=L===";"?j+1:j;break}}}a.push({name:v,text:e.slice(u.index,S).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=S}return a}function ap(e){let n=t(e),r=[],i=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,l=0,u=0;while((a=i.exec(n))!==null){for(;u<a.index;u++){let S=n[u];if(S==="{"||S==="("||S==="[")l++;else if(S==="}"||S===")"||S==="]")l=Math.max(0,l-1)}if(l!==0)continue;let f=0,v=n.length;for(let S=a.index+a[0].length;S<n.length;S++){let I=n[S];if(I==="{"||I==="("||I==="[")f++;else if(I==="}"||I===")"||I==="]")f--;else if(f<=0&&(I===";"||I===`
1150
1150
  `)){v=I===";"?S+1:S;break}}if(/\bdefineProps\s*(?:<|\()/.test(n.slice(a.index,v)))r.push(e.slice(a.index,v).replace(/^[ \t]*export[ \t]+/,"").trim())}return r}function Ii(e){let n=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
1151
1151
  `);if(/\bdefineProps\s*(?:<|\()/.test(t(n)))return n;let r=Sa(n),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let l=ap(a.code);if(!l.length)return[];return[...Zt(a.code).filter((u)=>!r.has(u.name)).map((u)=>u.text),...l]});return[n,...i].filter(Boolean).join(`
1152
- `)}function Sa(e){return new Set(Zt(e).map((n)=>n.name))}function al(e,n=""){let r=wa(e),i=Sa(n),a=Zt(e).filter((S)=>!i.has(S.name)).map((S)=>S.text);if(!r){let S=ye(e).filter((I)=>!Ut(n,I));if(S.length===0&&a.length===0)return"";return["",`// ${up}`,...a,...S.map((I)=>`declare var ${I}: any`)].join(`
1152
+ `)}function Sa(e){return new Set(Zt(e).map((n)=>n.name))}function al(e,n=""){let r=wa(e),i=Sa(n),a=Zt(e).filter((S)=>!i.has(S.name)).map((S)=>S.text);if(!r){let S=ye(e).filter((I)=>!Vt(n,I));if(S.length===0&&a.length===0)return"";return["",`// ${up}`,...a,...S.map((I)=>`declare var ${I}: any`)].join(`
1153
1153
  `)}if(r.length===0)return a.length>0?["",`// ${da}`,...a].join(`
1154
1154
  `):"";let{imports:l,body:u}=va(e),f=u.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${da}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${ga}() {`,f,` return { ${r.join(", ")} }`,"}",`type ${ma} = Awaited<ReturnType<typeof ${ga}>>`,...r.map((S)=>`declare var ${S}: ${ma}[${JSON.stringify(S)}]`)),v.join(`
1155
1155
  `)}function Oi(e){let n=t(e),r=n.split(""),i=[],a=0,l=0;for(let f=0;f<r.length;f++){let v=r[f];if(v===`
1156
1156
  `)l=f+1;if(v==="{"||v==="("||v==="["){if(a===0&&v!=="("&&cp.test(n.slice(l,f))){let S=$a(n,f);if(S!==-1)i.push(...Ea(n.slice(f,S+1)))}a++;continue}if(v==="}"||v===")"||v==="]"){a=Math.max(0,a-1);continue}if(a>0&&v!==`
1157
- `)r[f]=" "}let u=ye(r.join(""));return i.length===0?u:[...new Set([...u,...i])].sort()}var cp=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function $a(e,n){let r=0;for(let i=n;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")r++;else if(a==="}"||a===")"||a==="]")r--;if(r===0)return i}return-1}function lp(e){let n=[],r=0,i=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")r++;else if(l==="}"||l===")"||l==="]")r--;else if(l===","&&r===0)n.push(e.slice(i,a)),i=a+1}return n.push(e.slice(i)),n}function fa(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="{"||i==="("||i==="[")n++;else if(i==="}"||i===")"||i==="]")n--;else if(n===0&&(i===":"||i==="="))return{index:r,char:i}}return null}function Ea(e){let n=[],r=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let f=$a(l,0);if(f!==-1)n.push(...Ea(l.slice(0,f+1)));return}let u=fa(l);if(u)l=l.slice(0,u.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))n.push(l)},i=e.slice(1,-1);for(let a of lp(i)){if(!a.trim())continue;if(e[0]==="["){r(a);continue}let l=fa(a);r(l?.char===":"?a.slice(l.index+1):a)}return n}function cl(e,n){if(wa(e)!==null)return[];let r=Oi(e),i=Le(n,new Set(r)),a=new Set(C);return r.filter((l)=>{if(a.has(l))return!1;if(Ut(n,l))return!1;return i.has(l)})}var da="stx: types for the declared client payload (#1868)",up="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ga="__stxServerScope",ma="__StxClientPayload";var ha=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var pp=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function fp(e){let n=new Map,r=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=t(i),{depths:l,balanced:u}=h(a);if(!u)continue;let f=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(f)){let S=v.index??0;if(l[S+v[1].length]!==0)continue;let I=v[2],j=S+v[0].length-v[3].length,L=i.slice(j,S+v[0].length).trim().replace(/;$/,"").trim(),M=v[3],V=r.test(M)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(M)&&!/[,+\-*/%&|?:=]$/.test(L)&&h(M).balanced;n.set(I,n.has(I)||!V?null:L)}}return new Map([...n].filter((i)=>i[1]!==null))}function ka(e,n,r=0,i=new Set){if(n.size===0||r>=5)return e;let a=t(e),l="",u=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=f.index??0,S=f[0],I=n.get(S);if(!I||i.has(S))continue;let j=a.slice(0,v).trimEnd(),L=a.slice(v+S.length).trimStart();if(j.endsWith(".")||/^:(?!:)/.test(L)&&/[{,]$/.test(j))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(u,v)}(${ka(I,n,r+1,new Set([...i,S]))})`,u=v+S.length}return l+e.slice(u)}function dp(e,n){let r=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=r.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let u="";if(a[2]==="("){let f=0,v=a.index+a[0].length-1,S=v+1;for(;v<e.length;v++){let I=e[v];if(I==="(")f++;else if(I===")"){if(f--,f===0)break}}u=e.slice(S,v).trim(),r.lastIndex=v+1}if(l==="if")i.push({seen:[],current:u});else if(l==="unless")i.push({seen:[],current:`!(${u})`});else if(l==="elseif"||l==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=l==="elseif"?u:null}}return i.flatMap((l)=>[...l.seen.map((u)=>`!(${u})`),...l.current?[l.current]:[]]).filter(Boolean)}function gp(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(pp.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let r=";void ((";return{text:`${r}${n}));`,prefixLength:r.length}}var mp=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Es(e,n){return ro(e,n).code}function ro(e,n){let r=new Map;if(!n)return{code:e,columns:r};let i=Ca(e),a=[],l=0;for(let u of e.matchAll(mp)){let f=u.index,[v,S,I,j]=u,L=xa.resolve(n,j).replace(/\\/g,"/"),M=`${S}${I}${L}${I}`;if(a.push(e.slice(l,f),M),l=f+v.length,v.includes(`
1157
+ `)r[f]=" "}let u=ye(r.join(""));return i.length===0?u:[...new Set([...u,...i])].sort()}var cp=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function $a(e,n){let r=0;for(let i=n;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")r++;else if(a==="}"||a===")"||a==="]")r--;if(r===0)return i}return-1}function lp(e){let n=[],r=0,i=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")r++;else if(l==="}"||l===")"||l==="]")r--;else if(l===","&&r===0)n.push(e.slice(i,a)),i=a+1}return n.push(e.slice(i)),n}function fa(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="{"||i==="("||i==="[")n++;else if(i==="}"||i===")"||i==="]")n--;else if(n===0&&(i===":"||i==="="))return{index:r,char:i}}return null}function Ea(e){let n=[],r=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let f=$a(l,0);if(f!==-1)n.push(...Ea(l.slice(0,f+1)));return}let u=fa(l);if(u)l=l.slice(0,u.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))n.push(l)},i=e.slice(1,-1);for(let a of lp(i)){if(!a.trim())continue;if(e[0]==="["){r(a);continue}let l=fa(a);r(l?.char===":"?a.slice(l.index+1):a)}return n}function cl(e,n){if(wa(e)!==null)return[];let r=Oi(e),i=Le(n,new Set(r)),a=new Set(C);return r.filter((l)=>{if(a.has(l))return!1;if(Vt(n,l))return!1;return i.has(l)})}var da="stx: types for the declared client payload (#1868)",up="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ga="__stxServerScope",ma="__StxClientPayload";var ha=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var pp=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function fp(e){let n=new Map,r=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=t(i),{depths:l,balanced:u}=h(a);if(!u)continue;let f=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(f)){let S=v.index??0;if(l[S+v[1].length]!==0)continue;let I=v[2],j=S+v[0].length-v[3].length,L=i.slice(j,S+v[0].length).trim().replace(/;$/,"").trim(),M=v[3],V=r.test(M)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(M)&&!/[,+\-*/%&|?:=]$/.test(L)&&h(M).balanced;n.set(I,n.has(I)||!V?null:L)}}return new Map([...n].filter((i)=>i[1]!==null))}function ka(e,n,r=0,i=new Set){if(n.size===0||r>=5)return e;let a=t(e),l="",u=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=f.index??0,S=f[0],I=n.get(S);if(!I||i.has(S))continue;let j=a.slice(0,v).trimEnd(),L=a.slice(v+S.length).trimStart();if(j.endsWith(".")||/^:(?!:)/.test(L)&&/[{,]$/.test(j))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(u,v)}(${ka(I,n,r+1,new Set([...i,S]))})`,u=v+S.length}return l+e.slice(u)}function dp(e,n){let r=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=r.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let u="";if(a[2]==="("){let f=0,v=a.index+a[0].length-1,S=v+1;for(;v<e.length;v++){let I=e[v];if(I==="(")f++;else if(I===")"){if(f--,f===0)break}}u=e.slice(S,v).trim(),r.lastIndex=v+1}if(l==="if")i.push({seen:[],current:u});else if(l==="unless")i.push({seen:[],current:`!(${u})`});else if(l==="elseif"||l==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=l==="elseif"?u:null}}return i.flatMap((l)=>[...l.seen.map((u)=>`!(${u})`),...l.current?[l.current]:[]]).filter(Boolean)}function gp(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(pp.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let r=";void ((";return{text:`${r}${n}));`,prefixLength:r.length}}var mp=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Es(e,n){return ro(e,n).code}function ro(e,n){let r=new Map;if(!n)return{code:e,columns:r};let i=Ca(e),a=[],l=0;for(let u of e.matchAll(mp)){let f=u.index,[v,S,I,j]=u,L=xa.resolve(n,j).replace(/\\/g,"/"),M=`${S}${I}${L}${I}`;if(a.push(e.slice(l,f),M),l=f+v.length,v.includes(`
1158
1158
  `))continue;let V=Er(i,f),W=r.get(V.line)??[],Z=W.at(-1),q=V.column+(Z?Z.generatedEnd-Z.sourceEnd:0);W.push({sourceStart:V.column,sourceEnd:V.column+v.length,generatedStart:q,generatedEnd:q+M.length}),r.set(V.line,W)}return a.push(e.slice(l)),{code:a.join(""),columns:r}}function hp(e,n,r){let i=vr(e.importColumns?.get(n)??[],r);return vr(e.scriptColumns?.get(n)??[],vr(e.componentColumns?.get(n)??[],i))}function Ni(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function ks(e){let n=new Set,r=t(e);for(let i of r.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let S of l?.[1].split(",")??[]){let I=S.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(I&&/^[A-Z_$][\w$]*$/i.test(I))n.add(I)}let u=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(u);if(f)n.add(f[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(u);if(v&&v[1]!=="type")n.add(v[1])}return[...n].sort()}function Mi(e,n={}){let r=_e(e),i=n.scriptKinds?r.filter((H)=>n.scriptKinds.includes(H.kind)):r,a=to(e,n.componentMethodValidator),l=n.filePath&&n.templateExpressions!==!1?aa(e,{filePath:n.filePath,partialsDir:n.partialsDir,layoutsDir:n.layoutsDir,contractsKnown:n.inheritedContractsKnown,readTemplate:n.readComponent}):void 0,u=new Map,f=e.split(`
1159
1159
  `),v=Array.from({length:f.length},()=>""),S=new Map,I=new Map,j=new Map,L=[],M=Ii(r),V=n.filePath&&n.templateExpressions!==!1?Ko(e,ln(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(H,re)=>_e(H).map((ce)=>Es(ce.code,xa.dirname(re))).join(`
1160
1160
  `)}):void 0,W=new Set,Z=[];for(let[H,re]of i.entries()){let ce=Pi(Ni(re)+re.code,M,String(H));for(let[we,ge]of ce.columns)I.set(re.startLine+we-1,ge);for(let we of ce.declarations)L.push({text:Es(we.text,n.originDir??""),origin:we.origin?{...we.origin,line:we.origin.line+re.startLine-1}:void 0});let le=re.kind==="client"&&a?a.project(ce.code):void 0;for(let[we,ge]of le?.columns??[])u.set(re.startLine+we-1,ge);let de=En(le?.code??ce.code),Ee=ro(de,n.originDir??"");for(let[we,ge]of Ee.columns)j.set(re.startLine+we-1,ge);let Re=Ee.code.split(`
@@ -1178,13 +1178,13 @@ ${ce}`:"";S.push(` \u2717 ${W}${re}
1178
1178
  ${S.join(`
1179
1179
  `)}
1180
1180
  Tip: prefer useRef(), navigate(), and composables for component code`;if(kr.set(l,M),console.warn(M),a.failOnViolation)throw new te(M,i??n)}var wp=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],vp=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],Sp=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function jg(e){let n=[],r=[];return $p(e,n),Ep(e,n,r),kp(e,r),Cp(e,n),{valid:n.length===0,errors:n,warnings:r}}function $p(e,n){let r=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(r!==i)n.push({type:"expression",message:`Unclosed expression brackets: found ${r} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Ep(e,n,r){for(let i of wp){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),u=(e.match(a)||[]).length,f=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");f+=(e.match(v)||[]).length}if(u>f)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${u} opening and ${f} closing`,suggestion:`Add ${u-f} missing ${i.close} tag(s)`});else if(f>u)r.push({type:"directive",message:`Extra ${i.close} found: ${f-u} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function kp(e,n){for(let r of vp)if(r.pattern.test(e))n.push({type:"syntax",message:r.message,suggestion:r.suggestion})}function Cp(e,n){for(let r of Sp)if(r.pattern.test(e))n.push({type:"expression",message:`Security warning: ${r.message}`,suggestion:"Remove dangerous code from template expressions"})}function Bg(e,n){let r=e.slice(0,n).split(`
1181
- `);return{line:r.length,column:r[r.length-1].length+1}}function Fg(e,n,r){let i=[];switch(e){case"if":case"elseif":case"unless":if(r.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(r.length===0||!r[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(r.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(r.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(r.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(r.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function zg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Hg(e){let n=e.matchAll(/@([a-z]+)/gi),r=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))r.add(a)}return Array.from(r)}function Ta(e,n,r){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return P(i[0],n,r)+e.slice(i[0].length)}var Wn=new T(500),Tr=new Map;function Aa(e){try{let n=Is.statSync(e);return`${n.size}:${n.mtimeMs}`}catch{return""}}var Ts=new T(1000),Ar=new Map,Pr=new T(2000),Wr=new T(500),za=33554432,Vr=za;function Rp(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===Vr)return;Vr=n,As.setMaxBytes(n)}var As=new T(2000,{maxBytes:za,sizeOf:(e)=>e.output.length});function Tp(e){let n=new WeakSet;try{let r=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(r);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let u of Object.keys(i).sort())l[u]=r(i[u]);return l}finally{n.delete(i)}};return JSON.stringify(r(e))}catch{return null}}function Ap(e){let n={};for(let[r,i]of Object.entries(e))if(!r.startsWith("__")||r==="__stxServeContext")n[r]=i;return n}function Cr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function co(e){let n=process.cwd(),r=`${n}\x00${e}`,i=Ia.get(r);if(i===void 0)i=Bun.hash(Ba(e,n).split(xe.sep).join("/")).toString(36).slice(0,6),Ia.set(r,i);return i}var Ia=new Map;function Ba(e,n){if(!xe.isAbsolute(e))return e;let r=(i)=>{try{return Is.realpathSync(i)}catch{return i}};return xe.relative(r(n),r(e))}function Ug(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Xe(e){return!Ug(e)}var Rs=new Map;function ie(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let r=Rs.get(n);if(r)return r;if(Rs.size>=16)Rs.clear();let i=new Bun.Transpiler(e);return Rs.set(n,i),i}var Oa=new WeakMap,Ip=256;function Je(e){try{let n=ie({loader:"ts",target:"browser",define:A()}),r=Oa.get(n);if(!r)r=new Map,Oa.set(n,r);let i=r.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let v=l.length;return l.push(f),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let v=l.length;return l.push(f),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let v=l.length;return l.push(f),`"__STX_EXPR_${v}__"`});let u=n.transformSync(a);for(let f=0;f<l.length;f++)u=u.replace(`"__STX_EXPR_${f}__"`,l[f]),u=u.replace(`'__STX_EXPR_${f}__'`,l[f]);if(r.size>=Ip){let f=r.keys().next();if(!f.done)r.delete(f.value)}return r.set(e,u),u}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function Op(e){let n=[],r=new Set,i=0,a=0,l=e.length,u=(M)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===M){a++;return}a++}},f=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let M=1;while(a<l&&M>0)if(e[a]==="{")M++,a++;else if(e[a]==="}")M--,a++;else if(e[a]==="'"||e[a]==='"')u(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
1181
+ `);return{line:r.length,column:r[r.length-1].length+1}}function Fg(e,n,r){let i=[];switch(e){case"if":case"elseif":case"unless":if(r.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(r.length===0||!r[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(r.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(r.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(r.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(r.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function zg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Hg(e){let n=e.matchAll(/@([a-z]+)/gi),r=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))r.add(a)}return Array.from(r)}function Ta(e,n,r){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return P(i[0],n,r)+e.slice(i[0].length)}var Wn=new T(500),Tr=new Map;function Aa(e){try{let n=Is.statSync(e);return`${n.size}:${n.mtimeMs}`}catch{return""}}var Ts=new T(1000),Ar=new Map,Pr=new T(2000),Wr=new T(500),za=33554432,Vr=za;function Rp(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===Vr)return;Vr=n,As.setMaxBytes(n)}var As=new T(2000,{maxBytes:za,sizeOf:(e)=>e.output.length});function Tp(e){let n=new WeakSet;try{let r=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(r);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let u of Object.keys(i).sort())l[u]=r(i[u]);return l}finally{n.delete(i)}};return JSON.stringify(r(e))}catch{return null}}function Ap(e){let n={};for(let[r,i]of Object.entries(e))if(!r.startsWith("__")||r==="__stxServeContext")n[r]=i;return n}function Cr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function co(e){let n=process.cwd(),r=`${n}\x00${e}`,i=Ia.get(r);if(i===void 0)i=Bun.hash(Ba(e,n).split(xe.sep).join("/")).toString(36).slice(0,6),Ia.set(r,i);return i}var Ia=new Map;function Ba(e,n){if(!xe.isAbsolute(e))return e;let r=(i)=>{try{return Is.realpathSync(i)}catch{return i}};return xe.relative(r(n),r(e))}function Vg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Xe(e){return!Vg(e)}var Rs=new Map;function ie(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let r=Rs.get(n);if(r)return r;if(Rs.size>=16)Rs.clear();let i=new Bun.Transpiler(e);return Rs.set(n,i),i}var Oa=new WeakMap,Ip=256;function Je(e){try{let n=ie({loader:"ts",target:"browser",define:A()}),r=Oa.get(n);if(!r)r=new Map,Oa.set(n,r);let i=r.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let v=l.length;return l.push(f),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let v=l.length;return l.push(f),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let v=l.length;return l.push(f),`"__STX_EXPR_${v}__"`});let u=n.transformSync(a);for(let f=0;f<l.length;f++)u=u.replace(`"__STX_EXPR_${f}__"`,l[f]),u=u.replace(`'__STX_EXPR_${f}__'`,l[f]);if(r.size>=Ip){let f=r.keys().next();if(!f.done)r.delete(f.value)}return r.set(e,u),u}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function Op(e){let n=[],r=new Set,i=0,a=0,l=e.length,u=(M)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===M){a++;return}a++}},f=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let M=1;while(a<l&&M>0)if(e[a]==="{")M++,a++;else if(e[a]==="}")M--,a++;else if(e[a]==="'"||e[a]==='"')u(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
1182
1182
  `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},S=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),I=()=>{let M=a-1;while(M>=0&&/\s/.test(e[M]))M--;if(M<0)return!0;let V=e[M];if("(,=:[!&|?{};+-*%<>~^".includes(V))return!0;if(!/[\w$]/.test(V))return!1;let W=M;while(W>0&&/[\w$]/.test(e[W-1]))W--;return S.has(e.slice(W,M+1))},j=()=>{a++;let M=!1;while(a<l&&e[a]!==`
1183
- `){let V=e[a];if(V==="\\"){a+=2;continue}if(V==="[")M=!0;else if(V==="]")M=!1;else if(V==="/"&&!M){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},L=()=>{if(i!==0)return;let M=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let q=M[2].split(",").map((G)=>{let U=G.trim().split(":");return U[U.length-1].trim()});for(let G of q)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!r.has(G))n.push(G),r.add(G);return}let V=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(V){let q=V[2];if(!r.has(q))n.push(q),r.add(q);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let q=W[1];if(!r.has(q))n.push(q),r.add(q);return}let Z=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let q=Z[1];if(!r.has(q))n.push(q),r.add(q)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){j();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])))L();a++}return n}function jp(e,n,r){for(let i of ee(e)){let a=O(i.attrs);if(["server","src","component","stx:component"].some((f)=>a.has(f))||!$t(a))continue;let l=an(e.slice(i.bodyStart,i.bodyEnd));if(!l)continue;let u=Object.assign(Object.create(null),r);for(let[f,v]of Object.entries(l.defaults))if(u[f]===void 0)u[f]=ws(v);for(let f of new Set([...l.propNames,...Object.keys(l.defaults)])){let v=l.localBindings[f]??(l.propBindings[f]?void 0:f);if(v)Object.defineProperty(n,v,{value:u[f],writable:!0,enumerable:!0,configurable:!0})}if(l.identifier)Object.defineProperty(n,l.identifier,{value:u,writable:!0,enumerable:!0,configurable:!0})}}var Pp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Vg(e,n){let r=Vt(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!Pp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=x(e,(I,j)=>(l.lastIndex=j,l.exec(I)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,v=!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;v=!0;break}}if(!v)return null;let S=r+i[0].length;return e.slice(0,S)+n+e.slice(S)}function Wa(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=xe.relative(xe.resolve(i),xe.resolve(e));return!a.startsWith("..")&&!xe.isAbsolute(a)})}async function Fr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ce)=>ce.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ce of[l,l.toLowerCase(),u(l),J(l)])if(f.has(ce))return!0}let v=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${J(l)}.stx`])],S=typeof a.root==="string"?xe.resolve(a.root):void 0,I=S??xe.dirname(i),j=[],L=(ce)=>{if(ce&&!j.includes(ce))j.push(ce)};for(let ce of rs(i,S))L(ce);let M=r.__originalFilePath;if(M)L(xe.join(xe.dirname(M),"components"));if(Wa(n,a))L(a._rootComponentsDir);L(n),L(a._rootComponentsDir),L(xe.join(xe.dirname(i),"components")),L(a.componentsDir);for(let ce of a.additionalComponentsDirs??[])L(ce);let V=a._targetComponentFallbackNames?.some((ce)=>ce.toLowerCase()===l.toLowerCase());if(!V)for(let ce of a._targetComponentDirs??[])L(ce);if(S)L(xe.resolve(S,"resources/views/components")),L(xe.resolve(S,"resources/components")),L(xe.resolve(S,"src/components")),L(xe.resolve(S,"components"));for(let ce of a._layerComponentDirs??[])L(ce);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let ce of W)L(typeof ce==="string"?ce:null);if(L(a.fallbackComponentsDir),V)for(let ce of a._targetComponentDirs??[])L(ce);let Z=a._nativePrimitivesFallback;if(Z&&!Z.except.some((ce)=>ce.toLowerCase()===l.toLowerCase()))L(Z.dir);if(l.startsWith("./")||l.startsWith("../"))return s(xe.resolve(xe.dirname(i),`${l}.stx`));let q=ja(xe.resolve(import.meta.dir,"components")),G=j.map((ce)=>xe.isAbsolute(ce)?ce:xe.resolve(I,ce)),U=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,H=Pr.get(U);if(H!==void 0)return H;let re=!1;e:for(let ce of G){if(ja(ce)===q)continue;for(let le of v)if(await s(xe.join(ce,le))){re=!0;break e}}return Pr.set(U,re),re}function ja(e){let n=Wr.get(e);if(n!==void 0)return n;let r=e;try{r=Is.realpathSync(e)}catch{}return Wr.set(e,r),r}function Wg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Sl(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 Mp(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=N(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 Pa=new Set;function Ma(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Pa.has(a))return;Pa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
1183
+ `){let V=e[a];if(V==="\\"){a+=2;continue}if(V==="[")M=!0;else if(V==="]")M=!1;else if(V==="/"&&!M){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},L=()=>{if(i!==0)return;let M=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let q=M[2].split(",").map((G)=>{let U=G.trim().split(":");return U[U.length-1].trim()});for(let G of q)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!r.has(G))n.push(G),r.add(G);return}let V=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(V){let q=V[2];if(!r.has(q))n.push(q),r.add(q);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let q=W[1];if(!r.has(q))n.push(q),r.add(q);return}let Z=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let q=Z[1];if(!r.has(q))n.push(q),r.add(q)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){j();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])))L();a++}return n}function jp(e,n,r){for(let i of ee(e)){let a=O(i.attrs);if(["server","src","component","stx:component"].some((f)=>a.has(f))||!$t(a))continue;let l=an(e.slice(i.bodyStart,i.bodyEnd));if(!l)continue;let u=Object.assign(Object.create(null),r);for(let[f,v]of Object.entries(l.defaults))if(u[f]===void 0)u[f]=ws(v);for(let f of new Set([...l.propNames,...Object.keys(l.defaults)])){let v=l.localBindings[f]??(l.propBindings[f]?void 0:f);if(v)Object.defineProperty(n,v,{value:u[f],writable:!0,enumerable:!0,configurable:!0})}if(l.identifier)Object.defineProperty(n,l.identifier,{value:u,writable:!0,enumerable:!0,configurable:!0})}}var Pp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ug(e,n){let r=Ut(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!Pp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=x(e,(I,j)=>(l.lastIndex=j,l.exec(I)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,v=!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;v=!0;break}}if(!v)return null;let S=r+i[0].length;return e.slice(0,S)+n+e.slice(S)}function Wa(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=xe.relative(xe.resolve(i),xe.resolve(e));return!a.startsWith("..")&&!xe.isAbsolute(a)})}async function Fr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ce)=>ce.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ce of[l,l.toLowerCase(),u(l),J(l)])if(f.has(ce))return!0}let v=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${J(l)}.stx`])],S=typeof a.root==="string"?xe.resolve(a.root):void 0,I=S??xe.dirname(i),j=[],L=(ce)=>{if(ce&&!j.includes(ce))j.push(ce)};for(let ce of rs(i,S))L(ce);let M=r.__originalFilePath;if(M)L(xe.join(xe.dirname(M),"components"));if(Wa(n,a))L(a._rootComponentsDir);L(n),L(a._rootComponentsDir),L(xe.join(xe.dirname(i),"components")),L(a.componentsDir);for(let ce of a.additionalComponentsDirs??[])L(ce);let V=a._targetComponentFallbackNames?.some((ce)=>ce.toLowerCase()===l.toLowerCase());if(!V)for(let ce of a._targetComponentDirs??[])L(ce);if(S)L(xe.resolve(S,"resources/views/components")),L(xe.resolve(S,"resources/components")),L(xe.resolve(S,"src/components")),L(xe.resolve(S,"components"));for(let ce of a._layerComponentDirs??[])L(ce);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let ce of W)L(typeof ce==="string"?ce:null);if(L(a.fallbackComponentsDir),V)for(let ce of a._targetComponentDirs??[])L(ce);let Z=a._nativePrimitivesFallback;if(Z&&!Z.except.some((ce)=>ce.toLowerCase()===l.toLowerCase()))L(Z.dir);if(l.startsWith("./")||l.startsWith("../"))return s(xe.resolve(xe.dirname(i),`${l}.stx`));let q=ja(xe.resolve(import.meta.dir,"components")),G=j.map((ce)=>xe.isAbsolute(ce)?ce:xe.resolve(I,ce)),U=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,H=Pr.get(U);if(H!==void 0)return H;let re=!1;e:for(let ce of G){if(ja(ce)===q)continue;for(let le of v)if(await s(xe.join(ce,le))){re=!0;break e}}return Pr.set(U,re),re}function ja(e){let n=Wr.get(e);if(n!==void 0)return n;let r=e;try{r=Is.realpathSync(e)}catch{}return Wr.set(e,r),r}function Wg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Sl(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 Mp(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=N(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 Pa=new Set;function Ma(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Pa.has(a))return;Pa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
1184
1184
  searched:
1185
1185
  ${r.map((v)=>` - ${v}`).join(`
1186
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Da(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Dp=new Set(["for","if","show","key","ref","class","className","style"]),Na=new Set,Fa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",kl=new RegExp(`\\b(?:${Fa})\\s*(?:<[^>]*>)?\\s*\\(`);function Hi(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|${Fa})\\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 Ye(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-b77t5zy2.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&Wg(W)?W:"";try{let q=(pe)=>pe.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let pe=[G,G.toLowerCase(),q(G),J(G)];for(let ve of pe)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let pe=[`${G}.stx`,`${q(G)}.stx`,`${J(G)}.stx`],ve=[...new Set(pe)],Me=a.__originalFilePath,$e=[];for(let Te of rs(l))if(!$e.includes(Te))$e.push(Te);let lt=$e.length;for(let Te of u._layerComponentDirs??[])if(!$e.includes(Te))$e.push(Te);if(Me){let Te=xe.join(xe.dirname(Me),"components");$e.push(Te)}let Qe=u._rootComponentsDir;if(typeof Qe==="string"&&Wa(i,u)&&!$e.includes(Qe))$e.push(Qe);if(i&&!$e.includes(i))$e.push(i);if(typeof Qe==="string"&&!$e.includes(Qe))$e.push(Qe);let Ot=xe.join(xe.dirname(l),"components");if(!$e.includes(Ot))$e.push(Ot);if(u.componentsDir&&u.componentsDir!==i&&!$e.includes(u.componentsDir))$e.push(u.componentsDir);for(let Te of u.additionalComponentsDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let Yt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),Dt=(I?.events??[]).map((Te)=>Te.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ns=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Ls=!Dt.includes("valuechange")&&(Zn||Dt.includes("change")&&!Ns),Lt=u._nativeHostAttrs&&/^textinput$/i.test(G),Qt=Dt.includes("update:value")&&!Dt.includes("input"),yn=u._nativeHostAttrs&&/^video$/i.test(G),zs=u._nativeHostAttrs&&/^image$/i.test(G),Jn=Zs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),en=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Xn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Gn=yn&&(en||Xn)&&(I?.events??[]).every((Te)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Te.replace(/^@/,"").split(".")[0])),Yn=new Set(["","primary","secondary","outline","ghost","danger"]),Qn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",es=u._nativeHostAttrs&&/^button$/i.test(G)&&!Yn.has(Qn),Gr=u._targetComponentFallbackNames?.some((Te)=>Te.toLowerCase()===G.toLowerCase())??!1,Bs=Gr&&(!Yt||Ls)&&(!Lt||Qt)&&(!yn||Gn)&&(!zs||Jn)&&!es;for(let Te of Bs?[]:u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let tn=typeof u.root==="string"?xe.resolve(u.root):void 0,Yr=tn??xe.dirname(l),nn=[];if(tn)nn.push(xe.resolve(tn,"resources/views/components")),nn.push(xe.resolve(tn,"resources/components")),nn.push(xe.resolve(tn,"src/components")),nn.push(xe.resolve(tn,"components"));nn.push(xe.resolve(import.meta.dir,"components"));for(let Te of nn)if(!$e.includes(Te))$e.push(Te);if(Gr){let Te=(u._componentPackageDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0),jt=(Bs?Te.length?Te:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0);if(jt.length){let gt=$e.slice(lt).map((ut)=>xe.isAbsolute(ut)?ut:xe.resolve(Yr,ut)).filter((ut)=>!jt.includes(ut)),ns=`${G}\x00${gt.join("\x00")}`,kt=Ar.get(ns);if(kt===void 0){kt=!1;for(let ut of gt){for(let zt of ve)if(await s(xe.join(ut,zt))){kt=!0;break}if(kt)break}Ar.set(ns,kt)}if(!kt){for(let ut of jt){let zt=$e.indexOf(ut);if(zt>=0)$e.splice(zt,1)}$e.splice(lt,0,...jt)}}}let Qr=u._pluginComponentDirs;if(Array.isArray(Qr)){for(let Te of Qr)if(typeof Te==="string"&&!$e.includes(Te))$e.push(Te)}if(u.fallbackComponentsDir&&!$e.includes(u.fallbackComponentsDir))$e.push(u.fallbackComponentsDir);if(Bs){for(let Te of u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te)}let ts=u._nativePrimitivesFallback;if(ts&&!ts.except.some((Te)=>Te.toLowerCase()===G.toLowerCase())&&!$e.includes(ts.dir))$e.push(ts.dir);let ei=[...new Set($e.map((Te)=>{if(!Te)return Te;return xe.isAbsolute(Te)?Te:xe.resolve(Yr,Te)}))];$e.length=0,$e.push(...ei);let Ws=`${G}\x00${l}\x00${ei.join("\x00")}`,Fs=Ts.get(Ws);if(Fs)if(await s(Fs))U=Fs;else Ts.delete(Ws);if(!U&&(G.startsWith("./")||G.startsWith("../")))U=xe.resolve(xe.dirname(l),`${G}.stx`),re.push(U);else if(!U)for(let Te of $e){if(!Te)continue;for(let jt of ve){let gt=xe.join(Te,jt);if(re.push(gt),await s(gt)){U=gt;break}}if(U)break;if(!U)try{let jt=await import("fs");if(!jt.statSync(Te,{throwIfNoEntry:!1})?.isDirectory())continue;let ns=8,kt=[{path:Te,depth:0}];while(kt.length>0&&!U){let ut=kt.pop();if(ut.depth>=ns)continue;let zt;try{zt=jt.readdirSync(ut.path,{withFileTypes:!0})}catch{continue}for(let ss of zt){if(!ss.isDirectory())continue;if(ss.name==="node_modules"||ss.name.startsWith("."))continue;let ti=xe.join(ut.path,ss.name);for(let nc of ve){let Vs=xe.join(ti,nc);if(re.push(Vs),await s(Vs)){U=Vs;break}}if(U)break;kt.push({path:ti,depth:ut.depth+1})}}}catch{}if(U)break}if(U)Ts.set(Ws,U)}if(!U||!await s(U))return Ma(e,l,re),Da(e);v.add(U);let ce;if(Wn.has(U)&&Tr.get(U)===Aa(U))ce=Wn.get(U);else try{let pe=Aa(U);ce=await Bun.file(U).text(),Wn.set(U,ce),Tr.set(U,pe)}catch(pe){let ve=pe instanceof Error?pe.message:String(pe);return Ma(e,l,[U],ve),Da(e)}if(I)for(let pe of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=pe.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let Me=pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Me}\\b`).test(ce))I.declaredProps.add(pe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Me}\\b|\\[\\s*['"]${Me}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Me}['"]`).test(ce))I.consumedProps?.add(pe)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let pe of I.reactiveProps){if(Dp.has(pe)||I.consumedProps?.has(pe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${pe}`;if(Na.has(ve))continue;Na.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${pe}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${pe}): 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('${pe}').`)}let le=new Set(["__originalFilePath","__importedComponents",ls,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),de={};for(let[pe,ve]of Object.entries(a))if(!pe.startsWith("__")||le.has(pe))de[pe]=ve;let Ee=S.length>0?{[ms]:[...S]}:{},Re=r;if(r.includes("@include")){let{processIncludes:pe}=await o("stx/includes",()=>import("./chunk-brmmkfnq.js"));Re=await pe(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:pe}=await o("stx/component-renderer",()=>import("./chunk-0yw075t7.js")),ve={...a,__processedComponents:M,...Ee};Re=await pe(Re,ve,l,u,v);let Me=ve.__stx_preserved_client_expressions;if(Array.isArray(Me)&&Me.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Me])]}let we=[];if(Sl(Re)){let{processExpressions:pe}=await o("stx/expressions",()=>import("./chunk-ccecyvwf.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:S.length>0?{...a,...Ee}:a;Re=pe(Re,ve,l);for(let Me of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(Me[1].trim())}let ge=se(Re),ze=[],Fe=ge.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(pe,ve)=>{let Me=ge.scripts[Number(ve)]||"",$e=Me.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=$e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qe=!lt||["module","text/javascript","application/javascript"].includes(lt),Ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${$e}`);if(!/\bserver\b/i.test($e)&&Qe&&!Ot)return ze.push(Me),"";return Me}),{extractSlotContent:it}=await o("stx/slots",()=>import("./chunk-eenw264a.js")),rt=it(Fe),wt={};if(rt.defaultSlot?.trim())wt.default=rt.defaultSlot;for(let[pe,ve]of rt.namedSlots)wt[pe]=ve.content;let ft=a.__stx_scope_seq??={n:0,key:co(String(a.__filename??l))},ot=Ba(e,process.cwd()),je=`stx_${(ot.endsWith(".stx")?ot.slice(0,-4):ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ae={...de,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:Fe,$slots:wt,__processedComponents:V,__sections:{},__stx_signals_gate:Ne(ce)||Sl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we]};if(/import\s/.test(ce)){Ae.__importedComponents=new Map(Ae.__importedComponents);let{processESImports:pe}=await o("stx/component-renderer",()=>import("./chunk-0yw075t7.js"));ce=await pe(ce,Ae,U,u,v)}jp(ce,Ae,n);let dt=ce,nt=B(dt);if(nt)dt=nt.content.trim();let pn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Pt=[...ce.matchAll(pn)];for(let[,pe,ve]of Pt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(pe))We(ve,U,u.strict);let vt=[],fn=null,js=Pt.some((pe)=>/\bserver\b/.test(pe[1]||"")&&/\bcache\b/.test(pe[1]||"")),Jt=null,Rt=null,dn=null,Un=0,gn=null;if(Rp(u),js&&Vr>0){let pe=Tp({props:n,slot:Re,slotContext:r.trim()?Ap(de):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:je});if(pe!==null){Jt=`${U}\x00${E(ce)}\x00${pe}`;let ve=As.get(Jt);if(ve){for(let Me of ve.dependencies)v.add(Me);if(Ji(a,ve.clientFactories),ft.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let Me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let $e of ve.preservedClientExpressions)Me.add($e);a.__stx_preserved_client_expressions=[...Me]}return ve.output}Rt=new Set(v),dn=qi(a),Un=ft.n,gn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let mn=new Set;for(let pe of Pt){let ve=pe[1]||"",Me=pe[2]||"",$e=ve.includes("server");if(Xe(ve)&&Me.trim())Me=Je(Me);if($e&&Me){for(let Qe of ye(Me))mn.add(Qe);try{await L(Me,Ae,U,{onFailure:(Qe)=>{if(Qe.kind!=="unknown")fn=Qe.kind}})}catch(Qe){}}if(!$e){let Qe=Me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ot=Qe.includes("{{")&&Qe.includes("}}"),Yt=Qe.includes("{!!")&&Qe.includes("!!}");if(Ot||Yt)Qe=Vi(Qe,Ae,U);let Dt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");vt.push(`<script${Dt}>${Qe}</script>`)}}let St=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),hn=St?St[1]:"",Ps=St?St[2]:"",Tt="",ue=hn&&/\bscoped\b/i.test(hn);if(St)Tt=`<style${hn}>${Mp(Ps,Ae,U)}</style>`;let fe=dt;if(fe=fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),St)fe=fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let pe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(fe=fe.replace(pe,(Me,$e)=>{let lt=$e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)ve.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),fe=fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)Tt=`${Tt}${ve.join(`
1187
- `)}`}if(r&&fe.includes("{{ text || slot }}"))fe=fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:Se}=await o("stx/slots",()=>import("./chunk-eenw264a.js")),{defaultSlot:Be,namedSlots:tt}=rt,at=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Fe),Et=vt.length>0&&fr(fe)||u._nativeHostAttrs===!0&&vt.length>0||at&&vt.length>0||vt.some((pe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(pe)),Ms=(pe)=>Et?Vo(pe,je):pe,Ds=new Map([...tt].map(([pe,ve])=>[pe,{...ve,content:Ms(ve.content)}]));fe=await Se(fe,Et?Fo(Ms(Be),je):Be,Ds,Ae,Et?je:"");let Hn=Hi(vt),xn=(Array.isArray(Ae.__stx_client_signal_names)?Ae.__stx_client_signal_names:[]).filter((pe)=>!mn.has(pe));if(Hn.length>0||xn.length>0)Ae.__stx_client_signal_names=[...new Set([...xn,...Hn])];else delete Ae.__stx_client_signal_names;let bn=S.filter((pe)=>!mn.has(pe)&&!(pe in n));if(bn.length>0)Ae[ms]=bn;let Kn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Et||vt.length===0,defaultLayout:void 0};Ae.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:qn}=await o("stx/process",()=>import("./chunk-4eyyshsq.js")),At=await qn(fe,Ae,U,Kn,v),Mt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let pe of At.matchAll(/\{\{([\s\S]*?)\}\}/g))Mt.add(pe[1].trim());if(Mt.size>0)a.__stx_preserved_client_expressions=[...Mt];let It=je,ct=At;if(Et){let pe="";if(Object.keys(n).length>0)try{pe=` data-stx-props="${Cr(JSON.stringify(n))}"`}catch{}let ve=Z?` stx-hydrate="${Cr(Z)}"`:"",Me=Object.fromEntries(Object.entries(wt).map(([Lt,Qt])=>[Lt,Boolean(Qt)])),$e=Object.keys(Me).length>0?` data-stx-slots="${Cr(JSON.stringify(Me))}"`:"",lt=` data-stx-scope="${It}"${pe}${$e}${ve}`,Qe=At.slice(Vt(At)),Ot=/^<span(?=[\s/>])/i.test(Qe),Yt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),Dt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Qe),Zn=Ot?"span":"div",Ns=Yt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Dt&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ot||Yt?' style="display:contents"':"";ct=Vg(At,lt)??`<${Zn}${lt} data-stx-component-wrapper${Ns}>${At}</${Zn}>`;let Ls=await Promise.all(vt.map(async(Lt)=>{let Qt=Lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Qt)return Lt;let[,yn,zs]=Qt,Jn=Ta(Lt,Ae,U);if(Jn!==null)return Jn;let en=await Lp(zs,U,u.buildMode==="compile"),Xn=An(en.clientCode,Ke(Ae)),{vendorStyleTags:Gn}=en,Yn=Xn?`function(__scopeId) {
1186
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Da(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Dp=new Set(["for","if","show","key","ref","class","className","style"]),Na=new Set,Fa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",kl=new RegExp(`\\b(?:${Fa})\\s*(?:<[^>]*>)?\\s*\\(`);function Hi(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|${Fa})\\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 Ye(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-xvmd0aja.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&Wg(W)?W:"";try{let q=(pe)=>pe.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let pe=[G,G.toLowerCase(),q(G),J(G)];for(let ve of pe)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let pe=[`${G}.stx`,`${q(G)}.stx`,`${J(G)}.stx`],ve=[...new Set(pe)],Me=a.__originalFilePath,$e=[];for(let Te of rs(l))if(!$e.includes(Te))$e.push(Te);let lt=$e.length;for(let Te of u._layerComponentDirs??[])if(!$e.includes(Te))$e.push(Te);if(Me){let Te=xe.join(xe.dirname(Me),"components");$e.push(Te)}let Qe=u._rootComponentsDir;if(typeof Qe==="string"&&Wa(i,u)&&!$e.includes(Qe))$e.push(Qe);if(i&&!$e.includes(i))$e.push(i);if(typeof Qe==="string"&&!$e.includes(Qe))$e.push(Qe);let Ot=xe.join(xe.dirname(l),"components");if(!$e.includes(Ot))$e.push(Ot);if(u.componentsDir&&u.componentsDir!==i&&!$e.includes(u.componentsDir))$e.push(u.componentsDir);for(let Te of u.additionalComponentsDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let Yt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),Dt=(I?.events??[]).map((Te)=>Te.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ns=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Ls=!Dt.includes("valuechange")&&(Zn||Dt.includes("change")&&!Ns),Lt=u._nativeHostAttrs&&/^textinput$/i.test(G),Qt=Dt.includes("update:value")&&!Dt.includes("input"),yn=u._nativeHostAttrs&&/^video$/i.test(G),zs=u._nativeHostAttrs&&/^image$/i.test(G),Jn=Zs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),en=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Xn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Gn=yn&&(en||Xn)&&(I?.events??[]).every((Te)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Te.replace(/^@/,"").split(".")[0])),Yn=new Set(["","primary","secondary","outline","ghost","danger"]),Qn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",es=u._nativeHostAttrs&&/^button$/i.test(G)&&!Yn.has(Qn),Gr=u._targetComponentFallbackNames?.some((Te)=>Te.toLowerCase()===G.toLowerCase())??!1,Bs=Gr&&(!Yt||Ls)&&(!Lt||Qt)&&(!yn||Gn)&&(!zs||Jn)&&!es;for(let Te of Bs?[]:u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let tn=typeof u.root==="string"?xe.resolve(u.root):void 0,Yr=tn??xe.dirname(l),nn=[];if(tn)nn.push(xe.resolve(tn,"resources/views/components")),nn.push(xe.resolve(tn,"resources/components")),nn.push(xe.resolve(tn,"src/components")),nn.push(xe.resolve(tn,"components"));nn.push(xe.resolve(import.meta.dir,"components"));for(let Te of nn)if(!$e.includes(Te))$e.push(Te);if(Gr){let Te=(u._componentPackageDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0),jt=(Bs?Te.length?Te:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((gt)=>typeof gt==="string"&&gt.length>0);if(jt.length){let gt=$e.slice(lt).map((ut)=>xe.isAbsolute(ut)?ut:xe.resolve(Yr,ut)).filter((ut)=>!jt.includes(ut)),ns=`${G}\x00${gt.join("\x00")}`,kt=Ar.get(ns);if(kt===void 0){kt=!1;for(let ut of gt){for(let zt of ve)if(await s(xe.join(ut,zt))){kt=!0;break}if(kt)break}Ar.set(ns,kt)}if(!kt){for(let ut of jt){let zt=$e.indexOf(ut);if(zt>=0)$e.splice(zt,1)}$e.splice(lt,0,...jt)}}}let Qr=u._pluginComponentDirs;if(Array.isArray(Qr)){for(let Te of Qr)if(typeof Te==="string"&&!$e.includes(Te))$e.push(Te)}if(u.fallbackComponentsDir&&!$e.includes(u.fallbackComponentsDir))$e.push(u.fallbackComponentsDir);if(Bs){for(let Te of u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te)}let ts=u._nativePrimitivesFallback;if(ts&&!ts.except.some((Te)=>Te.toLowerCase()===G.toLowerCase())&&!$e.includes(ts.dir))$e.push(ts.dir);let ei=[...new Set($e.map((Te)=>{if(!Te)return Te;return xe.isAbsolute(Te)?Te:xe.resolve(Yr,Te)}))];$e.length=0,$e.push(...ei);let Ws=`${G}\x00${l}\x00${ei.join("\x00")}`,Fs=Ts.get(Ws);if(Fs)if(await s(Fs))U=Fs;else Ts.delete(Ws);if(!U&&(G.startsWith("./")||G.startsWith("../")))U=xe.resolve(xe.dirname(l),`${G}.stx`),re.push(U);else if(!U)for(let Te of $e){if(!Te)continue;for(let jt of ve){let gt=xe.join(Te,jt);if(re.push(gt),await s(gt)){U=gt;break}}if(U)break;if(!U)try{let jt=await import("fs");if(!jt.statSync(Te,{throwIfNoEntry:!1})?.isDirectory())continue;let ns=8,kt=[{path:Te,depth:0}];while(kt.length>0&&!U){let ut=kt.pop();if(ut.depth>=ns)continue;let zt;try{zt=jt.readdirSync(ut.path,{withFileTypes:!0})}catch{continue}for(let ss of zt){if(!ss.isDirectory())continue;if(ss.name==="node_modules"||ss.name.startsWith("."))continue;let ti=xe.join(ut.path,ss.name);for(let nc of ve){let Vs=xe.join(ti,nc);if(re.push(Vs),await s(Vs)){U=Vs;break}}if(U)break;kt.push({path:ti,depth:ut.depth+1})}}}catch{}if(U)break}if(U)Ts.set(Ws,U)}if(!U||!await s(U))return Ma(e,l,re),Da(e);v.add(U);let ce;if(Wn.has(U)&&Tr.get(U)===Aa(U))ce=Wn.get(U);else try{let pe=Aa(U);ce=await Bun.file(U).text(),Wn.set(U,ce),Tr.set(U,pe)}catch(pe){let ve=pe instanceof Error?pe.message:String(pe);return Ma(e,l,[U],ve),Da(e)}if(I)for(let pe of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=pe.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let Me=pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Me}\\b`).test(ce))I.declaredProps.add(pe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Me}\\b|\\[\\s*['"]${Me}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Me}['"]`).test(ce))I.consumedProps?.add(pe)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let pe of I.reactiveProps){if(Dp.has(pe)||I.consumedProps?.has(pe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${pe}`;if(Na.has(ve))continue;Na.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${pe}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${pe}): 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('${pe}').`)}let le=new Set(["__originalFilePath","__importedComponents",ls,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),de={};for(let[pe,ve]of Object.entries(a))if(!pe.startsWith("__")||le.has(pe))de[pe]=ve;let Ee=S.length>0?{[ms]:[...S]}:{},Re=r;if(r.includes("@include")){let{processIncludes:pe}=await o("stx/includes",()=>import("./chunk-n2d0jzyv.js"));Re=await pe(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:pe}=await o("stx/component-renderer",()=>import("./chunk-b35t77m0.js")),ve={...a,__processedComponents:M,...Ee};Re=await pe(Re,ve,l,u,v);let Me=ve.__stx_preserved_client_expressions;if(Array.isArray(Me)&&Me.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Me])]}let we=[];if(Sl(Re)){let{processExpressions:pe}=await o("stx/expressions",()=>import("./chunk-6shfk0tt.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:S.length>0?{...a,...Ee}:a;Re=pe(Re,ve,l);for(let Me of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(Me[1].trim())}let ge=se(Re),ze=[],Fe=ge.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(pe,ve)=>{let Me=ge.scripts[Number(ve)]||"",$e=Me.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=$e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qe=!lt||["module","text/javascript","application/javascript"].includes(lt),Ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${$e}`);if(!/\bserver\b/i.test($e)&&Qe&&!Ot)return ze.push(Me),"";return Me}),{extractSlotContent:it}=await o("stx/slots",()=>import("./chunk-jyd9trff.js")),rt=it(Fe),wt={};if(rt.defaultSlot?.trim())wt.default=rt.defaultSlot;for(let[pe,ve]of rt.namedSlots)wt[pe]=ve.content;let ft=a.__stx_scope_seq??={n:0,key:co(String(a.__filename??l))},ot=Ba(e,process.cwd()),je=`stx_${(ot.endsWith(".stx")?ot.slice(0,-4):ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ae={...de,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:Fe,$slots:wt,__processedComponents:V,__sections:{},__stx_signals_gate:Ne(ce)||Sl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we]};if(/import\s/.test(ce)){Ae.__importedComponents=new Map(Ae.__importedComponents);let{processESImports:pe}=await o("stx/component-renderer",()=>import("./chunk-b35t77m0.js"));ce=await pe(ce,Ae,U,u,v)}jp(ce,Ae,n);let dt=ce,nt=B(dt);if(nt)dt=nt.content.trim();let pn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Pt=[...ce.matchAll(pn)];for(let[,pe,ve]of Pt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(pe))We(ve,U,u.strict);let vt=[],fn=null,js=Pt.some((pe)=>/\bserver\b/.test(pe[1]||"")&&/\bcache\b/.test(pe[1]||"")),Jt=null,Rt=null,dn=null,Un=0,gn=null;if(Rp(u),js&&Vr>0){let pe=Tp({props:n,slot:Re,slotContext:r.trim()?Ap(de):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:je});if(pe!==null){Jt=`${U}\x00${E(ce)}\x00${pe}`;let ve=As.get(Jt);if(ve){for(let Me of ve.dependencies)v.add(Me);if(Ji(a,ve.clientFactories),ft.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let Me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let $e of ve.preservedClientExpressions)Me.add($e);a.__stx_preserved_client_expressions=[...Me]}return ve.output}Rt=new Set(v),dn=qi(a),Un=ft.n,gn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let mn=new Set;for(let pe of Pt){let ve=pe[1]||"",Me=pe[2]||"",$e=ve.includes("server");if(Xe(ve)&&Me.trim())Me=Je(Me);if($e&&Me){for(let Qe of ye(Me))mn.add(Qe);try{await L(Me,Ae,U,{onFailure:(Qe)=>{if(Qe.kind!=="unknown")fn=Qe.kind}})}catch(Qe){}}if(!$e){let Qe=Me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ot=Qe.includes("{{")&&Qe.includes("}}"),Yt=Qe.includes("{!!")&&Qe.includes("!!}");if(Ot||Yt)Qe=Ui(Qe,Ae,U);let Dt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");vt.push(`<script${Dt}>${Qe}</script>`)}}let St=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),hn=St?St[1]:"",Ps=St?St[2]:"",Tt="",ue=hn&&/\bscoped\b/i.test(hn);if(St)Tt=`<style${hn}>${Mp(Ps,Ae,U)}</style>`;let fe=dt;if(fe=fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),St)fe=fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let pe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(fe=fe.replace(pe,(Me,$e)=>{let lt=$e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)ve.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),fe=fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)Tt=`${Tt}${ve.join(`
1187
+ `)}`}if(r&&fe.includes("{{ text || slot }}"))fe=fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:Se}=await o("stx/slots",()=>import("./chunk-jyd9trff.js")),{defaultSlot:Be,namedSlots:tt}=rt,at=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Fe),Et=vt.length>0&&fr(fe)||u._nativeHostAttrs===!0&&vt.length>0||at&&vt.length>0||vt.some((pe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(pe)),Ms=(pe)=>Et?Vo(pe,je):pe,Ds=new Map([...tt].map(([pe,ve])=>[pe,{...ve,content:Ms(ve.content)}]));fe=await Se(fe,Et?Fo(Ms(Be),je):Be,Ds,Ae,Et?je:"");let Hn=Hi(vt),xn=(Array.isArray(Ae.__stx_client_signal_names)?Ae.__stx_client_signal_names:[]).filter((pe)=>!mn.has(pe));if(Hn.length>0||xn.length>0)Ae.__stx_client_signal_names=[...new Set([...xn,...Hn])];else delete Ae.__stx_client_signal_names;let bn=S.filter((pe)=>!mn.has(pe)&&!(pe in n));if(bn.length>0)Ae[ms]=bn;let Kn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Et||vt.length===0,defaultLayout:void 0};Ae.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:qn}=await o("stx/process",()=>import("./chunk-x57p5bay.js")),At=await qn(fe,Ae,U,Kn,v),Mt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let pe of At.matchAll(/\{\{([\s\S]*?)\}\}/g))Mt.add(pe[1].trim());if(Mt.size>0)a.__stx_preserved_client_expressions=[...Mt];let It=je,ct=At;if(Et){let pe="";if(Object.keys(n).length>0)try{pe=` data-stx-props="${Cr(JSON.stringify(n))}"`}catch{}let ve=Z?` stx-hydrate="${Cr(Z)}"`:"",Me=Object.fromEntries(Object.entries(wt).map(([Lt,Qt])=>[Lt,Boolean(Qt)])),$e=Object.keys(Me).length>0?` data-stx-slots="${Cr(JSON.stringify(Me))}"`:"",lt=` data-stx-scope="${It}"${pe}${$e}${ve}`,Qe=At.slice(Ut(At)),Ot=/^<span(?=[\s/>])/i.test(Qe),Yt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),Dt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Qe),Zn=Ot?"span":"div",Ns=Yt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Dt&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ot||Yt?' style="display:contents"':"";ct=Ug(At,lt)??`<${Zn}${lt} data-stx-component-wrapper${Ns}>${At}</${Zn}>`;let Ls=await Promise.all(vt.map(async(Lt)=>{let Qt=Lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Qt)return Lt;let[,yn,zs]=Qt,Jn=Ta(Lt,Ae,U);if(Jn!==null)return Jn;let en=await Lp(zs,U,u.buildMode==="compile"),Xn=An(en.clientCode,Ke(Ae)),{vendorStyleTags:Gn}=en,Yn=Xn?`function(__scopeId) {
1188
1188
  ${Xn}
1189
1189
  return (${en.factoryBody})(__scopeId);
1190
1190
  }`:en.factoryBody,Qn=Z?null:ir(a,Yn),es=Qn?`window.__stxComponentFactories[${JSON.stringify(Qn)}](${JSON.stringify(It)});`:`(${Yn})(${JSON.stringify(It)});`;if(Z)return`${Gn}<script type="stx/island" data-stx-island="${It}" data-stx-scoped data-stx-owner="${It}"${yn}>${me(es)}</script>`;return`${Gn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${It}"${yn}>${me(es)}</script>`}));if(ct=ct+`
@@ -1210,7 +1210,7 @@ ${He.yellow}${He.bold}Message:${He.reset} ${n}
1210
1210
  `,f)I+=`
1211
1211
  ${He.blue}${He.bold}Context:${He.reset}
1212
1212
  ${He.dim}${f}${He.reset}
1213
- `;return I}function Ce(){Wn.clear(),Tr.clear(),Ts.clear(),Ar.clear(),Pr.clear(),Wr.clear(),As.clear()}function $y(){return{size:Wn.size,maxSize:500}}var Rr=k(128);async function Lp(e,n,r){let i=E(e,n,r),a=Rr.get(i);if(a){if(Qs(a.deps))return a;Rr.delete(i)}let l=Fi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=zi(l.styles);u=Xt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-yrjm6zyh.js")),I=[],j=!1;if(v(u)){let G=u;u=await S(G,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),j=u===G}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-p06tqhp9.js"));u=L(u);let M=D(u),V=Op(M),W=new Set(X(M,!0).split(",").map((G)=>G.trim())),Z=`function(__scopeId) {
1213
+ `;return I}function Ce(){Wn.clear(),Tr.clear(),Ts.clear(),Ar.clear(),Pr.clear(),Wr.clear(),As.clear()}function $y(){return{size:Wn.size,maxSize:500}}var Rr=k(128);async function Lp(e,n,r){let i=E(e,n,r),a=Rr.get(i);if(a){if(Qs(a.deps))return a;Rr.delete(i)}let l=Fi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=zi(l.styles);u=Xt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-fnpq78k3.js")),I=[],j=!1;if(v(u)){let G=u;u=await S(G,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),j=u===G}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-exb4wc0c.js"));u=L(u);let M=D(u),V=Op(M),W=new Set(X(M,!0).split(",").map((G)=>G.trim())),Z=`function(__scopeId) {
1214
1214
  ${xt("const",[...Bl,...V],M)}
1215
1215
  const __scope = window.stx._scopes = window.stx._scopes || {};
1216
1216
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1319,4 +1319,4 @@ ${e[S]}`,S++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:u,value:
1319
1319
  ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
1320
1320
  ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Xp(e,n,r){let i=r,a=n+1;while(a<e.length){let l=tc(i);if(l!==-1){if(_(i,"{","}",l)!==-1)break}let u=e[a];i+=`
1321
1321
  ${u}`,a++}return{functionCode:i,nextIndex:a}}function Ga(e,n){let r=d(e,n)??d(`(${e})`,n);if(r!==void 0)return r;if(!/\bprocess\b/.test(e))return;let i={...n,process:Object.freeze({env:{...un.env}})},a=Object.keys(i).filter(zr),l=a.map((u)=>i[u]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Gp(e,n,r){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,u,f]=l;try{let v=f.trim().replace(/;$/,""),S=Ga(v,n);if(S!==void 0)n[u]=S}catch(v){console.warn(`Failed to parse export ${u} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,u,f]=l;if(!(u in n))try{let v=f.trim().replace(/;$/,""),S=Ga(v,n);if(S!==void 0)n[u]=S}catch{}}}function bl(e){let n=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),r=n?n[1]:"",i=n?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:r,templateWithoutScript:i}}function wl(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
1322
- export{Ve,Pe,X,Gs,Xs,J,Ir,Js,Ys,Ti,$i,Ri,Zs,Ai,tl,Ut,o,me,k,nl,E,Or,Qs,Ie,A,We,B,Vt,Oe,Q,Cn,qe,x,rl,ke,se,Nr,ee,Mr,Dr,he,Wt,oe,F,mt,O,Lr,jr,ht,sl,qt,eo,to,_e,Pi,En,no,ye,ol,il,Ii,al,Oi,cl,ro,Ni,Mi,ll,Di,Li,Tn,so,$n,Kt,Gt,ul,oo,dl,pl,Rn,Br,io,ao,fl,ji,gl,ml,hl,yl,Rg,Ag,Pg,Ig,Og,y,Ng,Bi,Mg,bl,wl,Fi,zi,Dg,Xt,vl,Lg,xl,Ty,Ke,An,Ge,jg,Bg,Fg,zg,Hg,co,Ug,Xe,ie,Je,Vg,Fr,Wg,Sl,kl,Hi,Ye,s,Pn,_l,b,Ce,$y,Cl,El,Tl,Ui,lo,qg,Ry,Kg,Ay,In,g,Y,ae,On,Ne,Gg,Vi,Xg,Py,P,Wi,Jg,Iy,N,Oy};
1322
+ export{Ue,Pe,X,Gs,Xs,J,Ir,Js,Ys,Ti,$i,Ri,Zs,Ai,tl,Vt,o,me,k,nl,E,Or,Qs,Ie,A,We,B,Ut,Oe,Q,Cn,qe,x,rl,ke,se,Nr,ee,Mr,Dr,he,Wt,oe,F,mt,O,Lr,jr,ht,sl,qt,eo,to,_e,Pi,En,no,ye,ol,il,Ii,al,Oi,cl,ro,Ni,Mi,ll,Di,Li,Tn,so,$n,Kt,Gt,ul,oo,dl,pl,Rn,Br,io,ao,fl,ji,gl,ml,hl,yl,Rg,Ag,Pg,Ig,Og,y,Ng,Bi,Mg,bl,wl,Fi,zi,Dg,Xt,vl,Lg,xl,Ty,Ke,An,Ge,jg,Bg,Fg,zg,Hg,co,Vg,Xe,ie,Je,Ug,Fr,Wg,Sl,kl,Hi,Ye,s,Pn,_l,b,Ce,$y,Cl,El,Tl,Vi,lo,qg,Ry,Kg,Ay,In,g,Y,ae,On,Ne,Gg,Ui,Xg,Py,P,Wi,Jg,Iy,N,Oy};