@stacksjs/stx 0.2.301 → 0.2.303
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-d6wq91cw.js → chunk-1evf3bdg.js} +72 -2
- package/dist/{chunk-4xs545h1.js → chunk-2jd9bxmf.js} +1 -1
- package/dist/{chunk-vh0qr8k9.js → chunk-2m6x8tcx.js} +1 -1
- package/dist/{chunk-s454ytp4.js → chunk-3bqz5zre.js} +1 -1
- package/dist/{chunk-ac9vpa5z.js → chunk-48p0k8y7.js} +1 -1
- package/dist/{chunk-d41b0rqp.js → chunk-4b625drg.js} +1 -1
- package/dist/{chunk-mzf6c0h7.js → chunk-593kby1d.js} +1 -1
- package/dist/{chunk-cthpzv4p.js → chunk-5nac67r4.js} +2 -2
- package/dist/{chunk-b26xazrf.js → chunk-78akhaws.js} +1 -1
- package/dist/{chunk-q0y1yxg3.js → chunk-95t0k8cz.js} +1 -1
- package/dist/{chunk-h65nep6y.js → chunk-9a4q74r6.js} +1 -1
- package/dist/{chunk-shr928nn.js → chunk-9f5329rv.js} +1 -1
- package/dist/{chunk-zwy5e35f.js → chunk-9rv7akqq.js} +1 -1
- package/dist/{chunk-btnky17z.js → chunk-apjy1a72.js} +1 -1
- package/dist/{chunk-n1j7gfe1.js → chunk-b3p3bzax.js} +1 -1
- package/dist/{chunk-4qj6pq60.js → chunk-c5hk1fxt.js} +1 -1
- package/dist/{chunk-52rkkkmt.js → chunk-c6b5nqct.js} +8 -8
- package/dist/{chunk-813dt09p.js → chunk-c9rs5g1s.js} +1 -1
- package/dist/{chunk-w9kzfesd.js → chunk-dxhtry04.js} +1 -1
- package/dist/{chunk-b2ghmxpj.js → chunk-em3jb1dn.js} +1 -1
- package/dist/{chunk-h7d01cy7.js → chunk-ev4djb0p.js} +1 -1
- package/dist/{chunk-em8p71et.js → chunk-ew6tr7b1.js} +1 -1
- package/dist/{chunk-38e9wgfc.js → chunk-f62fh1fw.js} +1 -1
- package/dist/{chunk-39qnycbc.js → chunk-frejnjh9.js} +1 -1
- package/dist/{chunk-q5sw26s7.js → chunk-ftvmk1nj.js} +1 -1
- package/dist/{chunk-me5kq4e6.js → chunk-fvcr26a0.js} +1 -1
- package/dist/{chunk-gv42xz15.js → chunk-ggwnrdqz.js} +1 -1
- package/dist/{chunk-2wcd2031.js → chunk-hp3rjwnb.js} +1 -1
- package/dist/{chunk-1na1dvda.js → chunk-jw248h1d.js} +1 -1
- package/dist/{chunk-4r1qdp25.js → chunk-m78y5qys.js} +1 -1
- package/dist/{chunk-fc5t3cxt.js → chunk-mx2wcb15.js} +1 -1
- package/dist/{chunk-pczxwdes.js → chunk-p4w3wjbv.js} +1 -1
- package/dist/{chunk-that7v95.js → chunk-pm3k8dyk.js} +1 -1
- package/dist/{chunk-7w3dttqh.js → chunk-qsmdvy1z.js} +1 -1
- package/dist/{chunk-454kar39.js → chunk-rdg1n42s.js} +1 -1
- package/dist/{chunk-pq6rabcy.js → chunk-rsxmjfxq.js} +16 -16
- package/dist/{chunk-c7av0px6.js → chunk-v2fp9vkh.js} +1 -1
- package/dist/{chunk-w63052rn.js → chunk-w0g99tx9.js} +1 -1
- package/dist/{chunk-8d15pd4g.js → chunk-whm6bybj.js} +1 -1
- package/dist/{chunk-sy0rbpxv.js → chunk-wj25qt72.js} +70 -70
- package/dist/{chunk-ebr2344x.js → chunk-x2pk87q2.js} +1 -1
- package/dist/{chunk-9cp3430d.js → chunk-xn0asg46.js} +1 -1
- package/dist/{chunk-e0s519df.js → chunk-xwmw1wtk.js} +1 -1
- package/dist/{chunk-svg37jzs.js → chunk-y7dcdjav.js} +1 -1
- package/dist/{chunk-cbwp8prr.js → chunk-yfwyvh02.js} +2 -2
- package/dist/{chunk-7k63nhap.js → chunk-zdx9s3z0.js} +1 -1
- package/dist/{chunk-38t0fxh0.js → chunk-zn6xcc0a.js} +1 -1
- package/dist/cli.js +9 -9
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +72 -2
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$r as Z2,As as m6,Cr as R2,Fr as g6,Hr as G0,Ks as t3,Lr as D2,Ls as e3,Mr as h6,Or as o0,Pr as u6,Wr as L4,Xr as $0,Yr as q0,Zr as T0,_r as G9,as as W0,bs as W9,rr as Q0,tr as q9,vr as K9,ws as d6}from"./chunk-m6wz1hf5.js";import{Rs as u2}from"./chunk-dcxtrqfy.js";import{Zs as x0,_s as M8}from"./chunk-qjkzpd68.js";import{$s as S7}from"./chunk-2rp09y5j.js";import{Kt as i6,ct as i1,dt as v1,et as c6,ft as I1,ht as j1,it as _8,jt as V8,kt as J2,lt as v2,mt as z9,nt as B$,ot as M6,pt as H6,qt as _1,rt as p0,st as S9,wt as p6,xt as A9}from"./chunk-
|
|
2
|
+
import{$r as Z2,As as m6,Cr as R2,Fr as g6,Hr as G0,Ks as t3,Lr as D2,Ls as e3,Mr as h6,Or as o0,Pr as u6,Wr as L4,Xr as $0,Yr as q0,Zr as T0,_r as G9,as as W0,bs as W9,rr as Q0,tr as q9,vr as K9,ws as d6}from"./chunk-m6wz1hf5.js";import{Rs as u2}from"./chunk-dcxtrqfy.js";import{Zs as x0,_s as M8}from"./chunk-qjkzpd68.js";import{$s as S7}from"./chunk-2rp09y5j.js";import{Kt as i6,ct as i1,dt as v1,et as c6,ft as I1,ht as j1,it as _8,jt as V8,kt as J2,lt as v2,mt as z9,nt as B$,ot as M6,pt as H6,qt as _1,rt as p0,st as S9,wt as p6,xt as A9}from"./chunk-whm6bybj.js";import{Lt as $7,Nt as Z7,Ot as J7,Qt as K2}from"./chunk-q25mr70f.js";import{Rt as n6,Vt as m2,Xt as Y8}from"./chunk-jsfch50r.js";import{fu as Z1}from"./chunk-6b4k8fay.js";import{iu as o6}from"./chunk-jb2r696a.js";import{ju as s$,ku as N8,lu as B8,mu as p1,qu as A8,ru as f$,su as U6,uu as a7,xu as Y4}from"./chunk-k5xtf38q.js";import{Iu as K$,Lu as r4,Su as a5,hv as l6,jv as hQ,kv as c9,mv as Q2}from"./chunk-0tbgvp70.js";import{rv as X7}from"./chunk-xdq52pwj.js";import{wv as u}from"./chunk-ddqkj56r.js";import E1 from"path";import A2 from"fs";var S$=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"]),P$={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"},y8=new Set(["ctrl","alt","shift","meta"]),x$={left:0,middle:1,right:2};function v$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(y8.has(X))Z.systemKeys.push(X);else if(X in x$)Z.mouse=X;else if(X in P$||/^[a-z]$/.test(X))Z.keys.push(P$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function g$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[Y,G,z]=Q,q=Q.index,K=q+Y.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,_,F]=j,L=_.split("."),O=L[0];if(!S$.has(O))continue;U.push({attribute:`@${_}`,event:O,handler:F,modifiers:v$(L.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,_,F]=j,L=_.split("."),O=L[0];if(!S$.has(O))continue;U.push({attribute:`@${_}`,event:O,handler:F,modifiers:v$(L.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Y,elementId:W,events:U,startIndex:q,endIndex:K})}return Z}function C8($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=x$[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function S8($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function b9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function P8($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=C8($),Q=S8(b9($.handler),Z),Y=[];if(Z.once)Y.push("once: true");if(Z.capture)Y.push("capture: true");if(Z.passive)Y.push("passive: true");let G=Y.length>0?`, { ${Y.join(", ")} }`:"",z=Q.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('${J}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3452,9 +3452,9 @@ ${Q}
|
|
|
3452
3452
|
} finally {
|
|
3453
3453
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3454
3454
|
}
|
|
3455
|
-
})();`}function $Y($,Z){if(i0($)){let Q=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:"body"};return{html:b1($,(Y,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Q=J[2].slice(1),Y=X.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:Q};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Q}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var q4=0,QH=new i1(500),W4=new Set;function GH(){W4.clear()}function ZY($){if($.__onceStore instanceof Set)return $.__onceStore;return W4}async function n5($,Z,J,X,Q,Y=new Set){let G=X.partialsDir||U0.join(U0.dirname(J),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let z=oX($,"@partial","@include"),q=ZY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(_,F,L)=>{let O=F.trim(),V=`${J}:${O}`;if(q.has(V))return"";return q.add(V),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")")V--;w++}if(V!==0)break;let R=z.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],I=K(A,G,J),N="";if(I&&await Bun.file(I).exists())Q.add(I),N=`@include(${R})`;z=z.substring(0,L)+N+z.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(z))!==null){let V=O.index,w=V+O[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let A=z.substring(w+1,D-1),I=i5(A,0);if(I===-1){L.lastIndex=D;continue}let N=A.substring(0,I).trim(),M=A.substring(I+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){L.lastIndex=D;continue}let k=T[1],y=M.substring(T[0].length),E,b=i5(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(q0(C)){let f=W0(C,Object.keys(Z));v=Boolean(f(...Object.values(Z)))}else v=Boolean($0(C,Z));let P=F?!v:v,g="";if(P){let f=K(k,G,J);if(f&&await Bun.file(f).exists())Q.add(f);g=`@include('${k}'${E?`, ${E}`:""})`}z=z.substring(0,V)+g+z.substring(D),L.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),P=H0("Include",`Error evaluating ${_} condition: ${v}`,J,$,V);z=z.substring(0,V)+P+z.substring(D),L.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")"){if(V--,V===0)break}w++}if(V!==0)break;let R=z.substring(O+1,w),D=z.substring(L,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let[,I,N,M,T]=A;try{let k,y=N.trim();if(q0(y))k=W0(y,Object.keys(Z))(...Object.values(Z));else k=$0(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let C={...Z,[M]:b},v=await H(I,C,$,L);E+=v}else if(T)E=await H(T,{},$,L);z=z.substring(0,L)+E+z.substring(w+1),_.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);z=z.substring(0,L)+H0("Each",`Error in @each: ${y}`,J,$,L)+z.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")"){if(V--,V===0)break}w++}if(V!==0)break;let R=z.substring(O+1,w),D=z.substring(L,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let I=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let k,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(M)try{b=T0(M,Z)}catch(v){let P=v instanceof Error?v.message:String(v);if(X.debug){let g=H0("Include",`Error parsing includeFirst variables: ${P}`,J,$,L,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>k||"");continue}let C=!1;for(let v of E){let P=K(v,G,J);if(!P)continue;if(await s(P)){let g=await H(v,b,$,L);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(k!==void 0)z=z.replace(D,()=>k);else if(X.debug){let v=H0("Include",`None of the includeFirst paths exist: ${I}`,J,$,L,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,L,D);z=z.replace(D,()=>C)}_.lastIndex=0}}function K(_,F,L){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let V=U0.resolve(F),w=U0.resolve(U0.dirname(L)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=U0.resolve(F,O);else R=U0.resolve(w,O);let D=U0.normalize(R),A=D.startsWith(V+U0.sep)||D===V,I=D.startsWith(w+U0.sep)||D===w,N=!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!==".."))N=!0}if(!A&&!I&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${V}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let W=U0.resolve(J);Y.add(W);function U(_,F,L,O){return X.onIncludeError?.({includePath:_,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,L,O)}async function H(_,F={},L,O){let V=K(_,G,J);if(!V)return U(_,`Could not resolve path for include: ${_}`,L,O);let w=U0.resolve(V);if(Y.has(w)){let R=[...Y,w].map((D)=>U0.basename(D)).join(" -> ");return U(_,`Circular include detected: ${R}`,L,O)}try{Q.add(V);let R;if(!R)try{R=await Bun.file(V).text()}catch(P){let g=P instanceof Error?P.message:String(P);return U(_,`Error loading include file ${_}: ${g}`,L,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-
|
|
3456
|
-
`;continue}if(r)try{let{extractVariables:Z0}=await import("./chunk-
|
|
3457
|
-
`}}if(b){let P=$Y(D,b);if(D=P.html,P.mergedIntoExisting){let f=b,r=P.mergedIntoExisting;E=E.split(`'${f}'`).join(`'${r}'`).split(`"${f}"`).join(`"${r}"`),b=r}else if(!P.stamped)console.warn(`[stx] ${U0.relative(process.cwd(),V)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let g=P.stamped&&P.root!==null&&Q4(P.root);E=tX(E,g?b:null)}if(D.includes("@include")||D.includes("@partial"))D=await n5(D,T,V,X,Q,Y);let{processLoops:C}=await import("./chunk-
|
|
3455
|
+
})();`}function $Y($,Z){if(i0($)){let Q=i0($).tag.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:"body"};return{html:b1($,(Y,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Q=J[2].slice(1),Y=X.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:Q};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Q}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var q4=0,QH=new i1(500),W4=new Set;function GH(){W4.clear()}function ZY($){if($.__onceStore instanceof Set)return $.__onceStore;return W4}async function n5($,Z,J,X,Q,Y=new Set){let G=X.partialsDir||U0.join(U0.dirname(J),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let z=oX($,"@partial","@include"),q=ZY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(_,F,L)=>{let O=F.trim(),V=`${J}:${O}`;if(q.has(V))return"";return q.add(V),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")")V--;w++}if(V!==0)break;let R=z.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],I=K(A,G,J),N="";if(I&&await Bun.file(I).exists())Q.add(I),N=`@include(${R})`;z=z.substring(0,L)+N+z.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(z))!==null){let V=O.index,w=V+O[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let A=z.substring(w+1,D-1),I=i5(A,0);if(I===-1){L.lastIndex=D;continue}let N=A.substring(0,I).trim(),M=A.substring(I+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){L.lastIndex=D;continue}let k=T[1],y=M.substring(T[0].length),E,b=i5(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(q0(C)){let f=W0(C,Object.keys(Z));v=Boolean(f(...Object.values(Z)))}else v=Boolean($0(C,Z));let P=F?!v:v,g="";if(P){let f=K(k,G,J);if(f&&await Bun.file(f).exists())Q.add(f);g=`@include('${k}'${E?`, ${E}`:""})`}z=z.substring(0,V)+g+z.substring(D),L.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),P=H0("Include",`Error evaluating ${_} condition: ${v}`,J,$,V);z=z.substring(0,V)+P+z.substring(D),L.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")"){if(V--,V===0)break}w++}if(V!==0)break;let R=z.substring(O+1,w),D=z.substring(L,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let[,I,N,M,T]=A;try{let k,y=N.trim();if(q0(y))k=W0(y,Object.keys(Z))(...Object.values(Z));else k=$0(y,Z);let E="";if(Array.isArray(k)&&k.length>0)for(let b of k){let C={...Z,[M]:b},v=await H(I,C,$,L);E+=v}else if(T)E=await H(T,{},$,L);z=z.substring(0,L)+E+z.substring(w+1),_.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k);z=z.substring(0,L)+H0("Each",`Error in @each: ${y}`,J,$,L)+z.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(z))!==null){let L=F.index,O=L+F[0].length-1,V=1,w=O+1;while(w<z.length&&V>0){if(z[w]==="(")V++;else if(z[w]===")"){if(V--,V===0)break}w++}if(V!==0)break;let R=z.substring(O+1,w),D=z.substring(L,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let I=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let k,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)k=y[1];try{let E=JSON.parse(I.replace(/'/g,'"')),b={};if(M)try{b=T0(M,Z)}catch(v){let P=v instanceof Error?v.message:String(v);if(X.debug){let g=H0("Include",`Error parsing includeFirst variables: ${P}`,J,$,L,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>k||"");continue}let C=!1;for(let v of E){let P=K(v,G,J);if(!P)continue;if(await s(P)){let g=await H(v,b,$,L);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(k!==void 0)z=z.replace(D,()=>k);else if(X.debug){let v=H0("Include",`None of the includeFirst paths exist: ${I}`,J,$,L,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,L,D);z=z.replace(D,()=>C)}_.lastIndex=0}}function K(_,F,L){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let V=U0.resolve(F),w=U0.resolve(U0.dirname(L)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=U0.resolve(F,O);else R=U0.resolve(w,O);let D=U0.normalize(R),A=D.startsWith(V+U0.sep)||D===V,I=D.startsWith(w+U0.sep)||D===w,N=!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!==".."))N=!0}if(!A&&!I&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${V}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let W=U0.resolve(J);Y.add(W);function U(_,F,L,O){return X.onIncludeError?.({includePath:_,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,L,O)}async function H(_,F={},L,O){let V=K(_,G,J);if(!V)return U(_,`Could not resolve path for include: ${_}`,L,O);let w=U0.resolve(V);if(Y.has(w)){let R=[...Y,w].map((D)=>U0.basename(D)).join(" -> ");return U(_,`Circular include detected: ${R}`,L,O)}try{Q.add(V);let R;if(!R)try{R=await Bun.file(V).text()}catch(P){let g=P instanceof Error?P.message:String(P);return U(_,`Error loading include file ${_}: ${g}`,L,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-593kby1d.js");R=P(R,Z)}if(R&&(X.debug||!q9()&&!K9()))try{let{warnUnbalancedTags:P}=await import("./chunk-mc4rtf5d.js");P(R,V)}catch{}let D=R;try{let{processESImports:P}=await import("./chunk-frejnjh9.js");await P(R,Z,V,X,Q)}catch(P){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${V}:`,P instanceof Error?P.message:P)}let A=a2(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(N)M=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=Y1(R,V);for(let[P,g]of Object.entries(F))T[P]=g;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(k)],E="",b=null;for(let P of y){let g=P[1]||"",f=P[2]||"",r=g.includes("server"),r0=A1(g);if(!r&&f.trim()){let{interpolateScriptExpressions:Z0}=await import("./chunk-p4w3wjbv.js");f=Z0(f,T)}let M0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:j0}=await import("./chunk-mx2wcb15.js"),k0=Z0(f,{filePath:V,projectRoot:process.cwd()});f=k0.code,M0=j0(k0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${V}:`,Z0 instanceof Error?Z0.message:Z0)}if(r0&&f.trim())f=M1(f);if(!r){try{let{injectBrowserCoreAutoImports:j0}=await import("./chunk-mx2wcb15.js");f=j0(f).code;let{hasUserImports:k0,bundleClientScript:f0}=await import("./chunk-ev4djb0p.js");if(k0(f))f=await f0(f,V,{projectRoot:process.cwd()})}catch(j0){if(X.debug)console.warn(`[stx] bundler skipped for ${V}:`,j0 instanceof Error?j0.message:j0)}let{stripStxRuntimeImports:Z0}=await import("./chunk-c5hk1fxt.js");f=Z0(f)}let y0=sX(f);if(y0&&!r){b=`stx_scope_${U0.basename(V,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++q4}`;let Z0=Z1(f),j0=z4(Z0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}">${j0}</script>
|
|
3456
|
+
`;continue}if(r)try{let{extractVariables:Z0}=await import("./chunk-9f5329rv.js");await Z0(f,T,V)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${V}:`,Z0)}if(!r&&!y0){let Z0=g.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(V,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++q4}`;let j0=Z1(f),k0=z4(j0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${b}"${Z0?` ${Z0}`:""}>${k0}</script>
|
|
3457
|
+
`}}if(b){let P=$Y(D,b);if(D=P.html,P.mergedIntoExisting){let f=b,r=P.mergedIntoExisting;E=E.split(`'${f}'`).join(`'${r}'`).split(`"${f}"`).join(`"${r}"`),b=r}else if(!P.stamped)console.warn(`[stx] ${U0.relative(process.cwd(),V)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let g=P.stamped&&P.root!==null&&Q4(P.root);E=tX(E,g?b:null)}if(D.includes("@include")||D.includes("@partial"))D=await n5(D,T,V,X,Q,Y);let{processLoops:C}=await import("./chunk-9a4q74r6.js"),v=C(D,T,V);if(v=$1(v,T,V),v=V1(v,T,V),M)v+=`
|
|
3458
3458
|
`+M;if(E)v+=`
|
|
3459
3459
|
`+E;return v}catch(R){let D=R instanceof Error?R.message:String(R);return U(_,`Error processing include ${_}: ${D}`,L,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let _=B.index,F=_+B[0].length-1,L=1,O=F+1;while(O<z.length&&L>0){if(z[O]==="(")L++;else if(z[O]===")")L--;O++}if(L!==0)break;let V=z.substring(_,O),w=z.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let D=R[1],A,I=w.substring(R[0].length),N=i5(I,0);if(N!==-1)A=I.substring(N+1).trim();let M={};if(A)try{M=T0(A,Z)}catch(k){let y=k instanceof Error?k.message:String(k);z=z.replace(V,H0("Include",`Error parsing include variables for ${D}: ${y}`,J,$,_)),j.lastIndex=0;continue}let T=await H(D,M,$,_);z=z.substring(0,_)+T+z.substring(O),j.lastIndex=0}return z}function o5($,Z){let J=$;function X(Q,Y,G,z){let q=Q,K=!0;while(K){K=!1;let W=new RegExp(`@${Y}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,_=new RegExp(`@${Y}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,O=B,V=-1;while(L>0&&O<q.length){let R=q.slice(O),D=R.match(_),A=R.match(F),I=D?O+D.index:1/0,N=A?O+A.index:1/0;if(I<N)L++,O=I+(D[0].length||1);else if(N<1/0){if(L--,L===0){V=N;break}O=N+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(V+`@${G}`.length),K=!0}return q}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function s5($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3460
3460
|
`)})}import*as r5 from"path";async function U4($,Z,J=""){if(r5.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return j4($,Z,J,"@js","@endjs")}async function H4($,Z,J=""){if(r5.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Y)=>({...Y,displayName:`User ${Y.id}: ${Y.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return j4($,Z,J,"@ts","@endts")}async function j4($,Z,J,X,Q){let Y=$,G=v1(`${X}([\\s\\S]*?)${Q}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),_=W.trim();if(X==="@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 L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",V=`
|
|
@@ -3517,14 +3517,14 @@ ${$.slice(J)}`}function s4($,Z={},J={},X){if(X??q$($))return $;return iY($,Z,J)}
|
|
|
3517
3517
|
${Z}${$.slice(Q)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3518
3518
|
`+$.slice(G)}if(i0($))return b1($,(G)=>`${G}
|
|
3519
3519
|
${Z}`);return`${Z}
|
|
3520
|
-
${$}`}async function O9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Q}=await import("./chunk-
|
|
3520
|
+
${$}`}async function O9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Q}=await import("./chunk-4b625drg.js"),{url:Y}=await Q("runtime",Z.debug===!0);return W$($,`<script data-stx-runtime src="${Y}"></script>`)}if(Z.buildMode==="compile")return W$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-4b625drg.js"),X=await J(Z.debug);return W$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function aY($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function X6($){if($.includes("data-stx-tooltip-runtime")||!aY($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${h5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3521
3521
|
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3522
3522
|
${$.slice(J)}`}var tY=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function eY($){return tY.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function $Q($,Z){if(!$.includes("</body>"))return $;if(eY($))return $;let J=Z?.router,X="";{let q={};if(J){if(J.container)q.container=J.container;if(J.interceptAllLinks!==void 0)q.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)q.progress=J.progress;if(J.viewTransitions!==void 0)q.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)q.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)q.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)q.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)q.prefetch=J.prefetch;if(J.cache!==void 0)q.cache=J.cache;if(J.progressColor!==void 0)q.progressColor=J.progressColor;if(J.progressHeight!==void 0)q.progressHeight=J.progressHeight}try{let K=await e4(Z?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)X=`<script>window.__stxRouterConfig=${$6(q)};</script>
|
|
3523
|
-
`}let{getCachedRouterScript:Q,getServeClientAsset:Y}=await import("./chunk-
|
|
3523
|
+
`}let{getCachedRouterScript:Q,getServeClientAsset:Y}=await import("./chunk-4b625drg.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Y("router")).url}"></script>`:`<script data-stx-router>${await Q()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
|
|
3524
3524
|
</body>`+$.slice(z+7)}var Y6=Symbol.for("stx.lazy-module-promises");function ZQ(){let $=globalThis;return $[Y6]??=new Map,$[Y6]}function n($,Z){let J=ZQ(),X=`${import.meta.url}\x00${$}`,Q=J.get(X);if(Q)return Q;let Y=Z();return J.set(X,Y),Y.catch(()=>{if(J.get(X)===Y)J.delete(X)}),Y}var U$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,j6=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,JQ=65536,XQ=4,w9=new Map;function Tj(){w9.clear()}function YQ($){let Z=[];for(let J of B$($,J2)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let Y=X[0].length,G=J.token.length-Q[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Y,G),start:J.start,end:J.end}))}return Z}function QQ($,Z={}){let J=$.length>=JQ,X=J?w9.get($):void 0;if(X===void 0){if(X=YQ($),J)H6(w9,XQ),w9.set($,X)}let Q=Z.skipAttrs;if(!Q)return X.slice();let Y=[];for(let G of X)if(Q.lastIndex=0,!Q.test(G.attrs))Y.push(G);return Y}function B6($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),Y=J[2].trim(),{itemVar:G,indexVar:z}=Q6(Y);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),Y=X[2].trim(),{itemVar:G,indexVar:z}=Q6(Q);if(G)return{style:"in",iterable:Y,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Q6($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let Y=Z.match(/^(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:null};return{itemVar:null,indexVar:null}}function _$($,Z){return U6($,Z)}function GQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function zQ($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=J.exec($))!==null){let Y=Q[1],G;while((G=X.exec(Y))!==null)Z.add(G[1])}return Z}function qQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${U$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=B$($,(Y,G)=>{Z.lastIndex=G;let z=Z.exec(Y);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Q=[];for(let Y of X){Z.lastIndex=0;let G=Z.exec(Y.token);if(!G)continue;let z=G[2].match(J),q=B6(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Y.token)||R9.has(W.toLowerCase())?Y.end:V6($,Y.start,W,Y.end);if(H!==-1)Q.push({start:Y.start,end:H,vars:new Set(K)})}return Q}var G6=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 z6($,Z,J,X){if(!$)return!1;let Q=KQ($),Y=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Q))!==null){let j=K[1];if(Q.slice(0,K.index).trimEnd().endsWith("."))continue;if(G6.has(j))continue;if(Z.has(j)||X?.has(j))Y=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Q))!==null){let j=U[1];if(Q.slice(0,U.index).trimEnd().endsWith("."))continue;if(G6.has(j)||J&&j in J)continue;z=!0}return(Y||z)&&!G}function F9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Q=$.trim(),Y=Q.match(j6);if(Y&&WQ(Y[3],Y[1])){let[,G,z,q]=Y;return`<${G}${z}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function WQ($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=J.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function _6($,Z){let J=zQ($);function X(Q){let Y=Q,G=qQ(Q),z=(U)=>{let H=new Set;for(let j of G)if(U>j.start&&U<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,W=[];while((K=q.exec(Y))!==null){let U=K.index,H=U+K[0].length,j=1,B=H;while(B<Y.length&&j>0){if(Y[B]==="(")j++;else if(Y[B]===")")j--;B++}if(j!==0)continue;let _=Y.substring(H,B-1).trim(),F=B,L=1,O=F,V=/@(if\s*\(|endif)/g;V.lastIndex=F;let w;while((w=V.exec(Y))!==null)if(w[1].startsWith("if"))L++;else if(w[1]==="endif"){if(L--,L===0){O=w.index+w[0].length;break}}if(L!==0)continue;let R=Y.substring(F,O-6).trim(),D;if(GQ(R)){let A=W2(Y.substring(U,O));if(A.length===0)continue;let I=A[0].branches.filter((k)=>k.type!=="else"),N=z(U);if(!(I.length>0&&I.every((k)=>z6(k.condition,J,Z,N))))continue;D=A[0].branches.map((k)=>{let y=X(k.content);if(k.type==="elseif")return F9(y,"@else-if",k.condition??"");if(k.type==="else")return F9(y,"@else");return F9(y,"@if",k.condition??"")}).join(`
|
|
3525
3525
|
`)}else{if(!z6(_,J,Z,z(U)))continue;D=F9(X(R),"@if",_)}W.push({start:U,end:O,replacement:D}),q.lastIndex=O}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Y=Y.substring(0,H)+B+Y.substring(j)}return Y}return X($)}function UQ($){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 Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var R9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),q6=/<(script|style)\b/iy,HQ=/<\/script/gi,jQ=/<\/style/gi;function V6($,Z,J,X){if(R9.has(J.toLowerCase()))return X;let Q=J.toLowerCase(),Y=$.length,G=1,z=X;while(z<Y){let q=$.indexOf("<",z);if(q===-1)return-1;if(z=q,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}q6.lastIndex=z;let K=q6.exec($);if(K){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=K[1].toLowerCase()==="script"?HQ:jQ;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let _=$.indexOf(">",B.index);if(_===-1)return-1;z=_+1;continue}if($[z+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!H){z++;continue}if(H[1].toLowerCase()===Q){if(G--,z+=H[0].length,G===0)return z;continue}z+=H[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let U=$.indexOf(">",z);if(U===-1)return-1;if(W[1].toLowerCase()===Q){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||R9.has(Q)))G++}z=U+1}return-1}var BQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function _Q($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Q=$.indexOf(">",J);if(Q===-1)return!1;let Y=$.slice(J,Q+1);return BQ.test(Y)}function L6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(U)=>Z.some(([H,j])=>U>=H&&U<j),Y=/<([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=[],z;while((z=Y.exec($))!==null){if(Q(z.index))continue;let[U,H,j,B,_,F,L]=z,O=UQ(_);if(O===void 0)continue;let V=z.index,w=V+U.length,A=!!L||/\/\s*>$/.test(U)||R9.has(H.toLowerCase())?w:V6($,V,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&_Q($,A)){Y.lastIndex=w;continue}if(O===!0){let N=`<${H}${j}${F}${L}>`;G.push({start:V,end:w,replacement:N});continue}G.push({start:V,end:A,replacement:""}),Y.lastIndex=A}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let q=[],K=-1;for(let U of G){if(U.start<K)continue;q.push(U),K=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=q[U];W=W.substring(0,H)+B+W.substring(j)}return W}function V$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Q,Y=[],G=[];while((Q=X.exec(J))!==null){let z=Q[1],q=Q.index,K=q+Q[0].length,W=1,U=K;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(K,U-1).trim(),j=U,B=B6(H),_=z==="for"?"@endfor":"@endforeach",F=1,L=j,O=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");O.lastIndex=j;let V;while((V=O.exec(J))!==null)if(V[1].startsWith(z))F++;else if(F--,F===0){L=V.index+V[0].length;break}if(F!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:L,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let T=M.split(/[.[(]/)[0].trim(),k=Z?T in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(T));if(T&&(k||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,L-_.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let A=V$(R,D),I=A.match(j6),N;if(I){let[,M,T,k]=I;N=`<${M}${T} @for="${H}">${k}</${M}>`}else N=`<template @for="${H}">${A}</template>`;Y.push({start:q,end:L,replacement:N}),X.lastIndex=L}for(let z=Y.length-1;z>=0;z--){let{start:q,end:K,replacement:W}=Y[z];J=J.substring(0,q)+W+J.substring(K)}return J}function VQ($){let Z=new Set,J=[],X=0,Q=0,Y=$.length,G=(W)=>{let U=X+1;while(U<Y){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Y},z=()=>{let W=X+2;while(W<Y&&$[W]!==`
|
|
3526
3526
|
`)W++;return W},q=()=>{let W=X+2;while(W<Y-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Y},K=(W)=>{let U=W,H=0;while(U<Y){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<Y&&$[B]!==`
|
|
3527
|
-
`)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Y-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Y){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Y};while(X<Y){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Q++,J.push(W),X++;continue}if(W==="}"){Q--,J.push(W),X++;continue}if(Q===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),J.push($.slice(X,_)),X=_;continue}}}J.push(W),X++}return J.join("")}var LQ=new Set(["script","style","html","head","meta","link","title","!doctype"]);function H$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function OQ($,Z,J){let X=0;while(X<$.length){let Q=$.indexOf(Z,X);if(Q===-1)return!1;if(!H$(Q,Q+Z.length,J))return!0;X=Q+Z.length}return!1}function FQ($,Z){if(OQ($,"<body",Z)){let Q=new RegExp(`<body(${U$})>`,"g"),Y;while((Y=Q.exec($))!==null)if(!H$(Y.index,Y.index+Y[0].length,Z))return Y.index+Y[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${U$})>`,"gi"),X;while((X=J.exec($))!==null){if(H$(X.index,X.index+X[0].length,Z))continue;if(LQ.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function wQ($,Z,J,X){let Q=[],Y=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Q.push($.slice(G,J),Y,$.slice(J,K)),z=!0;else Q.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Q.join("")}async function RQ($,Z,J){let X=QQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\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*\(/,Y=[],{hasUserImports:G,bundleClientScript:z}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3527
|
+
`)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Y-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Y){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Y};while(X<Y){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Q++,J.push(W),X++;continue}if(W==="}"){Q--,J.push(W),X++;continue}if(Q===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),J.push($.slice(X,_)),X=_;continue}}}J.push(W),X++}return J.join("")}var LQ=new Set(["script","style","html","head","meta","link","title","!doctype"]);function H$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function OQ($,Z,J){let X=0;while(X<$.length){let Q=$.indexOf(Z,X);if(Q===-1)return!1;if(!H$(Q,Q+Z.length,J))return!0;X=Q+Z.length}return!1}function FQ($,Z){if(OQ($,"<body",Z)){let Q=new RegExp(`<body(${U$})>`,"g"),Y;while((Y=Q.exec($))!==null)if(!H$(Y.index,Y.index+Y[0].length,Z))return Y.index+Y[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${U$})>`,"gi"),X;while((X=J.exec($))!==null){if(H$(X.index,X.index+X[0].length,Z))continue;if(LQ.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function wQ($,Z,J,X){let Q=[],Y=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Q.push($.slice(G,J),Y,$.slice(J,K)),z=!0;else Q.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Q.join("")}async function RQ($,Z,J){let X=QQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\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*\(/,Y=[],{hasUserImports:G,bundleClientScript:z}=await n("stx/client-script-bundler",()=>import("./chunk-ev4djb0p.js"));for(let O of X){let V=O.body;if(A1(O.attrs))V=M1(V);if(Q.test(V)){Y.push({content:V,start:O.start,end:O.end});continue}if(!G(V))continue;try{let w=await z(a1(V).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Q.test(w))Y.push({content:V,start:O.start,end:O.end})}catch{}}if(Y.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Y.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,W=[];for(let O=0;O<Y.length;O++){let V=Y[O].bundled??a1(Y[O].content).code;if(!Y[O].bundled&&G(V))V=await z(V,Z||"",{projectRoot:process.cwd()});V=MQ(V);let w=Z1(V);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
3528
3528
|
${w}`)}let U=W.join(`
|
|
3529
3529
|
|
|
3530
3530
|
`);U=VQ(U);let H=DQ(U),j=H.split(",").map((O)=>O.trim()).filter(Boolean),B=j$(U,J),_=`
|
|
@@ -3559,13 +3559,13 @@ ${q.join(`
|
|
|
3559
3559
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(w$.set(Y,H),Q.failOnViolation)throw Error(H);else console.warn(H)}hQ();import D$ from"path";var fQ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,xQ=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function gQ($,Z){if(!Z||!$.includes("/"))return $;let J=D$.dirname(Z);return $.replace(fQ,(X,Q,Y,G)=>{let z=D$.resolve(J,G);return`${Q}${Y}${z.split(D$.sep).join("/")}${Y}`})}function b6($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(xQ,(J,X,Q,Y)=>`${X}${gQ(Q,Z)}${Y}`)}var T1="<!--PARENT_CONTENT_PLACEHOLDER-->";function y6($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function dQ($,Z){let J=$.length,X=Z,Q=!0,Y=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
|
|
3560
3560
|
`,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(z==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(z==="/"&&Q){let q=X+1,K=!1;while(q<J){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")K=!0;else if(W==="]")K=!1;else if(W==="/"&&!K){q++;break}else if(W===`
|
|
3561
3561
|
`){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(z==="'"||z==='"'){let q=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
|
|
3562
|
-
`)break;X++}Q=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}if(Y.length===0)Q=!1;continue}if(z==="}"&&Y.length>0){Y.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Q=!1;else Q=!0;X++}return-1}function s6($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,Y=$.indexOf("</script>",Q);if(Y===-1)return null;let G=$.indexOf(">",Y);if(G===-1)return null;return{start:X.index,end:G+1}}var C6=/<style\b[^>]*>/iy,S6=/<\/style>/gi,P6=/<script\b[^>]*>/iy;function v6($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Q=$.indexOf("-->",J+4);Z=Q===-1?$.length:Q+3;continue}C6.lastIndex=J;let X=C6.exec($);if(X){S6.lastIndex=J+X[0].length;let Q=S6.exec($);Z=Q===null?$.length:Q.index+8;continue}if(P6.lastIndex=J,P6.test($))return J;Z=J+1}return-1}async function f6($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await n("stx/client-module-registry",()=>import("./chunk-
|
|
3562
|
+
`)break;X++}Q=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}if(Y.length===0)Q=!1;continue}if(z==="}"&&Y.length>0){Y.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){Y.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Q=!1;else Q=!0;X++}return-1}function s6($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,Y=$.indexOf("</script>",Q);if(Y===-1)return null;let G=$.indexOf(">",Y);if(G===-1)return null;return{start:X.index,end:G+1}}var C6=/<style\b[^>]*>/iy,S6=/<\/style>/gi,P6=/<script\b[^>]*>/iy;function v6($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Q=$.indexOf("-->",J+4);Z=Q===-1?$.length:Q+3;continue}C6.lastIndex=J;let X=C6.exec($);if(X){S6.lastIndex=J+X[0].length;let Q=S6.exec($);Z=Q===null?$.length:Q.index+8;continue}if(P6.lastIndex=J,P6.test($))return J;Z=J+1}return-1}async function f6($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await n("stx/client-module-registry",()=>import("./chunk-hp3rjwnb.js")),Q=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Q)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Q.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function mQ($,Z=""){let J=s6($,"data-stx-runtime");if(!J)return $;let X=v6($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
|
|
3563
3563
|
`+$.slice(X,J.start)+$.slice(J.end);let Q=$.slice(J.start,J.end),Y=$.slice(0,J.start)+$.slice(J.end),G=v6(Y);if(G===-1)return Q+Z+`
|
|
3564
3564
|
`+Y;return Y.slice(0,G)+Q+Z+`
|
|
3565
3565
|
`+Y.slice(G)}async function N$($,Z,J,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=Y1($,J);let Y=!Z.__stxProcessingDepth;if(Y)d$(Z),Z.__stx_head_injections=e5(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!q9()&&!K9())&&J&&J.endsWith(".stx"))o6($,J);try{return await c6.timeAsync("template-processing",async()=>{let G=await lQ($,Z,J,X,Q);if(Y)G=F$(G);if(Y&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},K=(Z.__stx_runtime_head||null)??n6(),W=(Z.__stx_head_raw||"").trim(),U,H=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)U=H[1].trim(),W=W.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||U||j,_=!K.title&&(!!U||!!j),F=K.meta||[],L=new Set(F.map((A)=>s1(A)).filter(Boolean)),O={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!L.has(s1(A))),...F],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
|
|
3566
3566
|
`),...K.htmlAttrs&&{htmlAttrs:i4(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},V=q$(G);if(G=s4(G,O,{..._&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},V),V)G=o4(G,z),G=n4(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],I=l6(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
3567
3567
|
<meta name="stx-layout" content="${y6(A)}">
|
|
3568
|
-
<meta name="stx-layout-group" content="${y6(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?i0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=b1(G,(I,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Y){let z=Z.__stx_head_injections??e5(),q=G$(G);if(q!==null)z.beforeClose.push(q);let K=X$(G);if(K!==null)z.afterOpen.push(K);G=f4(G,z);let W=X.app?.colorMode;if(W)G=h4(G,W)}if(Y)if(s6(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-
|
|
3568
|
+
<meta name="stx-layout-group" content="${y6(I)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?i0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=b1(G,(I,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Y){let z=Z.__stx_head_injections??e5(),q=G$(G);if(q!==null)z.beforeClose.push(q);let K=X$(G);if(K!==null)z.afterOpen.push(K);G=f4(G,z);let W=X.app?.colorMode;if(W)G=h4(G,W)}if(Y)if(s6(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-c9rs5g1s.js")),B=X.storesDir,_=await j(B);if(_)K=`<script data-stx-stores>${_}</script>`}catch{}q=await f6([G,K],X);try{let{getFrameworkComposableScript:j}=await n("stx/framework-composables",()=>import("./chunk-apjy1a72.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await n("stx/composable-loader",()=>import("./chunk-xwmw1wtk.js")),B=X.composablesDir,_=[q,K,U].filter((L)=>L!==null),F=await j(B,G,_);if(F)W=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,W,U].filter((j)=>j!==null).map((j)=>`
|
|
3569
3569
|
${j}`).join("");G=mQ(G,H)}else{let q=await f6([G],X);if(q){let K=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)G=G.slice(0,K)+q+`
|
|
3570
3570
|
`+G.slice(K)}}if(Y)G=u4(G);if(Y&&Z.__stx_inject_css!==!1)G=await i6(G,void 0,X.buildMode==="serve",!0);else if(Y)G=p6(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof g6)throw G;let z=G instanceof Error?G.message:String(G),q=new R2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:J,context:Z}),u6.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),X.debug)throw q;return h6.createFallbackContent("Template Processing",q)}}async function lQ($,Z,J,X,Q){let Y=process.cwd(),G={...X,partialsDir:X.partialsDir&&!A0.isAbsolute(X.partialsDir)?A0.resolve(Y,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!A0.isAbsolute(X.componentsDir)?A0.resolve(Y,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!A0.isAbsolute(X.layoutsDir)?A0.resolve(Y,X.layoutsDir):X.layoutsDir},z=G,q=$;await iQ(J,Z),pQ(Z,z),q=await D2(()=>M4(q,Z,J,z),q,(V)=>{o0.log(V,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${V.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=_1(q,z9,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let W=K.tokens,U=(V)=>W.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),q=b4(q),q=await N6(q,J,Q);let j={};q=o5(q,j);let B={...Z.__sections||{}},_="",F=j3(H3($)),L=/@nolayout\b/.test(q)||F===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(_=F,!/@section\s*\(/.test(q))q=`@section('content')
|
|
3571
3571
|
${q.trim()}
|
|
@@ -3574,7 +3574,7 @@ ${q.trim()}
|
|
|
3574
3574
|
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let D=$0(R.trim(),Z);if(D===void 0)return V;return B[w]=String(D??""),""}catch{return V}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",T1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=s5(q,j),_){let V=[],w=p0(q),R=_1(w.output,v2,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,I)=>{let N=A==="SCRIPT"?w.scripts[Number(I)]:R.tokens[Number(I)];if(N)V.push(N);return""}),V.length>0){let D=V.join(`
|
|
3575
3575
|
`);B.content=B.content?`${B.content}
|
|
3576
3576
|
${D}`:D,Z.__sections=B}}if(_)try{let V;if(A0.isAbsolute(_))V=_,Q.add(_);else V=await D2(()=>l2(_,J,G,Q),null,()=>{throw new R2(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!V){let N=(k)=>{if(!k)return[];try{let y=A0.isAbsolute(k)?k:A0.resolve(process.cwd(),k);return uQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((k,y,E)=>E.indexOf(k)===y).sort(),T=`Layout not found: ${_} (referenced from ${J})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(T),{layoutPath:_,filePath:J,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new R2(T,J);return q}let w=await D2(()=>Bun.file(V).text(),"",()=>{throw new R2(`Failed to read layout file: ${V}`,J,void 0,void 0,"Layout content could not be loaded")});w=b6(w,V);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let N={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return N[E]=b.trim(),""});for(let[y,E]of Object.entries(N))if(B[y]&&B[y].includes(T1)){let b=B[y].indexOf(T1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+T1.length)}else if(!B[y])B[y]=E;let T={...Z,__sections:B},k=`@layout('${R[1]}')${M}`;return await N$(k,T,V,G,Q)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=o5(D,j),I={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,M,T)=>{return I[M]=T.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,M,T)=>{if(B[M]){let k=B[M];if(k.includes(T1)){let y=I[M]||"",E=k.indexOf(T1);k=k.slice(0,E)+y+k.slice(E+T1.length)}return k}return T||""}),A=cQ(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=s5(A,j),Z.__originalFilePath=J,q=await x6(A,Z,V,G,Q),q=`<!-- stx-layout: ${_} -->
|
|
3577
|
-
${q}`,U(q)}catch(V){return o0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await x6(q,Z,J,G,Q))}function cQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Q)=>{let Y=Z[X];if(Y!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Y))return Y}return Q||""})}function pQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,Y]of Object.entries(process.env))if(Q.startsWith(J)&&Y!==void 0)X[Q]=Y;$.$env=X}async function iQ($,Z){await D2(()=>T4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function nQ($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let Y=Q[1],G=Q[2];if(!/\bserver\b/.test(Y)||!G.trim())continue;try{let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-
|
|
3577
|
+
${q}`,U(q)}catch(V){return o0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await x6(q,Z,J,G,Q))}function cQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Q)=>{let Y=Z[X];if(Y!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Y))return Y}return Q||""})}function pQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,Y]of Object.entries(process.env))if(Q.startsWith(J)&&Y!==void 0)X[Q]=Y;$.$env=X}async function iQ($,Z){await D2(()=>T4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function nQ($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let Y=Q[1],G=Q[2];if(!/\bserver\b/.test(Y)||!G.trim())continue;try{let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-9f5329rv.js"));await q(G,Z,J,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));o0.log(K,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${K.message}`)}}}async function oQ($,Z,J){try{let{interpolateScriptsInTemplate:X}=await n("stx/expressions",()=>import("./chunk-p4w3wjbv.js"));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return o0.log(Q,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Q.message}`),$}}async function x6($,Z,J,X,Q){let Y=$,G=X;if(await nQ(Y,Z,J),Y=await oQ(Y,Z,J),Y=await U4(Y,Z,J),Y=await H4(Y,Z,J),Y=await w7(Y,Z,J,G),Y1(Y))Y=_6(Y,Z),Y=V$(Y,Z);Y=L6(Y);let{processStreamDirectives:z}=await n("stx/streaming",()=>import("./chunk-593kby1d.js"));Y=z(Y,Z),Y=w4(Y,Z,J,G),Y=await P4(Y,Z,J,G,Q),Y=await p5(Y,Z,J,G,Q),Y=U3(Y,Z,J,G);let{processDeferDirectives:q}=await n("stx/defer",()=>import("./chunk-jc57j887.js"));Y=q(Y,Z,J);let{processTeleportDirectives:K}=await n("stx/teleport",()=>import("./chunk-h3t6fjba.js"));Y=K(Y,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await n("stx/transitions",()=>import("./chunk-6njgsr6w.js"));Y=W(Y,Z,J),Y=U(Y);let{processErrorBoundaryDirectives:H}=await n("stx/error-boundaries",()=>import("./chunk-5t0w4h6z.js"));Y=H(Y,Z,J);let{processSuspenseDirectives:j}=await n("stx/suspense",()=>import("./chunk-g6ttsdz1.js"));Y=j(Y,Z,J);let{processAsyncDirectives:B}=await n("stx/async-components",()=>import("./chunk-f9d27v49.js"));Y=B(Y,Z,J);let{processKeepAliveDirectives:_}=await n("stx/keep-alive",()=>import("./chunk-rqrfq305.js"));Y=_(Y,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await n("stx/virtual-scrolling",()=>import("./chunk-1xyhk1wr.js"));Y=F(Y,Z,J),Y=L(Y,Z,J),Y=O(Y,Z,J);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await n("stx/partial-hydration",()=>import("./chunk-j21csh4j.js"));Y=V(Y,Z,J),Y=w(Y);let{processComputedDirectives:R,processWatchDirectives:D}=await n("stx/computed",()=>import("./chunk-ry3a2674.js"));Y=R(Y,Z,J),Y=D(Y,Z,J);let{processFormValidationDirectives:A}=await n("stx/forms-validation",()=>import("./chunk-70cf5h11.js"));Y=A(Y,Z,J);let{processHeadDirective:I,processTitleDirective:N,processMetaDirective:M,resetHead:T}=await n("stx/head",()=>import("./chunk-29gjwajm.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let k=I(Y);if(Y=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
|
|
3578
3578
|
`;if(Y=N(Y,Z),Y=M(Y,Z),Y=I4(Y),Y=H5(Y,Z),Y=F7(Y),Y=N4(Y),Y=await n5(Y,Z,J,G,Q),Y=await p5(Y,Z,J,G,Q),Z.__stxProcessingDepth===1)Y=m$(Y,Z);if(Y=Y.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Y=F$(Y),Y=$1(Y,Z,J),Y=_3(Y,Z,{filePath:J,buildMode:G.buildMode}),Y=j5(Y,Z),Y=B5(Y,Z),Y=j2(Y,Z),Y=R5(Y,Z),Y=D5(Y,Z),Y=await G7(Y,Z,J,G),Y=await D3(Y,Z,J),Y=await d6(Y,Z,J,G),Y=m6(Y,Z,J,G),Y=p3(Y,Z,J,G),Y=i3(Y,Z,J),Y=n3(Y,Z,J,G),Y=L7(Y,Z,J,G),Y=L$(Y,Z),Y=O$(Y),Y=k6(Y),!G.skipEventDirectives)Y=h$(Y,Z,J);if(Y=O3(Y,Z,J),G.debug){let i=/\bx-data\s*=/.test(Y),l=_$($);if(i&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3579
3579
|
Both work on the same page, but they manage separate scopes.
|
|
3580
3580
|
Prefer signals (state/derived/effect) for new components.`)}Y=e7(Y,Z),Y=await V1(Y,Z,J),Y=T6(Y),Y=E6(Y),Y=X3(Y);let{processXElementDirectives:y}=await n("stx/x-element",()=>import("./chunk-hhnzd03k.js"));Y=y(Y);let E=Z.__originalFilePath||J,b=D9(Z);if(Y=await O6(Y,G,E,b),Y=A7(Y,Z),Y=await k4(Y,Z,J,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await n("stx/image-optimization/auto-sibling",()=>import("./chunk-2yp8ang5.js"));Y=await l(Y,{publicDir:i})}if(G.seo?.enabled)Y=o3(Y,Z,G);let C=(i,l,K0=!0)=>{if(!l)return i;let J0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),B0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(J0&&B0){if(K0)i=i.replace(B0[0],J0[0]);if(l=l.replace(J0[0],"").trim(),!l)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${l}
|
|
@@ -3588,7 +3588,7 @@ ${$3()}
|
|
|
3588
3588
|
`+B1}else Y=Y.replace("</head>",`${l}
|
|
3589
3589
|
</head>`)}else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
|
|
3590
3590
|
${l}`);else Y=l+`
|
|
3591
|
-
`+Y}{let{scanScriptTags:i}=await n("stx/signal-processing",()=>import("./chunk-
|
|
3591
|
+
`+Y}{let{scanScriptTags:i}=await n("stx/signal-processing",()=>import("./chunk-c5hk1fxt.js")),l=[];for(let K0 of i(Y)){if(!/\bserver\b/i.test(K0.attrs))continue;let J0=K0.start+K0.fullMatch.indexOf(">")+1,B0=dQ(Y,J0);if(B0===-1)continue;let I0=B0+9;while(I0<Y.length&&/\s/.test(Y[I0]))I0++;l.push({start:K0.start,end:I0})}if(l.length>0){let K0=Array(l.length+1),J0=0;for(let B0=0;B0<l.length;B0++){let{start:I0,end:B1}=l[B0];K0[B0]=Y.slice(J0,I0),J0=B1}K0[l.length]=Y.slice(J0),Y=K0.join("")}}let y0=A9(Y,J);if(y0.hasScoped)Y=y0.html;let Z0=Z.__stx_event_bindings||[],j0=!1,k0=[],f0=/\s:[a-z][\w.-]*\s*=/.test(Y),{scanScriptTags:d0}=await n("stx/signal-processing",()=>import("./chunk-c5hk1fxt.js"));for(let i of d0(Y,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))k0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:l,content:K0}of k0){j0=!0;let J0=K0;R$(K0,J,X.strict,Z.__originalFilePath);let B0=await N9(K0,{eventBindings:Z0,attrs:l,hasColonDirectives:f0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Y=Y.replace(i,()=>B0)}if(j0)Z.__stx_event_bindings=[];if(!j0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let l=y9(i);if(l){let K0=Y.lastIndexOf("</body>");Y=K0===-1?Y+l:Y.slice(0,K0)+l+`
|
|
3592
3592
|
`+Y.slice(K0)}Z.__stx_event_bindings=[]}}if(!Z6(Y)&&J6(Y))Y=await O9(Y,G);if(Y=X6(Y),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Y=V7(Y,Z.cspNonce);return Y}var sQ=[{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"}],rQ=[{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')"}],aQ=[{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 tQ($){let Z=[],J=[];return eQ($,Z),$G($,Z,J),ZG($,J),JG($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function eQ($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function $G($,Z,J){for(let X of sQ){let Q=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Y=new RegExp(X.close,"g"),G=($.match(Q)||[]).length,z=($.match(Y)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function ZG($,Z){for(let J of rQ)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function JG($,Z){for(let J of aQ)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function XG($,Z){let J=$.slice(0,Z).split(`
|
|
3593
3593
|
`);return{line:J.length,column:J[J.length-1].length+1}}function YG($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.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(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function QG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function GG($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Q=X[1].toLowerCase();if(!Q.startsWith("end"))J.add(Q)}return Array.from(J)}import s0 from"path";import $2 from"process";var Q8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","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"],r6=new Set(Q8),zG=new Set(["props","$props","defineProps"]),qG=new Set(["stx","@stacksjs/stx"]),a6=I1(128),t6=I1(64);function KG($){let Z=[],J=0,X=$.split(`
|
|
3594
3594
|
`);for(let Q of X){let Y=J,G=null,z=!1;for(let q=0;q<Q.length;q++){let K=Q[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(K==="{")J++;else if(K==="}")J--}if(Y===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let K=Q.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let U=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...U)}}}}return[...new Set(Z)]}function WG($){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 J(X){if(!X.includes(":"))return X;let Q=[],Y="",G=0,z=0,q=null;for(let K=0;K<X.length;K++){let W=X[K];if(q){if(Y+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Y+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Q.push(Y),Y="";continue}Y+=W}if(Y)Q.push(Y);return Q.map((K)=>{let W=K.trim(),U=W.startsWith("..."),H=U?W.slice(3):W,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let F=H.substring(0,j).trim().replace(/\?$/,""),L=H.substring(j+1),O=-1,V=0;for(let R=0;R<L.length;R++)if(L[R]==="<")V++;else if(L[R]===">")V--;else if(L[R]==="="&&V===0){O=R;break}let w=U?"...":"";if(O!==-1)return`${w}${F} = ${L.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,Y)=>{if(!Y.includes(":"))return X;return`${Q}(${J(Y)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,Y=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,z=1,q=G+1,K=0,W=null;while(q<Z.length&&z>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let H=J(U);Y.push({start:G+1,end:q,replacement:H})}for(let G=Y.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Y[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).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,`
|
|
@@ -3610,11 +3610,11 @@ ${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Y,name:G,value:
|
|
|
3610
3610
|
${Y}`,Q++}while(Q<$.length){let Y=$[Q].trim();if(Y.startsWith(".")||Y.startsWith("?."))X+=`
|
|
3611
3611
|
${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function wG($,Z,J){let X=J,Q=Z+1;while(Q<$.length){let Y=W8(X);if(Y!==-1){if(L0(X,"{","}",Y)!==-1)break}let G=$[Q];X+=`
|
|
3612
3612
|
${G}`,Q++}return{functionCode:X,nextIndex:Q}}function X8($,Z){let J=$0($,Z)??$0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...$2.env}})},Q=Object.keys(X).filter(Z2),Y=Q.map((G)=>X[G]);try{return Function(...Q,`'use strict'; return (${$});`)(...Y)}catch{try{return Function(...Q,`'use strict'; return ${$};`)(...Y)}catch{return}}}async function RG($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Y of X){let[,,G,z]=Y;try{let q=z.trim().replace(/;$/,""),K=X8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Y of Q){let[,,G,z]=Y;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=X8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function DG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function NG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var N2=new i1(500),k9=new i1(1000),O8=33554432,I$=O8;function AG($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===I$)return;I$=Z,I9.setMaxBytes(Z)}var I9=new i1(2000,{maxBytes:O8,sizeOf:($)=>$.output.length});function MG($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Q={};for(let Y of Object.keys(X).sort())Q[Y]=J(X[Y]);return Q};return JSON.stringify(J($))}catch{return null}}function U8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!kG($)}var M9=new Map;function M$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=M9.get(Z);if(J)return J;if(M9.size>=16)M9.clear();let X=new Bun.Transpiler($);return M9.set(Z,X),X}var H8=new WeakMap,IG=256;function M1($){try{let Z=M$({loader:"ts",target:"browser",define:t1()}),J=H8.get(Z);if(!J)J=new Map,H8.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Q=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Q=Q.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Q=Q.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let q=Y.length;return Y.push(z),`"__STX_EXPR_${q}__"`}),Q=Q.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let q=Y.length;return Y.push(z),`"__STX_EXPR_${q}__"`}),Q=Q.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let q=Y.length;return Y.push(z),`"__STX_EXPR_${q}__"`});let G=Z.transformSync(Q);for(let z=0;z<Y.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Y[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Y[z]);if(J.size>=IG){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function TG($){let Z=[],J=new Set,X=0,Q=0,Y=$.length,G=(W)=>{Q++;while(Q<Y){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},z=()=>{Q++;while(Q<Y){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<Y&&W>0)if($[Q]==="{")W++,Q++;else if($[Q]==="}")W--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")z();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<Y&&$[Q]!==`
|
|
3613
|
-
`)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<Y-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((_)=>{let F=_.trim().split(":");return F[F.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Q<Y){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){z();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))K();Q++}return Z}function EG($){let Z=[],J=0,X=0,Q=null;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Y)),X=Y+1}if(X<$.length)Z.push($.slice(X));return Z}function bG($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Q=$[X];if(J){if(Q==="\\"){X++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let Y=$[X-1],G=$[X+1];if(Y==="!"||Y==="<"||Y===">"||Y==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function yG($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,Y=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Y++;else if(q==="{"){if(Y--,Y===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Q);for(let q of EG(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=bG(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function X9($,Z,J,X,Q){let Y=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let L of[Y,Y.toLowerCase(),G(Y),z(Y)])if(q.has(L))return!0}let K=[...new Set([`${Y}.stx`,`${G(Y)}.stx`,`${z(Y)}.stx`])],W=typeof Q.root==="string"?h.resolve(Q.root):void 0,U=W??h.dirname(X),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=J.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Q._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Q.componentsDir),W)j(h.resolve(W,"resources/views/components")),j(h.resolve(W,"resources/components")),j(h.resolve(W,"src/components")),j(h.resolve(W,"components"));let _=Q._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Q.fallbackComponentsDir),Y.startsWith("./")||Y.startsWith("../"))return s(h.resolve(h.dirname(X),`${Y}.stx`));let F=j8(h.resolve(import.meta.dir,"components"));for(let L of H){let O=h.isAbsolute(L)?L:h.resolve(U,L);if(j8(O)===F)continue;for(let V of K)if(await s(h.join(O,V)))return!0}return!1}function j8($){try{return L8.realpathSync($)}catch{return $}}function CG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function SG($){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 PG($){let Z=new Set,J=/\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 X of $){let Q;while((Q=J.exec(X))!==null)Z.add(Q[1]);J.lastIndex=0}return[...Z]}async function N1($,Z,J,X,Q,Y,G,z=new Set,q){let{extractVariables:K}=await n("stx/variable-extractor",()=>import("./chunk-
|
|
3613
|
+
`)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<Y-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((_)=>{let F=_.trim().split(":");return F[F.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Q<Y){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){z();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))K();Q++}return Z}function EG($){let Z=[],J=0,X=0,Q=null;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Y)),X=Y+1}if(X<$.length)Z.push($.slice(X));return Z}function bG($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Q=$[X];if(J){if(Q==="\\"){X++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let Y=$[X-1],G=$[X+1];if(Y==="!"||Y==="<"||Y===">"||Y==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function yG($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,Y=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Y++;else if(q==="{"){if(Y--,Y===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Q);for(let q of EG(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=bG(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function X9($,Z,J,X,Q){let Y=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let L of[Y,Y.toLowerCase(),G(Y),z(Y)])if(q.has(L))return!0}let K=[...new Set([`${Y}.stx`,`${G(Y)}.stx`,`${z(Y)}.stx`])],W=typeof Q.root==="string"?h.resolve(Q.root):void 0,U=W??h.dirname(X),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=J.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Q._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Q.componentsDir),W)j(h.resolve(W,"resources/views/components")),j(h.resolve(W,"resources/components")),j(h.resolve(W,"src/components")),j(h.resolve(W,"components"));let _=Q._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Q.fallbackComponentsDir),Y.startsWith("./")||Y.startsWith("../"))return s(h.resolve(h.dirname(X),`${Y}.stx`));let F=j8(h.resolve(import.meta.dir,"components"));for(let L of H){let O=h.isAbsolute(L)?L:h.resolve(U,L);if(j8(O)===F)continue;for(let V of K)if(await s(h.join(O,V)))return!0}return!1}function j8($){try{return L8.realpathSync($)}catch{return $}}function CG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function SG($){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 PG($){let Z=new Set,J=/\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 X of $){let Q;while((Q=J.exec(X))!==null)Z.add(Q[1]);J.lastIndex=0}return[...Z]}async function N1($,Z,J,X,Q,Y,G,z=new Set,q){let{extractVariables:K}=await n("stx/variable-extractor",()=>import("./chunk-9f5329rv.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&CG(H)?H:"";try{let B=(d)=>d.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Q.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),_(F)];for(let m of d)if(O.has(m)){L=O.get(m);break}}let V=[];if(!L){let d=[`${F}.stx`,`${B(F)}.stx`,`${_(F)}.stx`],m=[...new Set(d)],z0=Q.__originalFilePath,o=[];if(z0){let V0=h.join(h.dirname(z0),"components");o.push(V0)}if(X)o.push(X);let _0=G._rootComponentsDir;if(typeof _0==="string"&&!o.includes(_0))o.push(_0);let w0=h.join(h.dirname(Y),"components");if(!o.includes(w0))o.push(w0);if(G.componentsDir&&G.componentsDir!==X&&!o.includes(G.componentsDir))o.push(G.componentsDir);let C0=typeof G.root==="string"?h.resolve(G.root):void 0,a0=C0??h.dirname(Y),b0=[];if(C0)b0.push(h.resolve(C0,"resources/views/components")),b0.push(h.resolve(C0,"resources/components")),b0.push(h.resolve(C0,"src/components")),b0.push(h.resolve(C0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let V0 of b0)if(!o.includes(V0))o.push(V0);let c0=G._pluginComponentDirs;if(Array.isArray(c0)){for(let V0 of c0)if(typeof V0==="string"&&!o.includes(V0))o.push(V0)}if(G.fallbackComponentsDir&&!o.includes(G.fallbackComponentsDir))o.push(G.fallbackComponentsDir);let X1=[...new Set(o.map((V0)=>{if(!V0)return V0;return h.isAbsolute(V0)?V0:h.resolve(a0,V0)}))];o.length=0,o.push(...X1);let a=`${F}\x00${Y}\x00${X1.join("\x00")}`,t0=k9.get(a);if(t0)if(await s(t0))L=t0;else k9.delete(a);if(!L&&(F.startsWith("./")||F.startsWith("../")))L=h.resolve(h.dirname(Y),`${F}.stx`),V.push(L);else if(!L)for(let V0 of o){if(!V0)continue;for(let I2 of m){let T2=h.join(V0,I2);if(V.push(T2),await s(T2)){L=T2;break}}if(L)break;if(!L)try{let I2=await import("fs");if(!I2.statSync(V0,{throwIfNoEntry:!1})?.isDirectory())continue;let E8=8,T9=[{path:V0,depth:0}];while(T9.length>0&&!L){let E2=T9.pop();if(E2.depth>=E8)continue;let y$;try{y$=I2.readdirSync(E2.path,{withFileTypes:!0})}catch{continue}for(let b2 of y$){if(!b2.isDirectory())continue;if(b2.name==="node_modules"||b2.name.startsWith("."))continue;let C$=h.join(E2.path,b2.name);for(let b8 of m){let E9=h.join(C$,b8);if(V.push(E9),await s(E9)){L=E9;break}}if(L)break;T9.push({path:C$,depth:E2.depth+1})}}}catch{}if(L)break}if(L)k9.set(a,L)}if(!L||!await s(L)){let d=V.length>0?`
|
|
3614
3614
|
Searched paths:
|
|
3615
3615
|
${V.map((m)=>` - ${m}`).join(`
|
|
3616
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(L);let w;if(N2.has(L))w=N2.get(L);else try{w=await Bun.file(L).text(),N2.set(L,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",y2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Q))if(!d.startsWith("__")||R.has(d))D[d]=m;let A=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-
|
|
3617
|
-
`)}`}if(J&&J0.includes("{{ text || slot }}"))J0=J0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B0}=await n("stx/slots",()=>import("./chunk-
|
|
3616
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(L);let w;if(N2.has(L))w=N2.get(L);else try{w=await Bun.file(L).text(),N2.set(L,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",y2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Q))if(!d.startsWith("__")||R.has(d))D[d]=m;let A=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-qsmdvy1z.js"));A=await d(J,Q,Y,G,q)}let I=p0(A),N=[],M=I.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,m)=>{let z0=I.scripts[Number(m)]||"",o=z0.match(/^<script\b([^>]*)>/i)?.[1]||"",_0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),w0=!_0||["module","text/javascript","application/javascript"].includes(_0);if(!/\bserver\b/i.test(o)&&w0)return N.push(z0),"";return z0}),{extractSlotContent:T}=await n("stx/slots",()=>import("./chunk-78akhaws.js")),k=T(M),y={};if(k.defaultSlot?.trim())y.default=k.defaultSlot;for(let[d,m]of k.namedSlots)y[d]=m.content;let E=Q.__stx_scope_seq??={n:0,key:Bun.hash(String(Q.__filename??Y)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...D,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:U,__sections:{},__stx_signals_gate:Y1(w)||SG(J)};yG(w,C);let v=w,P=a2(v);if(P)v=P.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f=[...w.matchAll(g)],r=[],r0=f.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),M0=null,y0=null,Z0=null,j0=0,k0=null;if(AG(G),r0&&I$>0){let d=MG({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(d!==null){M0=`${L}\x00${j1(w)}\x00${d}`;let m=I9.get(M0);if(m){for(let z0 of m.dependencies)q.add(z0);if(p$(Q,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let z0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let o of m.preservedClientExpressions)z0.add(o);Q.__stx_preserved_client_expressions=[...z0]}return m.output}y0=new Set(q),Z0=l$(Q),j0=E.n,k0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[])}}for(let d of f){let m=d[1]||"",z0=d[2]||"",o=m.includes("server");if(A1(m)&&z0.trim())z0=M1(z0);if(o&&z0)try{await K(z0,C,L)}catch(w0){}if(!o){let w0=z0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),C0=w0.includes("{{")&&w0.includes("}}"),a0=w0.includes("{!!")&&w0.includes("!!}");if(C0||a0)w0=v9(w0,C);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");r.push(`<script${b0}>${w0}</script>`)}}let f0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d0=f0?f0[1]:"",i=f0?f0[2]:"",l="",K0=d0&&/\bscoped\b/i.test(d0);if(f0)l=`<style${d0}>${i}</style>`;let J0=v;if(J0=J0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f0)J0=J0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(J0=J0.replace(d,(z0,o)=>{let _0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(_0)m.push(`<style${_0[1]}>${_0[2]}</style>`);return""}),J0=J0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)l=`${l}${m.join(`
|
|
3617
|
+
`)}`}if(J&&J0.includes("{{ text || slot }}"))J0=J0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:B0}=await n("stx/slots",()=>import("./chunk-78akhaws.js")),{defaultSlot:I0,namedSlots:B1}=k;J0=await B0(J0,I0,B1,C);let M2=r.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),k2=PG(r),S=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(k2.length>0||S.length>0)C.__stx_client_signal_names=[...new Set([...S,...k2])];let x={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:M2||r.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let c=await N$(J0,C,L,x,q),e=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let d of c.matchAll(/\{\{([\s\S]*?)\}\}/g))e.add(d[1].trim());if(e.size>0)Q.__stx_preserved_client_expressions=[...e];let X0=b,Y0=c;if(M2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${U8(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${U8(j)}"`:"";Y0=`<div data-stx-scope="${X0}"${d}${m}>${c}</div>`;let z0=await Promise.all(r.map(async(o)=>{let _0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_0)return o;let[,w0,C0]=_0,{vendorStyleTags:a0,factoryBody:b0}=await xG(C0,L,G.buildMode==="compile"),c0=j?null:C9(Q,b0),X1=c0?`window.__stxComponentFactories[${JSON.stringify(c0)}](${JSON.stringify(X0)});`:`(${b0})(${JSON.stringify(X0)});`;if(j)return`${a0}<script type="stx/island" data-stx-island="${X0}" data-stx-scoped data-stx-owner="${X0}"${w0}>${X1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${X0}"${w0}>${X1}</script>`}));if(Y0=Y0+`
|
|
3618
3618
|
`+z0.join(`
|
|
3619
3619
|
`),l)Y0+=`
|
|
3620
3620
|
`+l}else{if(l)Y0+=`
|
|
@@ -3637,7 +3637,7 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
|
|
|
3637
3637
|
`,z)W+=`
|
|
3638
3638
|
${t.blue}${t.bold}Context:${t.reset}
|
|
3639
3639
|
${t.dim}${z}${t.reset}
|
|
3640
|
-
`;return W}function E_(){N2.clear(),k9.clear(),I9.clear()}function b_(){return{size:N2.size,maxSize:500}}var k$=I1(128);async function xG($,Z,J){let X=j1($,Z,J),Q=k$.get(X);if(Q){if(V8(Q.deps))return Q;k$.delete(X)}let Y=E$($,{filePath:Z,projectRoot:process.cwd()}),G=Y.code,z=b$(Y.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3640
|
+
`;return W}function E_(){N2.clear(),k9.clear(),I9.clear()}function b_(){return{size:N2.size,maxSize:500}}var k$=I1(128);async function xG($,Z,J){let X=j1($,Z,J),Q=k$.get(X);if(Q){if(V8(Q.deps))return Q;k$.delete(X)}let Y=E$($,{filePath:Z,projectRoot:process.cwd()}),G=Y.code,z=b$(Y.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await n("stx/client-script-bundler",()=>import("./chunk-ev4djb0p.js")),W=[],U=!1;if(q(G)){let L=G;G=await K(L,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===L}let{stripStxRuntimeImports:H}=await n("stx/signal-processing",()=>import("./chunk-c5hk1fxt.js"));G=H(G);let j=Z1(G),B=TG(j),_=`function(__scopeId) {
|
|
3641
3641
|
${p1("const",[...B8,...B],j)}
|
|
3642
3642
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3643
3643
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3736,7 +3736,7 @@ else {
|
|
|
3736
3736
|
// STX: auto-generated event bindings
|
|
3737
3737
|
${$.map((J,X)=>$z(J,X)).join(`
|
|
3738
3738
|
`)}`}function D8($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,Y=X.length,G=0;while(G<Y){let z=X[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Y){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&K===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){K++,G+=2;continue}if(X[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Y){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Y&&X[G]!==`
|
|
3739
|
-
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Y-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Q++,G++;continue}if(z==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var Jz=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 Xz($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!Jz.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,Y;while((Y=Q.exec($))!==null)X(Y[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Y=G.exec($))!==null)X(Y[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Y=z.exec($))!==null)X(Y[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Y=q.exec($))!==null)X(Y[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Y=K.exec($))!==null)X(Y[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Y=W.exec($))!==null)X(Y[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Y=U.exec($))!==null)X(Y[1]);return Z}async function N9($,Z={}){let J=$,X="",Q=!1,Y=[],G=E$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=b$(G.styles),q=a1(J);J=q.code,Y=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await n("stx/client-script-bundler",()=>import("./chunk-
|
|
3739
|
+
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Y-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Q++,G++;continue}if(z==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var Jz=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 Xz($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!Jz.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,Y;while((Y=Q.exec($))!==null)X(Y[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Y=G.exec($))!==null)X(Y[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Y=z.exec($))!==null)X(Y[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Y=q.exec($))!==null)X(Y[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Y=K.exec($))!==null)X(Y[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Y=W.exec($))!==null)X(Y[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Y=U.exec($))!==null)X(Y[1]);return Z}async function N9($,Z={}){let J=$,X="",Q=!1,Y=[],G=E$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=b$(G.styles),q=a1(J);J=q.code,Y=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await n("stx/client-script-bundler",()=>import("./chunk-ev4djb0p.js"));if(K(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let V=I8(J);J=V.code,X=T8(V.stxImports,V.browserImports.filter((w)=>!Y.includes(w)))}if(X=`${j$(J,Z.serverData)}${X}`,J=Z1(J),!Q&&A1(Z.attrs||""))J=M1(J);let U=Zz(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let V=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${V?` ${V}`:""}`;return`${z}<script ${w}>
|
|
3740
3740
|
${r1(`${X}${J}
|
|
3741
3741
|
${U}`)}
|
|
3742
3742
|
</script>`}let _=A8($),F=/function __stx_setup_/.test(J),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(V){let w=V.length>0?`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{cr as a,dr as b,er as c,fr as d,gr as e,hr as f}from"./chunk-
|
|
2
|
+
import{cr as a,dr as b,er as c,fr as d,gr as e,hr as f}from"./chunk-rsxmjfxq.js";import"./chunk-m6wz1hf5.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-2rp09y5j.js";import"./chunk-whm6bybj.js";import"./chunk-q25mr70f.js";import"./chunk-jsfch50r.js";import"./chunk-6b4k8fay.js";import"./chunk-jb2r696a.js";import"./chunk-k5xtf38q.js";import"./chunk-0tbgvp70.js";import"./chunk-xdq52pwj.js";import"./chunk-ddqkj56r.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Jf as c,Kf as d,Lf as e,Mf as f,Nf as g,Of as h}from"./chunk-
|
|
2
|
+
import{Jf as c,Kf as d,Lf as e,Mf as f,Nf as g,Of as h}from"./chunk-m78y5qys.js";import{og as a,rg as b}from"./chunk-fvcr26a0.js";import"./chunk-zdx9s3z0.js";import"./chunk-91007tan.js";import"./chunk-rsxmjfxq.js";import"./chunk-m6wz1hf5.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-2rp09y5j.js";import"./chunk-whm6bybj.js";import"./chunk-q25mr70f.js";import"./chunk-jsfch50r.js";import"./chunk-6b4k8fay.js";import"./chunk-jb2r696a.js";import"./chunk-k5xtf38q.js";import"./chunk-0tbgvp70.js";import"./chunk-xdq52pwj.js";import"./chunk-ddqkj56r.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
|
|
@@ -17,7 +17,7 @@ catch (e) {
|
|
|
17
17
|
}
|
|
18
18
|
throw e;
|
|
19
19
|
}
|
|
20
|
-
`),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-c7av0px6.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
|
|
20
|
+
`),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-v2fp9vkh.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
|
|
21
21
|
`);for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean),R=[],g=[];for(let u of C){let qJ=u.startsWith("dark:"),GJ=`.${(qJ?u.slice(5):u).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<v.length;k++){let zJ=v[k].trim();if(zJ===`${GJ} {`||zJ.startsWith(`${GJ} {`)){let E=k,YJ="";while(E<v.length){if(YJ+=v[E],v[E].includes("}"))break;E++}let d=YJ.match(/\{([^}]+)\}/);if(d)if(qJ)g.push(d[1].trim());else R.push(d[1].trim());break}}}if(R.length)I+=`
|
|
22
22
|
.${B} { ${R.join(" ")} }`;if(g.length)I+=`
|
|
23
23
|
@media (prefers-color-scheme: dark) { .dark .${B} { ${g.join(" ")} } }`}return I=hJ+I,FJ(W,I),jQ(W,I),I}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function Z0(J,Q,Z=!1,$=!1){let U=await LQ(J,Q);if(!U)return $?QJ(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${VQ(U)}.css">`:`<style data-css="generated">
|