@stacksjs/stx 0.2.216 → 0.2.217
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.
- package/dist/{chunk-2vdxfjxw.js → chunk-10yft4b7.js} +1 -1
- package/dist/{chunk-eva1mgf5.js → chunk-17atrbv2.js} +1 -1
- package/dist/{chunk-znsffkmk.js → chunk-1bvstnz4.js} +1 -1
- package/dist/{chunk-e4h9zd1m.js → chunk-23vxz3hp.js} +1 -1
- package/dist/{chunk-7jq78m57.js → chunk-2z6k7gsa.js} +1 -1
- package/dist/{chunk-yhn2saa7.js → chunk-3fxcwk6a.js} +1 -1
- package/dist/{chunk-xerx4bn9.js → chunk-74gc1x9x.js} +2 -2
- package/dist/{chunk-sgxjx75w.js → chunk-775fabj4.js} +1 -1
- package/dist/{chunk-1hx2z3m0.js → chunk-7md45k52.js} +1 -1
- package/dist/{chunk-hnrtw0rd.js → chunk-808qy9cq.js} +8 -8
- package/dist/{chunk-drzrf2t7.js → chunk-8cyv5316.js} +1 -1
- package/dist/{chunk-5ckn8vbq.js → chunk-9064gyt5.js} +1 -1
- package/dist/{chunk-cf6npetr.js → chunk-9db2f09j.js} +1 -1
- package/dist/{chunk-62gc6qg9.js → chunk-9h908knr.js} +1 -1
- package/dist/{chunk-nrksd914.js → chunk-a1ydhf5t.js} +1 -1
- package/dist/{chunk-amv1v5qf.js → chunk-bd0yv6a0.js} +1 -1
- package/dist/{chunk-sk8ybwpe.js → chunk-crmk2jzf.js} +1 -1
- package/dist/{chunk-zsfpwqrt.js → chunk-css1sfnr.js} +1 -1
- package/dist/{chunk-y8m9n9v6.js → chunk-d48tzd8c.js} +1 -1
- package/dist/{chunk-nvfawtpq.js → chunk-dcy8hg45.js} +1 -1
- package/dist/{chunk-0rpqx6xa.js → chunk-dmb6t0qj.js} +1 -1
- package/dist/{chunk-ejrtygcb.js → chunk-e6377wfq.js} +1 -1
- package/dist/{chunk-hq60td8b.js → chunk-fvpaf9v5.js} +1 -1
- package/dist/{chunk-9whrwhx4.js → chunk-gvm4dw6p.js} +1 -1
- package/dist/{chunk-6ndvtzpk.js → chunk-j3njy10j.js} +18 -7
- package/dist/{chunk-655pb2nj.js → chunk-jmnftb29.js} +1 -1
- package/dist/{chunk-yxefre1s.js → chunk-jnjxf5t2.js} +1 -1
- package/dist/{chunk-yvgjys59.js → chunk-mxqp7x07.js} +1 -1
- package/dist/{chunk-d8hzg54c.js → chunk-n4smz31k.js} +2 -2
- package/dist/{chunk-fc3g2z0p.js → chunk-njkv35c3.js} +1 -1
- package/dist/{chunk-srdwsrnj.js → chunk-pdh79z63.js} +1 -1
- package/dist/{chunk-yb6f8ey1.js → chunk-pezxve4a.js} +1 -1
- package/dist/{chunk-xgxjp647.js → chunk-q3ea7q6t.js} +1 -1
- package/dist/{chunk-t82z0cbv.js → chunk-qd1nadff.js} +1 -1
- package/dist/{chunk-c11nnxkg.js → chunk-qwzfdq8q.js} +1 -1
- package/dist/{chunk-66630av9.js → chunk-tg0w29j1.js} +1 -1
- package/dist/{chunk-em4wy7zv.js → chunk-tqhwzjj7.js} +1 -1
- package/dist/{chunk-1wfvhxjz.js → chunk-weajy31v.js} +1 -1
- package/dist/{chunk-3z8tp7v4.js → chunk-x9bsft57.js} +1 -1
- package/dist/{chunk-hz1jcwdb.js → chunk-xwc4pg5w.js} +1 -1
- package/dist/{chunk-s9pa2var.js → chunk-y05vd24g.js} +1 -1
- package/dist/{chunk-r7qzjt0h.js → chunk-yrqnsd3a.js} +1 -1
- package/dist/{chunk-mm0f84gm.js → chunk-zat2ndst.js} +16 -16
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +18 -7
- package/dist/ssg.js +2 -2
- package/dist/stx.d.ts +11 -1
- package/package.json +5 -5
- package/stx.d.ts +11 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$i as Z,Zi as j,_i as E}from"./chunk-ht51fz7w.js";import{Il as R,Jl as U,Kl as X,Lr as M,uq as L}from"./chunk-
|
|
2
|
+
import{$i as Z,Zi as j,_i as E}from"./chunk-ht51fz7w.js";import{Il as R,Jl as U,Kl as X,Lr as M,uq as L}from"./chunk-zat2ndst.js";import{et as P}from"./chunk-1nm2xrvq.js";import $ from"path";var V=new Map;function w(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let Y=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Y))z.add(Y)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let K=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}}async function u(Q){let z;if(Q)z=$.resolve(Q);else{let q=await M();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(V,z,"",""),null}let K=j(H),Y=E(V,z,K);if(Y!==void 0)return Y||null;if(H.length===0)return Z(V,z,K,""),null;let x=[];for(let q of H){let y=await Bun.file(q).text();x.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}x.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let I=x.map((q)=>q.file),A=[],B=new Set,T=L({loader:"ts",target:"browser",define:X()});for(let q of I)try{let y=await Bun.file(q).text(),W=$.basename(q,".ts");w(y,B),y=R(y),y=U(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=T.transformSync(y),A.push(`// Store: ${W}
|
|
3
3
|
${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(A.length===0)return Z(V,z,K,""),null;let G=A.join(`
|
|
4
4
|
|
|
5
5
|
`),O=`;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fh as a,gh as b,hh as c,ih as d,jh as e,kh as f}from"./chunk-
|
|
2
|
+
import{fh as a,gh as b,hh as c,ih as d,jh as e,kh as f}from"./chunk-gvm4dw6p.js";import"./chunk-zat2ndst.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-pezxve4a.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ag as i,Dg as t,Eg as e,Fg as HH,Gg as KH,Hg as QH,Ig as YH,yg as S,zg as s}from"./chunk-p7qqbw2k.js";import{Wi as a}from"./chunk-
|
|
2
|
+
import{Ag as i,Dg as t,Eg as e,Fg as HH,Gg as KH,Hg as QH,Ig as YH,yg as S,zg as s}from"./chunk-p7qqbw2k.js";import{Wi as a}from"./chunk-mxqp7x07.js";import{Ms as h}from"./chunk-m2mhtpwy.js";import{et as f}from"./chunk-1nm2xrvq.js";import{existsSync as ZH,readFileSync as XH}from"fs";import J from"path";function qH(K,Q="",V=""){let U=K.startLine>1?`
|
|
3
3
|
`.repeat(K.startLine-1):"",E=i(s(K.code)),X=K.kind==="client"||K.kind==="plain"?e(Q,K.code):"";return KH(`${U+E}
|
|
4
4
|
${X}
|
|
5
5
|
export {}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rf as a}from"./chunk-
|
|
2
|
+
import{rf as a}from"./chunk-a1ydhf5t.js";import"./chunk-qd1nadff.js";import"./chunk-zat2ndst.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-pezxve4a.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{a as startProductionServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ui as a,Vi as b}from"./chunk-
|
|
2
|
+
import{Ui as a,Vi as b}from"./chunk-weajy31v.js";import"./chunk-ht51fz7w.js";import"./chunk-zat2ndst.js";import"./chunk-j0tfxbns.js";import"./chunk-khrtzbxd.js";import"./chunk-8anh6d36.js";import"./chunk-3fwn9edg.js";import"./chunk-pezxve4a.js";import"./chunk-m2mhtpwy.js";import"./chunk-6xg3j487.js";import"./chunk-q4se9rtw.js";import"./chunk-1nm2xrvq.js";import"./chunk-z47tw39z.js";import"./chunk-3wd9kfyz.js";import"./chunk-trtm887x.js";export{a as getStoreScript,b as clearStoreCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ur as g9,cs as z6,ds as H6}from"./chunk-j0tfxbns.js";import{is as i0}from"./chunk-8anh6d36.js";import{ns as m5}from"./chunk-3fwn9edg.js";import{Hs as u9}from"./chunk-
|
|
2
|
+
import{Ur as g9,cs as z6,ds as H6}from"./chunk-j0tfxbns.js";import{is as i0}from"./chunk-8anh6d36.js";import{ns as m5}from"./chunk-3fwn9edg.js";import{Hs as u9}from"./chunk-pezxve4a.js";import{Is as B6,Ks as j6,Ls as _6,Ns as j5}from"./chunk-m2mhtpwy.js";import{Os as d9,Ss as r5,Us as o9}from"./chunk-6xg3j487.js";import{dt as m9}from"./chunk-q4se9rtw.js";import{et as U8,ft as J8,gt as l1,ht as W8,it as S4,jt as r2,kt as B2,lt as T9}from"./chunk-1nm2xrvq.js";import{Et as h3,Vt as h9,Xt as pQ,Yt as d$,_t as U5,ut as n3,xt as x2}from"./chunk-z47tw39z.js";import{du as O6}from"./chunk-3wd9kfyz.js";import{iu as h}from"./chunk-trtm887x.js";import b1 from"path";import I5 from"fs";var E4=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),b4={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},_8=new Set(["ctrl","alt","shift","meta"]),C4={left:0,middle:1,right:2};function y4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(_8.has(J))Z.systemKeys.push(J);else if(J in C4)Z.mouse=J;else if(J in b4||/^[a-z]$/.test(J))Z.keys.push(b4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function P4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,K=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!E4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:y4(O.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!E4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:y4(O.slice(1)),elementId:K})}if(z.length>0)Z.push({originalTag:Q,elementId:K,events:z,startIndex:U,endIndex:W})}return Z}function O8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=C4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function V8($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function E$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function F8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=O8($),Y=V8(E$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${X}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3360,9 +3360,9 @@ ${i6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3360
3360
|
} finally {
|
|
3361
3361
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3362
3362
|
}
|
|
3363
|
-
})();`}function aJ($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var p6=0,Vz=new O1(500),o6=new Set;function Fz(){o6.clear()}function tJ($){if($.__onceStore instanceof Set)return $.__onceStore;return o6}async function v3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=sJ($,"@partial","@include"),U=tJ(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(q))!==null){let L=F.index,w=L+F[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),T=P3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=P3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())Y.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-
|
|
3364
|
-
`;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-
|
|
3365
|
-
`}}if(b){let f=aJ(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await v3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-
|
|
3363
|
+
})();`}function aJ($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var p6=0,Vz=new O1(500),o6=new Set;function Fz(){o6.clear()}function tJ($){if($.__onceStore instanceof Set)return $.__onceStore;return o6}async function v3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=sJ($,"@partial","@include"),U=tJ(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(q))!==null){let L=F.index,w=L+F[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),T=P3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=P3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())Y.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-njkv35c3.js");R=f(R,Z)}if(R&&(J.debug||!H5()&&!p5()))try{let{warnUnbalancedTags:f}=await import("./chunk-vgr8kykv.js");f(R,L)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-qwzfdq8q.js");await f(R,Z,L,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,f instanceof Error?f.message:f)}let N=G$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=Q1(R);for(let[f,n]of Object.entries(V))k[f]=n;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let f of y){let n=f[1]||"",m=f[2]||"",V0=n.includes("server"),M0=N1(n),T0="";try{let{extractAndStripCssImports:t,renderVendorStyleTags:K0}=await import("./chunk-tg0w29j1.js"),q0=t(m,{filePath:L,projectRoot:process.cwd()});m=q0.code,T0=K0(q0.styles)}catch(t){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,t instanceof Error?t.message:t)}if(M0&&m.trim())m=A1(m);if(!V0)try{let{hasUserImports:t,bundleClientScript:K0}=await import("./chunk-2z6k7gsa.js");if(t(m))m=await K0(m,L,{projectRoot:process.cwd()})}catch(t){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,t instanceof Error?t.message:t)}let h0=oJ(m);if(h0&&!V0){b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++p6}`;let t=r0(m),K0=rJ(t,b);E+=`${T0}<script data-stx-scoped data-stx-run="always">${K0}</script>
|
|
3364
|
+
`;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-23vxz3hp.js");await t(m,k,L)}catch(t){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,t)}if(!V0&&!h0){let t=n.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++p6}`;let K0=r0(m),q0=s6(K0,b),B1=n6(K0,q0);E+=`${T0}<script data-stx-scoped data-stx-run="always"${t?` ${t}`:""}>${B1}</script>
|
|
3365
|
+
`}}if(b){let f=aJ(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await v3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-d48tzd8c.js"),x=C(D,k,L);if(x=t0(x,k,L),x=_1(x,k,L),M)x+=`
|
|
3366
3366
|
`+M;if(E)x+=`
|
|
3367
3367
|
`+E;return x}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,O,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,V=_+j[0].length-1,O=1,F=V+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let L=q.substring(_,F),w=q.substring(V+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=P3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=_0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,W0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(F),B.lastIndex=0}return q}function f3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=U.match(K);if(!z||z.index===void 0)break;let H=z.index,B=z[1],j=H+z[0].length,_=new RegExp(`@${Q}\\(`),V=new RegExp(`@${G}(?![a-z])`),O=1,F=j,L=-1;while(O>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(V),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)O++,F=T+(D[0].length||1);else if(A<1/0){if(O--,O===0){L=A;break}F=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function x3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3368
3368
|
`)})}import*as g3 from"path";async function r6($,Z,X=""){if(g3.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return t6($,Z,X,"@js","@endjs")}async function a6($,Z,X=""){if(g3.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return t6($,Z,X,"@ts","@endts")}async function t6($,Z,X,J,Y){let Q=$,G=v1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:K,index:z}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=K.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
|
|
@@ -3534,14 +3534,14 @@ document.addEventListener("focusout",function(e){
|
|
|
3534
3534
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3535
3535
|
`+$.slice(G)}if(q5($))return h5($,(G)=>`${G}
|
|
3536
3536
|
${Z}`);return`${Z}
|
|
3537
|
-
${$}`}async function _$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return o3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return o3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3537
|
+
${$}`}async function _$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return o3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return o3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-9db2f09j.js"),J=await X(Z.debug);return o3($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function XQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function c2($){if($.includes("data-stx-tooltip-runtime")||!XQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${s3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3538
3538
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3539
3539
|
${$.slice(X)}`}async function JQ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let U=await u2(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${d2(q)};</script>
|
|
3540
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3540
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-9db2f09j.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
3541
3541
|
</body>`+$.slice(G+7)}var p2=Symbol.for("stx.lazy-module-promises");function YQ(){let $=globalThis;return $[p2]??=new Map,$[p2]}function a($,Z){let X=YQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var QQ=0,a3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,a2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function GQ($,Z={}){let X=[];for(let J of x5($,Y1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function t2($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=i2(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=i2(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function i2($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function e3($){return r2($)}function qQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function UQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function WQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${a3})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=x5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=t2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let K=G[1],H=/\/\s*>$/.test(Q.token)||V$.has(K.toLowerCase())?Q.end:$9($,Q.start,K,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var n2=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function KQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function s2($,Z,X,J){if(!$)return!1;let Y=KQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(n2.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(Y))!==null){let B=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(n2.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function O$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(a2);if(Q&&zQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function zQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function e2($,Z){let X=UQ($);function J(Y){let Q=Y,G=WQ(Y),q=(z)=>{let H=new Set;for(let B of G)if(z>B.start&&z<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,K=[];while((W=U.exec(Q))!==null){let z=W.index,H=z+W[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),V=j,O=1,F=V,L=/@(if\s*\(|endif)/g;L.lastIndex=V;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(V,F-6).trim(),D;if(qQ(R)){let N=_5(Q.substring(z,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(z);if(!(T.length>0&&T.every((I)=>s2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return O$(y,"@else-if",I.condition??"");if(I.type==="else")return O$(y,"@else");return O$(y,"@if",I.condition??"")}).join(`
|
|
3542
3542
|
`)}else{if(!s2(_,X,Z,q(z)))continue;D=O$(J(R),"@if",_)}K.push({start:z,end:F,replacement:D}),U.lastIndex=F}for(let z=K.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=K[z];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function HQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var V$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function $9($,Z,X,J){if(V$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(U,U+8));if(K){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${K[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!z){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(z[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||V$.has(Y)))q++}U=H+1}return-1}var BQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function jQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return BQ.test(Q)}function Z9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(z)=>Z.some(([H,B])=>z>=H&&z<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[z,H,B,j,_,V,O]=q,F=HQ(_);if(F===void 0)continue;let L=q.index,w=L+z.length,N=!!O||/\/\s*>$/.test(z)||V$.has(H.toLowerCase())?w:$9($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&jQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${V}${O}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let U=[],W=-1;for(let z of G){if(z.start<W)continue;U.push(z),W=z.end}let K=$;for(let z=U.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=U[z];K=K.substring(0,H)+j+K.substring(B)}return K}function X9($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,K=1,z=W;while(z<X.length&&K>0){if(X[z]==="(")K++;else if(X[z]===")")K--;z++}if(K!==0)continue;let H=X.substring(W,z-1).trim(),B=z,j=t2(H),_=q==="for"?"@endfor":"@endforeach",V=1,O=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))V++;else if(V--,V===0){O=L.index+L[0].length;break}if(V!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:O,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,O-_.length).trim(),D=R.match(a2),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:O,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:K}=Q[q];X=X.substring(0,U)+K+X.substring(W)}return X}function _Q($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(K)=>{let z=J+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===K)return z+1;z++}return Q},q=()=>{let K=J+2;while(K<Q&&$[K]!==`
|
|
3543
3543
|
`)K++;return K},U=()=>{let K=J+2;while(K<Q-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return Q},W=(K)=>{let z=K,H=0;while(z<Q){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<Q&&$[j]!==`
|
|
3544
|
-
`)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(J<Q){let K=$[J];if(K==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=U();X.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,X.push(K),J++;continue}if(K==="}"){Y--,X.push(K),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(K),J++}return X.join("")}async function OQ($,Z,X){let J=GQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${QQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-
|
|
3544
|
+
`)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(J<Q){let K=$[J];if(K==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=U();X.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,X.push(K),J++;continue}if(K==="}"){Y--,X.push(K),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(K),J++}return X.join("")}async function OQ($,Z,X){let J=GQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${QQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-2z6k7gsa.js")),W=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=R5(O).code,q(O))O=await U(O,Z||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>FQ(w));let F=r0(O);W.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3545
3545
|
${F}`)}let K=W.join(`
|
|
3546
3546
|
|
|
3547
3547
|
`);K=_Q(K);let z=VQ(K),H=z.split(",").map((V)=>V.trim()).filter(Boolean),B=t3(K,X),j=`
|
|
@@ -3619,9 +3619,9 @@ ${G.join(`
|
|
|
3619
3619
|
`+Y.slice(Q)}async function R4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=Q1($);let Q=!Z.__stxProcessingDepth;if(Q)x4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!H5()&&!p5())&&X&&X.endsWith(".stx"))m9($,X);try{return await J7.timeAsync("template-processing",async()=>{let G=await oQ($,Z,X,J,Y);if(Q)G=L4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??d9(),K=(Z.__stx_head_raw||"").trim(),z,H=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),K=K.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),V=W.meta||[],O=new Set(V.map((N)=>i1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!O.has(i1(N))),...V],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,K].filter(Boolean).join(`
|
|
3620
3620
|
`),...W.htmlAttrs&&{htmlAttrs:S2(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=i3(G);if(G=f2(G,F,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=v2(G,q),G=C2(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=h9(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
3621
3621
|
<meta name="stx-layout" content="${v9(N)}">
|
|
3622
|
-
<meta name="stx-layout-group" content="${v9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=h5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=P2(G);let q=J.app?.colorMode;if(q)G=I2(G,q);G=E2(G),G=sQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-
|
|
3623
|
-
`+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-
|
|
3624
|
-
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-
|
|
3622
|
+
<meta name="stx-layout-group" content="${v9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=h5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=P2(G);let q=J.app?.colorMode;if(q)G=I2(G,q);G=E2(G),G=sQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-yrqnsd3a.js")),U=J.storesDir,W=await q(U);if(W){let K=`<script data-stx-stores>${W}</script>`,z=Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3623
|
+
`+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-crmk2jzf.js")),U=await q(G);if(U){let W=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
|
|
3624
|
+
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-jnjxf5t2.js")),U=J.composablesDir,W=await q(U,G);if(W){let K=`<script data-stx-composables>${W}</script>`,z=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3625
3625
|
`+K+G.slice(z.end)}}catch{}if(Q)G=k2(G);if(Q&&Z.__stx_inject_css!==!1)G=await u9(G,void 0,J.buildMode==="serve");if(Q)G=T2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof s5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(d0.log(U,{filePath:X,context:Z}),J3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return Z3.createFallbackContent("Template Processing",U)}}async function oQ($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!R0.isAbsolute(J.partialsDir)?R0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!R0.isAbsolute(J.componentsDir)?R0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!R0.isAbsolute(J.layoutsDir)?R0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await tQ(X,Z),aQ(Z,q),U=await h1(()=>W2(U,Z,X,q),U,(L)=>{d0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=c0(U,Q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let K=W.tokens,z=(L)=>K.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>K[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=V2(U),U=await y9(U,X,Y);let B={};U=f3(U,B);let j={...Z.__sections||{}},_="",V=L7(F7($)),O=/@nolayout\b/.test(U)||V===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof V==="string"){if(_=V,!/@section\s*\(/.test(U))U=`@section('content')
|
|
3626
3626
|
${U.trim()}
|
|
3627
3627
|
@endsection`}if(!_&&!O&&q.defaultLayout){let L=p3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=R0.dirname(X),N=q.layoutsDir?R0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=R0.join(D,"_layout.stx");if(await r(A)){R=A;break}let M=R0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=R0.isAbsolute(q.layoutsDir)?q.layoutsDir:R0.resolve(process.cwd(),q.layoutsDir),A=R0.join(T,`${q.defaultLayout}.stx`);if(await r(A))_=A}if(_&&!w)U=`@section('content')
|
|
@@ -3629,7 +3629,7 @@ ${U.trim()}
|
|
|
3629
3629
|
@endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=X0(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",E1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=x3(U,B),_){let L=[],w=p0(U),R=c0(w.output,S1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
|
|
3630
3630
|
`);j.content=j.content?`${j.content}
|
|
3631
3631
|
${D}`:D,Z.__sections=j}}if(_)try{let L;if(R0.isAbsolute(_))L=_,Y.add(_);else L=await h1(()=>a5(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=R0.isAbsolute(I)?I:R0.resolve(process.cwd(),I);return iQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(d0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new L1(k,X);return U}let w=await h1(()=>Bun.file(L).text(),"",()=>{throw new L1(`Failed to read layout file: ${L}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(E1)){let b=j[y].indexOf(E1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+E1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await R4(I,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=f3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),N=rQ(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=x3(N,B),Z.__originalFilePath=X,U=await x9(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
|
|
3632
|
-
${U}`,z(U)}catch(L){return d0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return z(await x9(U,Z,X,G,Y))}function rQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function aQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function tQ($,Z){await h1(()=>H2($,Z),void 0,(X)=>{d0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function eQ($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await a("stx/variable-extractor",()=>import("./chunk-
|
|
3632
|
+
${U}`,z(U)}catch(L){return d0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return z(await x9(U,Z,X,G,Y))}function rQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function aQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function tQ($,Z){await h1(()=>H2($,Z),void 0,(X)=>{d0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function eQ($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await a("stx/variable-extractor",()=>import("./chunk-23vxz3hp.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));d0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function $G($,Z,X){try{let{interpolateScriptsInTemplate:J}=await a("stx/expressions",()=>import("./chunk-bd0yv6a0.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return d0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function x9($,Z,X,J,Y){let Q=$,G=J;if(await eQ(Q,Z,X),Q=await $G(Q,Z,X),Q=await r6(Q,Z,X),Q=await a6(Q,Z,X),Q=await C6(Q,Z,X,G),Q1(Q))Q=e2(Q,Z),Q=X9(Q,Z);Q=Z9(Q);let{processStreamDirectives:q}=await a("stx/streaming",()=>import("./chunk-njkv35c3.js"));Q=q(Q,Z),Q=Y2(Q,Z,X,G),Q=await R2(Q,Z,X,G,Y),Q=await O4(Q,Z,X,G,Y),Q=V7(Q,Z,X,G);let{processDeferDirectives:U}=await a("stx/defer",()=>import("./chunk-r153ybwd.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await a("stx/teleport",()=>import("./chunk-cr7s8q08.js"));Q=W(Q,Z,X);let{processTransitionDirectives:K,processTransitionAttributes:z}=await a("stx/transitions",()=>import("./chunk-ne8sygmy.js"));Q=K(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await a("stx/error-boundaries",()=>import("./chunk-tryt2h85.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await a("stx/suspense",()=>import("./chunk-2w5d5tw1.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await a("stx/async-components",()=>import("./chunk-rczpw37w.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await a("stx/keep-alive",()=>import("./chunk-c7pvwvse.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:V,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await a("stx/virtual-scrolling",()=>import("./chunk-wbq7cp57.js"));Q=V(Q,Z,X),Q=O(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await a("stx/partial-hydration",()=>import("./chunk-f6jm4hy3.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await a("stx/computed",()=>import("./chunk-3twce5kp.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await a("stx/forms-validation",()=>import("./chunk-w670sde5.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await a("stx/head",()=>import("./chunk-rg6v68ya.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3633
3633
|
`;if(Q=A(Q,Z),Q=M(Q,Z),Q=z2(Q),Q=O3(Q,Z),Q=S6(Q),Q=q2(Q),Q=await v3(Q,Z,X,G,Y),Q=await O4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=h4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=L4(Q),Q=t0(Q,Z,X),Q=V3(Q,Z),Q=F3(Q,Z),Q=F5(Q,Z),Q=M3(Q,Z),Q=T3(Q,Z),Q=await L6(Q,Z,X,G),Q=await T7(Q,Z,X),Q=await c6(Q,Z,X,G),Q=g9(Q,Z,X,G),Q=Y6(Q,Z,X,G),Q=Q6(Q,Z,X),Q=G6(Q,Z,X,G),Q=b6(Q,Z,X,G),Q=V4(Q,Z),Q=F4(Q),Q=S9(Q),!G.skipEventDirectives)Q=v4(Q,Z,X);if(Q=D7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),e=e3($);if(p&&e)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3634
3634
|
Both work on the same page, but they manage separate scopes.
|
|
3635
3635
|
Prefer signals (state/derived/effect) for new components.`)}Q=_2(Q,Z),Q=await _1(Q,Z,X),Q=C9(Q),Q=P9(Q),Q=W7(Q);let{processXElementDirectives:y}=await a("stx/x-element",()=>import("./chunk-47pge5gz.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=A$(Z);if(Q=await J9(Q,G,E,b),Q=x6(Q,Z),Q=await K2(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:e}=await a("stx/image-optimization/auto-sibling",()=>import("./chunk-2xeq5xnf.js"));Q=await e(Q,{publicDir:p})}if(G.seo?.enabled)Q=q6(Q,Z,G);let C=(p,e,Y0=!0)=>{if(!e)return p;let I0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),F0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(I0&&F0){if(Y0)p=p.replace(F0[0],I0[0]);if(e=e.replace(I0[0],"").trim(),!e)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${e}
|
|
@@ -3643,7 +3643,7 @@ ${G7()}
|
|
|
3643
3643
|
`+S}else Q=Q.replace("</head>",`${e}
|
|
3644
3644
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3645
3645
|
${e}`);else Q=e+`
|
|
3646
|
-
`+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-
|
|
3646
|
+
`+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-775fabj4.js")),e=[];for(let Y0 of p(Q)){if(!/\bserver\b/i.test(Y0.attrs))continue;let I0=Y0.start+Y0.fullMatch.indexOf(">")+1,F0=nQ(Q,I0);if(F0===-1)continue;let P0=F0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;e.push({start:Y0.start,end:P0})}for(let Y0=e.length-1;Y0>=0;Y0--){let{start:I0,end:F0}=e[Y0];Q=Q.substring(0,I0)+Q.substring(F0)}}let h0=z$(Q,X);if(h0.hasScoped)Q=h0.html;let t=Z.__stx_event_bindings||[],K0=!1,q0=[],B1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:J5}=await a("stx/signal-processing",()=>import("./chunk-775fabj4.js"));for(let p of J5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))q0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:e,content:Y0}of q0){K0=!0;let I0=Y0;w4(Y0,X,J.strict,Z.__originalFilePath);let F0=await M$(Y0,{eventBindings:t,attrs:e,hasColonDirectives:B1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>F0)}if(K0)Z.__stx_event_bindings=[];if(!K0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let e=b$(p);if(e){let Y0=Q.lastIndexOf("</body>");Q=Y0===-1?Q+e:Q.slice(0,Y0)+e+`
|
|
3647
3647
|
`+Q.slice(Y0)}Z.__stx_event_bindings=[]}}if(!m2(Q)&&l2(Q))Q=await _$(Q,G);if(Q=c2(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=E6(Q,Z.cspNonce);return Q}var ZG=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],XG=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],JG=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function YG($){let Z=[],X=[];return QG($,Z),GG($,Z,X),qG($,X),UG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function QG($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function GG($,Z,X){for(let J of ZG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function qG($,Z){for(let X of XG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function UG($,Z){for(let X of JG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function WG($,Z){let X=$.slice(0,Z).split(`
|
|
3648
3648
|
`);return{line:X.length,column:X[X.length-1].length+1}}function KG($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function zG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function HG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import s0 from"path";import X5 from"process";var r9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],l9=new Set(r9),BG=new Set(["props","$props","defineProps"]),jG=new Set(["stx","@stacksjs/stx"]);function _G($){let Z=[],X=0,J=$.split(`
|
|
3649
3649
|
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...z)}}}}return[...new Set(Z)]}function OG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,U=null;for(let W=0;W<J.length;W++){let K=J[W];if(U){if(Q+=K,K===U)U=null;continue}if(K==='"'||K==="'"||K==="`"){U=K,Q+=K;continue}if(K==="<")G++;else if(K===">"&&G>0)G--;else if(K==="(")q++;else if(K===")")q--;if(K===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=K}if(Q)Y.push(Q);return Y.map((W)=>{let K=W.trim(),z=K.startsWith("..."),H=z?K.slice(3):K,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return W;let V=H.substring(0,B).trim().replace(/\?$/,""),O=H.substring(B+1),F=-1,L=0;for(let R=0;R<O.length;R++)if(O[R]==="<")L++;else if(O[R]===">")L--;else if(O[R]==="="&&L===0){F=R;break}let w=z?"...":"";if(F!==-1)return`${w}${V} = ${O.substring(F+1).trim()}`;return`${w}${V}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,U=G+1,W=0,K=null;while(U<Z.length&&q>0){let B=Z[U];if(K){if(B===K)K=null;U++;continue}if(B==='"'||B==="'"||B==="`"){K=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let z=Z.substring(G+1,U);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
@@ -3665,11 +3665,11 @@ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3665
3665
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3666
3666
|
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function TG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=Z8(J);if(Q!==-1){if(H0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3667
3667
|
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function s9($,Z){let X=X0($,Z)??X0(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...X5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function IG($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=s9(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=s9(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function kG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function EG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=new O1(500),I$=new O1(1000),A4=new O1(2000),yG=0;function SG($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function X8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function CG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!CG($)}var T$=new Map;function N4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=T$.get(Z);if(X)return X;if(T$.size>=16)T$.clear();let J=new Bun.Transpiler($);return T$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=N4({loader:"ts",target:"browser",define:e1()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function PG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(K)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===K){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let K=1;while(Y<Q&&K>0)if($[Y]==="{")K++,Y++;else if($[Y]==="}")K--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3668
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function vG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function fG($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function xG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of vG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=fG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[z]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function D$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof Y.root==="string"?g.resolve(Y.root):void 0,z=K??g.dirname(J),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(J),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function gG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function hG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function uG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-
|
|
3668
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function vG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function fG($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function xG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of vG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=fG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[z]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function D$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof Y.root==="string"?g.resolve(Y.root):void 0,z=K??g.dirname(J),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(J),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function gG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function hG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function uG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-23vxz3hp.js")),K=q??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&gG(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),V=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Y.__importedComponents;if(F){let P=[V,V.toLowerCase(),j(V),_(V)];for(let u of P)if(F.has(u)){O=F.get(u);break}}let L=[];if(!O){let P=[`${V}.stx`,`${j(V)}.stx`,`${_(V)}.stx`],u=[...new Set(P)],s=Y.__originalFilePath,o=[];if(s){let J0=g.join(g.dirname(s),"components");o.push(J0)}if(J)o.push(J);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!o.includes(z0))o.push(z0);let L0=g.join(g.dirname(Q),"components");if(!o.includes(L0))o.push(L0);if(G.componentsDir&&G.componentsDir!==J&&!o.includes(G.componentsDir))o.push(G.componentsDir);let Z1=G._pluginComponentDirs;if(Array.isArray(Z1)){for(let J0 of Z1)if(typeof J0==="string"&&!o.includes(J0))o.push(J0)}let b0=typeof G.root==="string"?g.resolve(G.root):void 0,D0=b0??g.dirname(Q),v0=[];if(b0)v0.push(g.resolve(b0,"resources/views/components")),v0.push(g.resolve(b0,"resources/components")),v0.push(g.resolve(b0,"src/components")),v0.push(g.resolve(b0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let J0 of v0)if(!o.includes(J0))o.push(J0);let Y5=[...new Set(o.map((J0)=>{if(!J0)return J0;return g.isAbsolute(J0)?J0:g.resolve(D0,J0)}))];o.length=0,o.push(...Y5);let X1=`${V}\x00${Q}\x00${Y5.join("\x00")}`,i=I$.get(X1);if(i)if(await r(i))O=i;else I$.delete(X1);if(!O&&(V.startsWith("./")||V.startsWith("../")))O=g.resolve(g.dirname(Q),`${V}.stx`),L.push(O);else if(!O)for(let J0 of o){if(!J0)continue;for(let J1 of u){let j1=g.join(J0,J1);if(L.push(j1),await r(j1)){O=j1;break}}if(O)break;if(!O)try{let J1=await import("fs");if(!J1.statSync(J0,{throwIfNoEntry:!1})?.isDirectory())continue;let k5=8,y1=[{path:J0,depth:0}];while(y1.length>0&&!O){let o0=y1.pop();if(o0.depth>=k5)continue;let E5;try{E5=J1.readdirSync(o0.path,{withFileTypes:!0})}catch{continue}for(let b5 of E5){if(!b5.isDirectory())continue;if(b5.name==="node_modules"||b5.name.startsWith("."))continue;let k4=g.join(o0.path,b5.name);for(let j8 of u){let k$=g.join(k4,j8);if(L.push(k$),await r(k$)){O=k$;break}}if(O)break;y1.push({path:k4,depth:o0.depth+1})}}}catch{}if(O)break}if(O)I$.set(X1,O)}if(!O||!await r(O)){let P=L.length>0?`
|
|
3669
3669
|
Searched paths:
|
|
3670
3670
|
${L.map((u)=>` - ${u}`).join(`
|
|
3671
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=p0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-
|
|
3672
|
-
`)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-
|
|
3671
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=p0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-x9bsft57.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,u]of k.namedSlots)I[P]=u.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:Q1(w)||hG(X)};xG(w,y);let E=w,b=G$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(C)],f=[],n=x.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&x.every((P)=>/\bserver\b/.test(P[1]||"")),m=null,V0=null;if(n){let P=SG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){m=`${O}\x00${P}`;let u=A4.get(m);if(u){for(let s of u.dependencies)U.add(s);return u.output}V0=new Set(U)}}for(let P of x){let u=P[1]||"",s=P[2]||"",o=u.includes("server");if(N1(u)&&s.trim())s=A1(s);if(o&&s)try{await W(s,y,O)}catch(L0){}if(!o){let L0=s.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Z1=L0.includes("{{")&&L0.includes("}}"),b0=L0.includes("{!!")&&L0.includes("!!}");if(Z1||b0)L0=C$(L0,y);let D0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${D0}>${L0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T0=M0?M0[1]:"",h0=M0?M0[2]:"",t="",K0=T0&&/\bscoped\b/i.test(T0);if(M0)t=`<style${T0}>${h0}</style>`;let q0=E;if(q0=q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)q0=q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(q0=q0.replace(P,(s,o)=>{let z0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)u.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),q0=q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)t=`${t}${u.join(`
|
|
3672
|
+
`)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-x9bsft57.js")),{defaultSlot:J5,namedSlots:p}=k;q0=await B1(q0,J5,p,y);let e=f.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),Y0=uG(f),I0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(Y0.length>0||I0.length>0)y.__stx_client_signal_names=[...new Set([...I0,...Y0])];let F0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let P0=await R4(q0,y,O,F0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of P0.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=`stx_${V.replace(/[^a-zA-Z0-9]/g,"_")}_${++yG}_${Math.random().toString(36).slice(2,8)}`,d=P0;if(e){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${X8(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${X8(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${P0}</div>`;let s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return o;let[,L0,Z1]=z0,b0=T4(Z1,{filePath:O,projectRoot:process.cwd()}),D0=b0.code,v0=I4(b0.styles);D0=R5(D0).code;let{hasUserImports:Y5,bundleClientScript:X1}=await a("stx/client-script-bundler",()=>import("./chunk-2z6k7gsa.js"));if(Y5(D0))D0=await X1(D0,O,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:i}=await a("stx/signal-processing",()=>import("./chunk-775fabj4.js"));D0=D0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(o0,E5)=>i(E5));let J0=r0(D0),J1=PG(J0),j1=`function(__scopeId) {
|
|
3673
3673
|
${l1("const",[...J8,...J1],J0)}
|
|
3674
3674
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3675
3675
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3791,7 +3791,7 @@ else {
|
|
|
3791
3791
|
// STX: auto-generated event bindings
|
|
3792
3792
|
${$.map((X,J)=>Qq(X,J)).join(`
|
|
3793
3793
|
`)}`}function q8($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3794
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=K[0].length;continue}let z=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var qq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Uq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!qq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function M$($,Z={}){let X=$,J="",Y=!1,Q=[],G=T4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=I4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-
|
|
3794
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=K[0].length;continue}let z=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var qq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Uq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!qq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function M$($,Z={}){let X=$,J="",Y=!1,Q=[],G=T4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=I4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-2z6k7gsa.js"));if(W(X))X=await K(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=H8(X);X=F.code,J=B8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${t3(X,Z.serverData)}${J}`,X=r0(X),!Y&&N1(Z.attrs||""))X=A1(X);let z=Gq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
|
|
3795
3795
|
${n1(`${J}${X}
|
|
3796
3796
|
${z}`)}
|
|
3797
3797
|
</script>`}let j=W8($),_=/function __stx_setup_/.test(X),V=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(F){let L=F.length>0?`
|