@stacksjs/stx 0.2.833 → 0.2.835

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 (174) hide show
  1. package/dist/builtins/image-worker.js +6 -1
  2. package/dist/{chunk-a395a3dt.js → chunk-02s0hzwa.js} +8 -8
  3. package/dist/{chunk-vb4xzz5c.js → chunk-0a36jnq4.js} +1 -1
  4. package/dist/chunk-0nc94zjd.js +2 -0
  5. package/dist/chunk-0rnfywsx.js +2 -0
  6. package/dist/chunk-0ygvav3v.js +3 -0
  7. package/dist/{chunk-qym44qqd.js → chunk-12bwztw2.js} +4 -4
  8. package/dist/{chunk-4xw22xqd.js → chunk-1pg50kva.js} +6 -6
  9. package/dist/chunk-1q3gjt3t.js +2 -0
  10. package/dist/chunk-213skjvq.js +2 -0
  11. package/dist/{chunk-mxvevxb8.js → chunk-29f6vmyz.js} +4 -4
  12. package/dist/{chunk-jp6sbk05.js → chunk-2nxxhcyy.js} +1 -1
  13. package/dist/{chunk-1c62mrad.js → chunk-2xcnynmg.js} +5 -5
  14. package/dist/{chunk-xdwnbr9b.js → chunk-33czswpt.js} +2 -2
  15. package/dist/{chunk-r2fwxtke.js → chunk-35vsv68x.js} +1 -1
  16. package/dist/{chunk-ekh3mxyp.js → chunk-3bjnrmha.js} +2 -2
  17. package/dist/{chunk-1b1crd5a.js → chunk-3fk1cm0n.js} +4 -4
  18. package/dist/{chunk-tchz2m2v.js → chunk-3s70qc9v.js} +1 -1
  19. package/dist/{chunk-04z1xyrb.js → chunk-4ntm3dtk.js} +2 -2
  20. package/dist/{chunk-mypygxdm.js → chunk-52g026sc.js} +2 -2
  21. package/dist/{chunk-716jrdcg.js → chunk-52t0qpx6.js} +1 -1
  22. package/dist/{chunk-w7m9pecb.js → chunk-53gp3w46.js} +5 -5
  23. package/dist/{chunk-4a3r1kh1.js → chunk-55e46spy.js} +2 -2
  24. package/dist/{chunk-kn3pknzt.js → chunk-5n988caw.js} +3 -3
  25. package/dist/{chunk-xdqv5yq4.js → chunk-6eqjf0r6.js} +2 -2
  26. package/dist/{chunk-6kk8p766.js → chunk-6vx101bj.js} +1 -1
  27. package/dist/{chunk-yrw5ensv.js → chunk-7bvvv74e.js} +2 -2
  28. package/dist/chunk-7chq9qj0.js +2 -0
  29. package/dist/chunk-7efkc3gk.js +2 -0
  30. package/dist/chunk-7phzt95j.js +2 -0
  31. package/dist/{chunk-g00nhj1d.js → chunk-7v372ds3.js} +7 -7
  32. package/dist/chunk-7ygadxrq.js +2 -0
  33. package/dist/{chunk-5201w0f1.js → chunk-84nw3921.js} +3 -3
  34. package/dist/{chunk-qws72sn9.js → chunk-88b319bz.js} +32 -32
  35. package/dist/{chunk-g0vz0ch5.js → chunk-8f49t8wb.js} +7 -7
  36. package/dist/chunk-8tm6701m.js +2 -0
  37. package/dist/{chunk-gy59sm92.js → chunk-9cy3fy0k.js} +2 -2
  38. package/dist/chunk-9fk98kja.js +2 -0
  39. package/dist/chunk-9q378vgc.js +2 -0
  40. package/dist/{chunk-c6gr71fg.js → chunk-9q3pqtx8.js} +1 -1
  41. package/dist/chunk-9w3r1ch2.js +3 -0
  42. package/dist/{chunk-38wq4ttd.js → chunk-a1fp1nyf.js} +95 -95
  43. package/dist/chunk-a1hxz8q4.js +2 -0
  44. package/dist/{chunk-wt7qhv5b.js → chunk-a579jdwb.js} +1 -1
  45. package/dist/{chunk-7p8m82pj.js → chunk-amg6kr1p.js} +2 -2
  46. package/dist/chunk-anckn6bc.js +42 -0
  47. package/dist/{chunk-67nq6csk.js → chunk-bc4x45vx.js} +1 -1
  48. package/dist/{chunk-3p7r3ajd.js → chunk-bky02g7k.js} +2 -2
  49. package/dist/chunk-bsm5ds0r.js +2 -0
  50. package/dist/{chunk-hd378dgy.js → chunk-c3dg8qdn.js} +2 -2
  51. package/dist/chunk-c7hw37ww.js +2 -0
  52. package/dist/{chunk-cca18z35.js → chunk-c9vxm8yq.js} +8 -8
  53. package/dist/{chunk-gcf97wgx.js → chunk-dv11h4f0.js} +1 -1
  54. package/dist/{chunk-6b1g5a6a.js → chunk-e3pkgwd8.js} +11 -11
  55. package/dist/chunk-f6vzn90z.js +2 -0
  56. package/dist/chunk-fcy7n409.js +2 -0
  57. package/dist/{chunk-wr7bmkne.js → chunk-fvgk1w9s.js} +2 -2
  58. package/dist/chunk-g40zerct.js +2 -0
  59. package/dist/{chunk-cv1zc9dg.js → chunk-gh62p9mx.js} +2 -2
  60. package/dist/chunk-gtj8wy95.js +2 -0
  61. package/dist/{chunk-3grrmmrg.js → chunk-gy3pegf9.js} +1 -1
  62. package/dist/{chunk-wb6w807m.js → chunk-h4tbpr7p.js} +1 -1
  63. package/dist/{chunk-s67pnfvz.js → chunk-h6w7jr4b.js} +4 -4
  64. package/dist/{chunk-a7j451hn.js → chunk-h8pp1dsq.js} +2 -2
  65. package/dist/chunk-hhh6v5cw.js +2 -0
  66. package/dist/chunk-hzs22cc9.js +2 -0
  67. package/dist/chunk-j0w048sj.js +2 -0
  68. package/dist/chunk-j6146c13.js +2 -0
  69. package/dist/{chunk-t59bc7na.js → chunk-jr0r5pzw.js} +2 -2
  70. package/dist/{chunk-fby81k5g.js → chunk-k23nn7k9.js} +2 -2
  71. package/dist/chunk-k5jmnt0z.js +2 -0
  72. package/dist/chunk-k761q7s7.js +2 -0
  73. package/dist/{chunk-1vzncfka.js → chunk-kw5gra2z.js} +2 -2
  74. package/dist/chunk-mdtysd2d.js +2 -0
  75. package/dist/{chunk-hfktzsat.js → chunk-mejtwsgy.js} +1 -1
  76. package/dist/chunk-mmm5t7jf.js +2 -0
  77. package/dist/chunk-mr97dmgb.js +2 -0
  78. package/dist/{chunk-rkdsgfhd.js → chunk-ms3v5nat.js} +6 -6
  79. package/dist/{chunk-95d5qy7d.js → chunk-mvk7rm5q.js} +2 -2
  80. package/dist/{chunk-f6b7av6b.js → chunk-n4qznmkm.js} +5 -5
  81. package/dist/{chunk-6qbatp72.js → chunk-n82sms5e.js} +5 -5
  82. package/dist/{chunk-a9d14beh.js → chunk-nbz025jk.js} +1 -1
  83. package/dist/{chunk-m9bbhg46.js → chunk-nmtya57z.js} +2 -2
  84. package/dist/{chunk-02zvytqx.js → chunk-nxfyjw59.js} +1 -1
  85. package/dist/{chunk-xn9jg1q5.js → chunk-nyg0nbjj.js} +1 -1
  86. package/dist/{chunk-7nnep25t.js → chunk-pq6x35gz.js} +5 -5
  87. package/dist/chunk-pwv77cyb.js +2 -0
  88. package/dist/{chunk-dzm9g76x.js → chunk-pzavparv.js} +1 -1
  89. package/dist/{chunk-bgqbvf1w.js → chunk-q4h6mhn1.js} +6 -6
  90. package/dist/chunk-rkk2mb0h.js +2 -0
  91. package/dist/{chunk-wvds0s9m.js → chunk-rnm8ejpz.js} +2 -2
  92. package/dist/chunk-rsg4zdt3.js +2 -0
  93. package/dist/{chunk-c84pxd2k.js → chunk-s33andzg.js} +2 -2
  94. package/dist/{chunk-4z0jpzdq.js → chunk-s3j5vxy9.js} +2 -2
  95. package/dist/{chunk-8y8kgw9s.js → chunk-s6r54dyf.js} +2 -2
  96. package/dist/{chunk-vhehb6eh.js → chunk-sstbhctt.js} +1 -1
  97. package/dist/chunk-t612xpa4.js +2 -0
  98. package/dist/{chunk-g4qzy5hv.js → chunk-tesbhpbp.js} +1 -1
  99. package/dist/chunk-tj90sfcs.js +2 -0
  100. package/dist/{chunk-m9dj8pgb.js → chunk-tvw571ab.js} +1 -1
  101. package/dist/{chunk-6k26n0sj.js → chunk-tx8wk6h7.js} +2 -2
  102. package/dist/{chunk-c9mdvpf5.js → chunk-txd2js5v.js} +10 -10
  103. package/dist/{chunk-qnrgfm9v.js → chunk-v3xyb3ws.js} +2 -2
  104. package/dist/chunk-vbwtx73e.js +2 -0
  105. package/dist/{chunk-2qngyyaz.js → chunk-vfj9wp11.js} +2 -2
  106. package/dist/{chunk-nfpsaaqm.js → chunk-vfxkn1pe.js} +3 -3
  107. package/dist/{chunk-cfqz4bd6.js → chunk-vmj0hqzc.js} +1 -1
  108. package/dist/chunk-vqpypnys.js +2 -0
  109. package/dist/{chunk-qy6dtm1a.js → chunk-w0a6yz73.js} +8 -8
  110. package/dist/{chunk-ba499a3p.js → chunk-w5g788r7.js} +1 -1
  111. package/dist/{chunk-3sqay5jm.js → chunk-waz6g84g.js} +3 -3
  112. package/dist/{chunk-yd1j88kp.js → chunk-wpy1ytv9.js} +6 -6
  113. package/dist/{chunk-m6q2vedz.js → chunk-ws9ypnvs.js} +4 -4
  114. package/dist/chunk-wz24zyt1.js +2 -0
  115. package/dist/chunk-x4x1xj40.js +2 -0
  116. package/dist/{chunk-z58dr234.js → chunk-x6ck5s29.js} +1 -1
  117. package/dist/chunk-x7bbbmgd.js +2 -0
  118. package/dist/{chunk-6tjm38e4.js → chunk-xtqapjz3.js} +1 -1
  119. package/dist/{chunk-qadce16v.js → chunk-ya6bp08c.js} +1 -1
  120. package/dist/{chunk-zvvv6x8c.js → chunk-yw1s8kyj.js} +3 -3
  121. package/dist/{chunk-rmygv0n0.js → chunk-z0ynyz62.js} +4 -4
  122. package/dist/{chunk-y34ayg61.js → chunk-zr4e0jrh.js} +42 -40
  123. package/dist/cli.js +13 -13
  124. package/dist/client/signals-class-runtime.js +1 -1
  125. package/dist/client/signals-native-row-runtime.js +3 -3
  126. package/dist/craft-entry.js +2 -2
  127. package/dist/craft.js +2 -2
  128. package/dist/document-styles.d.ts +7 -0
  129. package/dist/document-styles.js +40 -0
  130. package/dist/html-masking.js +6 -3
  131. package/dist/process.js +3 -0
  132. package/dist/pwa.js +3 -3
  133. package/dist/ssg.js +4 -4
  134. package/package.json +1 -1
  135. package/dist/chunk-09fbj9b4.js +0 -2
  136. package/dist/chunk-17h13201.js +0 -2
  137. package/dist/chunk-17zrprh0.js +0 -2
  138. package/dist/chunk-28z6pq6w.js +0 -42
  139. package/dist/chunk-293fnyc2.js +0 -2
  140. package/dist/chunk-42c92rp3.js +0 -2
  141. package/dist/chunk-437wgphe.js +0 -2
  142. package/dist/chunk-46yyc2sf.js +0 -2
  143. package/dist/chunk-503ppv77.js +0 -2
  144. package/dist/chunk-5e7abvtz.js +0 -2
  145. package/dist/chunk-6r4teng3.js +0 -2
  146. package/dist/chunk-7b105hww.js +0 -2
  147. package/dist/chunk-83hwrh5n.js +0 -2
  148. package/dist/chunk-8n8vj099.js +0 -2
  149. package/dist/chunk-9jvpyq5h.js +0 -2
  150. package/dist/chunk-abh791bh.js +0 -2
  151. package/dist/chunk-aqjcqnex.js +0 -2
  152. package/dist/chunk-awd0dvjb.js +0 -2
  153. package/dist/chunk-b39g02k9.js +0 -2
  154. package/dist/chunk-e7yejx6x.js +0 -2
  155. package/dist/chunk-f8g0sgs0.js +0 -2
  156. package/dist/chunk-fb90n0by.js +0 -2
  157. package/dist/chunk-ggnzezrn.js +0 -2
  158. package/dist/chunk-jny0vbmt.js +0 -2
  159. package/dist/chunk-k6ye0159.js +0 -3
  160. package/dist/chunk-kgn911k7.js +0 -2
  161. package/dist/chunk-kr6x19z0.js +0 -2
  162. package/dist/chunk-kshem79d.js +0 -2
  163. package/dist/chunk-ns23fv15.js +0 -3
  164. package/dist/chunk-pc4xah5j.js +0 -2
  165. package/dist/chunk-q2tbbtqn.js +0 -2
  166. package/dist/chunk-qg2tpvdw.js +0 -2
  167. package/dist/chunk-shzkz2az.js +0 -2
  168. package/dist/chunk-v1mwhvf8.js +0 -2
  169. package/dist/chunk-vce1js6z.js +0 -2
  170. package/dist/chunk-vhmzkhy4.js +0 -2
  171. package/dist/chunk-wpyhavjy.js +0 -2
  172. package/dist/chunk-zt74q4c8.js +0 -2
  173. package/dist/chunk-zty254tw.js +0 -2
  174. package/dist/chunk-zy41xhc4.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{xe,Us,bg,Qh,wg,ey,Dt,p,W,Q,vn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry}from"./chunk-38wq4ttd.js";import"./chunk-xdqv5yq4.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{Sg as applyFilters,ey as clearCustomFilters,vg as clientLoopScopes,Us as defaultFilters,vn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,R as evaluateExpression,xe as findMustacheEnd,wg as getAllFilters,xg as interpolateScriptAttributes,xi as interpolateScriptExpressions,ty as interpolateScriptsInTemplate,_ as processExpressions,bg as registerFilter,Qh as registerFilters,Dt as replaceInterpolations,ny as resetRejectedExpressionWarnings,ry as unescapeHtml,ke as usesSignalsInScript};
2
+ import{xe,Ws,bg,Qh,wg,ey,Dt,p,W,Q,xn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry}from"./chunk-a1fp1nyf.js";import"./chunk-6eqjf0r6.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Sg as applyFilters,ey as clearCustomFilters,vg as clientLoopScopes,Ws as defaultFilters,xn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,R as evaluateExpression,xe as findMustacheEnd,wg as getAllFilters,xg as interpolateScriptAttributes,xi as interpolateScriptExpressions,ty as interpolateScriptsInTemplate,_ as processExpressions,bg as registerFilter,Qh as registerFilters,Dt as replaceInterpolations,ny as resetRejectedExpressionWarnings,ry as unescapeHtml,ke as usesSignalsInScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{u,f,sl,d,t,l}from"./chunk-c9mdvpf5.js";import{Qe,xt,un,Xo}from"./chunk-qadce16v.js";function L(w,e){try{let p=w.trim();if(f(p))return d(p,Object.keys(e))(...Object.values(e));else return u(p,e)}catch{return!1}}function Q(w,e,p){let n=w,v=!0;while(v){v=!1;let g=n.match(/@switch\s*\(/);if(!g||g.index===void 0)break;let b=g.index,s=Xo(n,b);if(!s)break;try{let o;if(f(s.expression))o=d(s.expression,Object.keys(e))(...Object.values(e));else o=u(s.expression,e);let r="",a=!1;for(let i of s.cases)if(i.type==="default"){if(!a)r=i.content.trim()}else try{let y;if(i.value&&f(i.value))y=d(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=u(i.value,e);if(o===y){r=i.content.trim(),a=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),a=l("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+a+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(p,n)=>e[Number(n)]??p)}function oe(w,e,p){let{masked:n,scripts:v}=H(w);return J(K(n,e,p),v)}function K(w,e,p){let n=w;n=Q(n,e,p);{let g=!0;while(g){g=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Qe(n,s+7);if(!o)break;let r=o.endPos,a=xt(n,"unless","endunless",r);if(a===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,a),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(a+10),g=!0}}n=Ho(n,e,p),n=Vo(n,e,p),n=zo(n,e);let v=()=>{let g=un(n);if(g.length===0)return!1;let b=Array(g.length);for(let r=g.length-1;r>=0;r--){let a=g[r];try{let i="",y=!1;for(let m of a.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?sl(m.condition,e):!1)i=m.content,y=!0}catch(c){i=l(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=l("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(g.length*2+1),o=0;for(let r=0;r<g.length;r++){let a=g[r];s[r*2]=n.slice(o,a.start),s[r*2+1]=b[r],o=a.end}return s[g.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let g=n;if(!v())break;if(n===g)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let p=w[e];if(p!=="'"&&p!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===p){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function zo(w,e){let p=w;function n(s,o,r,a){let i=1,y=a,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,y=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let a=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,h)=>k.pos-h.pos);for(let k of c)if(k.type==="open")a++;else if(k.type==="close")a--;else if(k.type==="else"&&a===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=p.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+5),m=q(y);if(m)a=m.value,i=r+5+m.consumed;else i=r+5;let c=n(p,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=a?L(`auth?.check && auth?.user?.[${a}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=p.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+6),m=q(y);if(m)a=m.value,i=r+6+m.consumed;else i=r+6;let c=n(p,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=a?L(`!auth?.check || !auth?.user?.[${a}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+9),s=!0}}function g(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let a=[s];if(o)a.push(o);if(r){let i=L(r,e);a.push(i)}return e.permissions.check(...a)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",a=!0;while(a){a=!1;let i=p.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=p.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(p,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let h=p.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=g(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=g(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}p=p.substring(0,y)+V+p.substring(k+`@${o}`.length),a=!0}}return p}function Ho(w,e,p){let n=w;function v(g,b,s,o,r){let a=!0;while(a){a=!1;let i=new RegExp(`@${b}\\s*\\(`),y=g.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Qe(g,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=xt(g,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";g=g.substring(0,m)+T+g.substring(k+`@${s}`.length),a=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=l(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);g=g.substring(0,m)+_+g.substring(k+`@${s}`.length);break}}return g}return n=v(n,"isset","endisset",(g)=>{let b=L(g,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(g)=>{let b=L(g,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function Vo(w,e,p){let n=w,v="development";function g(b,s,o,r){let a=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,a.lastIndex=0;let k=a.exec(c);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){a.lastIndex=C,i.lastIndex=C;let O=a.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,h)+I+c.substring(P+F),x=!0}return c}return n=g(n,"env","endenv",!1),n=g(n,"production","endproduction",v==="production"),n=g(n,"development","enddevelopment",v==="development"),n=g(n,"staging","endstaging",v==="staging"),n=g(n,"testing","endtesting",v==="testing"),n}
3
- export{oe,zo,Ho,Vo};
2
+ import{u,f,sl,d,t,l}from"./chunk-txd2js5v.js";import{Qe,xt,un,Go}from"./chunk-ya6bp08c.js";function L(w,e){try{let p=w.trim();if(f(p))return d(p,Object.keys(e))(...Object.values(e));else return u(p,e)}catch{return!1}}function Q(w,e,p){let n=w,v=!0;while(v){v=!1;let g=n.match(/@switch\s*\(/);if(!g||g.index===void 0)break;let b=g.index,s=Go(n,b);if(!s)break;try{let o;if(f(s.expression))o=d(s.expression,Object.keys(e))(...Object.values(e));else o=u(s.expression,e);let r="",a=!1;for(let i of s.cases)if(i.type==="default"){if(!a)r=i.content.trim()}else try{let y;if(i.value&&f(i.value))y=d(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=u(i.value,e);if(o===y){r=i.content.trim(),a=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),a=l("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+a+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(p,n)=>e[Number(n)]??p)}function oe(w,e,p){let{masked:n,scripts:v}=H(w);return J(K(n,e,p),v)}function K(w,e,p){let n=w;n=Q(n,e,p);{let g=!0;while(g){g=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Qe(n,s+7);if(!o)break;let r=o.endPos,a=xt(n,"unless","endunless",r);if(a===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,a),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(a+10),g=!0}}n=Vo(n,e,p),n=Uo(n,e,p),n=Ho(n,e);let v=()=>{let g=un(n);if(g.length===0)return!1;let b=Array(g.length);for(let r=g.length-1;r>=0;r--){let a=g[r];try{let i="",y=!1;for(let m of a.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?sl(m.condition,e):!1)i=m.content,y=!0}catch(c){i=l(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=l("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(g.length*2+1),o=0;for(let r=0;r<g.length;r++){let a=g[r];s[r*2]=n.slice(o,a.start),s[r*2+1]=b[r],o=a.end}return s[g.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let g=n;if(!v())break;if(n===g)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let p=w[e];if(p!=="'"&&p!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===p){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Ho(w,e){let p=w;function n(s,o,r,a){let i=1,y=a,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,y=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let a=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,h)=>k.pos-h.pos);for(let k of c)if(k.type==="open")a++;else if(k.type==="close")a--;else if(k.type==="else"&&a===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=p.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+5),m=q(y);if(m)a=m.value,i=r+5+m.consumed;else i=r+5;let c=n(p,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=a?L(`auth?.check && auth?.user?.[${a}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=p.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+6),m=q(y);if(m)a=m.value,i=r+6+m.consumed;else i=r+6;let c=n(p,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=p.slice(i,c),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=a?L(`!auth?.check || !auth?.user?.[${a}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(c+9),s=!0}}function g(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let a=[s];if(o)a.push(o);if(r){let i=L(r,e);a.push(i)}return e.permissions.check(...a)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",a=!0;while(a){a=!1;let i=p.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=p.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(p,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let h=p.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=g(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=g(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}p=p.substring(0,y)+V+p.substring(k+`@${o}`.length),a=!0}}return p}function Vo(w,e,p){let n=w;function v(g,b,s,o,r){let a=!0;while(a){a=!1;let i=new RegExp(`@${b}\\s*\\(`),y=g.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Qe(g,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=xt(g,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";g=g.substring(0,m)+T+g.substring(k+`@${s}`.length),a=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=l(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);g=g.substring(0,m)+_+g.substring(k+`@${s}`.length);break}}return g}return n=v(n,"isset","endisset",(g)=>{let b=L(g,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(g)=>{let b=L(g,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function Uo(w,e,p){let n=w,v="development";function g(b,s,o,r){let a=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,a.lastIndex=0;let k=a.exec(c);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){a.lastIndex=C,i.lastIndex=C;let O=a.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,h)+I+c.substring(P+F),x=!0}return c}return n=g(n,"env","endenv",!1),n=g(n,"production","endproduction",v==="production"),n=g(n,"development","enddevelopment",v==="development"),n=g(n,"staging","endstaging",v==="staging"),n=g(n,"testing","endtesting",v==="testing"),n}
3
+ export{oe,Ho,Vo,Uo};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{tr,Re}from"./chunk-6k26n0sj.js";import{V,w,br,Ds,C}from"./chunk-38wq4ttd.js";import{a,O}from"./chunk-a395a3dt.js";import{Oo}from"./chunk-w7m9pecb.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-k6ye0159.js";import{r,me}from"./chunk-fwktw49p.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Oo(t,e,n)}var at=2;function Sf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function kf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=kf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function _f(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(_f())console.log("[stx:bundler]",...t)}var K=[];function nc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function tn(){return K.slice()}function nn(){K.length=0}var Q;function Eh(t){Q=t}function rc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function rn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var er="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Cf(t,e){return p.relative(t,e).split(p.sep).join("/")}function Ef(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(er)?`${i}${l}${o}${l}`:n})}function Tf(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(er.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(er.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function ss(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function sn(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(X(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${er}${Cf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${er}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function $f(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function on(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Sf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=br(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=$f(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function sc(t){return`${t}-${process.pid}-${yt()}`}async function Th(t,e){let{projectRoot:n}=e,i=sc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=sc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
3
- export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=tr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),nc(e||"",F,z),n.throwOnFailure||rc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Tf(Ef(m,et),L);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(V(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
2
+ import{nr,Re}from"./chunk-tx8wk6h7.js";import{V,w,wr,Ls,C}from"./chunk-a1fp1nyf.js";import{a,O}from"./chunk-02s0hzwa.js";import{No}from"./chunk-53gp3w46.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-9w3r1ch2.js";import{r,me}from"./chunk-fwktw49p.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||No(t,e,n)}var at=2;function Sf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function kf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=kf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function _f(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(_f())console.log("[stx:bundler]",...t)}var K=[];function nc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function tn(){return K.slice()}function nn(){K.length=0}var Q;function Eh(t){Q=t}function rc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function rn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var tr="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Cf(t,e){return p.relative(t,e).split(p.sep).join("/")}function Ef(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(tr)?`${i}${l}${o}${l}`:n})}function Tf(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(tr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(tr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function os(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function sn(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(X(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${tr}${Cf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${tr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function $f(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function on(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Sf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(Ls(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=wr(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=$f(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function sc(t){return`${t}-${process.pid}-${yt()}`}async function Th(t,e){let{projectRoot:n}=e,i=sc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=sc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
3
+ export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=nr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),nc(e||"",F,z),n.throwOnFailure||rc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Tf(Ef(m,et),L);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(V(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
4
4
  `),ht=_.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
5
5
  `);if(m=`${dt.join(`
6
6
  `)}
@@ -16,5 +16,5 @@ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiv
16
16
  Object.keys(${J}).forEach(function(name) {
17
17
  if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
18
18
  Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${J}, name));
19
- });`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${p.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;B.mkdirSync(d,{recursive:!0}),await Bun.write(b,m);let W=br(tt);return await Bun.write(I,JSON.stringify({metadataVersion:at,files:W.map((x)=>bt(x.path,i)).filter((x)=>x!==null)})),Z(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),P.set(b,{code:m,files:W}),await jt(d),m}catch(R){let m=tr(R,e||void 0),_=Re(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),nc(e||"",_,m),n.throwOnFailure||rc()==="error")throw R;return t}finally{try{B.rmSync(y,{recursive:!0,force:!0})}catch{}}}function _t(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
- export{Sf,kf,ye,_f,nc,tn,nn,Eh,rc,rn,er,Cf,Ef,Tf,ss,sn,$f,on,sc,Th};
19
+ });`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${p.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;B.mkdirSync(d,{recursive:!0}),await Bun.write(b,m);let W=wr(tt);return await Bun.write(I,JSON.stringify({metadataVersion:at,files:W.map((x)=>bt(x.path,i)).filter((x)=>x!==null)})),Z(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),P.set(b,{code:m,files:W}),await jt(d),m}catch(R){let m=nr(R,e||void 0),_=Re(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),nc(e||"",_,m),n.throwOnFailure||rc()==="error")throw R;return t}finally{try{B.rmSync(y,{recursive:!0,force:!0})}catch{}}}function _t(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
+ export{Sf,kf,ye,_f,nc,tn,nn,Eh,rc,rn,tr,Cf,Ef,Tf,os,sn,$f,on,sc,Th};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{q,Me}from"./chunk-38wq4ttd.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function en(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{q,Me}from"./chunk-a1fp1nyf.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function en(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{en};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Or(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Or(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],pl=["onMount","onDestroy"];function ct(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=k.filter((e)=>!y.includes(e));function Pi(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function fl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Pi(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Or(r[1],t))return!0;return!1}function gl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function ml(e){return R.includes(e.toLowerCase())}var Zs=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],hl=[...Zs,..._];function yl(){return`{${Zs.map((e)=>`'${e}':1`).join(",")}}`}var Ii=["class","style","text","html","show","model","if","ref"];function bl(){return`{${Ii.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function wl(){return`/^(${p.join("|")})(?:\\.|$)/`}function vl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{Or,k,pl,ct,Pi,fl,gl,ml,Zs,hl,yl,Ii,bl,wl,vl};
2
+ import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Nr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Nr(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],pl=["onMount","onDestroy"];function ct(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=k.filter((e)=>!y.includes(e));function Pi(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function fl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Pi(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Nr(r[1],t))return!0;return!1}function gl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function ml(e){return R.includes(e.toLowerCase())}var Qs=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],hl=[...Qs,..._];function yl(){return`{${Qs.map((e)=>`'${e}':1`).join(",")}}`}var Ii=["class","style","text","html","show","model","if","ref"];function bl(){return`{${Ii.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function wl(){return`/^(${p.join("|")})(?:\\.|$)/`}function vl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{Nr,k,pl,ct,Pi,fl,gl,ml,Qs,hl,yl,Ii,bl,wl,vl};
@@ -298,5 +298,5 @@ catch (error) {
298
298
  init();
299
299
  }
300
300
  })();
301
- </script>`}var Ag={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Pg={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Ig={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Og={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},to=[Ag,Pg,Ig,Og];function my(t){return[...t,...to]}
302
- export{Ag,Pg,Ig,Og,to,my};
301
+ </script>`}var Ag={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Pg={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Ig={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Og={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},no=[Ag,Pg,Ig,Og];function my(t){return[...t,...no]}
302
+ export{Ag,Pg,Ig,Og,no,my};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ut,dt,pt}from"./chunk-ema1c29k.js";import{Ut,Wt,lt,Ki,qt,Kt}from"./chunk-qnrgfm9v.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();Ut();let t=await ut({mode:"build"});if(!t.config.enabled){lt("Story feature is disabled in config.");return}let n=await qt(t);dt(t,n);let l=Kt(t.config,n);pt(t,l),Wt(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Ki(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
2
+ import{ut,dt,pt}from"./chunk-ema1c29k.js";import{Ut,Wt,lt,Ki,qt,Kt}from"./chunk-v3xyb3ws.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();Ut();let t=await ut({mode:"build"});if(!t.config.enabled){lt("Story feature is disabled in config.");return}let n=await qt(t);dt(t,n);let l=Kt(t.config,n);pt(t,l),Wt(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Ki(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{de}from"./chunk-mxvevxb8.js";import{He,M}from"./chunk-2qngyyaz.js";import{Sc}from"./chunk-7p8m82pj.js";import{c}from"./chunk-k6ye0159.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function an(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Ao(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=de(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
- `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Po(s,l,o={}){let i=an(s,o);await Ao(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...de(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Io(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function $h(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=an(s,o);return await Ao(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=an(s,o);await Ao(s,t);let{loadStxConfig:e}=await import("./chunk-7b105hww.js"),a=M((await e(s)).runtimeConfig);return await He(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
- `));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Oo(s,l,o){if(Sc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
6
- export{an,Ao,Po,Io,$h,Oo};
2
+ import{de}from"./chunk-29f6vmyz.js";import{He,M}from"./chunk-vfj9wp11.js";import{Sc}from"./chunk-amg6kr1p.js";import{c}from"./chunk-9w3r1ch2.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function an(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Po(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=de(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
+ `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Io(s,l,o={}){let i=an(s,o);await Po(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
+ `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...de(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Oo(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function $h(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=an(s,o);return await Po(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=an(s,o);await Po(s,t);let{loadStxConfig:e}=await import("./chunk-tj90sfcs.js"),a=M((await e(s)).runtimeConfig);return await He(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
+ `));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function No(s,l,o){if(Sc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
6
+ export{an,Po,Io,Oo,$h,No};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ee,te,ne,Mn,he,$e,mt,Gt,Dn,Ln,jn,re,Bn,Fn}from"./chunk-m9bbhg46.js";import{St}from"./chunk-b1q40vq4.js";function Pl(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ne,placeholder:l="none",formats:f=te,widths:y=ee,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Ln(r),v=Dn(r),w=typeof m==="object"?Gt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=mt(z),Y=re(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
2
+ import{ee,te,ne,Dn,he,$e,mt,Gt,Ln,jn,Bn,re,Fn,zn}from"./chunk-nmtya57z.js";import{St}from"./chunk-b1q40vq4.js";function Pl(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ne,placeholder:l="none",formats:f=te,widths:y=ee,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=jn(r),v=Ln(r),w=typeof m==="object"?Gt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=mt(z),Y=re(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
3
3
  #${k} {
4
4
  position: relative;
5
5
  background-image: url('${e.placeholder}');
@@ -39,5 +39,5 @@ ${d}
39
39
  </div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
40
40
  ${d}
41
41
  </div>`}}if(e.priority&&y){let g=re(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
- `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Nl=oa();import P from"fs";import j from"path";function Ml(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=te,widths:a=ee,quality:i=ne,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await he()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Mn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await he())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await $e(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Bn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Fn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&jn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Dl(s,r,e={}){if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return $e(s,{...e,outputDir:r})}async function Ll(s,r,e={}){let{formats:t=te,widths:n=ee,quality:a=ne,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await $e(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function ia(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function jl(s,r){let e=ia(s);await Bun.write(r,JSON.stringify(e,null,2))}var em={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
42
+ `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Nl=oa();import P from"fs";import j from"path";function Ml(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=te,widths:a=ee,quality:i=ne,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await he()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Dn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await he())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await $e(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Fn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${zn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Bn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Dl(s,r,e={}){if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return $e(s,{...e,outputDir:r})}async function Ll(s,r,e={}){let{formats:t=te,widths:n=ee,quality:a=ne,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await $e(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function ia(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function jl(s,r){let e=ia(s);await Bun.write(r,JSON.stringify(e,null,2))}var em={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
43
  export{Pl,sa,Il,Ol,oa,Nl,Ml,Dl,Ll,ia,jl,em};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{A,_i,Ks,u,f,P,ot,d,Xs,t,l,x}from"./chunk-c9mdvpf5.js";import{xe,Pt,Y,N,Dt,Q,_}from"./chunk-38wq4ttd.js";import{ir}from"./chunk-g0vz0ch5.js";import{oe}from"./chunk-ekh3mxyp.js";import{bs}from"./chunk-qadce16v.js";var he=1000,me=!1;function be(n,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(n))!==null){let a=s.index+s[0].length,y=s.index+s[0].indexOf("("),b=x(n,"(",")",y);if(b===-1)continue;let p=n.slice(a,b).trim();if(!p)continue;if(!Object.keys(r).some((g)=>new RegExp(`(?:^|[^\\w$.])${g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let g=P(p,r);if(!g||typeof g!=="object")continue;m=JSON.stringify(g)}catch{continue}e+=n.slice(o,a)+m,o=b,i.lastIndex=b}return o===0?n:e+n.slice(o)}function ye(n,r){let i=/@component\s*\(/g,e=n,o,s=[];while((o=i.exec(e))!==null){let a=o.index,y=a+o[0].length-1,b=1,p=y+1;while(p<e.length&&b>0){if(e[p]==="(")b++;else if(e[p]===")"){if(b--,b===0)break}p++}if(b!==0)continue;let c=e.substring(y+1,p),m=p+1,g=c.match(/^\s*['"]([^'"]+)['"]/);if(!g)continue;let E=g[1],h=c.slice(g[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let I=h.slice(O[0].length).trim();if(!I)continue;try{let v=P(I,r),B=JSON.stringify(v),S=`@component('${E}', ${B})`;s.push({start:a,end:m,replacement:S})}catch{continue}}for(let a=s.length-1;a>=0;a--){let{start:y,end:b,replacement:p}=s[a];e=e.substring(0,y)+p+e.substring(b)}return e}function ce(n,r,i){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let a=s.index,y=a+s[0].length-1,b=1,p=y+1,c=null,m=!1;while(p<e.length&&b>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&c){m=!0,p++;continue}if(c){if(h===c)c=null;p++;continue}if(h==='"'||h==="'"||h==="`"){c=h,p++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}p++}if(b!==0)break;let g=e.substring(y+1,p),E=i(g);e=e.substring(0,a)+E+e.substring(p+1)}return e}function Ee(n,r){let i=n;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(N(s,r.__stx_client_signal_names||[]))return e;let a=Object.keys(r),y=Object.values(r);_i(s);let b=!1,c=d(s,a,()=>{b=!0})(...y);if(b)return e;let m=JSON.stringify(c);if(m===void 0){if(!ot(s).some((h)=>!(h in r)))return"";return e}let g=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${g}"`}catch(a){return e}}),i}var ne="<!--__STX_BREAK__-->",te="<!--__STX_CONTINUE__-->";function ue(n,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(n);s;s=i.exec(n)){if(!s[1]){let p=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?n.indexOf("!!}",i.lastIndex):xe(n,s.index,p);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:p);continue}let a=i.lastIndex,y=!0,b=/^\s*\(/.exec(n.slice(a));if(b){let p=a+b[0].length-1,c=x(n,"(",")",p);if(c<0)break;a=c+1;try{let m=`!!(${n.slice(p+1,c).trim()})`;y=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{y=!1}}if(e+=n.slice(o,s.index),y)return e+(s[1]==="break"?ne:te);o=a,i.lastIndex=a}return e+n.slice(o)}function fe(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Dt(n,(o,s,a)=>(i+=le(r(n.slice(e,a))),i+=`\${__stxRenderLoopValue(${a}, (${s}), ${o.length})}`,e=a+o.length,o)),i+le(r(n.slice(e)))}function ge(n,r,i,e){return Q(n,r,i==null?"":String(i),!1,e)}function le(n){let r=n;return r=ce(r,"@break",(i)=>{let e=i.trim();if(!Xs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=ce(r,"@continue",(i)=>{let e=i.trim();if(!Xs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function _e(n){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,a;while((a=o.exec(n))!==null)e.push({pos:a.index,delta:1});while((a=s.exec(n))!==null)e.push({pos:a.index,delta:-1});e.sort((c,m)=>c.pos-m.pos);let y=[],b=0;for(let c of e)b+=c.delta,y.push({pos:c.pos,depth:b});function p(c){let m=0,g=y.length-1,E=0;while(m<=g){let h=m+g>>1;if(y[h].pos<=c)E=y[h].depth,m=h+1;else g=h-1}return E}while((i=r.exec(n))!==null){if(p(i.index)>0)continue;let c=i.index,m=i.index+i[0].length-1,g=1,E=m+1,h=-1;while(E<n.length&&g>0){if(n[E]==="(")g++;else if(n[E]===")"){if(g--,g===0){h=E;break}}E++}if(h===-1)continue;let O=n.substring(m+1,h),I=Pt(O);if(!I)continue;let{arrayExpr:v,itemVar:B}=I,S=h+1,w=1,T=S,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(w>0&&T<n.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(n),R=L.exec(n);if(!R)break;if(C&&C.index<R.index)w++,T=C.index+C[0].length;else{if(w--,w===0){V=R.index;break}T=R.index+11}}if(V===-1)continue;let k=n.substring(S,V),Z=V+11,z=-1,D=0,M=0;while(M<k.length){let C=k.indexOf("@",M);if(C===-1)break;let R=k.substring(C);if(/^@forelse\s*\(/.test(R))D++,M=C+1;else if(R.startsWith("@endforelse"))D--,M=C+11;else if(D===0&&R.startsWith("@empty")){if(k.length<=C+6||!/[a-z]/i.test(k[C+6])){z=C;break}M=C+1}else M=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:v,itemVar:B,foreachContent:k.substring(0,z),emptyContent:k.substring(z+6)}}return null}function ae(n,r){let i=n;while(!0){let e=_e(i);if(!e)break;let{start:o,end:s,arrayExpr:a,itemVar:y,foreachContent:b,emptyContent:p}=e;try{let c;if(f(a))c=d(a,Object.keys(r))(...Object.values(r));else c=u(a,r);let m;if(!Array.isArray(c)||c.length===0)m=p;else m=`@foreach (${a} as ${y})${b}@endforeach`;i=i.substring(0,o)+m+i.substring(s)}catch(c){let m=c instanceof Error?c.message:String(c),g=l("Forelse",`Error in @forelse(${a} as ${y}): ${m}`,t.EVALUATION_ERROR);i=i.substring(0,o)+g+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",$e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Re(n,r){return`${de}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function Ae(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ds(n){if(!n.includes(de))return n;return n.replace($e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function Df(n,r,i,e,o=!1){let s=re(n,r,i,e,o),a=s.next();while(!a.done)a=s.next();return a.value}async function Fo(n,r,i,e,o=!1){let s=re(n,r,i,e,o),a=s.next();while(!a.done)await A(),a=s.next();return a.value}function*re(n,r,i,e,o=!1){let s=n,a=new Set(r.__stx_client_signal_names||[]);for(let c of ir(n))a.add(c);if(a.size)r={...r,__stx_client_signal_names:[...a]};s=ae(s,r);function y(c){let m=/@foreach\s*\(/g,g;while((g=m.exec(c))!==null){let E=g.index,h=g.index+g[0].length-1,O=1,I=h+1,v=-1;while(I<c.length&&O>0){if(c[I]==="(")O++;else if(c[I]===")"){if(O--,O===0){v=I;break}}I++}if(v===-1)continue;let B=c.substring(h+1,v),S=Pt(B);if(!S)continue;let w=E,{arrayExpr:T,itemVar:K}=S,L=v+1,V=1,k=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&k<c.length){Z.lastIndex=k,z.lastIndex=k;let D=Z.exec(c),M=z.exec(c);if(!M)break;if(D&&D.index<M.index)V++,k=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,M.index),R=M.index+11;return{start:w,end:R,arrayExpr:T,itemVar:K,content:C}}k=M.index+11}}}return null}function*b(c,m){let g=c;while(!0){let E=y(g);if(!E)break;let{start:h,end:O,arrayExpr:I,itemVar:v,content:B}=E;try{let S=I.trim(),w;if(f(S))w=d(S,Object.keys(m))(...Object.values(m));else w=u(S,m);let T=!1;if(!Array.isArray(w))if(w instanceof Map)w=Array.from(w),T=!0;else if(w instanceof Set)w=Array.from(w);else if(typeof w==="string")w=Array.from(w);else if(w&&typeof w==="object"&&!(w instanceof Date)&&!(w instanceof RegExp))w=Object.entries(w),T=!0;else{let R=Re(S,i)+l("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);g=g.substring(0,h)+R+g.substring(O);continue}let K=e?.loops?.useAltLoopVariable??me,L=v.trim(),V=null,k,Z=!1;if(L.includes("=>")){let R=L.split("=>").map((W)=>W.trim());if(R.length===2&&R[0]&&R[1])V=R[0],k=R[1];else k=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let R=L.split(",").map((W)=>W.trim());if(R.length===2&&R[0]&&R[1])k=R[0],V=R[1],Z=!0;else k=L}else k=L;let z="",D=new Set(Y(`${I} as ${v}`)),M=w,C=m[Ks]??new WeakMap;for(let R=0;R<M.length;R++){if(R%16===0)yield;let W=M[R],se={index:R,iteration:R+1,first:R===0,last:R===M.length-1,count:M.length},j={...m,loop:se,$loop:se,[Ks]:C};if(Array.isArray(m.__stx_client_signal_names))j.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!D.has(H));if(k.startsWith("[")&&k.endsWith("]")){let H=k.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[k]=W}else if(k.startsWith("{")&&k.endsWith("}")){let H=k.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),ee=(X===-1?U:U.slice(0,X)).trim(),ie=X===-1?ee:U.slice(X+1).trim();if(ee&&ie)j[ie]=W[ee]});else j[k]=W}else j[k]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[k]=W[1];else j[V]=R;let F=ae(B,j);F=yield*re(F,j,i,e,!0),F=oe(F,j,i),F=ue(F,j);let J=F.indexOf(ne),G=F.indexOf(te),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)F=F.slice(0,q);if(F=_(F,j,i),F=Ee(F,j),F=ye(F,j),F=be(F,j),z+=F,q>=0&&q===J)break}g=g.substring(0,h)+z+g.substring(O)}catch(S){let w=l("Foreach",`Error in @foreach(${I.trim()} as ${v.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);g=g.substring(0,h)+w+g.substring(O)}}return g}s=yield*b(s,r),s=we(s,r,i,e);let p=e?.loops?.maxWhileIterations??he;return s=Ie(s,r,p),o?s:ds(s)}function Lf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function pe(n){return Xs(n)}function we(n,r,i,e){let o=n,s=!0;while(s){s=!1;let a=o.match(/@for\s*\(/);if(!a||a.index===void 0)break;let y=a.index,b=y+a[0].length-1,p=x(o,"(",")",b);if(p===-1)break;let c=Lf(o.slice(b+1,p)),m=p+1,g=bs(o.slice(y),"for","endfor");if(g.length===0)break;let E=g[0].content,h=y+g[0].end;if(!pe(c)){let O=l("For",`Unsafe expression in @for: ${c}`,t.UNSAFE_EXPRESSION);o=o.substring(0,y)+O+o.substring(h),s=!0;continue}try{let O=Oe(c),I=/@(?:for|foreach|if|unless)\s*\(/.test(E);if(O.length>0&&I){let K=ke({forExpr:c,content:E,iterVarNames:O,context:r,filePath:i,options:e});o=o.substring(0,y)+K+o.substring(h),s=!0;continue}let v=Object.keys(r),B=Object.values(r),S=fe(E),T=Function(...v,"__stxRenderLoopValue",`
2
+ import{A,_i,Xs,u,f,P,ot,d,Gs,t,l,x}from"./chunk-txd2js5v.js";import{xe,Pt,Y,N,Dt,Q,_}from"./chunk-a1fp1nyf.js";import{ar}from"./chunk-8f49t8wb.js";import{oe}from"./chunk-3bjnrmha.js";import{ws}from"./chunk-ya6bp08c.js";var he=1000,me=!1;function be(n,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(n))!==null){let a=s.index+s[0].length,y=s.index+s[0].indexOf("("),b=x(n,"(",")",y);if(b===-1)continue;let p=n.slice(a,b).trim();if(!p)continue;if(!Object.keys(r).some((g)=>new RegExp(`(?:^|[^\\w$.])${g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let g=P(p,r);if(!g||typeof g!=="object")continue;m=JSON.stringify(g)}catch{continue}e+=n.slice(o,a)+m,o=b,i.lastIndex=b}return o===0?n:e+n.slice(o)}function ye(n,r){let i=/@component\s*\(/g,e=n,o,s=[];while((o=i.exec(e))!==null){let a=o.index,y=a+o[0].length-1,b=1,p=y+1;while(p<e.length&&b>0){if(e[p]==="(")b++;else if(e[p]===")"){if(b--,b===0)break}p++}if(b!==0)continue;let c=e.substring(y+1,p),m=p+1,g=c.match(/^\s*['"]([^'"]+)['"]/);if(!g)continue;let E=g[1],h=c.slice(g[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let I=h.slice(O[0].length).trim();if(!I)continue;try{let v=P(I,r),B=JSON.stringify(v),S=`@component('${E}', ${B})`;s.push({start:a,end:m,replacement:S})}catch{continue}}for(let a=s.length-1;a>=0;a--){let{start:y,end:b,replacement:p}=s[a];e=e.substring(0,y)+p+e.substring(b)}return e}function ce(n,r,i){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let a=s.index,y=a+s[0].length-1,b=1,p=y+1,c=null,m=!1;while(p<e.length&&b>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&c){m=!0,p++;continue}if(c){if(h===c)c=null;p++;continue}if(h==='"'||h==="'"||h==="`"){c=h,p++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}p++}if(b!==0)break;let g=e.substring(y+1,p),E=i(g);e=e.substring(0,a)+E+e.substring(p+1)}return e}function Ee(n,r){let i=n;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(N(s,r.__stx_client_signal_names||[]))return e;let a=Object.keys(r),y=Object.values(r);_i(s);let b=!1,c=d(s,a,()=>{b=!0})(...y);if(b)return e;let m=JSON.stringify(c);if(m===void 0){if(!ot(s).some((h)=>!(h in r)))return"";return e}let g=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${g}"`}catch(a){return e}}),i}var ne="<!--__STX_BREAK__-->",te="<!--__STX_CONTINUE__-->";function ue(n,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(n);s;s=i.exec(n)){if(!s[1]){let p=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?n.indexOf("!!}",i.lastIndex):xe(n,s.index,p);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:p);continue}let a=i.lastIndex,y=!0,b=/^\s*\(/.exec(n.slice(a));if(b){let p=a+b[0].length-1,c=x(n,"(",")",p);if(c<0)break;a=c+1;try{let m=`!!(${n.slice(p+1,c).trim()})`;y=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{y=!1}}if(e+=n.slice(o,s.index),y)return e+(s[1]==="break"?ne:te);o=a,i.lastIndex=a}return e+n.slice(o)}function fe(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Dt(n,(o,s,a)=>(i+=le(r(n.slice(e,a))),i+=`\${__stxRenderLoopValue(${a}, (${s}), ${o.length})}`,e=a+o.length,o)),i+le(r(n.slice(e)))}function ge(n,r,i,e){return Q(n,r,i==null?"":String(i),!1,e)}function le(n){let r=n;return r=ce(r,"@break",(i)=>{let e=i.trim();if(!Gs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=ce(r,"@continue",(i)=>{let e=i.trim();if(!Gs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function _e(n){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,a;while((a=o.exec(n))!==null)e.push({pos:a.index,delta:1});while((a=s.exec(n))!==null)e.push({pos:a.index,delta:-1});e.sort((c,m)=>c.pos-m.pos);let y=[],b=0;for(let c of e)b+=c.delta,y.push({pos:c.pos,depth:b});function p(c){let m=0,g=y.length-1,E=0;while(m<=g){let h=m+g>>1;if(y[h].pos<=c)E=y[h].depth,m=h+1;else g=h-1}return E}while((i=r.exec(n))!==null){if(p(i.index)>0)continue;let c=i.index,m=i.index+i[0].length-1,g=1,E=m+1,h=-1;while(E<n.length&&g>0){if(n[E]==="(")g++;else if(n[E]===")"){if(g--,g===0){h=E;break}}E++}if(h===-1)continue;let O=n.substring(m+1,h),I=Pt(O);if(!I)continue;let{arrayExpr:v,itemVar:B}=I,S=h+1,w=1,T=S,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(w>0&&T<n.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(n),R=L.exec(n);if(!R)break;if(C&&C.index<R.index)w++,T=C.index+C[0].length;else{if(w--,w===0){V=R.index;break}T=R.index+11}}if(V===-1)continue;let k=n.substring(S,V),Z=V+11,z=-1,D=0,M=0;while(M<k.length){let C=k.indexOf("@",M);if(C===-1)break;let R=k.substring(C);if(/^@forelse\s*\(/.test(R))D++,M=C+1;else if(R.startsWith("@endforelse"))D--,M=C+11;else if(D===0&&R.startsWith("@empty")){if(k.length<=C+6||!/[a-z]/i.test(k[C+6])){z=C;break}M=C+1}else M=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:v,itemVar:B,foreachContent:k.substring(0,z),emptyContent:k.substring(z+6)}}return null}function ae(n,r){let i=n;while(!0){let e=_e(i);if(!e)break;let{start:o,end:s,arrayExpr:a,itemVar:y,foreachContent:b,emptyContent:p}=e;try{let c;if(f(a))c=d(a,Object.keys(r))(...Object.values(r));else c=u(a,r);let m;if(!Array.isArray(c)||c.length===0)m=p;else m=`@foreach (${a} as ${y})${b}@endforeach`;i=i.substring(0,o)+m+i.substring(s)}catch(c){let m=c instanceof Error?c.message:String(c),g=l("Forelse",`Error in @forelse(${a} as ${y}): ${m}`,t.EVALUATION_ERROR);i=i.substring(0,o)+g+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",$e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Re(n,r){return`${de}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function Ae(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ps(n){if(!n.includes(de))return n;return n.replace($e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function Df(n,r,i,e,o=!1){let s=re(n,r,i,e,o),a=s.next();while(!a.done)a=s.next();return a.value}async function zo(n,r,i,e,o=!1){let s=re(n,r,i,e,o),a=s.next();while(!a.done)await A(),a=s.next();return a.value}function*re(n,r,i,e,o=!1){let s=n,a=new Set(r.__stx_client_signal_names||[]);for(let c of ar(n))a.add(c);if(a.size)r={...r,__stx_client_signal_names:[...a]};s=ae(s,r);function y(c){let m=/@foreach\s*\(/g,g;while((g=m.exec(c))!==null){let E=g.index,h=g.index+g[0].length-1,O=1,I=h+1,v=-1;while(I<c.length&&O>0){if(c[I]==="(")O++;else if(c[I]===")"){if(O--,O===0){v=I;break}}I++}if(v===-1)continue;let B=c.substring(h+1,v),S=Pt(B);if(!S)continue;let w=E,{arrayExpr:T,itemVar:K}=S,L=v+1,V=1,k=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&k<c.length){Z.lastIndex=k,z.lastIndex=k;let D=Z.exec(c),M=z.exec(c);if(!M)break;if(D&&D.index<M.index)V++,k=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,M.index),R=M.index+11;return{start:w,end:R,arrayExpr:T,itemVar:K,content:C}}k=M.index+11}}}return null}function*b(c,m){let g=c;while(!0){let E=y(g);if(!E)break;let{start:h,end:O,arrayExpr:I,itemVar:v,content:B}=E;try{let S=I.trim(),w;if(f(S))w=d(S,Object.keys(m))(...Object.values(m));else w=u(S,m);let T=!1;if(!Array.isArray(w))if(w instanceof Map)w=Array.from(w),T=!0;else if(w instanceof Set)w=Array.from(w);else if(typeof w==="string")w=Array.from(w);else if(w&&typeof w==="object"&&!(w instanceof Date)&&!(w instanceof RegExp))w=Object.entries(w),T=!0;else{let R=Re(S,i)+l("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);g=g.substring(0,h)+R+g.substring(O);continue}let K=e?.loops?.useAltLoopVariable??me,L=v.trim(),V=null,k,Z=!1;if(L.includes("=>")){let R=L.split("=>").map((W)=>W.trim());if(R.length===2&&R[0]&&R[1])V=R[0],k=R[1];else k=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let R=L.split(",").map((W)=>W.trim());if(R.length===2&&R[0]&&R[1])k=R[0],V=R[1],Z=!0;else k=L}else k=L;let z="",D=new Set(Y(`${I} as ${v}`)),M=w,C=m[Xs]??new WeakMap;for(let R=0;R<M.length;R++){if(R%16===0)yield;let W=M[R],se={index:R,iteration:R+1,first:R===0,last:R===M.length-1,count:M.length},j={...m,loop:se,$loop:se,[Xs]:C};if(Array.isArray(m.__stx_client_signal_names))j.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!D.has(H));if(k.startsWith("[")&&k.endsWith("]")){let H=k.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[k]=W}else if(k.startsWith("{")&&k.endsWith("}")){let H=k.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),ee=(X===-1?U:U.slice(0,X)).trim(),ie=X===-1?ee:U.slice(X+1).trim();if(ee&&ie)j[ie]=W[ee]});else j[k]=W}else j[k]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[k]=W[1];else j[V]=R;let F=ae(B,j);F=yield*re(F,j,i,e,!0),F=oe(F,j,i),F=ue(F,j);let J=F.indexOf(ne),G=F.indexOf(te),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)F=F.slice(0,q);if(F=_(F,j,i),F=Ee(F,j),F=ye(F,j),F=be(F,j),z+=F,q>=0&&q===J)break}g=g.substring(0,h)+z+g.substring(O)}catch(S){let w=l("Foreach",`Error in @foreach(${I.trim()} as ${v.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);g=g.substring(0,h)+w+g.substring(O)}}return g}s=yield*b(s,r),s=we(s,r,i,e);let p=e?.loops?.maxWhileIterations??he;return s=Ie(s,r,p),o?s:ps(s)}function Lf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function pe(n){return Gs(n)}function we(n,r,i,e){let o=n,s=!0;while(s){s=!1;let a=o.match(/@for\s*\(/);if(!a||a.index===void 0)break;let y=a.index,b=y+a[0].length-1,p=x(o,"(",")",b);if(p===-1)break;let c=Lf(o.slice(b+1,p)),m=p+1,g=ws(o.slice(y),"for","endfor");if(g.length===0)break;let E=g[0].content,h=y+g[0].end;if(!pe(c)){let O=l("For",`Unsafe expression in @for: ${c}`,t.UNSAFE_EXPRESSION);o=o.substring(0,y)+O+o.substring(h),s=!0;continue}try{let O=Oe(c),I=/@(?:for|foreach|if|unless)\s*\(/.test(E);if(O.length>0&&I){let K=ke({forExpr:c,content:E,iterVarNames:O,context:r,filePath:i,options:e});o=o.substring(0,y)+K+o.substring(h),s=!0;continue}let v=Object.keys(r),B=Object.values(r),S=fe(E),T=Function(...v,"__stxRenderLoopValue",`
3
3
  let result = '';
4
4
  for (${c}) {
5
5
  result += \`${S}\`;
@@ -9,7 +9,7 @@ import{A,_i,Ks,u,f,P,ot,d,Xs,t,l,x}from"./chunk-c9mdvpf5.js";import{xe,Pt,Y,N,Dt
9
9
  for (${r}) {
10
10
  if (!__renderIteration([${e.join(", ")}])) break;
11
11
  }
12
- `)(...b,(g)=>{let E={...o};e.forEach((B,S)=>{E[B]=g[S]});let h=Df(i,E,p,a,!0);h=oe(h,E,p),h=ue(h,E);let O=h.indexOf(ne),I=h.indexOf(te),v=O<0?I:I<0?O:Math.min(O,I);if(v>=0)h=h.slice(0,v);return c+=_(h,E,p),v<0||v!==O}),c}function Ie(n,r,i){let e=n,o=!0;while(o){o=!1;let s=e.match(/@while\s*\(/);if(!s||s.index===void 0)break;let a=s.index,y=a+s[0].length-1,b=x(e,"(",")",y);if(b===-1)break;let p=e.slice(y+1,b),c=bs(e.slice(a),"while","endwhile");if(c.length===0)break;let m=c[0].content,g=a+c[0].end;if(!pe(p)){let E=l("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,a)+E+e.substring(g),o=!0;continue}try{let E=Object.keys(r),h=Object.values(r),O=fe(m),v=Function(...E,"__stxRenderLoopValue",`
12
+ `)(...b,(g)=>{let E={...o};e.forEach((B,S)=>{E[B]=g[S]});let h=Df(i,E,p,a,!0);h=oe(h,E,p),h=ue(h,E);let O=h.indexOf(ne),I=h.indexOf(te),v=O<0?I:I<0?O:Math.min(O,I);if(v>=0)h=h.slice(0,v);return c+=_(h,E,p),v<0||v!==O}),c}function Ie(n,r,i){let e=n,o=!0;while(o){o=!1;let s=e.match(/@while\s*\(/);if(!s||s.index===void 0)break;let a=s.index,y=a+s[0].length-1,b=x(e,"(",")",y);if(b===-1)break;let p=e.slice(y+1,b),c=ws(e.slice(a),"while","endwhile");if(c.length===0)break;let m=c[0].content,g=a+c[0].end;if(!pe(p)){let E=l("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,a)+E+e.substring(g),o=!0;continue}try{let E=Object.keys(r),h=Object.values(r),O=fe(m),v=Function(...E,"__stxRenderLoopValue",`
13
13
  let result = '';
14
14
  let maxIterations = ${i}; // Configurable safety limit
15
15
  let counter = 0;
@@ -22,4 +22,4 @@ import{A,_i,Ks,u,f,P,ot,d,Xs,t,l,x}from"./chunk-c9mdvpf5.js";import{xe,Pt,Y,N,Dt
22
22
  }
23
23
  return result;
24
24
  `)(...h,(B,S,w)=>ge(m,B,S,w));e=e.substring(0,a)+v+e.substring(g),o=!0}catch(E){let h=l("While",`Error in @while(${p}): ${E instanceof Error?E.message:String(E)}`,t.EVALUATION_ERROR);e=e.substring(0,a)+h+e.substring(g),o=!0}}return e}
25
- export{ds,Df,Fo,Lf};
25
+ export{ps,Df,zo,Lf};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Sn,M}from"./chunk-2qngyyaz.js";import m from"fs";import e from"path";async function xn(r,o,i){if(r.__stx_runtime_config)return;let n=Sn();if(n||i){r.__stx_runtime_config=n??M(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-7b105hww.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=M(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Si(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{kn,M}from"./chunk-vfj9wp11.js";import m from"fs";import e from"path";async function Sn(r,o,i){if(r.__stx_runtime_config)return;let n=kn();if(n||i){r.__stx_runtime_config=n??M(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-tj90sfcs.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=M(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Si(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
6
6
  `)}
7
- export{xn,Si};
7
+ export{Sn,Si};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_}from"./chunk-38wq4ttd.js";import{i}from"./chunk-y34ayg61.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{_}from"./chunk-a1fp1nyf.js";import{i}from"./chunk-zr4e0jrh.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function We(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function $n(e){if(e.entries.length===0)return"[]";return`[
2
+ import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function We(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function Rn(e){if(e.entries.length===0)return"[]";return`[
3
3
  ${e.entries.map((t)=>` { url: '${t.url}', revision: '${t.revision}' }`).join(`,
4
4
  `)}
5
5
  ]`}function Ni(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
6
- export{We,$n,Ni};
6
+ export{We,Rn,Ni};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Mf,ds}from"./chunk-anckn6bc.js";import"./chunk-0ygvav3v.js";import"./chunk-3bjnrmha.js";import"./chunk-ya6bp08c.js";import{_r}from"./chunk-a1fp1nyf.js";import"./chunk-6eqjf0r6.js";import"./chunk-vfj9wp11.js";import{ot}from"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{ot as freeIdentifiers,ds as processComponents,Mf as processESImports,_r as rendersAsElement};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{He,kn,qs,ki,M,Lt}from"./chunk-vfj9wp11.js";export{kn as currentRuntimeConfig,Lt as injectRuntimeConfig,M as resolveRuntimeConfig,ki as useRuntimeConfig,qs as useServerRuntimeConfig,He as withRuntimeConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{jr,oo,Hg,Tl,io}from"./chunk-2xcnynmg.js";export{Hg as buildModuleRegistryScript,io as buildSharedModuleRegistries,Tl as exportsMutableBinding,jr as registeredModuleIdsIn,oo as registeredModuleNamesIn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{T,u,f,P,d,K}from"./chunk-c9mdvpf5.js";import{V,Ps,Ne,pe,kr,Be,Fe,s,h,ke,_}from"./chunk-38wq4ttd.js";import{ct}from"./chunk-04z1xyrb.js";import{I}from"./chunk-8y8kgw9s.js";import{oe}from"./chunk-ekh3mxyp.js";import{B,Ze}from"./chunk-ybq56wam.js";import{E,Cn}from"./chunk-t59bc7na.js";import A from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(i);while(n){let g=n.index,e=g+n[0].length-1,D=1,U=e+1;while(U<i.length&&D>0){if(i[U]==="(")D++;else if(i[U]===")")D--;U++}if(D!==0)break;let rt=i.substring(e+1,U-1),j=`${c}(${rt})`;i=i.substring(0,g)+j+i.substring(U),S.lastIndex=g+j.length,n=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,n=0,g=t.length,e=(j)=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]===j){n++;return}n++}},D=()=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`"){n++;return}if(t[n]==="$"&&t[n+1]==="{"){n+=2;let j=1;while(n<g&&j>0)if(t[n]==="{")j++,n++;else if(t[n]==="}")j--,n++;else if(t[n]==="'"||t[n]==='"')e(t[n]);else if(t[n]==="`")D();else n++;continue}n++}},U=()=>{if(t[n]==="/"&&t[n+1]==="/"){while(n<g&&t[n]!==`
2
+ import{T,u,f,P,d,K}from"./chunk-txd2js5v.js";import{V,Is,Ne,pe,_r,Be,Fe,s,h,ke,_}from"./chunk-a1fp1nyf.js";import{ct}from"./chunk-4ntm3dtk.js";import{I}from"./chunk-s6r54dyf.js";import{oe}from"./chunk-3bjnrmha.js";import{B,Ze}from"./chunk-ybq56wam.js";import{E,En}from"./chunk-jr0r5pzw.js";import A from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(i);while(n){let g=n.index,e=g+n[0].length-1,D=1,U=e+1;while(U<i.length&&D>0){if(i[U]==="(")D++;else if(i[U]===")")D--;U++}if(D!==0)break;let rt=i.substring(e+1,U-1),j=`${c}(${rt})`;i=i.substring(0,g)+j+i.substring(U),S.lastIndex=g+j.length,n=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,n=0,g=t.length,e=(j)=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]===j){n++;return}n++}},D=()=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`"){n++;return}if(t[n]==="$"&&t[n+1]==="{"){n+=2;let j=1;while(n<g&&j>0)if(t[n]==="{")j++,n++;else if(t[n]==="}")j--,n++;else if(t[n]==="'"||t[n]==='"')e(t[n]);else if(t[n]==="`")D();else n++;continue}n++}},U=()=>{if(t[n]==="/"&&t[n+1]==="/"){while(n<g&&t[n]!==`
3
3
  `)n++;return!0}if(t[n]==="/"&&t[n+1]==="*"){n+=2;while(n<g-1&&!(t[n]==="*"&&t[n+1]==="/"))n++;return n+=2,!0}return!1},rt=()=>{if(S!==0)return;let j=t.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let Z=j[2];if(!i.has(Z))c.push(Z),i.add(Z);return}let et=t.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let Z=et[1];if(!i.has(Z))c.push(Z),i.add(Z);return}let Y=t.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!i.has(Z))c.push(Z),i.add(Z)}};while(n<g){if(U())continue;if(t[n]==="'"||t[n]==='"'){e(t[n]);continue}if(t[n]==="`"){D();continue}if(t[n]==="{"){S++,n++;continue}if(t[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(t[n])&&(n===0||/\s|[;{}()]/.test(t[n-1])))rt();n++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${ct("var",c)}
@@ -9,7 +9,7 @@ import{T,u,f,P,d,K}from"./chunk-c9mdvpf5.js";import{V,Ps,Ne,pe,kr,Be,Fe,s,h,ke,_
9
9
 
10
10
  ${a}
11
11
  ${t}})();
12
- `}function vt(a,t){let i=mt(a).split(",").map((g)=>g.trim()).filter(Boolean),S=new Set(V(a,!0).split(",").map((g)=>g.trim())),n=i.map((g)=>S.has(g)?` try { ${g}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(g)}, ${Ps(g)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(g)}] = ${g}; } catch (e) { /* not actually top-level */ }`).join(`
12
+ `}function vt(a,t){let i=mt(a).split(",").map((g)=>g.trim()).filter(Boolean),S=new Set(V(a,!0).split(",").map((g)=>g.trim())),n=i.map((g)=>S.has(g)?` try { ${g}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(g)}, ${Is(g)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(g)}] = ${g}; } catch (e) { /* not actually top-level */ }`).join(`
13
13
  `);return`
14
14
  // Register scope variables for STX runtime
15
15
  if (!window.stx._scopes) window.stx._scopes = {};
@@ -44,11 +44,11 @@ ${n}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return c+a+i}function It(a,t){if(B(a)){let S=B(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ze(a,(n,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),n=i.match(/data-stx-scope="([^"]*)"/);if(n)return{html:a,mergedIntoExisting:n[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=A.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Ih(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(c))!==null){let e=g[1]==="/",D=g[2],U=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!U)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ye=new T(500),cc=new Set;function Oh(){cc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return cc}async function is(a,t,c,i,S,n=new Set){let g=i.partialsDir||A.join(A.dirname(c),"partials");if(g&&!A.isAbsolute(g))g=A.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),r=`${c}:${p}`;if(D.has(r))return"";return D.add(r),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")")r--;w++}if(r!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],W=U(O,g,c),R="";if(W&&await Bun.file(W).exists())S.add(W),R=`@include(${l})`;e=e.substring(0,x)+R+e.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let r=p.index,w=r+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),W=at(O,0);if(W===-1){x.lastIndex=o;continue}let R=O.substring(0,W).trim(),H=O.substring(W+1).trim(),z=H.match(/^\s*['"]([^'"]+)['"]/);if(!z){x.lastIndex=o;continue}let b=z[1],J=H.substring(z[0].length),N,M=at(J,0);if(M!==-1)N=J.substring(M+1).trim();try{let C=`Boolean(${R})`,L;if(f(C)){let it=d(C,Object.keys(t));L=Boolean(it(...Object.values(t)))}else L=Boolean(u(C,t));let tt=k?!L:L,nt="";if(tt){let it=U(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${N?`, ${N}`:""})`}e=e.substring(0,r)+nt+e.substring(o),x.lastIndex=0}catch(C){let L=C instanceof Error?C.message:String(C),tt=h("Include",`Error evaluating ${m} condition: ${L}`,c,a,r);e=e.substring(0,r)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,W,R,H,z]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let N="";if(Array.isArray(b)&&b.length>0)for(let M of b){let C={...t,[H]:M},L=await et(W,C,a,x);N+=L}else if(z)N=await et(z,{},a,x);e=e.substring(0,x)+N+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let W=O[1],R=l.slice(O[0].length),H,z=R.match(/^\s*,\s*\{/);if(z){R=R.slice(z[0].length-1);let N=1,M=1;while(M<R.length&&N>0){if(R[M]==="{")N++;else if(R[M]==="}"){if(N--,N===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let N=JSON.parse(W.replace(/'/g,'"')),M={};if(H)try{M=P(H,t)}catch(L){let tt=L instanceof Error?L.message:String(L);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let C=!1;for(let L of N){let tt=U(L,g,c);if(!tt)continue;if(await s(tt)){let nt=await et(L,M,a,x);e=e.replace(o,()=>nt),C=!0;break}}if(!C)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let L=h("Include",`None of the includeFirst paths exist: ${W}`,c,a,x,o);e=e.replace(o,()=>L)}else e=e.replace(o,"")}catch(N){let M=N instanceof Error?N.message:String(N),C=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>C)}m.lastIndex=0}}function U(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let r=A.resolve(k),w=A.resolve(A.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let z of i._layerPartialDirs??[]){let b=A.resolve(z,p);if(b.startsWith(`${A.resolve(z)}${A.sep}`)&&St(b))return b}l=A.resolve(k,p)}else l=A.resolve(w,p);let o=A.normalize(l),O=o.startsWith(r+A.sep)||o===r,W=o.startsWith(w+A.sep)||o===w,R=!1,H=A.dirname(w);if(o.startsWith(H+A.sep)){if(!A.relative(H,o).split(A.sep).some((N)=>N.startsWith(".")&&N!=="."&&N!==".."))R=!0}if(!O&&!W&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${r}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=A.resolve(c);n.add(rt);function j(m,k,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:k,partialsDir:g}),h("Include",k,c,x,p)}async function et(m,k={},x,p){let r=U(m,g,c);if(!r)return j(m,`Could not resolve path for include: ${m}`,x,p);let w=A.resolve(r);if(n.has(w)){let l=[...n,w].map((o)=>A.basename(o)).join(" -> ");return j(m,`Circular include detected: ${l}`,x,p)}try{S.add(r);let l;if(!l)try{l=await Bun.file(r).text()}catch(v){let q=v instanceof Error?v.message:String(v);return j(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-vce1js6z.js");l=v(l,t)}if(l&&(i.debug||!E()&&!Cn()))try{let{warnUnbalancedTags:v}=await import("./chunk-kgn911k7.js");v(l,r)}catch{}try{let{processESImports:v}=await import("./chunk-5e7abvtz.js");l=await v(l,t,r,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${r}:`,v instanceof Error?v.message:v)}let o=l,O=pe(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(R)H=`<style${R[1]}>${R[2]}</style>`;let z=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,q,y)=>{if(!ft(q))return"";return z.push({attrs:q,body:y}),`__STX_DATA_BLOCK_${z.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=ke(l,r);for(let[v,q]of Object.entries(k))b[v]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,N=[...l.matchAll(J)].sort((v,q)=>{let y=(v[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(y)}),M="",C=null,L=!1,tt=!1;for(let v of N){let q=v[1]||"",y=v[2]||"";if(ft(q))continue;let X=q.includes("server"),wt=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(y,r,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-r2fwxtke.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-a9d14beh.js"),st=F(y,{filePath:r,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${r}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Fe(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-a9d14beh.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-503ppv77.js");if(st(y))y=await bt(y,r,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${r}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-9jvpyq5h.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-a9d14beh.js"),st=Q(y,F(b));if(st)y=`${st}
47
+ })();`;return c+a+i}function It(a,t){if(B(a)){let S=B(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ze(a,(n,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),n=i.match(/data-stx-scope="([^"]*)"/);if(n)return{html:a,mergedIntoExisting:n[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=A.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Ih(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(c))!==null){let e=g[1]==="/",D=g[2],U=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!U)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ye=new T(500),cc=new Set;function Oh(){cc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return cc}async function as(a,t,c,i,S,n=new Set){let g=i.partialsDir||A.join(A.dirname(c),"partials");if(g&&!A.isAbsolute(g))g=A.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),r=`${c}:${p}`;if(D.has(r))return"";return D.add(r),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")")r--;w++}if(r!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],W=U(O,g,c),R="";if(W&&await Bun.file(W).exists())S.add(W),R=`@include(${l})`;e=e.substring(0,x)+R+e.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let r=p.index,w=r+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),W=at(O,0);if(W===-1){x.lastIndex=o;continue}let R=O.substring(0,W).trim(),H=O.substring(W+1).trim(),z=H.match(/^\s*['"]([^'"]+)['"]/);if(!z){x.lastIndex=o;continue}let b=z[1],J=H.substring(z[0].length),N,M=at(J,0);if(M!==-1)N=J.substring(M+1).trim();try{let C=`Boolean(${R})`,L;if(f(C)){let it=d(C,Object.keys(t));L=Boolean(it(...Object.values(t)))}else L=Boolean(u(C,t));let tt=k?!L:L,nt="";if(tt){let it=U(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${N?`, ${N}`:""})`}e=e.substring(0,r)+nt+e.substring(o),x.lastIndex=0}catch(C){let L=C instanceof Error?C.message:String(C),tt=h("Include",`Error evaluating ${m} condition: ${L}`,c,a,r);e=e.substring(0,r)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,W,R,H,z]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let N="";if(Array.isArray(b)&&b.length>0)for(let M of b){let C={...t,[H]:M},L=await et(W,C,a,x);N+=L}else if(z)N=await et(z,{},a,x);e=e.substring(0,x)+N+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let W=O[1],R=l.slice(O[0].length),H,z=R.match(/^\s*,\s*\{/);if(z){R=R.slice(z[0].length-1);let N=1,M=1;while(M<R.length&&N>0){if(R[M]==="{")N++;else if(R[M]==="}"){if(N--,N===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let N=JSON.parse(W.replace(/'/g,'"')),M={};if(H)try{M=P(H,t)}catch(L){let tt=L instanceof Error?L.message:String(L);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let C=!1;for(let L of N){let tt=U(L,g,c);if(!tt)continue;if(await s(tt)){let nt=await et(L,M,a,x);e=e.replace(o,()=>nt),C=!0;break}}if(!C)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let L=h("Include",`None of the includeFirst paths exist: ${W}`,c,a,x,o);e=e.replace(o,()=>L)}else e=e.replace(o,"")}catch(N){let M=N instanceof Error?N.message:String(N),C=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>C)}m.lastIndex=0}}function U(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let r=A.resolve(k),w=A.resolve(A.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let z of i._layerPartialDirs??[]){let b=A.resolve(z,p);if(b.startsWith(`${A.resolve(z)}${A.sep}`)&&St(b))return b}l=A.resolve(k,p)}else l=A.resolve(w,p);let o=A.normalize(l),O=o.startsWith(r+A.sep)||o===r,W=o.startsWith(w+A.sep)||o===w,R=!1,H=A.dirname(w);if(o.startsWith(H+A.sep)){if(!A.relative(H,o).split(A.sep).some((N)=>N.startsWith(".")&&N!=="."&&N!==".."))R=!0}if(!O&&!W&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${r}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=A.resolve(c);n.add(rt);function j(m,k,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:k,partialsDir:g}),h("Include",k,c,x,p)}async function et(m,k={},x,p){let r=U(m,g,c);if(!r)return j(m,`Could not resolve path for include: ${m}`,x,p);let w=A.resolve(r);if(n.has(w)){let l=[...n,w].map((o)=>A.basename(o)).join(" -> ");return j(m,`Circular include detected: ${l}`,x,p)}try{S.add(r);let l;if(!l)try{l=await Bun.file(r).text()}catch(v){let q=v instanceof Error?v.message:String(v);return j(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-hhh6v5cw.js");l=v(l,t)}if(l&&(i.debug||!E()&&!En()))try{let{warnUnbalancedTags:v}=await import("./chunk-vqpypnys.js");v(l,r)}catch{}try{let{processESImports:v}=await import("./chunk-7chq9qj0.js");l=await v(l,t,r,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${r}:`,v instanceof Error?v.message:v)}let o=l,O=pe(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(R)H=`<style${R[1]}>${R[2]}</style>`;let z=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,q,y)=>{if(!ft(q))return"";return z.push({attrs:q,body:y}),`__STX_DATA_BLOCK_${z.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=ke(l,r);for(let[v,q]of Object.entries(k))b[v]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,N=[...l.matchAll(J)].sort((v,q)=>{let y=(v[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(y)}),M="",C=null,L=!1,tt=!1;for(let v of N){let q=v[1]||"",y=v[2]||"";if(ft(q))continue;let X=q.includes("server"),wt=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(y,r,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-35vsv68x.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-nbz025jk.js"),st=F(y,{filePath:r,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${r}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Fe(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-nbz025jk.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-j6146c13.js");if(st(y))y=await bt(y,r,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${r}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-0nc94zjd.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-nbz025jk.js"),st=Q(y,F(b));if(st)y=`${st}
48
48
  ${y}`}if(dt&&!X){L=!0,C=ut(r,t);let F=I(y),Q=gt(F,C);M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-3grrmmrg.js");await F(y,b,r)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${r}:`,F)}if(!X&&!dt){let F=q.replace(/\bclient\b/i,"").trim();C=ut(r,t);let Q=I(y),st=gt(Q,C);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${F?` ${F}`:""}>${st}</script>
50
- `}}if(z.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-r2fwxtke.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,y)=>{let X=z[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(C){let v=It(o,C);if(o=v.html,v.mergedIntoExisting){let y=C,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),C=X}else if(!v.stamped&&L&&!lt.has(r))lt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(L||tt)&&!pt.has(r)){let y=Nf(o);if(y.length>1)pt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares ${L?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=v.stamped&&v.root!==null&&kr(v.root);M=Rt(M,q?C:null)}if(o.includes("@include")||o.includes("@partial"))o=await is(o,b,r,i,S,n);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-q2tbbtqn.js"),G=nt(o,b,r,void 0,!0);G=oe(G,b,r),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-42c92rp3.js");if(G=ht(G,b,r,i),G=_t(G,b,r),G=xt(G,b,r,i),G=_(G,b,r),H)G+=`
49
+ `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-gy3pegf9.js");await F(y,b,r)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${r}:`,F)}if(!X&&!dt){let F=q.replace(/\bclient\b/i,"").trim();C=ut(r,t);let Q=I(y),st=gt(Q,C);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${F?` ${F}`:""}>${st}</script>
50
+ `}}if(z.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-35vsv68x.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,y)=>{let X=z[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(C){let v=It(o,C);if(o=v.html,v.mergedIntoExisting){let y=C,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),C=X}else if(!v.stamped&&L&&!lt.has(r))lt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(L||tt)&&!pt.has(r)){let y=Nf(o);if(y.length>1)pt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares ${L?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=v.stamped&&v.root!==null&&_r(v.root);M=Rt(M,q?C:null)}if(o.includes("@include")||o.includes("@partial"))o=await as(o,b,r,i,S,n);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-9q378vgc.js"),G=nt(o,b,r,void 0,!0);G=oe(G,b,r),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-j0w048sj.js");if(G=ht(G,b,r,i),G=_t(G,b,r),G=xt(G,b,r,i),G=_(G,b,r),H)G+=`
51
51
  `+H;if(M)G+=`
52
- `+M;return G}catch(l){if(l instanceof K)throw l;let o=l instanceof Error?l.message:String(l);return j(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(e))!==null){let m=Z.index,k=m+Z[0].length-1,x=1,p=k+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let r=e.substring(m,p),w=e.substring(k+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,W=w.substring(l[0].length),R=at(W,0);if(R!==-1)O=W.substring(R+1).trim();let H={};if(O)try{H=P(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(r,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let z=await et(o,H,a,m);e=e.substring(0,m)+z+e.substring(p),Y.lastIndex=0}return e}function as(a,t){let c=a;function i(S,n,g,e){let D=S,U=!0;while(U){U=!1;let rt=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),j=D.match(rt);if(!j||j.index===void 0)break;let et=j.index,Y=j[1],Z=et+j[0].length,m=new RegExp(`@${n}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,r=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(k),W=o?p+o.index:1/0,R=O?p+O.index:1/0;if(W<R)x++,p=W+(o[0].length||1);else if(R<1/0){if(x--,x===0){r=R;break}p=R+g.length+1}else break}if(r===-1)break;let w=D.slice(Z,r);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(r+`@${g}`.length),U=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function cs(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
52
+ `+M;return G}catch(l){if(l instanceof K)throw l;let o=l instanceof Error?l.message:String(l);return j(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(e))!==null){let m=Z.index,k=m+Z[0].length-1,x=1,p=k+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let r=e.substring(m,p),w=e.substring(k+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,W=w.substring(l[0].length),R=at(W,0);if(R!==-1)O=W.substring(R+1).trim();let H={};if(O)try{H=P(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(r,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let z=await et(o,H,a,m);e=e.substring(0,m)+z+e.substring(p),Y.lastIndex=0}return e}function cs(a,t){let c=a;function i(S,n,g,e){let D=S,U=!0;while(U){U=!1;let rt=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),j=D.match(rt);if(!j||j.index===void 0)break;let et=j.index,Y=j[1],Z=et+j[0].length,m=new RegExp(`@${n}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,r=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(k),W=o?p+o.index:1/0,R=O?p+O.index:1/0;if(W<R)x++,p=W+(o[0].length||1);else if(R<1/0){if(x--,x===0){r=R;break}p=R+g.length+1}else break}if(r===-1)break;let w=D.slice(Z,r);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(r+`@${g}`.length),U=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function ls(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
53
53
  `)})}
54
- export{Ih,Nf,Ye,cc,Oh,is,as,cs};
54
+ export{Ih,Nf,Ye,cc,Oh,as,cs,ls};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{an,Po,Io,Oo,$h,No}from"./chunk-53gp3w46.js";import"./chunk-amg6kr1p.js";import"./chunk-29f6vmyz.js";import"./chunk-vfj9wp11.js";export{Io as buildServerApi,$h as createServerApi,an as discoverServerApi,Po as generateApiTypes,No as isServerApiSource,Oo as productionApiDispatcher};