@stacksjs/stx 0.2.603 → 0.2.604
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/builtins/stx-image.js +9 -1
- package/dist/{chunk-z45vasvd.js → chunk-00vp75pj.js} +1 -1
- package/dist/{chunk-ydjvq37t.js → chunk-08p1kxsj.js} +1 -1
- package/dist/{chunk-0503xem3.js → chunk-0rekvsy4.js} +1 -1
- package/dist/chunk-1sbj8yqe.js +2 -0
- package/dist/{chunk-dp3y2rzk.js → chunk-38mt99p3.js} +1 -1
- package/dist/{chunk-hzx1w6zp.js → chunk-3xdfqn0d.js} +2 -2
- package/dist/{chunk-g0vea6pt.js → chunk-5c153w4j.js} +1 -1
- package/dist/{chunk-ab2pgm10.js → chunk-6vncjspv.js} +1 -1
- package/dist/{chunk-xqq5qhry.js → chunk-788d9msn.js} +1 -1
- package/dist/{chunk-5p6hhtts.js → chunk-79zfhk62.js} +1 -1
- package/dist/{chunk-ws47nafx.js → chunk-7ejmya3v.js} +1 -1
- package/dist/{chunk-251nphdz.js → chunk-8mffwm1f.js} +1 -1
- package/dist/{chunk-hcpp6yar.js → chunk-8txwa114.js} +1 -1
- package/dist/{chunk-5gc66nr0.js → chunk-a1szmtn1.js} +2 -2
- package/dist/{chunk-e7hmrrmt.js → chunk-afmzxwj1.js} +1 -1
- package/dist/{chunk-m8hf7ptd.js → chunk-bk3yktq8.js} +1 -1
- package/dist/{chunk-dwdfgvt5.js → chunk-bn7fzfc2.js} +1 -1
- package/dist/{chunk-2mb8tf3m.js → chunk-bpz3yv92.js} +1 -1
- package/dist/{chunk-hpjtzap4.js → chunk-bx3qewwk.js} +1 -1
- package/dist/{chunk-r6s1bweb.js → chunk-de3gknmn.js} +1 -1
- package/dist/{chunk-4zynysf7.js → chunk-djqmzzn6.js} +1 -1
- package/dist/{chunk-9vyq00n1.js → chunk-eactb0nz.js} +1 -1
- package/dist/{chunk-xkq16s3g.js → chunk-er5wxv0f.js} +1 -1
- package/dist/chunk-esac5ych.js +2 -0
- package/dist/{chunk-gxm1rb64.js → chunk-et8wjgxw.js} +1 -1
- package/dist/{chunk-tsr1segw.js → chunk-ftr0fvw7.js} +2 -2
- package/dist/{chunk-4c3w08zb.js → chunk-g3qbe5y2.js} +1 -1
- package/dist/{chunk-2jmm2r0n.js → chunk-h5g8k974.js} +1 -1
- package/dist/chunk-hvd9qc98.js +2 -0
- package/dist/{chunk-tthvk93d.js → chunk-hvqjs9ps.js} +1 -1
- package/dist/{chunk-cqpa9t8d.js → chunk-j0z7010x.js} +213 -213
- package/dist/{chunk-wv7n3rf7.js → chunk-jb6zejnt.js} +1 -1
- package/dist/{chunk-6xw8e915.js → chunk-jczknjbw.js} +1 -1
- package/dist/{chunk-1qzwmwy3.js → chunk-jjs6nqh1.js} +1 -1
- package/dist/{chunk-7p24w8s7.js → chunk-jmczvhpy.js} +1 -1
- package/dist/{chunk-67c7b1sq.js → chunk-kn2exbq7.js} +2 -2
- package/dist/{chunk-1r9pp3n6.js → chunk-r4adpej7.js} +1 -1
- package/dist/{chunk-twzgm77s.js → chunk-rd7w0cx4.js} +5 -5
- package/dist/{chunk-8703zy2m.js → chunk-rd9yv1n3.js} +1 -1
- package/dist/{chunk-s7j2nfgm.js → chunk-t9914jjh.js} +1 -1
- package/dist/{chunk-2hfkz731.js → chunk-vmsw9sdw.js} +1 -1
- package/dist/{chunk-ej48g5jf.js → chunk-wf2wnmjg.js} +1 -1
- package/dist/{chunk-cazey998.js → chunk-xarb7knj.js} +1 -1
- package/dist/{chunk-g1fzq7ph.js → chunk-xcyreehd.js} +1 -1
- package/dist/{chunk-vdx8k2rz.js → chunk-xe7jw7nn.js} +1 -1
- package/dist/{chunk-00prqyk1.js → chunk-xwatzxk5.js} +1 -1
- package/dist/{chunk-c5f6nasc.js → chunk-ydt4sd6m.js} +1 -1
- package/dist/{chunk-evzxtxk3.js → chunk-zg0pnh4w.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-5h7804sa.js +0 -2
- package/dist/chunk-gdnyhem4.js +0 -2
- package/dist/chunk-vjp3zha1.js +0 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mn,y,Xi,Ht,Qs,Ji,Yi,Zi,Qi}from"./chunk-b3c1gggs.js";import{O}from"./chunk-jtq8e3b0.js";import{t,Y,xr,i,se,Js,I,Ft,On,Ys,l,p,Ki,D,Re,it,c,kr}from"./chunk-38mt83wa.js";import{jn,Bn,$r,Pe}from"./chunk-nfht2ryp.js";import{S,qs,st,Gs,Hi,En,Tn,Vi,$e,Ui,$n,Wi,Bt,Ks,qi,Rn,Pn,vr,ye,Xs,be,wr}from"./chunk-gh181dnr.js";import{Hs,Vs,Us,Ws,mr,hr}from"./chunk-qf39z0hg.js";import{Bi,Bs,pr,fr}from"./chunk-k71e38fk.js";import{me,jt,gr,zs,C,nt}from"./chunk-48s1nprc.js";import{_n}from"./chunk-
|
|
2
|
+
import{Mn,y,Xi,Ht,Qs,Ji,Yi,Zi,Qi}from"./chunk-b3c1gggs.js";import{O}from"./chunk-jtq8e3b0.js";import{t,Y,xr,i,se,Js,I,Ft,On,Ys,l,p,Ki,D,Re,it,c,kr}from"./chunk-38mt83wa.js";import{jn,Bn,$r,Pe}from"./chunk-nfht2ryp.js";import{S,qs,st,Gs,Hi,En,Tn,Vi,$e,Ui,$n,Wi,Bt,Ks,qi,Rn,Pn,vr,ye,Xs,be,wr}from"./chunk-gh181dnr.js";import{Hs,Vs,Us,Ws,mr,hr}from"./chunk-qf39z0hg.js";import{Bi,Bs,pr,fr}from"./chunk-k71e38fk.js";import{me,jt,gr,zs,C,nt}from"./chunk-48s1nprc.js";import{_n}from"./chunk-jczknjbw.js";import{so}from"./chunk-82bttwqm.js";import{Ii,Oi,Ni,Mi}from"./chunk-t19th11m.js";import{tt}from"./chunk-25zpd110.js";import{s,Ee}from"./chunk-6eg9a3mt.js";import{Lt,zi,kn,a,Cn}from"./chunk-dgtxj56t.js";import{d}from"./chunk-yn2d8x8m.js";import{E,N,Dn,Zs}from"./chunk-zvs13kgh.js";import{Rr}from"./chunk-67m2prah.js";import Yr from"path";import Po from"fs";var Mh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Za(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Mh.has(v.toLowerCase())}var Iu=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"]),Pu={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"},Nh=new Set(["ctrl","alt","shift","meta"]),Mu={left:0,middle:1,right:2};function Du(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Nh.has(R))_.systemKeys.push(R);else if(R in Mu)_.mouse=R;else if(R in Pu||/^[a-z]$/.test(R))_.keys.push(Pu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Nu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,F,W]=B,U=B.index,H=U+z.length,q=`__stx_evt_${_}${R++}`,ie=[],Z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Q;while((Q=Z.exec(W))!==null){let[,ae,ce]=Q,ue=ae.split("."),le=ue[0];if(!Iu.has(le))continue;ie.push({attribute:`@${ae}`,event:le,handler:ce,modifiers:Du(ue.slice(1)),elementId:q})}let oe=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Q=oe.exec(W))!==null){let[,ae,ce]=Q,ue=ae.split("."),le=ue[0];if(!Iu.has(le))continue;ie.push({attribute:`@${ae}`,event:le,handler:ce,modifiers:Du(ue.slice(1)),elementId:q})}if(ie.length>0)k.push({originalTag:z,elementId:q,events:ie,startIndex:U,endIndex:H})}return k}function jh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Mu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Lh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function Ga(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Bh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=jh(v),T=Lh(Ga(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(Za(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",F=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${k}');
|
|
5
5
|
if (!$el) return;
|
|
6
6
|
// Run mounted handler immediately (DOM is ready)
|
|
7
7
|
var scope = $el.closest('[data-stx-scope]');
|
|
8
8
|
if (scope && scope.__stx_execute) {
|
|
9
|
-
scope.__stx_execute('${
|
|
9
|
+
scope.__stx_execute('${F}', null, $el);
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
|
-
__stx_runHandler('${
|
|
12
|
+
__stx_runHandler('${F}', null, $el);
|
|
13
13
|
}
|
|
14
14
|
})();`;if(v.event==="unmounted")return`
|
|
15
15
|
(function() {
|
|
@@ -23,10 +23,10 @@ else {
|
|
|
23
23
|
observer.disconnect();
|
|
24
24
|
var scope = $el.closest('[data-stx-scope]');
|
|
25
25
|
if (scope && scope.__stx_execute) {
|
|
26
|
-
scope.__stx_execute('${
|
|
26
|
+
scope.__stx_execute('${F}', null, $el);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
__stx_runHandler('${
|
|
29
|
+
__stx_runHandler('${F}', null, $el);
|
|
30
30
|
}
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -46,11 +46,11 @@ else {
|
|
|
46
46
|
// Find the closest reactive scope and execute within its context
|
|
47
47
|
var scope = $el.closest('[data-stx-scope]');
|
|
48
48
|
if (scope && scope.__stx_execute) {
|
|
49
|
-
scope.__stx_execute('${
|
|
49
|
+
scope.__stx_execute('${F}', $event, $el);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
-
__stx_runHandler('${
|
|
53
|
+
__stx_runHandler('${F}', $event, $el);
|
|
54
54
|
}
|
|
55
55
|
}${z});
|
|
56
56
|
})();`}function Ja(v){if(v.length===0)return"";return`
|
|
@@ -111,20 +111,20 @@ else {
|
|
|
111
111
|
${v.map(Bh).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function zh(v,_=""){let k=Nu(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],
|
|
115
|
-
`+T.slice(z);else T+=B;return T}function Lu(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function to(v,_){let k=s(v),{depths:R,balanced:T}=Ee(k),B=(W)=>!T||R[W]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let W of k.matchAll(z)){let F=(W.index??0)+W[0].length-W[1].length;if(B(F))return!0}for(let W of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(W.index??0)&&Lu(W[1],!0).has(_))return!0;for(let W of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(W.index??0)&&Lu(W[1],!1).has(_))return!0;return!1}var Bu="",Bo,_r=/^[A-Za-z_$][\w$]*$/,Wh=new Set(["if","for","while","switch","with"]),zu=["(","[","{"],Wu=[")","]","}"],Fh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Vh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function Ya(v){if(Bo&&v===Bu)return Bo;let{code:_,tokens:k}=Vh(v),R=new Map,T=[];for(let Q=0;Q<k.length;Q++){let oe=k[Q].text;if(["(","[","{"].includes(oe))T.push(Q);else if([")","]","}"].includes(oe)){let ae=T.at(-1);if(ae!==void 0&&["()","[]","{}"].includes(k[ae].text+oe))T.pop(),R.set(ae,Q),R.set(Q,ae)}}function B(Q,oe){let ae=[],ce=Q;for(let ue=Q;ue<oe;ue++){if(["(","[","{"].includes(k[ue].text)&&(R.get(ue)??oe)<oe){ue=R.get(ue);continue}if(k[ue].text===",")ae.push([ce,ue]),ce=ue+1}return ae.push([ce,oe]),ae}let z=[];function W(Q,oe,ae,ce=!1){if(k[Q]?.text==="...")Q++;if(Q>=oe)return;let ue=k[Q].text;if(_r.test(ue)){if(ae.add(ue),ae===H)z.push({name:ue,token:Q,functionScoped:ce});return}if(ue!=="{"&&ue!=="[")return;let le=R.get(Q);if(le===void 0||le>=oe)return;for(let[Ae,ve]of B(Q+1,le)){let he=Ae;if(ue==="{")for(let Te=Ae;Te<ve;Te++){if(k[Te].text===":"){he=Te+1;break}if(k[Te].text==="=")break;if(["(","[","{"].includes(k[Te].text)&&R.has(Te))Te=R.get(Te)}W(he,ve,ae,ce)}}function F(Q,oe){let ae=new Set;for(let[ce,ue]of B(Q,oe))W(ce,ue,ae);return ae}function U(Q){let oe=Q;for(;oe<k.length;oe++){let ae=k[oe].text;if(["(","[","{"].includes(ae)&&R.has(oe)){oe=R.get(oe);continue}if([",",";",")","]","}"].includes(ae))break}return k[Math.max(Q,oe-1)]?.end??_.length}let H=new Set,q=[];for(let Q=0;Q<k.length;Q++)if(k[Q].text==="=>"){let oe=Q-1,ae=oe,ce;if(k[oe]?.text===")"&&R.has(oe))ae=R.get(oe),ce=F(ae+1,oe);else if(k[oe]&&_r.test(k[oe].text))ce=new Set([k[oe].text]);else continue;let ue=Q+1,le=k[ue]?.text==="{"&&R.has(ue)?k[R.get(ue)].end:U(ue);q.push({start:k[ae].start,end:le,bodyStart:k[ue]?.start??le,functionBody:!0,names:ce})}else if(k[Q].text==="("&&R.has(Q)){let oe=k[Q-1]?.text;if(!oe||Wh.has(oe)||!_r.test(oe)&&oe!=="*"&&oe!=="]")continue;let ae=R.get(Q),ce=ae+1;if(k[ce]?.text===":"){ce++;while(ce<k.length&&!["{","=>",";","="].includes(k[ce].text))ce++}if(k[ce]?.text!=="{"||!R.has(ce))continue;q.push({start:k[Q].start,end:k[R.get(ce)].end,bodyStart:k[ce].start,functionBody:oe!=="catch",names:F(Q+1,ae)})}function ie(Q){let oe=Q;for(;oe<k.length;oe++){let ae=k[oe].text;if(zu.includes(ae)&&R.has(oe)){oe=R.get(oe);continue}if(ae===";"||Wu.includes(ae))break;let ce=k[oe-1];if(oe>Q&&Fh.has(ae)&&ce.text!==".")break;if(oe>Q&&/[\n\r]/.test(_.slice(ce.end,k[oe].start))&&(/^[\w$]+$/.test(ce.text)||Wu.includes(ce.text)||['"',"'","`"].includes(ce.text))&&_r.test(ae)&&!["in","of","instanceof"].includes(ae))break}return oe}let Z=[];for(let Q=0;Q<k.length;Q++){if(k[Q].text!=="for")continue;let oe=k[Q+1]?.text==="await"?Q+2:Q+1;if(k[oe]?.text!=="("||!R.has(oe))continue;let ae=R.get(oe),ce=ae+1,ue=k[ce]?.text==="{"&&R.has(ce)?R.get(ce):ie(ce),le=k[ue]?.text===";"||k[ue]?.text==="}"?k[ue].end:k[Math.max(ce,ue-1)]?.end??_.length;Z.push({headStart:oe,headEnd:ae,start:k[oe].start,end:le})}for(let Q=0;Q<k.length;Q++){let oe=k[Q].text,ae=k[Q-1]?.text;if(ae==="."||k[Q+1]?.text===":")continue;if(ae==="as"||ae==="<")continue;if(oe==="const"||oe==="let"||oe==="var"){let ce=ie(Q+1),ue=Q+1,le=!1,Ae=!1,ve=0;for(let he=Q+1;he<=ce;he++){let Te=k[he]?.text;if(he<ce&&zu.includes(Te)&&R.has(he)&&R.get(he)<ce){he=R.get(he);continue}if(he<ce&&Te===":"&&!Ae)le=!0;else if(he<ce&&Te==="="&&ve===0)le=!1,Ae=!0;else if(he<ce&&le&&Te==="<")ve++;else if(he<ce&&le&&Te===">"&&ve>0)ve--;else if(he===ce||Te===","&&ve===0)W(ue,he,H,oe==="var"),ue=he+1,le=!1,Ae=!1}}else if(oe==="function"||oe==="class"){let ce=Q+1;if(k[ce]?.text==="*")ce++;if(k[ce]&&_r.test(k[ce].text)&&k[ce].text!=="extends")H.add(k[ce].text),z.push({name:k[ce].text,token:ce})}else if(oe==="import"){let ce=Q+1;if(k[ce]?.text==="*"&&k[ce+1]?.text==="as")ce+=2;let ue=k[ce]?.text;if(ue&&_r.test(ue)&&ue!=="type"&&k[ce+1]?.text!=="("&&k[ce+1]?.text!==".")H.add(ue),z.push({name:ue,token:ce,file:!0});let le=k[ce]?.text==="{"?ce:k[ce+1]?.text===","&&k[ce+2]?.text==="{"?ce+2:-1;if(le!==-1&&R.has(le)){let Ae=R.get(le);for(let[ve,he]of B(le+1,Ae)){let Te=he-1;while(Te>=ve&&!_r.test(k[Te].text))Te--;if(Te>=ve&&k[Te].text!=="type")z.push({name:k[Te].text,token:Te,file:!0})}}}}return Bu=v,Bo={code:_,scopes:q,loops:Z,declarations:H,sites:z,tokens:k,pairs:R},Bo}function Qa(v){let _=Ya(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function zo(v){return new Set(Ya(v).declarations)}function Rt(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=Ya(v),W=Array.from({length:B.length},()=>-1),F=[];for(let Z=0;Z<B.length;Z++){W[Z]=F.length?F[F.length-1]:-1;let Q=B[Z].text;if(Q==="{"&&z.has(Z))F.push(Z);else if(Q==="}"&&F.length&&z.get(Z)===F[F.length-1])F.pop()}let U=new Set,H=new Map;for(let Z of T){if(!_.has(Z.name))continue;U.add(Z.token);let Q=Z.file?-1:W[Z.token],oe=Q===-1?[0,Number.POSITIVE_INFINITY]:[B[Q].start,B[z.get(Q)].end];if(Z.functionScoped){let ce=B[Z.token].start,ue=k.filter((le)=>le.functionBody&&ce>=le.bodyStart&&ce<le.end).sort((le,Ae)=>le.end-le.bodyStart-(Ae.end-Ae.bodyStart))[0];oe=ue?[ue.bodyStart,ue.end]:[0,Number.POSITIVE_INFINITY]}else if(!Z.file){let ce=R.filter((ue)=>Z.token>ue.headStart&&Z.token<ue.headEnd).sort((ue,le)=>ue.headEnd-ue.headStart-(le.headEnd-le.headStart))[0];if(ce)oe=[ce.start,ce.end]}let ae=H.get(Z.name);if(ae)ae.push(oe);else H.set(Z.name,[oe])}let q=new Set;for(let Z=0;Z<B.length;Z++){if(B[Z].text!=="import"||B[Z-1]?.text===".")continue;let Q=Z+1;if(B[Q]?.text==="type")Q++;if(B[Q]&&_r.test(B[Q].text)&&B[Q+1]?.text===",")Q+=2;if(B[Q]?.text==="{"&&z.has(Q))for(let oe=Q+1;oe<z.get(Q);oe++)q.add(oe)}let ie=new Set;for(let Z=0;Z<B.length;Z++){let Q=B[Z].text;if(!_.has(Q)||ie.has(Q)||U.has(Z)||q.has(Z))continue;let oe=B[Z-1]?.text;if(oe==="#"||oe==="."&&B[Z-2]?.text!=="..")continue;if(B[Z+1]?.text===":"&&(oe==="{"||oe===","))continue;let ae=B[Z].start;if(H.get(Q)?.some(([ce,ue])=>ae>=ce&&ae<ue))continue;if(k.some((ce)=>ae>=ce.start&&ae<ce.end&&ce.names.has(Q)))continue;ie.add(Q)}return ie}import Wo from"fs";import Gt from"path";function un(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Fu=new Map;function Fo(v,_=!0){let k=Fu.get(v);if(_&&k)return k;let R=new Map,T=[Gt.join(v,"src"),Gt.join(v,"dist"),v];function B(z,W){if(W>6)return;let F;try{F=Wo.readdirSync(z,{withFileTypes:!0})}catch{return}for(let U of F){let H=Gt.join(z,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;B(H,W+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let q=U.name.slice(0,-4);if(!R.has(q))R.set(q,H);let ie=q.toLowerCase();if(!R.has(ie))R.set(ie,H);let Z=un(q);if(!R.has(Z))R.set(Z,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)Fu.set(v,R);return R}function Vo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Gt.join(k,"node_modules",v);try{if(Wo.statSync(R).isDirectory())return R}catch{}let T=Gt.dirname(k);if(T===k)return null;k=T}}function Uo(v,_,k={}){return[Gt.resolve(Gt.dirname(_),`${v}.stx`),Gt.resolve(Gt.dirname(_),v),Gt.resolve(k.componentsDir||"components",`${v}.stx`),Gt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function Vu(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=un(_);return[_,k,R]}function ec(v,_){let[k,R,T]=Vu(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*tc(v,_,k={},R){let T=Vu(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Gt.resolve(Gt.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((F)=>`${F}.stx`))],z=k.projectRoot||process.cwd(),W=[...R?.__originalFilePath?[Gt.join(Gt.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Gt.join(Gt.dirname(_),"components"),Gt.resolve(z,"src/components"),Gt.resolve(z,"components"),...import.meta.dir?[Gt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(W)){for(let U of B)yield Gt.join(F,U);try{for(let U of Wo.readdirSync(F,{withFileTypes:!0}))if(U.isDirectory())for(let H of B)yield Gt.join(F,U.name,H)}catch{}}}function Uu(v,_,k={},R){let T=ec(v,R);if(T!==void 0)return T;for(let B of tc(v,_,k,R))try{if(Wo.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import Eh from"fs";import ct from"path";import{createHash as Uh}from"crypto";var Ho="__stx_component_client_factories";function qo(v){let _=v[Ho];return _ instanceof Map?_:null}function qu(v){v[Ho]=new Map}function nc(v,_){let k=qo(v);if(!k)return null;let R=Uh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function xd(v,_){let k=qo(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),ie=q.exec(v);while(ie!==null){let Z=R.get(JSON.parse(ie[1]));if(Z!==void 0)T.push({start:ie.index,end:ie.index+ie[0].length,replacement:`(${Z})(${ie[2]});`});ie=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return Hu(v,T);let W=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
114
|
+
</script>`}function zh(v,_=""){let k=Nu(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],F=z.originalTag;if(!F.includes(" id="))F=F.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let W=F.match(/id=["']([^"']+)["']/);if(W)for(let U of z.events)U.elementId=W[1]}for(let W of z.events){let U=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");F=F.replace(H,""),F=F.replace(q,"")}R=R.slice(0,z.startIndex)+F+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function Ou(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function ju(v,_,k){if(Ji(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:F,bindings:W}=zh(v,Ou(_)),U=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...U,...W],F}let R=Nu(v,Ou(_));if(R.length===0)return v;let T=v;for(let F=R.length-1;F>=0;F--){let W=R[F],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let H=U.match(/id=["']([^"']+)["']/);if(H)for(let q of W.events)q.elementId=H[1]}for(let H of W.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ie=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),Z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");U=U.replace(ie,""),U=U.replace(Z,"")}T=T.slice(0,W.startIndex)+U+T.slice(W.endIndex)}let B=Ja(R.flatMap((F)=>F.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
|
|
115
|
+
`+T.slice(z);else T+=B;return T}function Lu(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function to(v,_){let k=s(v),{depths:R,balanced:T}=Ee(k),B=(F)=>!T||R[F]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let F of k.matchAll(z)){let W=(F.index??0)+F[0].length-F[1].length;if(B(W))return!0}for(let F of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(F.index??0)&&Lu(F[1],!0).has(_))return!0;for(let F of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(F.index??0)&&Lu(F[1],!1).has(_))return!0;return!1}var Bu="",Bo,_r=/^[A-Za-z_$][\w$]*$/,Fh=new Set(["if","for","while","switch","with"]),zu=["(","[","{"],Fu=[")","]","}"],Wh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Vh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function Ya(v){if(Bo&&v===Bu)return Bo;let{code:_,tokens:k}=Vh(v),R=new Map,T=[];for(let Q=0;Q<k.length;Q++){let oe=k[Q].text;if(["(","[","{"].includes(oe))T.push(Q);else if([")","]","}"].includes(oe)){let ae=T.at(-1);if(ae!==void 0&&["()","[]","{}"].includes(k[ae].text+oe))T.pop(),R.set(ae,Q),R.set(Q,ae)}}function B(Q,oe){let ae=[],ce=Q;for(let ue=Q;ue<oe;ue++){if(["(","[","{"].includes(k[ue].text)&&(R.get(ue)??oe)<oe){ue=R.get(ue);continue}if(k[ue].text===",")ae.push([ce,ue]),ce=ue+1}return ae.push([ce,oe]),ae}let z=[];function F(Q,oe,ae,ce=!1){if(k[Q]?.text==="...")Q++;if(Q>=oe)return;let ue=k[Q].text;if(_r.test(ue)){if(ae.add(ue),ae===H)z.push({name:ue,token:Q,functionScoped:ce});return}if(ue!=="{"&&ue!=="[")return;let le=R.get(Q);if(le===void 0||le>=oe)return;for(let[Ae,ve]of B(Q+1,le)){let he=Ae;if(ue==="{")for(let Te=Ae;Te<ve;Te++){if(k[Te].text===":"){he=Te+1;break}if(k[Te].text==="=")break;if(["(","[","{"].includes(k[Te].text)&&R.has(Te))Te=R.get(Te)}F(he,ve,ae,ce)}}function W(Q,oe){let ae=new Set;for(let[ce,ue]of B(Q,oe))F(ce,ue,ae);return ae}function U(Q){let oe=Q;for(;oe<k.length;oe++){let ae=k[oe].text;if(["(","[","{"].includes(ae)&&R.has(oe)){oe=R.get(oe);continue}if([",",";",")","]","}"].includes(ae))break}return k[Math.max(Q,oe-1)]?.end??_.length}let H=new Set,q=[];for(let Q=0;Q<k.length;Q++)if(k[Q].text==="=>"){let oe=Q-1,ae=oe,ce;if(k[oe]?.text===")"&&R.has(oe))ae=R.get(oe),ce=W(ae+1,oe);else if(k[oe]&&_r.test(k[oe].text))ce=new Set([k[oe].text]);else continue;let ue=Q+1,le=k[ue]?.text==="{"&&R.has(ue)?k[R.get(ue)].end:U(ue);q.push({start:k[ae].start,end:le,bodyStart:k[ue]?.start??le,functionBody:!0,names:ce})}else if(k[Q].text==="("&&R.has(Q)){let oe=k[Q-1]?.text;if(!oe||Fh.has(oe)||!_r.test(oe)&&oe!=="*"&&oe!=="]")continue;let ae=R.get(Q),ce=ae+1;if(k[ce]?.text===":"){ce++;while(ce<k.length&&!["{","=>",";","="].includes(k[ce].text))ce++}if(k[ce]?.text!=="{"||!R.has(ce))continue;q.push({start:k[Q].start,end:k[R.get(ce)].end,bodyStart:k[ce].start,functionBody:oe!=="catch",names:W(Q+1,ae)})}function ie(Q){let oe=Q;for(;oe<k.length;oe++){let ae=k[oe].text;if(zu.includes(ae)&&R.has(oe)){oe=R.get(oe);continue}if(ae===";"||Fu.includes(ae))break;let ce=k[oe-1];if(oe>Q&&Wh.has(ae)&&ce.text!==".")break;if(oe>Q&&/[\n\r]/.test(_.slice(ce.end,k[oe].start))&&(/^[\w$]+$/.test(ce.text)||Fu.includes(ce.text)||['"',"'","`"].includes(ce.text))&&_r.test(ae)&&!["in","of","instanceof"].includes(ae))break}return oe}let Z=[];for(let Q=0;Q<k.length;Q++){if(k[Q].text!=="for")continue;let oe=k[Q+1]?.text==="await"?Q+2:Q+1;if(k[oe]?.text!=="("||!R.has(oe))continue;let ae=R.get(oe),ce=ae+1,ue=k[ce]?.text==="{"&&R.has(ce)?R.get(ce):ie(ce),le=k[ue]?.text===";"||k[ue]?.text==="}"?k[ue].end:k[Math.max(ce,ue-1)]?.end??_.length;Z.push({headStart:oe,headEnd:ae,start:k[oe].start,end:le})}for(let Q=0;Q<k.length;Q++){let oe=k[Q].text,ae=k[Q-1]?.text;if(ae==="."||k[Q+1]?.text===":")continue;if(ae==="as"||ae==="<")continue;if(oe==="const"||oe==="let"||oe==="var"){let ce=ie(Q+1),ue=Q+1,le=!1,Ae=!1,ve=0;for(let he=Q+1;he<=ce;he++){let Te=k[he]?.text;if(he<ce&&zu.includes(Te)&&R.has(he)&&R.get(he)<ce){he=R.get(he);continue}if(he<ce&&Te===":"&&!Ae)le=!0;else if(he<ce&&Te==="="&&ve===0)le=!1,Ae=!0;else if(he<ce&&le&&Te==="<")ve++;else if(he<ce&&le&&Te===">"&&ve>0)ve--;else if(he===ce||Te===","&&ve===0)F(ue,he,H,oe==="var"),ue=he+1,le=!1,Ae=!1}}else if(oe==="function"||oe==="class"){let ce=Q+1;if(k[ce]?.text==="*")ce++;if(k[ce]&&_r.test(k[ce].text)&&k[ce].text!=="extends")H.add(k[ce].text),z.push({name:k[ce].text,token:ce})}else if(oe==="import"){let ce=Q+1;if(k[ce]?.text==="*"&&k[ce+1]?.text==="as")ce+=2;let ue=k[ce]?.text;if(ue&&_r.test(ue)&&ue!=="type"&&k[ce+1]?.text!=="("&&k[ce+1]?.text!==".")H.add(ue),z.push({name:ue,token:ce,file:!0});let le=k[ce]?.text==="{"?ce:k[ce+1]?.text===","&&k[ce+2]?.text==="{"?ce+2:-1;if(le!==-1&&R.has(le)){let Ae=R.get(le);for(let[ve,he]of B(le+1,Ae)){let Te=he-1;while(Te>=ve&&!_r.test(k[Te].text))Te--;if(Te>=ve&&k[Te].text!=="type")z.push({name:k[Te].text,token:Te,file:!0})}}}}return Bu=v,Bo={code:_,scopes:q,loops:Z,declarations:H,sites:z,tokens:k,pairs:R},Bo}function Qa(v){let _=Ya(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function zo(v){return new Set(Ya(v).declarations)}function Rt(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=Ya(v),F=Array.from({length:B.length},()=>-1),W=[];for(let Z=0;Z<B.length;Z++){F[Z]=W.length?W[W.length-1]:-1;let Q=B[Z].text;if(Q==="{"&&z.has(Z))W.push(Z);else if(Q==="}"&&W.length&&z.get(Z)===W[W.length-1])W.pop()}let U=new Set,H=new Map;for(let Z of T){if(!_.has(Z.name))continue;U.add(Z.token);let Q=Z.file?-1:F[Z.token],oe=Q===-1?[0,Number.POSITIVE_INFINITY]:[B[Q].start,B[z.get(Q)].end];if(Z.functionScoped){let ce=B[Z.token].start,ue=k.filter((le)=>le.functionBody&&ce>=le.bodyStart&&ce<le.end).sort((le,Ae)=>le.end-le.bodyStart-(Ae.end-Ae.bodyStart))[0];oe=ue?[ue.bodyStart,ue.end]:[0,Number.POSITIVE_INFINITY]}else if(!Z.file){let ce=R.filter((ue)=>Z.token>ue.headStart&&Z.token<ue.headEnd).sort((ue,le)=>ue.headEnd-ue.headStart-(le.headEnd-le.headStart))[0];if(ce)oe=[ce.start,ce.end]}let ae=H.get(Z.name);if(ae)ae.push(oe);else H.set(Z.name,[oe])}let q=new Set;for(let Z=0;Z<B.length;Z++){if(B[Z].text!=="import"||B[Z-1]?.text===".")continue;let Q=Z+1;if(B[Q]?.text==="type")Q++;if(B[Q]&&_r.test(B[Q].text)&&B[Q+1]?.text===",")Q+=2;if(B[Q]?.text==="{"&&z.has(Q))for(let oe=Q+1;oe<z.get(Q);oe++)q.add(oe)}let ie=new Set;for(let Z=0;Z<B.length;Z++){let Q=B[Z].text;if(!_.has(Q)||ie.has(Q)||U.has(Z)||q.has(Z))continue;let oe=B[Z-1]?.text;if(oe==="#"||oe==="."&&B[Z-2]?.text!=="..")continue;if(B[Z+1]?.text===":"&&(oe==="{"||oe===","))continue;let ae=B[Z].start;if(H.get(Q)?.some(([ce,ue])=>ae>=ce&&ae<ue))continue;if(k.some((ce)=>ae>=ce.start&&ae<ce.end&&ce.names.has(Q)))continue;ie.add(Q)}return ie}import Fo from"fs";import Gt from"path";function un(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Wu=new Map;function Wo(v,_=!0){let k=Wu.get(v);if(_&&k)return k;let R=new Map,T=[Gt.join(v,"src"),Gt.join(v,"dist"),v];function B(z,F){if(F>6)return;let W;try{W=Fo.readdirSync(z,{withFileTypes:!0})}catch{return}for(let U of W){let H=Gt.join(z,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;B(H,F+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let q=U.name.slice(0,-4);if(!R.has(q))R.set(q,H);let ie=q.toLowerCase();if(!R.has(ie))R.set(ie,H);let Z=un(q);if(!R.has(Z))R.set(Z,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)Wu.set(v,R);return R}function Vo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Gt.join(k,"node_modules",v);try{if(Fo.statSync(R).isDirectory())return R}catch{}let T=Gt.dirname(k);if(T===k)return null;k=T}}function Uo(v,_,k={}){return[Gt.resolve(Gt.dirname(_),`${v}.stx`),Gt.resolve(Gt.dirname(_),v),Gt.resolve(k.componentsDir||"components",`${v}.stx`),Gt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function Vu(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=un(_);return[_,k,R]}function ec(v,_){let[k,R,T]=Vu(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*tc(v,_,k={},R){let T=Vu(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Gt.resolve(Gt.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((W)=>`${W}.stx`))],z=k.projectRoot||process.cwd(),F=[...R?.__originalFilePath?[Gt.join(Gt.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Gt.join(Gt.dirname(_),"components"),Gt.resolve(z,"src/components"),Gt.resolve(z,"components"),...import.meta.dir?[Gt.resolve(import.meta.dir,"components")]:[]];for(let W of new Set(F)){for(let U of B)yield Gt.join(W,U);try{for(let U of Fo.readdirSync(W,{withFileTypes:!0}))if(U.isDirectory())for(let H of B)yield Gt.join(W,U.name,H)}catch{}}}function Uu(v,_,k={},R){let T=ec(v,R);if(T!==void 0)return T;for(let B of tc(v,_,k,R))try{if(Fo.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import Eh from"fs";import lt from"path";import{createHash as Uh}from"crypto";var Ho="__stx_component_client_factories";function qo(v){let _=v[Ho];return _ instanceof Map?_:null}function qu(v){v[Ho]=new Map}function nc(v,_){let k=qo(v);if(!k)return null;let R=Uh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function xd(v,_){let k=qo(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),ie=q.exec(v);while(ie!==null){let Z=R.get(JSON.parse(ie[1]));if(Z!==void 0)T.push({start:ie.index,end:ie.index+ie[0].length,replacement:`(${Z})(${ie[2]});`});ie=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return Hu(v,T);let F=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
116
|
(function() {
|
|
117
117
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
118
|
${B.map(([H,q])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${q.body}; }
|
|
119
119
|
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(H)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
120
120
|
`)}
|
|
121
121
|
})();
|
|
122
|
-
</script>`,
|
|
123
|
-
`}),Hu(v,T)}function Hu(v,_){if(_.length===0)return v;_.sort((B,z)=>B.start-z.start||B.end-z.end);let k=Array(_.length*2+1),R=0,T=0;for(let B of _)k[T++]=v.slice(R,B.start),k[T++]=B.replacement,R=B.end;return k[T]=v.slice(R),k.join("")}function bd(v){let _=qo(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function vd(v,_){let k=qo(v);if(!k)return[];let R=[];for(let[T,B]of k){let z=B.instances-(_.get(T)??0);if(z>0)R.push({body:B.body,count:z})}return R}function wd(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)nc(v,k)}import Od from"fs";var Sd=0,rc=new Map;function ai(){Sd=0,rc.clear()}function Ko(v,_){let k=Sd++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return rc.set(R,{type:v,expression:_}),R}function ci(){let v={};for(let[_,k]of rc)v[_]={type:k.type,expression:k.expression};return v}function li(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function ms(v){return v.includes("<!--__STX_")}var Hh=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function qh(v){return Array.from({length:v},()=>"{").join("⁠")}function $d(v){return v.replace(/\{{2,}/g,(_)=>qh(_.length)).replace(/\{(?=!)/g,"{⁠").replace(Hh,"@")}function _d(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),B=R.lastIndexOf(">");if(T>=0&&B>T)return null;if(T<0&&!k)return null;let z=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(z))return/^\s*\/?\s*$/.test(z)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(z))return{kind:"tag-name"};let W=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(W)return{kind:"attribute",name:W[1],quote:'"',valuePrefix:W[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:"'",valuePrefix:F[2]};let U=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(U)return{kind:"attribute",name:U[1],quote:null,valuePrefix:U[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class Jn extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var kd="unsafe:";var Kh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Xh=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Zh=/^data:(?:text\/html|application\/xhtml\+xml)/,Gh=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Jh(v){return v.replace(Gh,"").toLowerCase()}function sc(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function Xo(v,_="navigable"){let k=Jh(v);if(Kh.test(k))return!0;return _==="navigable"?Xh.test(k):Zh.test(k)}function no(v,_="navigable"){return Xo(v,_)?"unsafe:"+v:v}function Yh(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return sc(_[1])}function Ed(v,_,k=256){if(_<=k)return v.slice(0,_);let R=v.slice(_-k,_),T=R.search(/[\s"'`/]/);return T===-1?"":R.slice(T)}function Cd(v,_,k=_){let R=Yh(v);return R&&Xo(_,R)?"unsafe:"+k:k}var Zo=/<script\b[^>]*>/iy,cc=/<\/script\s*>/ig,Go=/<style\b[^>]*>/iy,lc=/<\/style\s*>/ig;function Rd(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let B=R.exec(v);if(!B)return-1;return B.index+B[0].length}function V(v,_){return Rd(v,_,Zo,cc)}function os(v,_){return Rd(v,_,Go,lc)}function We(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Ad(v,_){if(v.startsWith("<!--",_)){let T=We(v,_);return T===-1?v.length:T}if(Zo.lastIndex=_,Zo.exec(v)?.index===_){cc.lastIndex=Zo.lastIndex;let T=cc.exec(v);return T?T.index+T[0].length:v.length}if(Go.lastIndex=_,Go.exec(v)?.index===_){lc.lastIndex=Go.lastIndex;let T=lc.exec(v);return T?T.index+T[0].length:v.length}return-1}function ee(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let W=v[R];if(B){if(z){if(W===z)z=null}else if(W==='"'||W==="'")z=W;else if(W===">")B=!1;R++;continue}if(W!=="<"){let q=v.indexOf("<",R+1);if(q===-1)break;R=q;continue}let F=_(v,R);if(F>R){k.push({start:R,end:F,token:v.slice(R,F)}),R=F;continue}let U=Ad(v,R);if(U>R){R=U;continue}let H=v.charCodeAt(R+1);if(H>=65&&H<=90||H>=97&&H<=122)B=!0;R++}return k}function Td(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let q=v[R];if(B){if(q===B)B=null}else if(q==='"'||q==="'")B=q;else if(q===">")T=!1;R++;continue}let z=v.indexOf("<",R),W=z===-1?v.length:z;while(R<W){let q=v[R++];if(q==="{")_++;else if(q==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let F=Ad(v,z);if(F>z){R=F;continue}let U=v.charCodeAt(z+1),H=U===47?v.charCodeAt(z+2):U;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;R=z+1}return!1}function Id(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var Qh=1024,ey=16777216,ss=new Map,ic=0;function ty(v,_){ss.set(v,_),ic+=v.length+_.output.length;for(let[k,R]of ss){if(ic<=ey)break;ss.delete(k),ic-=k.length+R.output.length}}function Fn(v,_,k,R){let T=R!==void 0&&v.length>=Qh,B=T?`${R}\x00${v}`:"";if(T){let H=ss.get(B);if(H)return ss.delete(B),ss.set(B,H),{output:H.output,tokens:H.tokens.slice()}}let z=ee(v,_);if(z.length===0)return{output:v,tokens:[]};let W=z.map((H)=>H.token),F="",U=0;for(let H=0;H<z.length;H++){let q=z[H];F+=v.slice(U,q.start),F+=k(q.token,H),U=q.end}if(F+=v.slice(U),T)return ty(B,{output:F,tokens:W}),{output:F,tokens:W.slice()};return{output:F,tokens:W}}var ny=1024,ry=16777216,is=new Map,oc=0;function sy(v,_){is.set(v,_),oc+=v.length+_.output.length;for(let[k,R]of is){if(oc<=ry)break;is.delete(k),oc-=k.length+R.output.length}}function ac(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:as(R,k)}}function pn(v){let _=v.length>=ny;if(_){let T=is.get(v);if(T)return is.delete(v),is.set(v,T),ac(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=Fn(v,V,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return sy(v,{output:k,scripts:R}),ac(v,k,R.slice());return ac(v,k,R)}function as(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Pt(v){let _=v.indexOf(" as ");if(_!==-1){let B=v.slice(0,_).trim(),z=v.slice(_+4).trim();return B&&z?{arrayExpr:B,itemVar:z}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let R=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return R&&T?{arrayExpr:T,itemVar:R}:null}function Jo(v){let _=[],k=0,R="",T=0;for(let B=0;B<v.length;B++){let z=v[B];if(R){if(z==="\\")B++;else if(z===R)R="";continue}if(z==="'"||z==='"'||z==="`")R=z;else if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(T,B)),T=B+1}return _.push(v.slice(T)),_}function Pd(v,_){let k=0;for(let R=0;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return R}return-1}function Dd(v){let _=0;for(let k=0;k<v.length;k++){let R=v[k];if(R==="("||R==="["||R==="{")_++;else if((R===")"||R==="]"||R==="}")&&--_===0)return k}return-1}function zr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=Pd(k,"=");if(R!==-1&&k[R+1]!==">")k=k.slice(0,R).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of Jo(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){zr(B,_);continue}let z=Pd(B,":");zr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Jo(k.slice(1,-1)))zr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function cs(v){let _=v.trim(),k=[],R=0;for(let B=0;B<_.length;B++){let z=_[B];if(z==="("||z==="["||z==="{")R++;else if(z===")"||z==="]"||z==="}")R--;else if(R===0&&/\s/.test(z)){if(!/^\s+(?:in|of)\s/.exec(_.slice(B)))continue;let F=_.slice(0,B).trim();if(F.startsWith("(")&&Dd(F)===F.length-1)F=F.slice(1,-1);for(let U of Jo(F))zr(U,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let B=T[1].trim();if(B.startsWith("(")&&Dd(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)zr(z[2],k),zr(z[1],k);else for(let W of Jo(B))zr(W,k)}return k}function Wr(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let z=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let W of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(W))return!0;return!1}var Yo="__stx_client_loop_names";function Er(v){let _=v?.[Yo];return Array.isArray(_)?_:[]}var io={},Md=new Map;function iy(v){let _=Md.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Md.set(v,_)}return _.lastIndex=0,_}var tr={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let R=Number(v);return Number.isNaN(R)?"":R.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let R=Number(v);if(Number.isNaN(R))return String(v);return R.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return It(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let F of B){if(z===void 0||z===null)break;z=z[F]}if(z===void 0||z===null)return T?v:"";let W=String(z);return Object.entries(k).forEach(([F,U])=>{W=W.replace(iy(F),String(U))}),W},t:(v,_,k={})=>tr.translate(v,_,k),truncate:(v,_,k=50,R="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=R.length)return R.substring(0,k);return T.substring(0,k-R.length)+R},date:(v,_,k="short",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let B={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(R,B[k]||B.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(R,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,R)=>{let T=Number(v);if(Number.isNaN(T))return k;let B=R||`${k}s`;return T===1?k:B},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,R)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,R);return v},replace:(v,_,k,R="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>R)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let R=Number(v);if(Number.isNaN(R))return 0;let T=10**k;return Math.round(R*T)/T}};function yc(v,_){if(v in tr)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);io[v]=_}function Ku(v){for(let[_,k]of Object.entries(v))yc(_,k)}function bc(){return{...tr,...io}}function Xu(){for(let v of Object.keys(io))delete io[v]}function vc(v,_,k=2){let R=0,T=null;for(let B=_+k;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="{"){R++;continue}if(z==="}"){if(R>0){R--;continue}let W=0;while(v[B+W]==="}")W++;if(W>=k)return B}}return-1}function nr(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",B=0;for(;;){let z=v.indexOf(R,B);if(z===-1)break;let W=vc(v,z,k);if(W===-1)break;T+=v.slice(B,z)+_(v.slice(z,W+k),v.slice(z+k,W),z),B=W+k}return B===0?v:T+v.slice(B)}function b(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function It(v){return $d(b(v))}function oy(v){return v.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function ay(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function cy(v,_){let k=ay(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new Jn(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let B=T[1].replace(/^["']|["']$/g,""),z=B.startsWith("/")&&!B.startsWith("//")||B.startsWith("./")||B.startsWith("../")||B.startsWith("#"),W=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!W)throw new Jn(_,"CSS URLs must be local paths or base64 raster images")}}function zd(v,_,k,R=!1,T=0){let B=_d(v,_,R),z=It(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new Jn("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let U=v.slice(_+T).trimStart(),H=k.trim();if(!U.startsWith("=")&&(H===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(H)))return H;throw new Jn("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let W=B.name.toLowerCase();if(/^on[a-z]/.test(W))throw new Jn(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(W==="srcdoc")z=It(z);if(W==="style")cy(k,B.name);if(B.quote===null)z=oy(z);let F=sc(W);if(F&&B.valuePrefix.trim()===""&&Xo(k,F))return kd+z;return Cd(Ed(v,_),k,z)}function Se(v,_){let{scripts:k}=pn(v);for(let R of k){let T=R.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let B=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(B))return!0;if(Mn(B,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function wc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let R=k.exec(v);R;R=k.exec(v)){let T=R[1].toLowerCase(),B=new Set(cs(R[3]));if(B.size===0)continue;let z=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:z,names:B});continue}let W=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");W.lastIndex=z;let F=1,U=v.length;for(let H=W.exec(v);H;H=W.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){U=H.index+H[0].length;break}}_.push({start:R.index,end:U,names:B})}return _}function ly(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let B of T.names)if(new RegExp(`(?<![.#\\w$])${B.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function Nd(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],R=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",B=!1,z=0;for(let U=0;U<R.length;U++){let H=R[U];if(!B&&H==="`"){B=!0,z=0;continue}if(B){if(H==="`"&&z===0){B=!1;continue}if(H==="$"&&R[U+1]==="{"){z++,U++,T+=" ";continue}if(H==="}"&&z>0){z--;continue}if(z>0){T+=H;continue}continue}T+=H}R=T;let W=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=W.exec(R))!==null){let U=F[1];if(!R.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(U)&&!(U in _))return!1}}return!0}function uy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let R=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(R))return!0;return!1}var jd=new Set;function Ld(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Bd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!jd.has(k))jd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function hs(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return Ld(B)?Bd(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=nr(R,(T,B,z)=>{let W=B.trim();if(/^__[A-Z_]+__$/.test(W))return T;try{let F=x(B,_);if(F===void 0)return Ld(W)?Bd(W,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),R}function xc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let B=x(T,_);if(B===void 0)return R;return B===null?"":String(B)}catch{return R}}),k=nr(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let W=x(T,_);if(W===void 0)return R;if(W===null)return"";let F=String(W);return zd(k,B,F,!0,R.length)}catch(W){if(W instanceof Jn)throw W;return R}}),k}function Ju(v,_,k={}){let{output:R,scripts:T}=pn(v),B=T.map((z)=>{let W=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=z.match(/^<script\b[^>]*>/i),U=z.search(/<\/script\s*>$/i);if(!W||!F||U===-1)return z;let H=W[1],q=W[2];if(/\bdata-raw\b/.test(H))return z;if(k.skipServer&&/\bserver\b/.test(H))return z;let Z=`<script${xc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return Z+q+z.slice(U);return Z+hs(q,_)+z.slice(U)});return as(R,B)}function X(v,_,k){let R=v,T=(Z,Q)=>{let oe=os(Z,Q);if(oe===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(Q,oe))?-1:oe},B=(Z,Q,oe,ae)=>{let ce=oe.length,{output:ue,tokens:le}=Fn(Z,Q,(Ae,ve)=>ae(ce+ve));return oe.push(...le),ue},z=[];R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let W=[];R=B(R,V,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let F=_?.__stx_signals_gate===!0||Se(v),U=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);R=nr(R,(Z,Q,oe)=>{try{let ae=x(Q,_,!1,(ce)=>uc(ce,Z,k,v));return ae!==void 0&&ae!==null?String(ae):""}catch(ae){let ce=ae instanceof Error?ae.message:String(ae);return g("Expression",`Error evaluating: {{{ ${Q.trim()}}}}: ${ce}`,k,v,oe,Z)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Z,Q,oe)=>{try{let ae=x(Q,_,!1,(ce)=>uc(ce,Z,k,v));if(ae===void 0&&_.__stx_buildMode==="compile")return Ko("raw",Q.trim());return ae!==void 0&&ae!==null?String(ae):""}catch(ae){if(_.__stx_buildMode==="compile")return Ko("raw",Q.trim());let ce=ae instanceof Error?ae.message:String(ae);return g("Expression",`Error evaluating: {!! ${Q.trim()} !!}: ${ce}`,k,v,oe,Z)}}),R=B(R,V,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let q=F?wc(R):[],ie=new Set(Er(_));if(R=nr(R,(Z,Q,oe)=>{let ae=Q.trim();if(Wr(ae,ie))return Z;if(q.length>0&&ly(q,oe,ae))return Z;if(H.has(ae))return Z;let ce=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ue=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,Ae=ae.match(ue)?.[1],ve=Ae&&((Ae in _)||ce.includes(Ae)),he=Boolean(Ae&&U.has(Ae)),Te=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,De=ae.match(Te),Oe=De&&!ce.includes(De[1])&&!(De[1]in _);if(/^__[A-Z_]+__$/.test(ae))return"";let Me;try{let Ne=x(Q,_,!1,(Le)=>{Me=Le});if(he)return Z;if(F&&!Nd(ae,_))return Z;if(Me)uc(Me,Z,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Ne===void 0||uy(ae,_)))return Ko("expr",ae);if(Ne===void 0||Ne===null)return"";let Ie=String(Ne);return zd(R,oe,Ie,!1,Z.length)}catch(Ne){if(Ne instanceof Jn)throw Ne;if(he)return Z;if(F&&!Nd(ae,_))return Z;if(Oe)return Z;let Ie=Ne instanceof Error?Ne.message:String(Ne);return g("Expression",`Error evaluating: {{ ${ae} }}: ${Ie}`,k,v,oe,Z)}}),W.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,Q)=>W[Number(Q)]??Z);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,Q)=>z[Number(Q)]??Z);return R}function Sc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let B=T.match(/^(\w+)/);if(!B)break;let z=B[1];T=T.substring(z.length).trim();let W=io[z]||tr[z];if(!W)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(bc()).join(", ")}`);let F=[];if(T.startsWith(":")){let U=T.match(/^:([^|\s]+)/);if(U){let H=U[1].trim();try{let q=Number(H);F=[Number.isNaN(q)?H:q]}catch{F=[H]}T=T.substring(U[0].length).trim()}}else if(T.startsWith("(")){let U=1,H=1;while(U>0&&H<T.length){if(T[H]==="(")U++;if(T[H]===")")U--;H++}if(U===0){let q=T.substring(1,H-1).trim();if(q)try{if(q.startsWith("{")&&q.endsWith("}"))F=[x(`(${q})`,k,!0)];else{let ie=[],Z="",Q=null,oe=0,ae=0,ce=0,ue=!1;for(let le=0;le<q.length;le++){let Ae=q[le];if(ue){Z+=Ae,ue=!1;continue}if(Ae==="\\"){Z+=Ae,ue=!0;continue}if(Q){if(Z+=Ae,Ae===Q)Q=null;continue}if(Ae==='"'||Ae==="'"||Ae==="`"){Q=Ae,Z+=Ae;continue}if(Ae==="(")oe++;else if(Ae===")")oe--;else if(Ae==="[")ae++;else if(Ae==="]")ae--;else if(Ae==="{")ce++;else if(Ae==="}")ce--;if(Ae===","&&oe===0&&ae===0&&ce===0){ie.push(Z),Z="";continue}Z+=Ae}if(Z)ie.push(Z);F=ie.map((le)=>{let Ae=le.trim();return x(Ae,k,!0)})}}catch{F=[q]}T=T.substring(H).trim()}}try{R=W(R,k,...F)}catch(U){let H=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${z}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function dy(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let W=0;W<v.length;W++){let F=v[W],U=v[W+1];if(_&&z){z=!1;continue}if(_&&F==="\\"){z=!0;continue}if(z=!1,(F==='"'||F==="'"||F==="`")&&!z){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&U==="{"){let H=1;W+=2;while(W<v.length&&H>0){if(v[W]==="{")H++;else if(v[W]==="}")H--;if(H>0)W++}continue}if(_)continue;if(F==="(")R++;else if(F===")")R--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")B++;else if(F==="}")B--;if(F==="|"&&R===0&&T===0&&B===0){if(U==="|"){W++;continue}if(U==="="){W++;continue}return W}}return-1}var ro=new Set,fy=1000;function Yu(){ro.clear()}function uc(v,_,k,R){if(!N())return;let T=`${k}\x00${v.expression}`;if(ro.has(T))return;if(ro.size>=fy)ro.clear();ro.add(T);let B=k,z=R;try{if(k&&Od.existsSync(k))z=Od.readFileSync(k,"utf8")}catch{}let W=z.indexOf(_);if(W>=0)B=`${k}:${z.slice(0,W).split(`
|
|
124
|
-
`).length}`;console.warn(`${B}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,R){try{let T=v.trim(),B=dy(T);if(B>0){let
|
|
122
|
+
</script>`,W=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),U=W<0?0:W;return T.push({start:U,end:U,replacement:`${F}
|
|
123
|
+
`}),Hu(v,T)}function Hu(v,_){if(_.length===0)return v;_.sort((B,z)=>B.start-z.start||B.end-z.end);let k=Array(_.length*2+1),R=0,T=0;for(let B of _)k[T++]=v.slice(R,B.start),k[T++]=B.replacement,R=B.end;return k[T]=v.slice(R),k.join("")}function bd(v){let _=qo(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function vd(v,_){let k=qo(v);if(!k)return[];let R=[];for(let[T,B]of k){let z=B.instances-(_.get(T)??0);if(z>0)R.push({body:B.body,count:z})}return R}function wd(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)nc(v,k)}import Od from"fs";var Sd=0,rc=new Map;function ai(){Sd=0,rc.clear()}function Ko(v,_){let k=Sd++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return rc.set(R,{type:v,expression:_}),R}function ci(){let v={};for(let[_,k]of rc)v[_]={type:k.type,expression:k.expression};return v}function li(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function ms(v){return v.includes("<!--__STX_")}var Hh=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function qh(v){return Array.from({length:v},()=>"{").join("⁠")}function $d(v){return v.replace(/\{{2,}/g,(_)=>qh(_.length)).replace(/\{(?=!)/g,"{⁠").replace(Hh,"@")}function _d(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),B=R.lastIndexOf(">");if(T>=0&&B>T)return null;if(T<0&&!k)return null;let z=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(z))return/^\s*\/?\s*$/.test(z)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(z))return{kind:"tag-name"};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:'"',valuePrefix:F[2]};let W=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(W)return{kind:"attribute",name:W[1],quote:"'",valuePrefix:W[2]};let U=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(U)return{kind:"attribute",name:U[1],quote:null,valuePrefix:U[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class Jn extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var kd="unsafe:";var Kh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Xh=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Zh=/^data:(?:text\/html|application\/xhtml\+xml)/,Gh=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Jh(v){return v.replace(Gh,"").toLowerCase()}function sc(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function Xo(v,_="navigable"){let k=Jh(v);if(Kh.test(k))return!0;return _==="navigable"?Xh.test(k):Zh.test(k)}function no(v,_="navigable"){return Xo(v,_)?"unsafe:"+v:v}function Yh(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return sc(_[1])}function Ed(v,_,k=256){if(_<=k)return v.slice(0,_);let R=v.slice(_-k,_),T=R.search(/[\s"'`/]/);return T===-1?"":R.slice(T)}function Cd(v,_,k=_){let R=Yh(v);return R&&Xo(_,R)?"unsafe:"+k:k}var Zo=/<script\b[^>]*>/iy,cc=/<\/script\s*>/ig,Go=/<style\b[^>]*>/iy,lc=/<\/style\s*>/ig;function Rd(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let B=R.exec(v);if(!B)return-1;return B.index+B[0].length}function V(v,_){return Rd(v,_,Zo,cc)}function os(v,_){return Rd(v,_,Go,lc)}function We(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Ad(v,_){if(v.startsWith("<!--",_)){let T=We(v,_);return T===-1?v.length:T}if(Zo.lastIndex=_,Zo.exec(v)?.index===_){cc.lastIndex=Zo.lastIndex;let T=cc.exec(v);return T?T.index+T[0].length:v.length}if(Go.lastIndex=_,Go.exec(v)?.index===_){lc.lastIndex=Go.lastIndex;let T=lc.exec(v);return T?T.index+T[0].length:v.length}return-1}function ee(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let F=v[R];if(B){if(z){if(F===z)z=null}else if(F==='"'||F==="'")z=F;else if(F===">")B=!1;R++;continue}if(F!=="<"){let q=v.indexOf("<",R+1);if(q===-1)break;R=q;continue}let W=_(v,R);if(W>R){k.push({start:R,end:W,token:v.slice(R,W)}),R=W;continue}let U=Ad(v,R);if(U>R){R=U;continue}let H=v.charCodeAt(R+1);if(H>=65&&H<=90||H>=97&&H<=122)B=!0;R++}return k}function Td(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let q=v[R];if(B){if(q===B)B=null}else if(q==='"'||q==="'")B=q;else if(q===">")T=!1;R++;continue}let z=v.indexOf("<",R),F=z===-1?v.length:z;while(R<F){let q=v[R++];if(q==="{")_++;else if(q==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let W=Ad(v,z);if(W>z){R=W;continue}let U=v.charCodeAt(z+1),H=U===47?v.charCodeAt(z+2):U;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;R=z+1}return!1}function Id(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var Qh=1024,ey=16777216,ss=new Map,ic=0;function ty(v,_){ss.set(v,_),ic+=v.length+_.output.length;for(let[k,R]of ss){if(ic<=ey)break;ss.delete(k),ic-=k.length+R.output.length}}function Wn(v,_,k,R){let T=R!==void 0&&v.length>=Qh,B=T?`${R}\x00${v}`:"";if(T){let H=ss.get(B);if(H)return ss.delete(B),ss.set(B,H),{output:H.output,tokens:H.tokens.slice()}}let z=ee(v,_);if(z.length===0)return{output:v,tokens:[]};let F=z.map((H)=>H.token),W="",U=0;for(let H=0;H<z.length;H++){let q=z[H];W+=v.slice(U,q.start),W+=k(q.token,H),U=q.end}if(W+=v.slice(U),T)return ty(B,{output:W,tokens:F}),{output:W,tokens:F.slice()};return{output:W,tokens:F}}var ny=1024,ry=16777216,is=new Map,oc=0;function sy(v,_){is.set(v,_),oc+=v.length+_.output.length;for(let[k,R]of is){if(oc<=ry)break;is.delete(k),oc-=k.length+R.output.length}}function ac(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:as(R,k)}}function pn(v){let _=v.length>=ny;if(_){let T=is.get(v);if(T)return is.delete(v),is.set(v,T),ac(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=Wn(v,V,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return sy(v,{output:k,scripts:R}),ac(v,k,R.slice());return ac(v,k,R)}function as(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Pt(v){let _=v.indexOf(" as ");if(_!==-1){let B=v.slice(0,_).trim(),z=v.slice(_+4).trim();return B&&z?{arrayExpr:B,itemVar:z}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let R=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return R&&T?{arrayExpr:T,itemVar:R}:null}function Jo(v){let _=[],k=0,R="",T=0;for(let B=0;B<v.length;B++){let z=v[B];if(R){if(z==="\\")B++;else if(z===R)R="";continue}if(z==="'"||z==='"'||z==="`")R=z;else if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(T,B)),T=B+1}return _.push(v.slice(T)),_}function Pd(v,_){let k=0;for(let R=0;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return R}return-1}function Dd(v){let _=0;for(let k=0;k<v.length;k++){let R=v[k];if(R==="("||R==="["||R==="{")_++;else if((R===")"||R==="]"||R==="}")&&--_===0)return k}return-1}function zr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=Pd(k,"=");if(R!==-1&&k[R+1]!==">")k=k.slice(0,R).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of Jo(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){zr(B,_);continue}let z=Pd(B,":");zr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Jo(k.slice(1,-1)))zr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function cs(v){let _=v.trim(),k=[],R=0;for(let B=0;B<_.length;B++){let z=_[B];if(z==="("||z==="["||z==="{")R++;else if(z===")"||z==="]"||z==="}")R--;else if(R===0&&/\s/.test(z)){if(!/^\s+(?:in|of)\s/.exec(_.slice(B)))continue;let W=_.slice(0,B).trim();if(W.startsWith("(")&&Dd(W)===W.length-1)W=W.slice(1,-1);for(let U of Jo(W))zr(U,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let B=T[1].trim();if(B.startsWith("(")&&Dd(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)zr(z[2],k),zr(z[1],k);else for(let F of Jo(B))zr(F,k)}return k}function Fr(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let z=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let F of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(F))return!0;return!1}var Yo="__stx_client_loop_names";function Er(v){let _=v?.[Yo];return Array.isArray(_)?_:[]}var io={},Md=new Map;function iy(v){let _=Md.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Md.set(v,_)}return _.lastIndex=0,_}var tr={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let R=Number(v);return Number.isNaN(R)?"":R.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let R=Number(v);if(Number.isNaN(R))return String(v);return R.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return It(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let W of B){if(z===void 0||z===null)break;z=z[W]}if(z===void 0||z===null)return T?v:"";let F=String(z);return Object.entries(k).forEach(([W,U])=>{F=F.replace(iy(W),String(U))}),F},t:(v,_,k={})=>tr.translate(v,_,k),truncate:(v,_,k=50,R="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=R.length)return R.substring(0,k);return T.substring(0,k-R.length)+R},date:(v,_,k="short",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let B={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(R,B[k]||B.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(R,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,R)=>{let T=Number(v);if(Number.isNaN(T))return k;let B=R||`${k}s`;return T===1?k:B},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,R)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,R);return v},replace:(v,_,k,R="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>R)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let R=Number(v);if(Number.isNaN(R))return 0;let T=10**k;return Math.round(R*T)/T}};function yc(v,_){if(v in tr)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);io[v]=_}function Ku(v){for(let[_,k]of Object.entries(v))yc(_,k)}function bc(){return{...tr,...io}}function Xu(){for(let v of Object.keys(io))delete io[v]}function vc(v,_,k=2){let R=0,T=null;for(let B=_+k;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="{"){R++;continue}if(z==="}"){if(R>0){R--;continue}let F=0;while(v[B+F]==="}")F++;if(F>=k)return B}}return-1}function nr(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",B=0;for(;;){let z=v.indexOf(R,B);if(z===-1)break;let F=vc(v,z,k);if(F===-1)break;T+=v.slice(B,z)+_(v.slice(z,F+k),v.slice(z+k,F),z),B=F+k}return B===0?v:T+v.slice(B)}function b(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function It(v){return $d(b(v))}function oy(v){return v.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function ay(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function cy(v,_){let k=ay(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new Jn(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let B=T[1].replace(/^["']|["']$/g,""),z=B.startsWith("/")&&!B.startsWith("//")||B.startsWith("./")||B.startsWith("../")||B.startsWith("#"),F=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!F)throw new Jn(_,"CSS URLs must be local paths or base64 raster images")}}function zd(v,_,k,R=!1,T=0){let B=_d(v,_,R),z=It(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new Jn("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let U=v.slice(_+T).trimStart(),H=k.trim();if(!U.startsWith("=")&&(H===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(H)))return H;throw new Jn("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let F=B.name.toLowerCase();if(/^on[a-z]/.test(F))throw new Jn(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(F==="srcdoc")z=It(z);if(F==="style")cy(k,B.name);if(B.quote===null)z=oy(z);let W=sc(F);if(W&&B.valuePrefix.trim()===""&&Xo(k,W))return kd+z;return Cd(Ed(v,_),k,z)}function Se(v,_){let{scripts:k}=pn(v);for(let R of k){let T=R.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let B=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(B))return!0;if(Mn(B,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function wc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let R=k.exec(v);R;R=k.exec(v)){let T=R[1].toLowerCase(),B=new Set(cs(R[3]));if(B.size===0)continue;let z=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:z,names:B});continue}let F=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");F.lastIndex=z;let W=1,U=v.length;for(let H=F.exec(v);H;H=F.exec(v)){if(H[2]==="/")continue;if(W+=H[1]==="/"?-1:1,W===0){U=H.index+H[0].length;break}}_.push({start:R.index,end:U,names:B})}return _}function ly(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let B of T.names)if(new RegExp(`(?<![.#\\w$])${B.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function Nd(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],R=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",B=!1,z=0;for(let U=0;U<R.length;U++){let H=R[U];if(!B&&H==="`"){B=!0,z=0;continue}if(B){if(H==="`"&&z===0){B=!1;continue}if(H==="$"&&R[U+1]==="{"){z++,U++,T+=" ";continue}if(H==="}"&&z>0){z--;continue}if(z>0){T+=H;continue}continue}T+=H}R=T;let F=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=F.exec(R))!==null){let U=W[1];if(!R.substring(0,W.index).trimEnd().endsWith(".")){if(!k.includes(U)&&!(U in _))return!1}}return!0}function uy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let R=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(R))return!0;return!1}var jd=new Set;function Ld(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Bd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!jd.has(k))jd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function hs(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return Ld(B)?Bd(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=nr(R,(T,B,z)=>{let F=B.trim();if(/^__[A-Z_]+__$/.test(F))return T;try{let W=x(B,_);if(W===void 0)return Ld(F)?Bd(F,k):T;return JSON.stringify(W).replace(/</g,"\\u003c")}catch{return T}}),R}function xc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let B=x(T,_);if(B===void 0)return R;return B===null?"":String(B)}catch{return R}}),k=nr(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let F=x(T,_);if(F===void 0)return R;if(F===null)return"";let W=String(F);return zd(k,B,W,!0,R.length)}catch(F){if(F instanceof Jn)throw F;return R}}),k}function Ju(v,_,k={}){let{output:R,scripts:T}=pn(v),B=T.map((z)=>{let F=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=z.match(/^<script\b[^>]*>/i),U=z.search(/<\/script\s*>$/i);if(!F||!W||U===-1)return z;let H=F[1],q=F[2];if(/\bdata-raw\b/.test(H))return z;if(k.skipServer&&/\bserver\b/.test(H))return z;let Z=`<script${xc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return Z+q+z.slice(U);return Z+hs(q,_)+z.slice(U)});return as(R,B)}function X(v,_,k){let R=v,T=(Z,Q)=>{let oe=os(Z,Q);if(oe===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(Q,oe))?-1:oe},B=(Z,Q,oe,ae)=>{let ce=oe.length,{output:ue,tokens:le}=Wn(Z,Q,(Ae,ve)=>ae(ce+ve));return oe.push(...le),ue},z=[];R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let F=[];R=B(R,V,F,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let W=_?.__stx_signals_gate===!0||Se(v),U=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);R=nr(R,(Z,Q,oe)=>{try{let ae=x(Q,_,!1,(ce)=>uc(ce,Z,k,v));return ae!==void 0&&ae!==null?String(ae):""}catch(ae){let ce=ae instanceof Error?ae.message:String(ae);return g("Expression",`Error evaluating: {{{ ${Q.trim()}}}}: ${ce}`,k,v,oe,Z)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Z,Q,oe)=>{try{let ae=x(Q,_,!1,(ce)=>uc(ce,Z,k,v));if(ae===void 0&&_.__stx_buildMode==="compile")return Ko("raw",Q.trim());return ae!==void 0&&ae!==null?String(ae):""}catch(ae){if(_.__stx_buildMode==="compile")return Ko("raw",Q.trim());let ce=ae instanceof Error?ae.message:String(ae);return g("Expression",`Error evaluating: {!! ${Q.trim()} !!}: ${ce}`,k,v,oe,Z)}}),R=B(R,V,F,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let q=W?wc(R):[],ie=new Set(Er(_));if(R=nr(R,(Z,Q,oe)=>{let ae=Q.trim();if(Fr(ae,ie))return Z;if(q.length>0&&ly(q,oe,ae))return Z;if(H.has(ae))return Z;let ce=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ue=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,Ae=ae.match(ue)?.[1],ve=Ae&&((Ae in _)||ce.includes(Ae)),he=Boolean(Ae&&U.has(Ae)),Te=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,De=ae.match(Te),Oe=De&&!ce.includes(De[1])&&!(De[1]in _);if(/^__[A-Z_]+__$/.test(ae))return"";let Me;try{let Ne=x(Q,_,!1,(Be)=>{Me=Be});if(he)return Z;if(W&&!Nd(ae,_))return Z;if(Me)uc(Me,Z,k,v);if(_.__stx_buildMode==="compile"&&!W&&(Ne===void 0||uy(ae,_)))return Ko("expr",ae);if(Ne===void 0||Ne===null)return"";let Ie=String(Ne);return zd(R,oe,Ie,!1,Z.length)}catch(Ne){if(Ne instanceof Jn)throw Ne;if(he)return Z;if(W&&!Nd(ae,_))return Z;if(Oe)return Z;let Ie=Ne instanceof Error?Ne.message:String(Ne);return g("Expression",`Error evaluating: {{ ${ae} }}: ${Ie}`,k,v,oe,Z)}}),F.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,Q)=>F[Number(Q)]??Z);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,Q)=>z[Number(Q)]??Z);return R}function Sc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let B=T.match(/^(\w+)/);if(!B)break;let z=B[1];T=T.substring(z.length).trim();let F=io[z]||tr[z];if(!F)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(bc()).join(", ")}`);let W=[];if(T.startsWith(":")){let U=T.match(/^:([^|\s]+)/);if(U){let H=U[1].trim();try{let q=Number(H);W=[Number.isNaN(q)?H:q]}catch{W=[H]}T=T.substring(U[0].length).trim()}}else if(T.startsWith("(")){let U=1,H=1;while(U>0&&H<T.length){if(T[H]==="(")U++;if(T[H]===")")U--;H++}if(U===0){let q=T.substring(1,H-1).trim();if(q)try{if(q.startsWith("{")&&q.endsWith("}"))W=[x(`(${q})`,k,!0)];else{let ie=[],Z="",Q=null,oe=0,ae=0,ce=0,ue=!1;for(let le=0;le<q.length;le++){let Ae=q[le];if(ue){Z+=Ae,ue=!1;continue}if(Ae==="\\"){Z+=Ae,ue=!0;continue}if(Q){if(Z+=Ae,Ae===Q)Q=null;continue}if(Ae==='"'||Ae==="'"||Ae==="`"){Q=Ae,Z+=Ae;continue}if(Ae==="(")oe++;else if(Ae===")")oe--;else if(Ae==="[")ae++;else if(Ae==="]")ae--;else if(Ae==="{")ce++;else if(Ae==="}")ce--;if(Ae===","&&oe===0&&ae===0&&ce===0){ie.push(Z),Z="";continue}Z+=Ae}if(Z)ie.push(Z);W=ie.map((le)=>{let Ae=le.trim();return x(Ae,k,!0)})}}catch{W=[q]}T=T.substring(H).trim()}}try{R=F(R,k,...W)}catch(U){let H=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${z}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function dy(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let F=0;F<v.length;F++){let W=v[F],U=v[F+1];if(_&&z){z=!1;continue}if(_&&W==="\\"){z=!0;continue}if(z=!1,(W==='"'||W==="'"||W==="`")&&!z){if(!_)_=!0,k=W;else if(W===k)_=!1,k="";continue}if(_&&k==="`"&&W==="$"&&U==="{"){let H=1;F+=2;while(F<v.length&&H>0){if(v[F]==="{")H++;else if(v[F]==="}")H--;if(H>0)F++}continue}if(_)continue;if(W==="(")R++;else if(W===")")R--;else if(W==="[")T++;else if(W==="]")T--;else if(W==="{")B++;else if(W==="}")B--;if(W==="|"&&R===0&&T===0&&B===0){if(U==="|"){F++;continue}if(U==="="){F++;continue}return F}}return-1}var ro=new Set,fy=1000;function Yu(){ro.clear()}function uc(v,_,k,R){if(!N())return;let T=`${k}\x00${v.expression}`;if(ro.has(T))return;if(ro.size>=fy)ro.clear();ro.add(T);let B=k,z=R;try{if(k&&Od.existsSync(k))z=Od.readFileSync(k,"utf8")}catch{}let F=z.indexOf(_);if(F>=0)B=`${k}:${z.slice(0,F).split(`
|
|
124
|
+
`).length}`;console.warn(`${B}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,R){try{let T=v.trim(),B=dy(T);if(B>0){let F=T.substring(0,B).trim(),W=T.substring(B+1).trim(),U=x(F,_,!0,R);return Sc(U,W,_)}let z=On(T);if(z!==null){R?.({expression:T,rule:z});return}try{let F=Object.keys(_),W=Object.values(_);return c(T,F)(...W)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let B=/(\b\w+)\s+is not defined/.exec(T.message);if(B){let z=B[1],F=py(z,Object.keys(_));if(F&&F!==z)T.message=`${T.message} \u2014 did you mean '${F}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function py(v,_){let k=null;for(let T of _){if(T===v)continue;let B=gy(v,T);if(k===null||B<k.dist)k={key:T,dist:B}}if(!k)return null;let R=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/R<=0.35)return k.key;return null}function gy(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,R]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),B=Array(k.length+1);for(let z=0;z<=k.length;z++)T[z]=z;for(let z=1;z<=R.length;z++){B[0]=z;for(let F=1;F<=k.length;F++){let W=k[F-1]===R[z-1]?0:1;B[F]=Math.min(B[F-1]+1,T[F]+1,T[F-1]+W)}for(let F=0;F<=k.length;F++)T[F]=B[F]}return T[k.length]}function Zu(v){if(!v)return"";return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Vd from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let R=this.cache.keys().next().value;if(R===void 0)break;this.delete(R)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var ls=new Map,my=500;function Wr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!ls.has(k)){if(ls.size>=my){let R=ls.keys().next().value;if(R)ls.delete(R)}ls.set(k,new RegExp(v,_))}return ls.get(k)}class Fd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((F)=>F.context.join(",")===k);if(R)return R.func;let T=this.fnCache,B=this.fnCacheMaxSize,z=(...F)=>(W)=>{try{let U=`${k}:${W}`,H=T.get(U);if(!H){if(T.size>=B){let q=T.keys().next().value;if(q)T.delete(q)}H=Function(..._,`
|
|
125
125
|
'use strict';
|
|
126
126
|
try {
|
|
127
|
-
return ${
|
|
127
|
+
return ${W};
|
|
128
128
|
}
|
|
129
129
|
catch (e) {
|
|
130
130
|
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
@@ -132,28 +132,28 @@ catch (e) {
|
|
|
132
132
|
}
|
|
133
133
|
throw e;
|
|
134
134
|
}
|
|
135
|
-
`),T.set(U,H)}return H(...W)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:z,context:_.slice()});return z}clear(){this.pool.length=0,this.fnCache.clear()}}var y$=new Wd;class Fd{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),R=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),R=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let R=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,B=_>=k.maxTime;if(!T&&!B)return;let z={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(z);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(z)}catch{}let W=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${R.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(R-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(W);break;case"warn":console.warn(W);break;case"error":console.error(W);break;case"throw":if(B)throw Error(W);else console.warn(W);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let R=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:R?.maxTime,budgetUtilization:R?k.totalTime/k.count/R.maxTime*100:void 0}}let _={};for(let[k,R]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:R.count,avgTime:R.totalTime/R.count,totalTime:R.totalTime,maxTime:R.maxTime,minTime:R.minTime,budget:T?.maxTime,budgetUtilization:T?R.totalTime/R.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let R of this.violations)if(v[R.label]=(v[R.label]||0)+1,R.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}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 dc=null;function hy(){if(!dc)dc=new Fd;return dc}var G=new Proxy({},{get(v,_){return hy()[_]}});var Ud=[];function m(v){let _=new M(v);return Ud.push(_),_}function Hd(){for(let v of Ud)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function qd(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Vd.statSync(k).mtimeMs})}catch{}return _}function gn(v){for(let _ of v)try{if(Vd.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import MS from"fs";import cn from"path";import co from"fs";import Vt from"path";import{hasLocalConfig as xf}from"bunfig";import Vn from"fs";import Vr from"path";import fc from"fs";import Kd from"path";import{fileURLToPath as yy}from"url";var pc;function Ue(){if(pc)return pc;let v="unknown";try{v=String(JSON.parse(fc.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=Kd.dirname(yy(import.meta.url)),k=0;for(let R of fc.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,fc.statSync(Kd.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return pc=v,v}var kc=new Map,Ur=new Map;async function Qu(v){let k;for(let R=0;R<3;R++)try{let B=(await Vn.promises.stat(v)).mtime.getTime(),z=Ur.get(v);if(z&&z.mtime===B)return z.content;let W=await Bun.file(v).text(),U=(await Vn.promises.stat(v)).mtime.getTime();if(U!==B)continue;return Ur.set(v,{content:W,mtime:U}),W}catch(T){k=T;break}throw Ur.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function ed(v){Ur.delete(v)}function td(v){for(let _ of Ur.keys())if(_.startsWith(v))Ur.delete(_)}var ea=null,xy=null,Zd=null;function nd(v){Zd=v}async function Cc(v=!1){let _=Zd??await import("./chunk-d81h4mxd.js");if(v)return _.generateSignalsRuntimeDev();if(ea===null)ea=_.generateSignalsRuntime();return ea}var ta=null;async function _c(){if(ta===null){let{getRouterScript:v}=await import("./chunk-xmz2h8cb.js");ta=v()}return ta}var Xd={};async function rd(v,_=!1){let k=v==="runtime"?await Cc(_):await _c(),R=v==="runtime"&&_?"runtime-debug":v,T=Xd[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Xd[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var by=500,vy=33554432,Yn=new Map,Qo=0;function Gd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function sd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Yn.get(_),R=k!==void 0;if(R)Yn.delete(_),Qo-=k.length*2;Yn.set(_,v),Qo+=v.length*2;while(Yn.size>1&&(Yn.size>by||Qo>vy)){let T=Yn.keys().next().value;Qo-=Yn.get(T).length*2,Yn.delete(T)}if(!R)try{let T=Gd(_);if(!Vn.existsSync(T))Vn.mkdirSync(Vr.dirname(T),{recursive:!0}),Vn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function ui(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Yn.get(v);if(_!==void 0)return _;try{return Vn.readFileSync(Gd(v),"utf8")}catch{return}}function od(){Ur.clear(),re(),Hd(),ea=null,xy=null,ta=null}function Jd(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function hn(v,_){try{if(!_.cachePath)return null;let k=Vr.resolve(_.cachePath),R=Vr.join(k,`${rr(v)}.html`),T=Vr.join(k,`${rr(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let B=await Bun.file(T).text(),z=JSON.parse(B);if(z.cacheVersion!==_.cacheVersion)return null;if(z.engine!==Ue())return null;if(z.optionsSignature!==Jd(_))return null;if((await Vn.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let F of z.dependencies)if(await r(F)){if((await Vn.promises.stat(F)).mtime.getTime()>z.mtime)return null}else return null;return await Bun.file(R).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function yn(v,_,k,R){try{if(!R.cachePath)return;let T=Vr.resolve(R.cachePath);await Vn.promises.mkdir(T,{recursive:!0});let B=Vr.join(T,`${rr(v)}.html`),z=Vr.join(T,`${rr(v)}.meta.json`),W=await Vn.promises.stat(v);await Bun.write(B,_);let F={sourcePath:v,mtime:W.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:Ue(),optionsSignature:Jd(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(F,null,2)),kc.set(v,{output:_,mtime:W.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var wy=16;function rr(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,wy)}var qe={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function ke(v){return`--stx-${v}`}function na(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let R=v[_.slice(0,k)];if(!R||typeof R!=="object")return;let T=R[_.slice(k+1)];return typeof T==="string"?T:void 0}var Sy=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function Yd(v,_){let k=_.trim();return na(v,k)??(Sy.test(k)?k:void 0)}function Qd(v={}){return[...Object.keys(v.roles??{}).filter((_)=>!qe[_]).map((_)=>`roles.${_}`),...Object.keys(v.shapes??{}).filter((_)=>!te[_]).map((_)=>`shapes.${_}`),...Object.keys(v.density??{}).filter((_)=>!de[_]).map((_)=>`density.${_}`)]}function ef(v){let _={};for(let[k,R]of Object.entries(qe)){let T=na(v,R.light);if(T===void 0)continue;_[k]=`var(${ke(k)}, ${T})`}return _}function tf(v,_={}){let k=[],R=[];for(let[T,B]of Object.entries(qe)){let z=_[T],W=typeof z==="string"?z:z?.light,F=typeof z==="string"?z:z?.dark,U=W&&Yd(v,W)||na(v,B.light),H=F&&Yd(v,F)||na(v,B.dark);if(U===void 0)continue;if(k.push(` ${ke(T)}: ${U};`),H!==void 0)R.push(` ${ke(T)}: ${H};`)}if(k.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...k,"}",".dark {",...R,"}",""].join(`
|
|
135
|
+
`),T.set(U,H)}return H(...F)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:z,context:_.slice()});return z}clear(){this.pool.length=0,this.fnCache.clear()}}var y$=new Fd;class Wd{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),R=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),R=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let R=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,B=_>=k.maxTime;if(!T&&!B)return;let z={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(z);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(z)}catch{}let F=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${R.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(R-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(F);break;case"warn":console.warn(F);break;case"error":console.error(F);break;case"throw":if(B)throw Error(F);else console.warn(F);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let R=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:R?.maxTime,budgetUtilization:R?k.totalTime/k.count/R.maxTime*100:void 0}}let _={};for(let[k,R]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:R.count,avgTime:R.totalTime/R.count,totalTime:R.totalTime,maxTime:R.maxTime,minTime:R.minTime,budget:T?.maxTime,budgetUtilization:T?R.totalTime/R.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let R of this.violations)if(v[R.label]=(v[R.label]||0)+1,R.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}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 dc=null;function hy(){if(!dc)dc=new Wd;return dc}var G=new Proxy({},{get(v,_){return hy()[_]}});var Ud=[];function m(v){let _=new M(v);return Ud.push(_),_}function Hd(){for(let v of Ud)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function qd(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Vd.statSync(k).mtimeMs})}catch{}return _}function gn(v){for(let _ of v)try{if(Vd.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import MS from"fs";import cn from"path";import co from"fs";import Vt from"path";import{hasLocalConfig as xf}from"bunfig";import Vn from"fs";import Vr from"path";import fc from"fs";import Kd from"path";import{fileURLToPath as yy}from"url";var pc;function Ue(){if(pc)return pc;let v="unknown";try{v=String(JSON.parse(fc.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=Kd.dirname(yy(import.meta.url)),k=0;for(let R of fc.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,fc.statSync(Kd.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return pc=v,v}var kc=new Map,Ur=new Map;async function Qu(v){let k;for(let R=0;R<3;R++)try{let B=(await Vn.promises.stat(v)).mtime.getTime(),z=Ur.get(v);if(z&&z.mtime===B)return z.content;let F=await Bun.file(v).text(),U=(await Vn.promises.stat(v)).mtime.getTime();if(U!==B)continue;return Ur.set(v,{content:F,mtime:U}),F}catch(T){k=T;break}throw Ur.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function ed(v){Ur.delete(v)}function td(v){for(let _ of Ur.keys())if(_.startsWith(v))Ur.delete(_)}var ea=null,xy=null,Zd=null;function nd(v){Zd=v}async function Cc(v=!1){let _=Zd??await import("./chunk-d81h4mxd.js");if(v)return _.generateSignalsRuntimeDev();if(ea===null)ea=_.generateSignalsRuntime();return ea}var ta=null;async function _c(){if(ta===null){let{getRouterScript:v}=await import("./chunk-xmz2h8cb.js");ta=v()}return ta}var Xd={};async function rd(v,_=!1){let k=v==="runtime"?await Cc(_):await _c(),R=v==="runtime"&&_?"runtime-debug":v,T=Xd[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Xd[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var by=500,vy=33554432,Yn=new Map,Qo=0;function Gd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function sd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Yn.get(_),R=k!==void 0;if(R)Yn.delete(_),Qo-=k.length*2;Yn.set(_,v),Qo+=v.length*2;while(Yn.size>1&&(Yn.size>by||Qo>vy)){let T=Yn.keys().next().value;Qo-=Yn.get(T).length*2,Yn.delete(T)}if(!R)try{let T=Gd(_);if(!Vn.existsSync(T))Vn.mkdirSync(Vr.dirname(T),{recursive:!0}),Vn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function ui(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Yn.get(v);if(_!==void 0)return _;try{return Vn.readFileSync(Gd(v),"utf8")}catch{return}}function od(){Ur.clear(),re(),Hd(),ea=null,xy=null,ta=null}function Jd(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function hn(v,_){try{if(!_.cachePath)return null;let k=Vr.resolve(_.cachePath),R=Vr.join(k,`${rr(v)}.html`),T=Vr.join(k,`${rr(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let B=await Bun.file(T).text(),z=JSON.parse(B);if(z.cacheVersion!==_.cacheVersion)return null;if(z.engine!==Ue())return null;if(z.optionsSignature!==Jd(_))return null;if((await Vn.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let W of z.dependencies)if(await r(W)){if((await Vn.promises.stat(W)).mtime.getTime()>z.mtime)return null}else return null;return await Bun.file(R).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function yn(v,_,k,R){try{if(!R.cachePath)return;let T=Vr.resolve(R.cachePath);await Vn.promises.mkdir(T,{recursive:!0});let B=Vr.join(T,`${rr(v)}.html`),z=Vr.join(T,`${rr(v)}.meta.json`),F=await Vn.promises.stat(v);await Bun.write(B,_);let W={sourcePath:v,mtime:F.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:Ue(),optionsSignature:Jd(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(W,null,2)),kc.set(v,{output:_,mtime:F.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var wy=16;function rr(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,wy)}var qe={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function ke(v){return`--stx-${v}`}function na(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let R=v[_.slice(0,k)];if(!R||typeof R!=="object")return;let T=R[_.slice(k+1)];return typeof T==="string"?T:void 0}var Sy=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function Yd(v,_){let k=_.trim();return na(v,k)??(Sy.test(k)?k:void 0)}function Qd(v={}){return[...Object.keys(v.roles??{}).filter((_)=>!qe[_]).map((_)=>`roles.${_}`),...Object.keys(v.shapes??{}).filter((_)=>!te[_]).map((_)=>`shapes.${_}`),...Object.keys(v.density??{}).filter((_)=>!de[_]).map((_)=>`density.${_}`)]}function ef(v){let _={};for(let[k,R]of Object.entries(qe)){let T=na(v,R.light);if(T===void 0)continue;_[k]=`var(${ke(k)}, ${T})`}return _}function tf(v,_={}){let k=[],R=[];for(let[T,B]of Object.entries(qe)){let z=_[T],F=typeof z==="string"?z:z?.light,W=typeof z==="string"?z:z?.dark,U=F&&Yd(v,F)||na(v,B.light),H=W&&Yd(v,W)||na(v,B.dark);if(U===void 0)continue;if(k.push(` ${ke(T)}: ${U};`),H!==void 0)R.push(` ${ke(T)}: ${H};`)}if(k.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...k,"}",".dark {",...R,"}",""].join(`
|
|
136
136
|
`)}var te={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function Ot(v){return`--stx-radius-${v}`}function nf(){let v={};for(let[_,k]of Object.entries(te))v[_]=`var(${Ot(_)}, ${k.value})`;return v}function rf(v={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(te).map(([_,k])=>` ${Ot(_)}: ${v[_]??k.value};`),"}",""].join(`
|
|
137
137
|
`)}var de={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},bn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},vn={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Ce(v){return`--stx-${v}`}function gc(v){let _=de[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${Ce(v)}, ${_.value})`}function sf(){let v={};for(let[_,k]of Object.entries(bn))v[_]=gc(k);return v}function of(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(vn))v[_]=[gc(k),{lineHeight:gc(R)}];return v}function af(v={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(de).map(([_,k])=>` ${Ce(_)}: ${v[_]??k.value};`),"}",""].join(`
|
|
138
138
|
`)}function cf(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function mc(v,_){let k={...v};for(let[R,T]of Object.entries(_))k[R]=cf(T)&&cf(k[R])?mc(k[R],T):T;return k}function lf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
|
|
139
|
-
`:k}function uf(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...
|
|
139
|
+
`:k}function uf(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...F}=k,W=F.colors||{};F.colors={...W,...ef(W)};let U=F.borderRadius||{};F.borderRadius={...U,...nf()};let H=F.spacing||{};F.spacing={...H,...sf()};let q=F.fontSize||{};F.fontSize={...q,...of()};let ie=mc(F,B),Z=mc(z||{},T||{});if(Object.keys(Z).length>0)ie.extend=Z;let Q=[...v.safelist||[],..._.safelist||[]],oe={...v.shortcuts||{},..._.shortcuts||{}},ae=[...v.preflights||[],..._.preflights||[]],{fonts:ce,...ue}=v,{fonts:le,roles:Ae,shapes:ve,density:he,...Te}=_,De={roles:Ae,shapes:ve,density:he},Oe=le??ce;return{config:{...ue,...Te,theme:ie,safelist:Q,shortcuts:oe,...ae.length>0?{preflights:ae}:{},content:[],output:""},safelist:Q,shortcuts:oe,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:tf({...W,...ie.colors},Ae)+rf(ve)+af(he),unknownRoles:Qd(De),...Oe?{fonts:Oe}:{}}}function df(v,_=""){let k=`${v}${_}`,R=0;for(let T=0;T<k.length;T++){let B=k.charCodeAt(T);R=(R<<5)-R+B,R=R&R}return`stx-${Math.abs(R).toString(36)}`}function ff(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:B=!0,scopeCustomProperties:z=!1}=k;if(!v.trim())return"";let F=el(v),W=[],U=new Map;if(B)for(let H of F){let q=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(q){let ie=q[1],Z=`${_}_${ie}`;U.set(ie,Z)}}for(let H of F){let q=pf(H,_,R,T,U,z);W.push(q)}return W.join(`
|
|
140
140
|
|
|
141
|
-
`)}function el(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",B=!1,z="";for(let
|
|
142
|
-
`)})}else _.push({selector:`@${H} ${q.trim()}`,declarations:ie.trim()})}z="",B=!1}else if(T.trim()){T+=
|
|
141
|
+
`)}function el(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",B=!1,z="";for(let F=0;F<k.length;F++){let W=k[F];if(W==="@"&&R===0)B=!0;if(W==="{")R++;else if(W==="}"){if(R--,R===0){if(B){z+=W;let U=z.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,H,q,ie]=U;if(H==="keyframes")_.push({selector:`@keyframes ${q.trim()}`,declarations:ie.trim()});else if(H==="media"||H==="supports"||H==="container"){let Z=el(ie);_.push({selector:`@${H} ${q.trim()}`,declarations:Z.map((Q)=>`${Q.selector} { ${Q.declarations} }`).join(`
|
|
142
|
+
`)})}else _.push({selector:`@${H} ${q.trim()}`,declarations:ie.trim()})}z="",B=!1}else if(T.trim()){T+=W;let U=T.match(/([^{]+)\{([^}]*)\}/);if(U)_.push({selector:U[1].trim(),declarations:U[2].trim()});T=""}continue}}if(B)z+=W;else T+=W}return _}function pf(v,_,k,R,T,B){let{selector:z,declarations:F}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let H=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${F} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let q=el(`x { ${F} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((ie)=>pf(ie,_,k,R,T,B)).join(`
|
|
143
143
|
`);return`${z} {
|
|
144
144
|
${q}
|
|
145
|
-
}`}return`${z} { ${W} }`}let F=$y(z,_,k,R),U=W;for(let[H,q]of T)U=U.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)U=U.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${U} }`}function $y(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let U=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(U)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=_y(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function _y(v,_){let k=0,R=v.length;for(let F=0;F<v.length;F++){let U=v[F];if(U==="["||U==="(")k++;else if(U==="]"||U===")")k--;else if(k===0&&(U===" "||U===">"||U==="+"||U==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let U=T[F];if(U==="["||U==="(")W++;else if(U==="]"||U===")")W--;else if(k===0&&W===0&&U===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var hf=String.raw`(?<![\w-])scoped(?![\w-])`,tl=/<style\s+([^>]*)>/gi,gf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,yf=new RegExp(hf,"i"),ky=new RegExp(hf,"gi"),nl=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ey(v){tl.lastIndex=0;let _=tl.exec(v);while(_!==null){if(yf.test(_[1]))return!0;_=tl.exec(v)}return!1}function rl(v){let _=new Set,k=[];nl.lastIndex=0;let R=nl.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=nl.exec(v)}return k}function oo(v){let _=rl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function ra(v,_){if(!Ey(v))return{html:v,hasScoped:!1};let k=df(_),R=`data-v-${k}`,T=v,B=!1;if(gf.lastIndex=0,T=T.replace(gf,(z,W,F)=>{if(!yf.test(W))return z;B=!0;let U=Cy(F,R),H=W.replace(ky,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${U}</style>`}),!B)return{html:v,hasScoped:!1};return T=Ay(T,R),{html:T,hasScoped:!0}}function Cy(v,_){return ff(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Ry=(v)=>`\x00stx-scope-mask-${v}\x00`,mf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ay(v,_){let k=Fn(v,(T,B)=>{let z=V(T,B);return z>B?z:os(T,B)},(T,B)=>Ry(B)),R=Ty(k.output,_);return mf.lastIndex=0,R.replace(mf,(T,B)=>k.tokens[Number(B)])}function Ty(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Un=null,sa="";function bf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;sa=`${_}@${Math.trunc(co.statSync(_).mtimeMs)}`}catch{sa=v}}var il=!1,Hr=null,ao="",us=!1,$f=256,Cr=new Map,Hn=new Map,ia=null,_f=null,oa=new Map,vf=new Set;function aa(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function sl(v,_){if(Cr.has(v))Cr.delete(v);else if(Cr.size>=$f)Cr.delete(Cr.keys().next().value);Cr.set(v,_)}function Iy(v){let _=aa(v);if(Hn.has(_))Hn.delete(_);else if(Hn.size>=$f)Hn.delete(Hn.keys().next().value);return Hn.set(_,v),_}function id(v){let _=Hn.get(v);if(_===void 0)return;return Hn.delete(v),Hn.set(v,_),_}async function Py(v,_=ia){if(!_)return null;try{let k=Bun.file(Vt.join(_,`cw-${aa(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Dy(v,_,k=ia){if(!k)return;try{if(!co.existsSync(k))co.mkdirSync(k,{recursive:!0});await Bun.write(Vt.join(k,`cw-${aa(v)}.css`),_)}catch{}}async function wf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Oy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],My=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ny(){let v=[],_=process.cwd();while(_!==Vt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Oy)v.push(Vt.join(_,k,...R));_=Vt.dirname(_)}return v}function jy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Vt.join(_,"Code","Tools","ts-css"),_&&Vt.join(_,"Code","Tools","crosswind"),_&&Vt.join(_,"repos","stacks-org","ts-css"),_&&Vt.join(_,"repos","stacks-org","crosswind"),Vt.join(process.cwd(),"..","ts-css"),Vt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Vt.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Vt.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Vt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function di(){if(il)return Un;il=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await wf(B);if(z){if(bf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Vt.dirname(Vt.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Vt.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Un=B,Un}let _=await v(Ny());if(_)return Un=_,Un;let k=My;for(let T of k){let B=await wf(T);if(B){Un=B;try{bf(import.meta.resolve(T))}catch{sa=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Un}}let R=await v(jy());if(R)return Un=R,Un;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function ad(){ol.clear(),Un=null,il=!1,Hr=null,ao="",Cr.clear(),Hn.clear(),_f=null,oa.clear()}var Sf=!1;async function pi(v){try{let _=xf({name:"css",cwd:v})?"css":xf({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Sf)Sf=!0,console.warn(`${e.yellow}[ts-css]${e.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:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Vt.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Ec(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-evzxtxk3.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Vt.isAbsolute(R.css)?R.css:Vt.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Vt.isAbsolute(R.css.config)?R.css.config:Vt.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await pi(v)}function Tc(v){try{let _=new WeakSet;return aa(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Dt(v){if(us)return ao;us=!0;try{let _=await di();if(!_||!_.build)return us=!1,"";if(!Hr)Hr=await pi(v);if(!Hr)return us=!1,"";let k=_.defaultConfig?.theme||{},R=Hr.theme||{},T={..._.defaultConfig,...Hr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(ao=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=Vt.isAbsolute(T.output)?T.output:Vt.join(v,T.output),U=Vt.dirname(F);if(!co.existsSync(U))co.mkdirSync(U,{recursive:!0});await Bun.write(F,z.css)}return us=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),us=!1,ao}}async function wn(v){Hr=null,await Dt(v)}function cd(){return ao}function $c(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var ol=m(64);async function Rc(v,_){let k=()=>oa.get(_?Vt.resolve(_):process.cwd())?.fingerprint??null,R=ol.get(h(v,_,k()));if(R!==void 0)return R;let T=await Ly(v,_);if(T)ol.set(h(v,_,k()),T);return T}function*kf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=ui(R);if(T)yield T}}function ld(v){return[...kf(v)].join(`
|
|
146
|
-
`)}async function Ly(v,_){try{let k=await di();if(!k)return"";let R=new Set;for(let De of kf(v)){let Oe=typeof k.extractClasses==="function"?k.extractClasses(De):$c(De);for(let Me of Oe)R.add(Me)}if(R.size===0)return"";let T=_?Vt.resolve(_):process.cwd(),B=a(T,"cache");if(!ia)ia=B;let z=oa.get(T);if(!z){let De=await Ec(T);z={config:De,fingerprint:Tc(De)},oa.set(T,z),_f=z.fingerprint}let
|
|
145
|
+
}`}return`${z} { ${F} }`}let W=$y(z,_,k,R),U=F;for(let[H,q]of T)U=U.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)U=U.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${W} { ${U} }`}function $y(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let U=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(U)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let F=k?`${k} .${_}`:`.${_}`;B.push(`${F} ${z}`);let W=_y(z,_);if(W)B.push(k?`${k} ${W}`:W)}return B.join(", ")}function _y(v,_){let k=0,R=v.length;for(let W=0;W<v.length;W++){let U=v[W];if(U==="["||U==="(")k++;else if(U==="]"||U===")")k--;else if(k===0&&(U===" "||U===">"||U==="+"||U==="~")){R=W;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,F=0;for(let W=0;W<T.length;W++){let U=T[W];if(U==="["||U==="(")F++;else if(U==="]"||U===")")F--;else if(k===0&&F===0&&U===":"){z=W;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var hf=String.raw`(?<![\w-])scoped(?![\w-])`,tl=/<style\s+([^>]*)>/gi,gf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,yf=new RegExp(hf,"i"),ky=new RegExp(hf,"gi"),nl=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ey(v){tl.lastIndex=0;let _=tl.exec(v);while(_!==null){if(yf.test(_[1]))return!0;_=tl.exec(v)}return!1}function rl(v){let _=new Set,k=[];nl.lastIndex=0;let R=nl.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=nl.exec(v)}return k}function oo(v){let _=rl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function ra(v,_){if(!Ey(v))return{html:v,hasScoped:!1};let k=df(_),R=`data-v-${k}`,T=v,B=!1;if(gf.lastIndex=0,T=T.replace(gf,(z,F,W)=>{if(!yf.test(F))return z;B=!0;let U=Cy(W,R),H=F.replace(ky,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${U}</style>`}),!B)return{html:v,hasScoped:!1};return T=Ay(T,R),{html:T,hasScoped:!0}}function Cy(v,_){return ff(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Ry=(v)=>`\x00stx-scope-mask-${v}\x00`,mf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ay(v,_){let k=Wn(v,(T,B)=>{let z=V(T,B);return z>B?z:os(T,B)},(T,B)=>Ry(B)),R=Ty(k.output,_);return mf.lastIndex=0,R.replace(mf,(T,B)=>k.tokens[Number(B)])}function Ty(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Un=null,sa="";function bf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;sa=`${_}@${Math.trunc(co.statSync(_).mtimeMs)}`}catch{sa=v}}var il=!1,Hr=null,ao="",us=!1,$f=256,Cr=new Map,Hn=new Map,ia=null,_f=null,oa=new Map,vf=new Set;function aa(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function sl(v,_){if(Cr.has(v))Cr.delete(v);else if(Cr.size>=$f)Cr.delete(Cr.keys().next().value);Cr.set(v,_)}function Iy(v){let _=aa(v);if(Hn.has(_))Hn.delete(_);else if(Hn.size>=$f)Hn.delete(Hn.keys().next().value);return Hn.set(_,v),_}function id(v){let _=Hn.get(v);if(_===void 0)return;return Hn.delete(v),Hn.set(v,_),_}async function Py(v,_=ia){if(!_)return null;try{let k=Bun.file(Vt.join(_,`cw-${aa(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Dy(v,_,k=ia){if(!k)return;try{if(!co.existsSync(k))co.mkdirSync(k,{recursive:!0});await Bun.write(Vt.join(k,`cw-${aa(v)}.css`),_)}catch{}}async function wf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Oy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],My=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ny(){let v=[],_=process.cwd();while(_!==Vt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Oy)v.push(Vt.join(_,k,...R));_=Vt.dirname(_)}return v}function jy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Vt.join(_,"Code","Tools","ts-css"),_&&Vt.join(_,"Code","Tools","crosswind"),_&&Vt.join(_,"repos","stacks-org","ts-css"),_&&Vt.join(_,"repos","stacks-org","crosswind"),Vt.join(process.cwd(),"..","ts-css"),Vt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Vt.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Vt.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Vt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function di(){if(il)return Un;il=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await wf(B);if(z){if(bf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Vt.dirname(Vt.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Vt.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Un=B,Un}let _=await v(Ny());if(_)return Un=_,Un;let k=My;for(let T of k){let B=await wf(T);if(B){Un=B;try{bf(import.meta.resolve(T))}catch{sa=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Un}}let R=await v(jy());if(R)return Un=R,Un;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function ad(){ol.clear(),Un=null,il=!1,Hr=null,ao="",Cr.clear(),Hn.clear(),_f=null,oa.clear()}var Sf=!1;async function pi(v){try{let _=xf({name:"css",cwd:v})?"css":xf({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Sf)Sf=!0,console.warn(`${e.yellow}[ts-css]${e.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:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Vt.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Ec(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-zg0pnh4w.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Vt.isAbsolute(R.css)?R.css:Vt.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Vt.isAbsolute(R.css.config)?R.css.config:Vt.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await pi(v)}function Tc(v){try{let _=new WeakSet;return aa(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Dt(v){if(us)return ao;us=!0;try{let _=await di();if(!_||!_.build)return us=!1,"";if(!Hr)Hr=await pi(v);if(!Hr)return us=!1,"";let k=_.defaultConfig?.theme||{},R=Hr.theme||{},T={..._.defaultConfig,...Hr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),F=performance.now()-B;if(ao=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${F.toFixed(1)}ms`),T.output){let W=Vt.isAbsolute(T.output)?T.output:Vt.join(v,T.output),U=Vt.dirname(W);if(!co.existsSync(U))co.mkdirSync(U,{recursive:!0});await Bun.write(W,z.css)}return us=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),us=!1,ao}}async function wn(v){Hr=null,await Dt(v)}function cd(){return ao}function $c(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let F of z)for(let W of F.slice(1,-1).split(/\s+/))if(W.trim())_.add(W.trim())}B=T.exec(v)}return _}var ol=m(64);async function Rc(v,_){let k=()=>oa.get(_?Vt.resolve(_):process.cwd())?.fingerprint??null,R=ol.get(h(v,_,k()));if(R!==void 0)return R;let T=await Ly(v,_);if(T)ol.set(h(v,_,k()),T);return T}function*kf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=ui(R);if(T)yield T}}function ld(v){return[...kf(v)].join(`
|
|
146
|
+
`)}async function Ly(v,_){try{let k=await di();if(!k)return"";let R=new Set;for(let De of kf(v)){let Oe=typeof k.extractClasses==="function"?k.extractClasses(De):$c(De);for(let Me of Oe)R.add(Me)}if(R.size===0)return"";let T=_?Vt.resolve(_):process.cwd(),B=a(T,"cache");if(!ia)ia=B;let z=oa.get(T);if(!z){let De=await Ec(T);z={config:De,fingerprint:Tc(De)},oa.set(T,z),_f=z.fingerprint}let F=[...R].sort().join(" "),W=`${sa}::${z.fingerprint||"default"}::${F}`,U=Cr.get(W);if(U!==void 0)return sl(W,U),U;let H=await Py(W,B);if(H!==null)return sl(W,H),H;let q=k.defaultConfig||k.config,ie=z.config||{},Z=uf(q,ie),{safelist:Q,includePreflight:oe,minify:ae,tokenCSS:ce}=Z;if(Z.unknownRoles.length>0&&!vf.has(T))vf.add(T),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${Z.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let ue=Z.config,le=new k.CSSGenerator(ue),Ae=ue.shortcuts||ie.shortcuts||{},ve=Object.keys(Ae).filter((De)=>R.has(De)||Q.includes(De));for(let De of Q)if(!Ae[De])le.generate(De);for(let De of R)if(!Ae[De])le.generate(De);let he="";if(ve.length>0){let De=new k.CSSGenerator(ue);for(let Oe of ve)De.generate(Oe);if(he=De.toCSS(!1,ae),he&&!he.endsWith(`
|
|
147
147
|
`))he+=`
|
|
148
|
-
`}let Te=he+le.toCSS(oe,ae);return Te=lf(k.CSSGenerator,Z)+ce+Te,sl(
|
|
148
|
+
`}let Te=he+le.toCSS(oe,ae);return Te=lf(k.CSSGenerator,Z)+ce+Te,sl(W,Te),Dy(W,Te,B),Te}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await Rc(v,_);if(!T)return R?oo(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Iy(T)}.css">`:`<style data-css="generated">
|
|
149
149
|
${T}
|
|
150
|
-
</style>`;if(R)return By(v,B);let z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(z.test(v)){let
|
|
150
|
+
</style>`;if(R)return By(v,B);let z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(z.test(v)){let F=!1;return v.replace(z,()=>{if(F)return"";return F=!0,B})}if(v.includes("</head>"))return v.replace("</head>",`${B}
|
|
151
151
|
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
152
|
-
${B}`);return B+v}function By(v,_){let k=rl(v).map((
|
|
152
|
+
${B}`);return B+v}function By(v,_){let k=rl(v).map((W)=>({...W,replacement:""})),R=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=R.exec(v);if(T!==null){let W=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:W?_:""}),W=!1,T=R.exec(v)}else{let W=v.indexOf("</head>");if(W!==-1)k.push({start:W,end:W,replacement:`${_}
|
|
153
153
|
`});else{let U=v.match(/<body([^>]*)>/);if(U?.index!==void 0)k.push({start:U.index,end:U.index+U[0].length,replacement:`${U[0]}
|
|
154
|
-
${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((
|
|
154
|
+
${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((W,U)=>W.start-U.start||W.end-U.end);for(let W=1;W<k.length;W++)if(k[W].start<k[W-1].end)return zy(oo(v),_);let B=Array(k.length*2+1),z=0,F=0;for(let W of k)B[F++]=v.slice(z,W.start),B[F++]=W.replacement,z=W.end;return B[F]=v.slice(z),B.join("")}function zy(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let R=!1;return v.replace(k,()=>{if(R)return"";return R=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
|
|
155
155
|
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
156
|
-
${_}`);return _+v}var al=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Ef=/<body\b([^>]*)>/gi;function qn(v){let _=0,k,R=al.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Ef.lastIndex=_,k=Ef.exec(v);if(!k)return null;let T=k.index,B=-1,z=null;for(let
|
|
156
|
+
${_}`);return _+v}var al=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Ef=/<body\b([^>]*)>/gi;function qn(v){let _=0,k,R=al.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Ef.lastIndex=_,k=Ef.exec(v);if(!k)return null;let T=k.index,B=-1,z=null;for(let W=0;W<al.length;W++){let U=al[W],H=R[W];if(H===void 0||H!==null&&H.index<_)U.open.lastIndex=_,H=U.open.exec(v),R[W]=H;if(!H)continue;if(H.index<T&&(B===-1||H.index<B))B=H.index,z=U.close}if(B===-1||!z)return{index:T,tag:k[0],attrs:k[1]??""};z.lastIndex=B;let F=z.exec(v);if(!F)return null;_=F.index+F[0].length}return null}function fs(v,_){let k=qn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var Cf=/<style\b[^>]*>/iy,Rf=/<\/style>/gi,Af=/<script\b[^>]*>/iy,Tf=/<template(?=[\s>/])[^>]*>/iy,If=/<\/template\s*>/iy;function lo(v){let _=0,k=0,R=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let W=v.indexOf("-->",T+4);_=W===-1?v.length:W+3;continue}Cf.lastIndex=T;let B=Cf.exec(v);if(B){Rf.lastIndex=T+B[0].length;let W=Rf.exec(v);_=W===null?v.length:W.index+8;continue}Tf.lastIndex=T;let z=Tf.exec(v);if(z){if(k===0)R=T;k++,_=T+z[0].length;continue}If.lastIndex=T;let F=If.exec(v);if(F){if(k>0)k--;_=T+F[0].length;continue}if(Af.lastIndex=T,Af.test(v))return k>0?R:T;_=T+1}return-1}function Pf(){return`
|
|
157
157
|
// STX Lifecycle Runtime
|
|
158
158
|
(function() {
|
|
159
159
|
if (typeof window === 'undefined') return;
|
|
@@ -501,7 +501,7 @@ else {
|
|
|
501
501
|
|
|
502
502
|
console.log('[stx] Lifecycle runtime initialized');
|
|
503
503
|
})();
|
|
504
|
-
`}function cl(v){return Symbol(v)}var e_=cl("theme"),t_=cl("router"),n_=cl("i18n");import*as Of from"crypto";function Df(v){let _=/\$(\w+)\./g,k=[],R;while((R=_.exec(v))!==null)if(!k.includes(R[1]))k.push(R[1]);return k}function
|
|
504
|
+
`}function cl(v){return Symbol(v)}var e_=cl("theme"),t_=cl("router"),n_=cl("i18n");import*as Of from"crypto";function Df(v){let _=/\$(\w+)\./g,k=[],R;while((R=_.exec(v))!==null)if(!k.includes(R[1]))k.push(R[1]);return k}function Fy(){return`stx-${Of.randomBytes(4).toString("hex")}`}function Wy(v){return/\$\w+\./.test(v)}function Vy(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,R=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(R,(B,z,F,W)=>{if(["script","style","template"].includes(z.toLowerCase()))return B;let U=[],H=!1,q=F,ie=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,Z=[...F.matchAll(ie)];for(let ae of Z){let ce=ae[0],ue=ae[1],le=ae[2];if(Wy(le)){H=!0;let Ae=le.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(Ae){let ve=Ae[1];if(U.push({attr:ue,expr:ve,fullMatch:ce,originalAttr:ue}),Df(ve).forEach((Te)=>k.add(Te)),ue==="text")q=q.replace(ce,"");else if(ue==="class")q=q.replace(ce,'class=""');else if(ue==="disabled"||ue==="hidden")q=q.replace(ce,"");else q=q.replace(ce,`${ue}=""`)}}}if(!H)return B;let Q=q.match(/\bid\s*=\s*"([^"]+)"/),oe;if(Q)oe=Q[1];else oe=Fy(),q=` id="${oe}"${q}`;for(let ae of U)_.push({elementId:oe,attribute:ae.attr,expression:ae.expr,stores:Df(ae.expr)});return`<${z}${q}${W}`}),{html:T,bindings:_,stores:k}}function Uy(v,_){if(v.length===0)return"";let k=Array.from(_),R=`
|
|
505
505
|
<script>
|
|
506
506
|
(function() {
|
|
507
507
|
'use strict';
|
|
@@ -521,11 +521,11 @@ else {
|
|
|
521
521
|
`;R+=`
|
|
522
522
|
// Binding update functions
|
|
523
523
|
function updateBindings() {
|
|
524
|
-
`;for(let T of v){let{elementId:B,attribute:z,expression:
|
|
524
|
+
`;for(let T of v){let{elementId:B,attribute:z,expression:F}=T,W=F.replace(/\$(\w+)\./g,"$state.$1.");if(z==="text")R+=` (function() {
|
|
525
525
|
var el = document.getElementById('${B}');
|
|
526
526
|
if (el) {
|
|
527
527
|
try {
|
|
528
|
-
el.textContent = ${
|
|
528
|
+
el.textContent = ${W};
|
|
529
529
|
}
|
|
530
530
|
catch (e) { console.error('Binding error:', e); }
|
|
531
531
|
}
|
|
@@ -534,7 +534,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
534
534
|
var el = document.getElementById('${B}');
|
|
535
535
|
if (el) {
|
|
536
536
|
try {
|
|
537
|
-
el.innerHTML = ${
|
|
537
|
+
el.innerHTML = ${W};
|
|
538
538
|
}
|
|
539
539
|
catch (e) { console.error('Binding error:', e); }
|
|
540
540
|
}
|
|
@@ -543,7 +543,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
543
543
|
var el = document.getElementById('${B}');
|
|
544
544
|
if (el) {
|
|
545
545
|
try {
|
|
546
|
-
var value = ${
|
|
546
|
+
var value = ${W};
|
|
547
547
|
if (typeof value === 'string') {
|
|
548
548
|
// Dynamic class string - merge with existing static classes
|
|
549
549
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
@@ -572,7 +572,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
572
572
|
var el = document.getElementById('${B}');
|
|
573
573
|
if (el) {
|
|
574
574
|
try {
|
|
575
|
-
el.style.display = (${
|
|
575
|
+
el.style.display = (${W}) ? '' : 'none';
|
|
576
576
|
}
|
|
577
577
|
catch (e) { console.error('Binding error:', e); }
|
|
578
578
|
}
|
|
@@ -581,7 +581,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
581
581
|
var el = document.getElementById('${B}');
|
|
582
582
|
if (el) {
|
|
583
583
|
try {
|
|
584
|
-
el.style.visibility = (${
|
|
584
|
+
el.style.visibility = (${W}) ? 'visible' : 'hidden';
|
|
585
585
|
}
|
|
586
586
|
catch (e) { console.error('Binding error:', e); }
|
|
587
587
|
}
|
|
@@ -590,7 +590,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
590
590
|
var el = document.getElementById('${B}');
|
|
591
591
|
if (el) {
|
|
592
592
|
try {
|
|
593
|
-
var value = ${
|
|
593
|
+
var value = ${W};
|
|
594
594
|
if (value === false || value === null || value === undefined) {
|
|
595
595
|
el.removeAttribute('${z}');
|
|
596
596
|
}
|
|
@@ -1332,11 +1332,11 @@ else {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
})();
|
|
1334
1334
|
</script>
|
|
1335
|
-
`}var zf={name:"transition",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||Qn.duration:Qn.duration,z=_.length>2?_[2]||Qn.ease:Qn.ease,
|
|
1336
|
-
style="--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${
|
|
1337
|
-
${
|
|
1338
|
-
</head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let
|
|
1339
|
-
`+T.slice(U)}}return T}function Ge(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Hf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var ix=100,ox=599,ul="__stxResponseStatus",uo="__stxResponseHeaders";function ca(v){return typeof v==="number"&&Number.isInteger(v)&&v>=ix&&v<=ox}function Nt(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let R=Number(k[1]);if(ca(R))return R}return}function ll(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!ca(k))return!1;return v[ul]=k,!0}function ax(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[uo]={...v[uo],[R]:String(k)}}function Ke(v){let _=v?.[ul];return ca(_)?_:void 0}function Xe(v){let _=v?.[uo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function fi(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Ke(v);if(k!==void 0)_[ul]=k;let R=Xe(v);if(R)_[uo]={..._[uo],...R}}function sr(v){return{setResponseStatus:(_)=>{ll(v,_)},notFound:(_=404)=>{let k=ca(_)&&_>=400?_:404;ll(v,k)},setResponseHeader:(_,k)=>{ax(v,_,k)}}}function qf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",
|
|
1335
|
+
`}var zf={name:"transition",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||Qn.duration:Qn.duration,z=_.length>2?_[2]||Qn.ease:Qn.ease,F=_.length>3?Number.parseInt(_[3],10)||Qn.delay:Qn.delay,W=_.length>4?_[4]||Qn.direction:Qn.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=Qy(T,{duration:B,delay:F,ease:z,direction:W}),q="stx-transition",ie="";if(T==="fade")ie="stx-fade";else if(T==="slide")ie="stx-slide";else if(T==="scale")ie="stx-scale";else if(T==="flip")ie="stx-flip";else if(T==="rotate")ie="stx-rotate";return`<div id="${U}" class="${q} ${ie} ${W==="out"?"stx-out":""}"
|
|
1336
|
+
style="--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${F}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Ff={name:"scrollAnimate",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||300:300,z=_.length>2?_[2]||"ease":"ease",F=_.length>3?Number.parseFloat(_[3])||0.2:0.2,W=_.length>4?Number.parseInt(_[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,H=`--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,q="stx-transition stx-observe stx-out";if(T==="fade")q+=" stx-fade";else if(T==="slide-up"||T==="slide")q+=" stx-from-bottom";else if(T==="slide-down")q+=" stx-from-top";else if(T==="slide-left")q+=" stx-from-right";else if(T==="slide-right")q+=" stx-from-left";else if(T==="scale")q+=" stx-scale";else if(T.includes("-"))q+=` stx-${T}`;else q+=` stx-${T}`;return`<div id="${U}" class="${q}" style="${H}" data-threshold="${F}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Wf={name:"animationGroup",handler:(v,_,k,R)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],B=_.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),z=k.staggerDelay||50,F=k.sequence||!0,W=sx(T,B,{staggerDelay:z,sequence:F});return`${v}
|
|
1337
|
+
${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Vf={name:"motion",handler:(v,_,k,R)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,B=ex();return`<div data-animate="${T?"auto":"true"}">${v}</div>${B}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Uf(v,_,k,R){let T=v;if(R.animation?.enabled===!1)return T;let B=k.includes("test")&&k.includes("animation");if(!tx(T)&&!B)return T;if(!T.includes('<style id="stx-animation-base">')){let F=rx();T=T.replace("</head>",`${F}
|
|
1338
|
+
</head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let W=nx(),U=T.lastIndexOf("</body>");if(U!==-1)T=T.slice(0,U)+W+`
|
|
1339
|
+
`+T.slice(U)}}return T}function Ge(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Hf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var ix=100,ox=599,ul="__stxResponseStatus",uo="__stxResponseHeaders";function ca(v){return typeof v==="number"&&Number.isInteger(v)&&v>=ix&&v<=ox}function Nt(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let R=Number(k[1]);if(ca(R))return R}return}function ll(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!ca(k))return!1;return v[ul]=k,!0}function ax(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[uo]={...v[uo],[R]:String(k)}}function Ke(v){let _=v?.[ul];return ca(_)?_:void 0}function Xe(v){let _=v?.[uo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function fi(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Ke(v);if(k!==void 0)_[ul]=k;let R=Xe(v);if(R)_[uo]={..._[uo],...R}}function sr(v){return{setResponseStatus:(_)=>{ll(v,_)},notFound:(_=404)=>{let k=ca(_)&&_>=400?_:404;ll(v,k)},setResponseHeader:(_,k)=>{ax(v,_,k)}}}function qf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",F=0,W=/@status\s*\(/g,U;while((U=W.exec(v))!==null){let H=cx(v,U.index+U[0].length-1);if(H<0)break;let q=v.slice(U.index+U[0].length,H).trim(),ie=/^\d+$/.test(q)?Number(q):l(q,_),Z=R?` in ${R}`:"";if(B)console.warn(`[stx] @status(${q})${Z} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${q}) from <script server> instead \u2014 that runs per request.`);else if(!ll(_,ie))console.warn(`[stx] @status(${q})${Z} is not an HTTP status (100-599) \u2014 ignoring it.`);z+=v.slice(F,U.index),F=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),W.lastIndex=F}return F===0?v:z+v.slice(F)}function cx(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}var lx=0,ux=0;function Kf(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let R=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(R)return R[1];return null}function dx(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,R;while((R=k.exec(v))!==null){let[T,B,z]=R,F=R.index,W=Kf(z,"x-data");if(!W)continue;let U=`__stx_scope_${lx++}`,H=Kf(z,"x-init"),q=fx(v,B,F+T.length),ie=v.slice(F,q.endIndex),Z=px(ie);_.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:W,initExpr:H,bindings:[],refs:Z})}return _}function fx(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s|>)`,"gi"),z=new RegExp(`</${_}>`,"gi"),F=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T,F.lastIndex=T;let W=B.exec(v),U=z.exec(v),H=F.exec(v);if(H&&H.index<(W?.index??1/0)){T=H.index+H[0].length;continue}if(!U)return{endIndex:v.length};if(W&&W.index<U.index)R++,T=W.index+W[0].length;else{if(R--,R===0)return{endIndex:U.index+U[0].length};T=U.index+U[0].length}}return{endIndex:v.length}}function px(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),R=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=R.exec(k))!==null){let[,B,z]=T,F=gx(B);_.set(z,F)}return _}function gx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${ux++}`}function mx(){return`
|
|
1340
1340
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1341
1341
|
(function() {
|
|
1342
1342
|
var style = document.createElement('style');
|
|
@@ -1589,20 +1589,20 @@ window.__stx_reactive = (function() {
|
|
|
1589
1589
|
|
|
1590
1590
|
return { initScope: initScope, reactive: reactive };
|
|
1591
1591
|
})();
|
|
1592
|
-
`}function Xf(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(W
|
|
1592
|
+
`}function Xf(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(F,W)=>{try{let U=x(W,_,!0);if(U===void 0)return F;return String(U)}catch{return F}}),R="",T=0,B=null;while(T<k.length){let F=k[T];if(B&&F==="\\"){R+=F+(k[T+1]??""),T+=2;continue}if(F==="{"&&k[T+1]==="{"){let W=k.indexOf("}}",T+2);if(W!==-1){let U=k.slice(T,W+2);R+=z(k.slice(T+2,W),U,B),T=W+2;continue}}if(B){if(F===B)B=null}else if(F==="'"||F==='"'||F==="`")B=F;R+=F,T++}return R;function z(F,W,U){let H;try{H=x(F,_,!0)}catch{return W}if(H===void 0)return W;if(U){let q=String(H).replace(/\\/g,"\\\\").replace(new RegExp(U==="`"?"`":U,"g"),`\\${U}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return U==="`"?q.replace(/\$\{/g,"\\${"):q}if(typeof H==="string"){let q=H.trim();if(q.startsWith("{")&&q.endsWith("}")||q.startsWith("[")&&q.endsWith("]"))try{return JSON.parse(q),q}catch{}}return JSON.stringify(H)}}function hx(v,_){if(v.length===0)return"";let k=v.map((R)=>{let T=JSON.stringify(Object.fromEntries(R.refs)),B=Xf(R.stateExpr,_),z=R.initExpr?Xf(R.initExpr,_):null,F=JSON.stringify(B),W=z?JSON.stringify(z):"null";return`
|
|
1593
1593
|
(function() {
|
|
1594
1594
|
var scopeEl = document.querySelector('${R.selector}');
|
|
1595
1595
|
if (!scopeEl) return;
|
|
1596
1596
|
var refs = ${T};
|
|
1597
|
-
__stx_reactive.initScope(scopeEl, ${
|
|
1597
|
+
__stx_reactive.initScope(scopeEl, ${F}, [], refs, ${W});
|
|
1598
1598
|
})();`}).join(`
|
|
1599
1599
|
`);return`
|
|
1600
1600
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1601
1601
|
${mx()}
|
|
1602
1602
|
${k}
|
|
1603
1603
|
</script>`}function Zf(v,_,k){if(!xx(v))return v;let R=dx(v);if(R.length===0)return v;let T=yx(v,R),B=hx(R,_),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
|
|
1604
|
-
`+T.slice(z);else T+=B;return T}function yx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let
|
|
1605
|
-
`)){let
|
|
1604
|
+
`+T.slice(z);else T+=B;return T}function yx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let F=_[k++];if(!F)return T;let W=/data-stx-scope="([^"]*)"/.exec(z);if(W)return F.id=W[1],F.selector=`[data-stx-scope="${F.id}"]`,T;return`<${B} data-stx-scope="${F.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function xx(v){return/x-data\s*=\s*["']/.test(v)}import nb from"fs";import $l from"path";import{createHighlighter as rb}from"ts-syntax-highlighter";import Fs from"fs";import sn from"path";import{loadConfigWithResult as Gx}from"bunfig";async function bx(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Pe();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var Gf={name:"stxRouter",handler:bx,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Ar(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Jf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function er(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
|
|
1605
|
+
`)){let F=z.trim();if(!F||F.startsWith("#"))continue;let W=F.indexOf(":");if(W===-1)continue;let U=F.slice(0,W).trim(),H=F.slice(W+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}B[U]=H}return{data:B,content:T.trim()}}function Ve(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,q,ie)=>{let Z=B.length,Q=q?` class="language-${Ar(q)}"`:"";return B.push(`<pre><code${Q}>${Ar(ie.trim())}</code></pre>`),`\x00CODEBLOCK${Z}\x00`}),T=T.replace(/`([^`]*)`/g,(H,q)=>`<code>${Ar(q)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,q,ie)=>`<img src="${Jf(ie)?Ar(ie):""}" alt="${Ar(q)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,q,ie)=>`<a href="${Jf(ie)?Ar(ie):""}">${q}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1606
1606
|
`),T=T.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),T=T.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),T=T.replace(/<\/ul>\n<ul>/g,""),T=T.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),T=T.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),T=T.replace(/<\/ol>\n<ol>/g,""),T=T.replace(/<li data-ul>/g,"<li>"),T=T.replace(/<li data-ol>/g,"<li>"),k)T=T.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(H,q,ie)=>{let Q=`<tr>${q.split("|").map((ae)=>ae.trim()).filter(Boolean).map((ae)=>`<th>${Ar(ae)}</th>`).join("")}</tr>`,oe=ie.trim().split(`
|
|
1607
1607
|
`).map((ae)=>`<tr>${ae.split("|").map((ue)=>ue.trim()).filter(Boolean).map((ue)=>`<td>${Ar(ue)}</td>`).join("")}</tr>`).join(`
|
|
1608
1608
|
`);return`<table>
|
|
@@ -1613,14 +1613,14 @@ ${Q}
|
|
|
1613
1613
|
${oe}
|
|
1614
1614
|
</tbody>
|
|
1615
1615
|
</table>`});if(k)T=T.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),T=T.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let z=T.split(`
|
|
1616
|
-
`),
|
|
1616
|
+
`),F=[],W=!1,U=[];for(let H of z){let q=H.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(q)||/^\0CODEBLOCK\d+\0$/.test(q)||q===""){if(W&&U.length>0)F.push(`<p>${U.join(R?`<br />
|
|
1617
1617
|
`:`
|
|
1618
|
-
`)}</p>`),U=[],
|
|
1618
|
+
`)}</p>`),U=[],W=!1;F.push(H)}else W=!0,U.push(q)}if(W&&U.length>0)F.push(`<p>${U.join(R?`<br />
|
|
1619
1619
|
`:`
|
|
1620
|
-
`)}</p>`);if(T=
|
|
1620
|
+
`)}</p>`);if(T=F.join(`
|
|
1621
1621
|
`),R)T=T.replace(/\n/g,`<br />
|
|
1622
|
-
`);for(let H=0;H<B.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,B[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function Yf(v,_,k=""){let R=v,T=[],B=/@markdown(?:\([^)]*\))?/g,z;while((z=B.exec(v))!==null){let
|
|
1623
|
-
`||ue==="\r"||ue===" "||ue===void 0)q++;ie=ae+9}else{if(q--,q===0){Z=ce;break}ie=ce+12}}if(Z===-1)continue;let Q=v.slice(H,Z),oe=v.slice(
|
|
1622
|
+
`);for(let H=0;H<B.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,B[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function Yf(v,_,k=""){let R=v,T=[],B=/@markdown(?:\([^)]*\))?/g,z;while((z=B.exec(v))!==null){let F=z.index,W=z[0].match(/@markdown\(([^)]*)\)/),U=W?W[1]:"",H=F+z[0].length,q=1,ie=H,Z=-1;while(q>0&&ie<v.length){let ae=v.indexOf("@markdown",ie),ce=v.indexOf("@endmarkdown",ie);if(ce===-1)break;if(ae!==-1&&ae<ce&&ae!==F){let ue=v[ae+9];if(ue==="("||ue===`
|
|
1623
|
+
`||ue==="\r"||ue===" "||ue===void 0)q++;ie=ae+9}else{if(q--,q===0){Z=ce;break}ie=ce+12}}if(Z===-1)continue;let Q=v.slice(H,Z),oe=v.slice(F,Z+12);T.push({fullMatch:oe,options:U,content:Q,index:F}),B.lastIndex=Z+12}for(let{fullMatch:F,options:W,content:U,index:H}of T)try{let q={};if(W)W.split(",").forEach((Q)=>{let oe=Q.trim();if(oe)q[oe]=!0});let ie={gfm:q.gfm??!0,breaks:q.breaks??!1},Z=Ve(U.trim(),ie);R=R.split(F).join(Z)}catch(q){let ie=q instanceof Error?q.message:String(q),Z=g("Markdown Directive",`Error processing markdown: ${ie}`,k,v,H,F);R=R.split(F).join(Z)}return R}async function Qf(v,_,k,R){let T={gfm:!0,breaks:!1};return _.forEach((B)=>{let z=B.trim().replace(/['"]/g,"");if(z==="breaks")T.breaks=!0;if(z==="no-gfm")T.gfm=!1}),Ve(v.trim(),T)}var js=[320,480,640,768,1024,1280,1536,1920,2560],vx=[1,1.5,2,3],fo=["avif","webp","jpeg"],wx={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function dl(v,_=js,k={},R){return _.sort((T,B)=>T-B).map((T)=>`${po(v,{...k,w:T,fm:R})} ${T}w`).join(", ")}function ep(v,_,k=vx,R={},T){return k.sort((B,z)=>B-z).map((B)=>{let z=Math.round(_*B);return`${po(v,{...R,w:z,dpr:B,fm:T})} ${B}x`}).join(", ")}function fl(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let R=Object.entries(v).map(([T,B])=>{let z=/^\d+$/.test(T)?`${T}px`:T;return{bp:z,size:B,numericBp:Number.parseInt(z)||0}}).sort((T,B)=>T.numericBp-B.numericBp).map(({bp:T,size:B})=>`(max-width: ${T}) ${B}`);return R.push(_),R.join(", ")}function po(v,_={}){let k=Object.entries(_).filter(([,B])=>B!==void 0&&B!==null).map(([B,z])=>{if(Array.isArray(z))return[B,z.join(",")];return[B,String(z)]});if(k.length===0)return v;let R=k.map(([B,z])=>`${B}=${encodeURIComponent(z)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${R}`}function pl(v){return wx[v]||"application/octet-stream"}var Sx={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},ml=`
|
|
1624
1624
|
.stx-img-placeholder {
|
|
1625
1625
|
position: relative;
|
|
1626
1626
|
overflow: hidden;
|
|
@@ -1649,7 +1649,7 @@ ${oe}
|
|
|
1649
1649
|
filter: blur(0);
|
|
1650
1650
|
transform: scale(1);
|
|
1651
1651
|
}
|
|
1652
|
-
`.trim();async function $x(){try{return await import("ts-images")}catch{return null}}async function _x(v,_={}){let k={...Sx,..._},R=await $x();if(R)try{return await kx(v,k,R)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return Ex(v,k)}async function kx(v,_,k){let{generatePlaceholder:R,generateThumbHash:T}=k,z={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let
|
|
1652
|
+
`.trim();async function $x(){try{return await import("ts-images")}catch{return null}}async function _x(v,_={}){let k={...Sx,..._},R=await $x();if(R)try{return await kx(v,k,R)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return Ex(v,k)}async function kx(v,_,k){let{generatePlaceholder:R,generateThumbHash:T}=k,z={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let F=await R(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:z,base64Encode:!0});return{dataURL:F.dataURL,width:F.width,height:F.height,aspectRatio:F.aspectRatio,originalWidth:F.originalWidth,originalHeight:F.originalHeight,strategy:_.strategy,dominantColor:F.dominantColor,css:F.css}}function Ex(v,_){let k=_.width||20,R=_.height||k,T="#e5e7eb",B=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${R}" viewBox="0 0 ${k} ${R}"><rect fill="#e5e7eb" width="${k}" height="${R}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(B)}`,width:k,height:R,aspectRatio:k/R,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function tp(v,_,k={}){let R=k.transitionDuration||300,T=k.easing||"ease-out";return`
|
|
1653
1653
|
#${v} {
|
|
1654
1654
|
--stx-img-transition-duration: ${R}ms;
|
|
1655
1655
|
--stx-img-transition-easing: ${T};
|
|
@@ -1666,8 +1666,8 @@ ${oe}
|
|
|
1666
1666
|
#${v}.stx-img-loaded img {
|
|
1667
1667
|
opacity: 1;
|
|
1668
1668
|
}
|
|
1669
|
-
`.trim()}var gl=new Map;async function np(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(gl.has(k))return gl.get(k);let R=await _x(v,_);return gl.set(k,R),R}async function Cx(){try{return await import("./chunk-khdvzjzd.js")}catch(v){if(!rp)console.warn("[stx-media] Image processor not available, some features disabled:",v),rp=!0;return null}}var rp=!1,hl=80,ua="async",da="lazy",sp=!1;async function la(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Ix(R,k)}if(k.processedResult?.processed)return bl(v,k.processedResult,_);if(k.responsiveVariants)return ap(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:
|
|
1670
|
-
`):void 0,script
|
|
1669
|
+
`.trim()}var gl=new Map;async function np(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(gl.has(k))return gl.get(k);let R=await _x(v,_);return gl.set(k,R),R}async function Cx(){try{return await import("./chunk-khdvzjzd.js")}catch(v){if(!rp)console.warn("[stx-media] Image processor not available, some features disabled:",v),rp=!0;return null}}var rp=!1,hl=80,ua="async",da="lazy",sp=!1;async function la(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Ix(R,k)}if(k.processedResult?.processed)return bl(v,k.processedResult,_);if(k.responsiveVariants)return ap(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:F,sizes:W,widths:U=js,dpr:H,formats:q=fo,quality:ie=hl,params:Z={},placeholder:Q="none",placeholderOptions:oe={},lazy:ae=!0,priority:ce=!1,loading:ue=ce?"eager":da,decoding:le=ua,fetchpriority:Ae,objectFit:ve,objectPosition:he,crossorigin:Te,referrerpolicy:De}=v,{class:Oe,style:Me,id:Ne}=v,Ie=v.data||{},{isDev:Be=!1,baseUrl:Fe=""}=_;if(Be&&!_.optimize)return Tx(v);let Le,je,rt=Ne||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(Q!=="none"&&!ce)try{Le=await np(T,{strategy:Q,...oe}),je=tp(rt,Le,oe)}catch{}let gt=H!==void 0&&z!==void 0,mt;if(gt)mt=Ax(v,rt,Le,_);else mt=await Rx(v,rt,Le,_);let yt;if(ce){let St=q.includes("webp")?"webp":q[0],xt=dl(T,U,{...Z,q:ie},St),at=typeof W==="object"?fl(W):W||"100vw";yt=`<link rel="preload" as="image" imagesrcset="${xt}" imagesizes="${at}" />`}let ut=[];if(!sp&&Q!=="none")ut.push(ml),sp=!0;if(je)ut.push(je);let $t=ae?op(rt):void 0;return{html:mt,preloadLink:yt,css:ut.length>0?ut.join(`
|
|
1670
|
+
`):void 0,script:$t}}async function Rx(v,_,k,R){let{src:T,alt:B,width:z,height:F,sizes:W,widths:U=js,formats:H=fo,quality:q=hl,params:ie={},lazy:Z=!0,priority:Q=!1,loading:oe=Q?"eager":da,decoding:ae=ua,fetchpriority:ce,objectFit:ue,objectPosition:le,crossorigin:Ae,referrerpolicy:ve}=v,{class:he,style:Te}=v,De=v.data||{},Oe=typeof W==="object"?fl(W):W||"100vw",Me=[];for(let Be of H){let Fe=dl(T,U,{...ie,q},Be),Le=pl(Be);if(Z&&!Q)Me.push(` <source type="${Le}" data-srcset="${Fe}" data-sizes="${Oe}" />`);else Me.push(` <source type="${Le}" srcset="${Fe}" sizes="${Oe}" />`)}let Ne=yl({src:po(T,{...ie,q}),alt:B,width:z,height:F,loading:Q?void 0:oe,decoding:ae,fetchpriority:Q?"high":ce,objectFit:ue,objectPosition:le,crossorigin:Ae,referrerpolicy:ve,className:ip(he,k),style:xl(Te,ue,le,k),lazy:Z&&!Q,data:De}),Ie;if(k){let Be=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;Ie=`<div id="${_}" class="stx-img-placeholder" style="${Be}">
|
|
1671
1671
|
<picture>
|
|
1672
1672
|
${Me.join(`
|
|
1673
1673
|
`)}
|
|
@@ -1677,9 +1677,9 @@ ${Me.join(`
|
|
|
1677
1677
|
${Me.join(`
|
|
1678
1678
|
`)}
|
|
1679
1679
|
<img ${Ne} />
|
|
1680
|
-
</picture>`;return Ie}function Ax(v,_,k,R){let{src:T,alt:B,width:z,height:
|
|
1680
|
+
</picture>`;return Ie}function Ax(v,_,k,R){let{src:T,alt:B,width:z,height:F,dpr:W=[1,2,3],quality:U=hl,params:H={},lazy:q=!0,priority:ie=!1,loading:Z=ie?"eager":da,decoding:Q=ua,fetchpriority:oe,objectFit:ae,objectPosition:ce,crossorigin:ue,referrerpolicy:le}=v,{class:Ae,style:ve}=v,he=v.data||{},Te=typeof z==="number"?z:Number.parseInt(String(z),10),De=ep(T,Te,W,{...H,q:U}),Oe=yl({src:po(T,{...H,w:Te,q:U}),alt:B,width:z,height:F,loading:ie?void 0:Z,decoding:Q,fetchpriority:ie?"high":oe,objectFit:ae,objectPosition:ce,crossorigin:ue,referrerpolicy:le,className:ip(Ae,k),style:xl(ve,ae,ce,k),lazy:q&&!ie,data:he}),Me=q&&!ie?`data-srcset="${De}"`:`srcset="${De}"`;if(k){let Ne=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Ne}">
|
|
1681
1681
|
<img ${Oe} ${Me} />
|
|
1682
|
-
</div>`}return`<img ${_?`id="${_}" `:""}${Oe} ${Me} />`}function Tx(v){let{src:_,alt:k,width:R,height:T,loading:B=da,decoding:z=ua,fetchpriority:
|
|
1682
|
+
</div>`}return`<img ${_?`id="${_}" `:""}${Oe} ${Me} />`}function Tx(v){let{src:_,alt:k,width:R,height:T,loading:B=da,decoding:z=ua,fetchpriority:F,objectFit:W,objectPosition:U,crossorigin:H,referrerpolicy:q,priority:ie=!1}=v,{class:Z,style:Q,id:oe}=v,ae=v.data||{};return{html:`<img ${yl({src:_,alt:k,width:R,height:T,loading:ie?"eager":B,decoding:z,fetchpriority:ie?"high":F,objectFit:W,objectPosition:U,crossorigin:H,referrerpolicy:q,className:Z,style:xl(Q,W,U),id:oe,data:ae})} />`}}function yl(v){let _=[];if(v.lazy)_.push(`data-src="${zn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${zn(v.src)}"`);if(_.push(`alt="${zn(v.alt)}"`),v.width)_.push(`width="${v.width}"`);if(v.height)_.push(`height="${v.height}"`);if(v.loading)_.push(`loading="${v.loading}"`);if(v.decoding)_.push(`decoding="${v.decoding}"`);if(v.fetchpriority)_.push(`fetchpriority="${v.fetchpriority}"`);if(v.crossorigin)_.push(`crossorigin="${v.crossorigin}"`);if(v.referrerpolicy)_.push(`referrerpolicy="${v.referrerpolicy}"`);if(v.className)_.push(`class="${zn(v.className)}"`);if(v.style)_.push(`style="${zn(v.style)}"`);if(v.id)_.push(`id="${zn(v.id)}"`);if(v.data)for(let[k,R]of Object.entries(v.data))_.push(`data-${k}="${zn(R)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function ip(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function xl(v,_,k,R){let T=[];if(_)T.push(`object-fit: ${_}`);if(k)T.push(`object-position: ${k}`);if(R)T.push("opacity: 0; transition: opacity 300ms ease-out");if(v)T.push(v);return T.join("; ")}function zn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function op(v){return`
|
|
1683
1683
|
(function() {
|
|
1684
1684
|
const container = document.getElementById('${v}');
|
|
1685
1685
|
if (!container) return;
|
|
@@ -1716,7 +1716,7 @@ ${Me.join(`
|
|
|
1716
1716
|
|
|
1717
1717
|
observer.observe(container);
|
|
1718
1718
|
})();
|
|
1719
|
-
`.trim()}async function Ix(v,_){let k=await Cx();if(!k)return la({...v,process:!1},_);let R=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let B=await k.generateResponsiveVariants(v.src,v,R);if(B)return ap(v,B,_)}else{let B=await k.processImage(v.src,v,R);if(B.processed)return bl(v,B,_)}return la({...v,process:!1},_)}async function bl(v,_,k){let{alt:R,width:T,height:B,lazy:z=!0,priority:
|
|
1719
|
+
`.trim()}async function Ix(v,_){let k=await Cx();if(!k)return la({...v,process:!1},_);let R=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let B=await k.generateResponsiveVariants(v.src,v,R);if(B)return ap(v,B,_)}else{let B=await k.processImage(v.src,v,R);if(B.processed)return bl(v,B,_)}return la({...v,process:!1},_)}async function bl(v,_,k){let{alt:R,width:T,height:B,lazy:z=!0,priority:F=!1,objectFit:W,objectPosition:U,crossorigin:H,referrerpolicy:q}=v,{class:ie,style:Z}=v,Q=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,oe=v.data||{},ae=_.variants||[],ce=ae.find((je)=>je.format==="jpeg")||ae.find((je)=>je.format==="webp")||ae[0],ue=ce?.url||v.src,le=ae.filter((je)=>je.format===(ce?.format||"jpeg")).map((je)=>`${je.url} ${je.width}w`).join(", "),Ae=new Map;for(let je of ae){if(!Ae.has(je.format))Ae.set(je.format,[]);Ae.get(je.format).push(je)}let ve=[],he=["avif","webp","jpeg","png"];for(let je of he){let rt=Ae.get(je);if(rt&&rt.length>0){let gt=rt.map((yt)=>`${yt.url} ${yt.width}w`).join(", "),mt=pl(je);if(z&&!F)ve.push(` <source type="${mt}" data-srcset="${gt}" />`);else ve.push(` <source type="${mt}" srcset="${gt}" />`)}}let Te=[];if(z&&!F){if(Te.push(`data-src="${zn(ue)}"`),Te.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),le)Te.push(`data-srcset="${le}"`)}else if(Te.push(`src="${zn(ue)}"`),le)Te.push(`srcset="${le}"`);Te.push(`alt="${zn(R)}"`);let De=T||_.originalWidth,Oe=B||_.originalHeight;if(De)Te.push(`width="${De}"`);if(Oe)Te.push(`height="${Oe}"`);if(!F)Te.push(`loading="${z?"lazy":"eager"}"`);if(Te.push('decoding="async"'),F)Te.push('fetchpriority="high"');if(H)Te.push(`crossorigin="${H}"`);if(q)Te.push(`referrerpolicy="${q}"`);let Me=[];if(W)Me.push(`object-fit: ${W}`);if(U)Me.push(`object-position: ${U}`);if(_.placeholder&&z)Me.push("opacity: 0; transition: opacity 300ms ease-out");if(Z)Me.push(Z);if(Me.length>0)Te.push(`style="${Me.join("; ")}"`);let Ne=[];if(ie)Ne.push(ie);if(_.placeholder)Ne.push("stx-img-blur");if(Ne.length>0)Te.push(`class="${Ne.join(" ")}"`);if(z&&!F)Te.push("data-stx-lazy");for(let[je,rt]of Object.entries(oe))Te.push(`data-${je}="${zn(rt)}"`);let Ie;if(_.placeholder||_.dominantColor&&v.useDominantColor){let je=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;Ie=`<div id="${Q}" class="stx-img-placeholder" style="${je}">
|
|
1720
1720
|
<picture>
|
|
1721
1721
|
${ve.join(`
|
|
1722
1722
|
`)}
|
|
@@ -1726,15 +1726,15 @@ ${ve.join(`
|
|
|
1726
1726
|
${ve.join(`
|
|
1727
1727
|
`)}
|
|
1728
1728
|
<img ${Te.join(" ")} />
|
|
1729
|
-
</picture>`;let
|
|
1730
|
-
`):void 0,script:Fe}}async function ap(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,B]of Object.entries(_.byFormat))if(B)R.variants.push(...B);return bl(v,R,k)}function Px(){return tt({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:B,options:z}=Dx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let
|
|
1729
|
+
</picture>`;let Be=[];if(_.placeholder)Be.push(ml);let Fe=z?op(Q):void 0,Le;if(F&&le)Le=`<link rel="preload" as="image" imagesrcset="${le}" />`;return{html:Ie,preloadLink:Le,css:Be.length>0?Be.join(`
|
|
1730
|
+
`):void 0,script:Fe}}async function ap(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,B]of Object.entries(_.byFormat))if(B)R.variants.push(...B);return bl(v,R,k)}function Px(){return tt({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:B,options:z}=Dx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let F={src:T,alt:B||"",widths:z.widths||js,formats:z.formats||fo,quality:z.quality,sizes:z.sizes,dpr:z.dpr,params:z.params,placeholder:z.placeholder,placeholderOptions:z.placeholderOptions,lazy:z.lazy!==!1,priority:z.priority||!1,loading:z.loading,decoding:z.decoding,fetchpriority:z.fetchpriority,objectFit:z.objectFit,objectPosition:z.objectPosition,class:z.class,style:z.style,id:z.id,width:z.width,height:z.height},W=k.__isDev||!1,U=await la(F,{isDev:W}),H=U.html;if(U.preloadLink)H=U.preloadLink+`
|
|
1731
1731
|
`+H;if(U.css)H+=`
|
|
1732
1732
|
<style>${U.css}</style>`;if(U.script)H+=`
|
|
1733
|
-
<script>${U.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Dx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Ox(R),B=vl(T[0],k)||"",z=vl(T[1],k)||"",
|
|
1733
|
+
<script>${U.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Dx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Ox(R),B=vl(T[0],k)||"",z=vl(T[1],k)||"",F={};if(T[2]){let W=vl(T[2],k);if(typeof W==="object"&&W!==null)F=W;else if(typeof T[2]==="string")try{F=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:F}}function Ox(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let F=0;F<v.length;F++){let W=v[F],U=F>0?v[F-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){if(!R)R=!0,T=W;else if(W===T)R=!1,T="";else k+=W;continue}if(!R){if(W==="{")B++;if(W==="}")B--;if(W==="[")z++;if(W==="]")z--;if(W===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=W}if(k.trim())_.push(k.trim());return _}function vl(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var cp=Px();async function up(){try{return await import("./chunk-04gt67sv.js")}catch(v){if(!lp)console.warn("[stx-media] Video processor not available, some features disabled:",v),lp=!0;return null}}var lp=!1,dp=!0,fp="metadata",Mx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function fa(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return zx(R,k)}if(k.processedResult?.processed)return gp(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Fx(R,k);let{src:B,sources:z=[],poster:F,posterPlaceholder:W,controls:U=dp,autoplay:H=!1,muted:q=!1,loop:ie=!1,preload:Z=fp,playsinline:Q=!0,lazy:oe=!0,player:ae="native",type:ce,width:ue,height:le,crossorigin:Ae,disablePictureInPicture:ve=!1,disableRemotePlayback:he=!1}=v,Te=T||F,{class:De,style:Oe}=v,Me=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ae==="ts-video")return jx(v,_);if(ce&&ce!=="video")return Nx(B||"",ce,v);let Ne=z.length>0?z:B?[{src:B,type:pp(B)}]:[],Ie=[`id="${Me}"`];if(U)Ie.push("controls");if(H)Ie.push("autoplay");if(q)Ie.push("muted");if(ie)Ie.push("loop");if(Q)Ie.push("playsinline");if(ve)Ie.push("disablepictureinpicture");if(he)Ie.push("disableremoteplayback");if(Ae)Ie.push(`crossorigin="${Ae}"`);if(oe){if(Ie.push(`data-preload="${Z}"`),Ie.push('preload="none"'),Te)Ie.push(`data-poster="${rn(Te)}"`);Ie.push("data-stx-lazy")}else if(Ie.push(`preload="${Z}"`),Te)Ie.push(`poster="${rn(Te)}"`);if(ue)Ie.push(`width="${ue}"`);if(le)Ie.push(`height="${le}"`);if(De)Ie.push(`class="${rn(De)}"`);if(Oe)Ie.push(`style="${rn(Oe)}"`);let Be=Ne.map((je)=>` <source ${oe?`data-src="${rn(je.src)}"`:`src="${rn(je.src)}"`} type="${je.type}"${je.media?` media="${je.media}"`:""} />`).join(`
|
|
1734
1734
|
`),Fe=`<video ${Ie.join(" ")}>
|
|
1735
|
-
${
|
|
1735
|
+
${Be}
|
|
1736
1736
|
Your browser does not support the video tag.
|
|
1737
|
-
</video>`,
|
|
1737
|
+
</video>`,Le;if(oe)Le=`
|
|
1738
1738
|
(function() {
|
|
1739
1739
|
var video = document.getElementById('${Me}');
|
|
1740
1740
|
if (!video) return;
|
|
@@ -1769,12 +1769,12 @@ ${Le}
|
|
|
1769
1769
|
|
|
1770
1770
|
observer.observe(video);
|
|
1771
1771
|
})();
|
|
1772
|
-
`.trim();return{html:Fe,script:
|
|
1772
|
+
`.trim();return{html:Fe,script:Le}}function Nx(v,_,k){let{width:R=640,height:T=360}=k,{class:B,style:z}=k,F=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,U=null;switch(_){case"youtube":U=Lx(v),W=U?`https://www.youtube-nocookie.com/embed/${U}`:v;break;case"vimeo":U=Bx(v),W=U?`https://player.vimeo.com/video/${U}`:v;break;case"dailymotion":U=v.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=v.split("/").pop()||"",W=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=v}let H=[`id="${F}"`,`src="${rn(W)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(B)H.push(`class="${rn(B)}"`);if(z)H.push(`style="${rn(z)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1773
1773
|
<iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1774
|
-
</div>`}}function jx(v,_={}){let{src:k,sources:R=[],poster:T,controls:B=!0,autoplay:z=!1,muted:
|
|
1774
|
+
</div>`}}function jx(v,_={}){let{src:k,sources:R=[],poster:T,controls:B=!0,autoplay:z=!1,muted:F=!1,loop:W=!1,preload:U="metadata",playsinline:H=!0,lazy:q=!0,width:ie,height:Z}=v,{class:Q,style:oe}=v,ae=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ce={src:R.length>0?R:k,autoplay:z,loop:W,muted:F,playsinline:H,preload:U,poster:T,controls:B,title:v.title},ue=["position: relative",ie?`width: ${typeof ie==="number"?ie+"px":ie}`:"width: 100%",Z?`height: ${typeof Z==="number"?Z+"px":Z}`:"",oe||""].filter(Boolean).join("; "),le=`
|
|
1775
1775
|
<div
|
|
1776
1776
|
id="${ae}"
|
|
1777
|
-
class="ts-video-player${Q?" "+
|
|
1777
|
+
class="ts-video-player${Q?" "+rn(Q):""}"
|
|
1778
1778
|
style="${ue}"
|
|
1779
1779
|
data-ts-video-player
|
|
1780
1780
|
data-config='${JSON.stringify(ce)}'
|
|
@@ -1782,7 +1782,7 @@ ${Le}
|
|
|
1782
1782
|
>
|
|
1783
1783
|
<div class="ts-video-player__container">
|
|
1784
1784
|
${T?`
|
|
1785
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${
|
|
1785
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${rn(T)}');">
|
|
1786
1786
|
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1787
1787
|
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1788
1788
|
<path d="M8 5v14l11-7z"/>
|
|
@@ -1938,10 +1938,10 @@ else {
|
|
|
1938
1938
|
.ts-video-player__play-button svg {
|
|
1939
1939
|
margin-left: 4px;
|
|
1940
1940
|
}
|
|
1941
|
-
`.trim();return{html:le,script:Ae,css:ve}}function pp(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Lx(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let R=v.match(k);if(R)return R[1]}return null}function Bx(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function
|
|
1941
|
+
`.trim();return{html:le,script:Ae,css:ve}}function pp(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Lx(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let R=v.match(k);if(R)return R[1]}return null}function Bx(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function rn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function zx(v,_){let k=await up();if(!k)return fa({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return gp(v,T,_);return fa({...v,process:!1},_)}async function Fx(v,_){let k=await up();if(!k||!v.src)return;let R=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,R,T.outputDir,T.baseUrl||"/videos"))?.url}function gp(v,_,k){let{controls:R=dp,autoplay:T=!1,muted:B=!1,loop:z=!1,preload:F=fp,playsinline:W=!0,lazy:U=!0,width:H,height:q,crossorigin:ie,disablePictureInPicture:Z=!1,disableRemotePlayback:Q=!1}=v,{class:oe,style:ae}=v,ce=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ue=v.src,le=pp(ue);if(_.transcoded)ue=_.transcoded.url,le="video/mp4";let Ae=_.streaming?.hls||_.streaming?.dash;if(Ae){if(_.streaming?.hls)ue=_.streaming.hls.manifestUrl,le="application/x-mpegURL";else if(_.streaming?.dash)ue=_.streaming.dash.manifestUrl,le="application/dash+xml"}let ve=_.poster?.url||v.poster,he=[`id="${ce}"`];if(R)he.push("controls");if(T)he.push("autoplay");if(B)he.push("muted");if(z)he.push("loop");if(W)he.push("playsinline");if(Z)he.push("disablepictureinpicture");if(Q)he.push("disableremoteplayback");if(ie)he.push(`crossorigin="${ie}"`);if(U){if(he.push(`data-preload="${F}"`),he.push('preload="none"'),ve)he.push(`data-poster="${rn(ve)}"`);he.push("data-stx-lazy")}else if(he.push(`preload="${F}"`),ve)he.push(`poster="${rn(ve)}"`);let Te=H||_.metadata?.width,De=q||_.metadata?.height;if(Te)he.push(`width="${Te}"`);if(De)he.push(`height="${De}"`);if(oe)he.push(`class="${rn(oe)}"`);if(ae)he.push(`style="${rn(ae)}"`);let Me=` <source ${U?`data-src="${rn(ue)}"`:`src="${rn(ue)}"`} type="${le}" />`,Ne=`<video ${he.join(" ")}>
|
|
1942
1942
|
${Me}
|
|
1943
1943
|
Your browser does not support the video tag.
|
|
1944
|
-
</video>`;if(_.spriteSheet)Ne=`<div class="stx-video-wrapper" data-sprite-sheet="${
|
|
1944
|
+
</video>`;if(_.spriteSheet)Ne=`<div class="stx-video-wrapper" data-sprite-sheet="${rn(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
|
|
1945
1945
|
${Ne}
|
|
1946
1946
|
</div>`;let Ie;if(U)Ie=`
|
|
1947
1947
|
(function() {
|
|
@@ -1978,7 +1978,7 @@ ${Ne}
|
|
|
1978
1978
|
|
|
1979
1979
|
observer.observe(video);
|
|
1980
1980
|
})();
|
|
1981
|
-
`.trim();let
|
|
1981
|
+
`.trim();let Be;if(Ae)Be=`
|
|
1982
1982
|
.stx-video-wrapper {
|
|
1983
1983
|
position: relative;
|
|
1984
1984
|
width: 100%;
|
|
@@ -1987,9 +1987,9 @@ ${Ne}
|
|
|
1987
1987
|
width: 100%;
|
|
1988
1988
|
height: auto;
|
|
1989
1989
|
}
|
|
1990
|
-
`.trim();return{html:Ne,script:Ie,css:
|
|
1990
|
+
`.trim();return{html:Ne,script:Ie,css:Be}}function mp(){return tt({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,R)=>{let{src:T,options:B}=Wx(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let z={src:T,poster:B.poster,controls:B.controls!==!1,autoplay:B.autoplay||!1,muted:B.muted||!1,loop:B.loop||!1,preload:B.preload||"metadata",playsinline:B.playsinline!==!1,lazy:B.lazy!==!1,player:B.player||"native",type:B.type,width:B.width,height:B.height,class:B.class,style:B.style,id:B.id,crossorigin:B.crossorigin,disablePictureInPicture:B.disablePictureInPicture,disableRemotePlayback:B.disableRemotePlayback,title:B.title,quality:B.quality,platform:B.platform,process:B.process,generatePoster:B.generatePoster,streaming:B.streaming,transcode:B.transcode,spriteSheet:B.spriteSheet,waveform:B.waveform},W={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},U=await fa(z,W),H=U.html;if(U.css)H+=`
|
|
1991
1991
|
<style>${U.css}</style>`;if(U.script)H+=`
|
|
1992
|
-
<script>${U.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
1992
|
+
<script>${U.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Wx(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let R=v.trim();if(R.startsWith("@video(")||R.startsWith("("))R=R.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Vx(R),B=hp(T[0],k)||"",z={};if(T[1]){let F=hp(T[1],k);if(typeof F==="object"&&F!==null)z=F;else if(typeof T[1]==="string")try{z=JSON.parse(T[1])}catch{}}return{src:B,options:z}}function Vx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let F=0;F<v.length;F++){let W=v[F],U=F>0?v[F-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){if(!R)R=!0,T=W;else if(W===T)R=!1,T="";else k+=W;continue}if(!R){if(W==="{")B++;if(W==="}")B--;if(W==="[")z++;if(W==="]")z--;if(W===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=W}if(k.trim())_.push(k.trim());return _}function hp(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var wl=mp();import Ux from"fs";import An from"path";async function dr(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],R=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let B=await Hx(T,v,_);if(B)R.push(B)}catch(B){if(console.error(`Error building web component ${T.name}:`,B),v.debug)throw B}}return R}async function Hx(v,_,k){let{name:R,file:T,tag:B,extends:z}=v;if(!R||!T||!B)return console.error("Invalid web component configuration, missing required fields:",v),null;let F=null;if(An.isAbsolute(T)&&await r(T))F=T;else if(_.componentsDir){let oe=An.join(_.componentsDir,T);if(await r(oe))F=oe}if(!F)F=await ur(T,process.cwd(),_,k);if(!F)return console.error(`Web component source file not found: ${T}`),null;let W=await Bun.file(F).text();k.add(F);let H=(v.outputFormat||"js")==="ts",q=H?Kx({name:R,tag:B,baseElement:z,source:W,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):qx({name:R,tag:B,baseElement:z,source:W,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),ie=_.webComponents?.outputDir||"dist/web-components";await Ux.promises.mkdir(ie,{recursive:!0});let Z=H?"ts":"js",Q=An.join(ie,`${B}.${Z}`);if(await Bun.write(Q,q),_.debug)console.log(`Built web component ${R} -> ${Q}`);return Q}function qx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:F,attributes:W=[]}=v,U=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let H="";if(F)H=`<link rel="stylesheet" href="${F}">`;return`/**
|
|
1993
1993
|
* ${_} Web Component
|
|
1994
1994
|
* Auto-generated from stx component
|
|
1995
1995
|
*/
|
|
@@ -2054,9 +2054,9 @@ class ${_.replace(/\W/g,"")} extends ${R} {
|
|
|
2054
2054
|
}`}
|
|
2055
2055
|
}
|
|
2056
2056
|
|
|
2057
|
-
${
|
|
2057
|
+
${W.length>0?`
|
|
2058
2058
|
static get observedAttributes() {
|
|
2059
|
-
return [${
|
|
2059
|
+
return [${W.map((q)=>`'${q}'`).join(", ")}]
|
|
2060
2060
|
}
|
|
2061
2061
|
|
|
2062
2062
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -2081,8 +2081,8 @@ class ${_.replace(/\W/g,"")} extends ${R} {
|
|
|
2081
2081
|
|
|
2082
2082
|
// Register the web component
|
|
2083
2083
|
customElements.define('${k}', ${_.replace(/\W/g,"")})
|
|
2084
|
-
`}function Kx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:
|
|
2085
|
-
`),ae=
|
|
2084
|
+
`}function Kx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:F,attributes:W=[],attributeTypes:U={}}=v,H=_.replace(/\W/g,""),q=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)q=q.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),q=q.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),q=q.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),q=q.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");q=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let ie=F?`<link rel="stylesheet" href="${F}">`:"",Z=(ve)=>{switch(U[ve]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},Q=(ve)=>ve.replace(/-([a-z])/g,(he,Te)=>Te.toUpperCase()),oe=W.map((ve)=>` private _${Q(ve)}: ${Z(ve)} | null = null;`).join(`
|
|
2085
|
+
`),ae=W.map((ve)=>{let he=Z(ve),Te=Q(ve);return`
|
|
2086
2086
|
get ${Te}(): ${he} | null {
|
|
2087
2087
|
return this._${Te};
|
|
2088
2088
|
}
|
|
@@ -2096,16 +2096,16 @@ else {
|
|
|
2096
2096
|
this.removeAttribute('${ve}');
|
|
2097
2097
|
}
|
|
2098
2098
|
}`}).join(`
|
|
2099
|
-
`),ce=
|
|
2099
|
+
`),ce=W.length>0?`/**
|
|
2100
2100
|
* Props interface for ${_}
|
|
2101
2101
|
*/
|
|
2102
2102
|
export interface ${H}Props {
|
|
2103
|
-
${
|
|
2103
|
+
${W.map((ve)=>{let he=Z(ve);return` ${Q(ve)}?: ${he};`}).join(`
|
|
2104
2104
|
`)}
|
|
2105
2105
|
}
|
|
2106
|
-
`:"",ue=
|
|
2106
|
+
`:"",ue=W.length>0?`
|
|
2107
2107
|
static get observedAttributes(): string[] {
|
|
2108
|
-
return [${
|
|
2108
|
+
return [${W.map((ve)=>`'${ve}'`).join(", ")}];
|
|
2109
2109
|
}
|
|
2110
2110
|
|
|
2111
2111
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
@@ -2236,7 +2236,7 @@ declare global {
|
|
|
2236
2236
|
|
|
2237
2237
|
// Register the web component
|
|
2238
2238
|
customElements.define('${k}', ${H});
|
|
2239
|
-
`}function Xx(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),R=k?k[1].trim():"",T=_,B=[],z=!0;if(R){let q=R.match(/export\s+default\s+({[\s\S]*})/);if(q)try{let ie=q[1],Z=ie.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(Z)T=Z[1];let Q=ie.match(/props\s*:\s*\[([\s\S]*?)\]/);if(Q)B=Q[1].split(",").map((ae)=>ae.trim().replace(/['"`]/g,"")).filter((ae)=>ae.length>0);let oe=ie.match(/shadowDOM\s*:\s*(true|false)/);if(oe)z=oe[1]==="true"}catch{}}let
|
|
2239
|
+
`}function Xx(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),R=k?k[1].trim():"",T=_,B=[],z=!0;if(R){let q=R.match(/export\s+default\s+({[\s\S]*})/);if(q)try{let ie=q[1],Z=ie.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(Z)T=Z[1];let Q=ie.match(/props\s*:\s*\[([\s\S]*?)\]/);if(Q)B=Q[1].split(",").map((ae)=>ae.trim().replace(/['"`]/g,"")).filter((ae)=>ae.length>0);let oe=ie.match(/shadowDOM\s*:\s*(true|false)/);if(oe)z=oe[1]==="true"}catch{}}let F=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=F?F[1].trim():"",U=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),H=U?U[1].trim():"";return{tag:T,props:B,template:W,styles:H,script:R,shadowDOM:z}}function Zx(v){let{tag:_,props:k,template:R,styles:T,shadowDOM:B}=v,z=_.split("-").map((q)=>q.charAt(0).toUpperCase()+q.slice(1)).join(""),F=R.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=k.map((q)=>`'${q}'`).join(", "),H=k.map((q)=>`
|
|
2240
2240
|
get ${q}() {
|
|
2241
2241
|
return this.getAttribute('${q}') || '';
|
|
2242
2242
|
}
|
|
@@ -2271,7 +2271,7 @@ class ${z} extends HTMLElement {
|
|
|
2271
2271
|
${H}
|
|
2272
2272
|
|
|
2273
2273
|
_render() {
|
|
2274
|
-
const template = \`${
|
|
2274
|
+
const template = \`${W?`<style>${W}</style>`:""}${F}\`;
|
|
2275
2275
|
|
|
2276
2276
|
// Interpolate {{ prop }} with attribute values
|
|
2277
2277
|
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
|
|
@@ -2287,24 +2287,24 @@ ${H}
|
|
|
2287
2287
|
}
|
|
2288
2288
|
|
|
2289
2289
|
customElements.define('${_}', ${z});
|
|
2290
|
-
`}async function yp(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",
|
|
2290
|
+
`}async function yp(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",F=An.isAbsolute(z)?[An.join(z,`${T}.stx`),An.join(An.dirname(R),`${T}.stx`)]:[An.join(An.dirname(R),z,`${T}.stx`),An.join(process.cwd(),z,`${T}.stx`),An.join(An.dirname(R),`${T}.stx`)],W=null;for(let q of F)if(await r(q)){W=await Bun.file(q).text();break}if(!W)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let U=Xx(W,T);return`<script type="module">
|
|
2291
2291
|
${Zx(U)}
|
|
2292
|
-
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Lt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Qf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:yp,hasEndTag:!1,description:"Include a web component in the template"},Ni,Mi,mr,hr,zf,Ff,Vf,Wf,Gf,Bf,cp,wl,...Rr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jx(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=rn.join(T,"resources","views"),z=rn.join(T,"resources","layouts");if(Fs.existsSync(B)&&Fs.existsSync(z))return{root:"resources",pagesDir:"views"};let W=rn.join(T,"resources","views","pages");if(Fs.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var xp=new Set,ga=["partialsDir","componentsDir","layoutsDir"],Sl=new WeakMap;function Yx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function Qc(v,_){let k=!v.root,R=Jx(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!xp.has(T))xp.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Sl.has(v)){let T={};for(let B of ga){let z=v[B];if(typeof z==="string"&&z)T[B]=z}Sl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ga){let z=v[B];if(typeof z!=="string"||!z)continue;if(rn.isAbsolute(z)||Yx(z,T))continue;v[B]=rn.join(T,z)}}for(let T of ga){let B=v[T];if(typeof B!=="string"||!B||rn.isAbsolute(B))continue;v[T]=rn.resolve(_,B)}return v}function Qx(v,_){let k=Sl.get(v);for(let R of ga){let T=v[R];if(typeof T!=="string"||!T)continue;let B=rn.isAbsolute(T)?T:rn.join(_,T);if(Fs.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function eb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function tb(v){if(zi(v.stateDir),v.stateDir=kn(),v.cachePath=Cn(v.cachePath),v.build)v.build.cacheDir=Cn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=Cn(v.media.cache.directory);if(v.story)v.story.outDir=Cn(v.story.outDir)}var Tr=null,qr=new Map,pa=new Map,go=null;async function Ls(v,_=Gx){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?rn.resolve(v):process.cwd(),k=pa.get(_);if(k&&k.signature!==pr(k.graph)){let B=qr.get(_);if(qr.delete(_),pa.delete(_),!v)Tr=null,go=null;let{clearComponentCache:z}=await import("./chunk-hpjtzap4.js"),{partialsCache:W}=await import("./chunk-e7hmrrmt.js");if(z(),W.clear(),B&&k.configSignature===fr(k.graph)){let F=B.then(async(U)=>{let H={...k.graph};await Bs(H,_),pa.set(_,{graph:H,signature:pr(H),configSignature:fr(H)});let q={...U,_layerGraph:H};if(!v)Tr=q;return q});return qr.set(_,F),F}}if(!v){if(Tr)return Tr;if(go)return go}let R=qr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((ie)=>Fs.existsSync(rn.join(_,`stx.config${ie}`))),W=B.some((ie)=>Fs.existsSync(rn.join(_,"config",`ui${ie}`))),F;if(z&&W){let ie=await Ls({name:"ui",cwd:rn.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await Ls({name:"stx",alias:"ui",cwd:_,defaultConfig:ie.config,errorPolicy:"throw",verbose:!1})).config}else F=(await Ls({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let ie=await Bi(_,A);F=ie.config,pa.set(_,{graph:ie.graph,signature:pr(ie.graph),configSignature:fr(ie.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:ie}=await import("./chunk-138zjhwa.js");ie(F.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-gxm1rb64.js");await Z(_,F.runtimeConfig)}eb(F),tb(F),Qc(F,_),Qx(F,_);let U=[],H=new Set((F.plugins??[]).map((ie)=>typeof ie==="string"?ie:ie[0]));for(let ie of F.componentPackages??["@stacksjs/components"]){let Z=`${ie}/stx-plugin`;if(H.has(Z)||H.has(ie))continue;try{d.resolve(Z,{paths:[_]}),U.push(Z)}catch{}}let q=[...F.plugins??[],...U];if(q.length>0){let{pluginManager:ie}=await import("./chunk-p973efbe.js"),Z=[],Q=[];for(let oe of q){let ae=typeof oe==="string"?oe:oe[0],ce=typeof oe==="string"?{}:oe[1]||{};try{let ue,le;try{let ve=d.resolve(ae,{paths:[_]});ue=await import(ve),le=rn.dirname(ve)}catch{let ve=rn.resolve(_,ae);ue=await import(ve),le=rn.dirname(ve)}let Ae=ue.default||ue;if(!ie.has(Ae.name))await ie.register(Ae,F);if(Ae.components){let ve=Array.isArray(Ae.components)?Ae.components:[Ae.components];for(let he of ve)Z.push(rn.resolve(le,he))}if(Ae.pages){let ve=rn.resolve(le,Ae.pages),he=ce.path||"/";Q.push({dir:ve,prefix:he})}if(Ae.setup){let ve={addDirective:(he)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(he)},addRoute:(he,Te)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[he]=Te},addMiddleware:(he)=>{F.middleware=F.middleware||[],F.middleware.push(he)},pluginDir:le,config:F};await Ae.setup(ce,ve)}process.stderr.write(`[stx] Plugin loaded: ${Ae.name||ae}
|
|
2293
|
-
`)}catch(ue){console.warn(`[stx] Failed to load plugin ${ae}:`,ue.message)}}F._pluginComponentDirs=Z,F._pluginPageDirs=Q}return F})();if(qr.set(_,T),T.catch(()=>{if(qr.get(_)===T)qr.delete(_)}),!v)go=T,T.then((B)=>{Tr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Tr&&_ in Tr)return Tr[_];if(!go)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function hd(v){return v}function yd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${B}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var _l=new Map;async function ge(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await nb.promises.stat(v)).mtime.getTime();if(_.cache&&_l.has(v)){let q=_l.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=er(T),W=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=Ve(z,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)U=await sb(U,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:U,data:B||{}};if(_.cache)_l.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var ma=null;async function sb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ma)try{ma=await rb({theme:_||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),v}let T=async(W,F,U,H)=>{let q=H.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),ie=U||(k?"text":"");if(!ie)return W;try{if(!ma.getSupportedLanguages().includes(ie))return W;return(await ma.highlight(q,ie,{theme:_})).html}catch(Z){console.error(`Error highlighting code block with language ${U}:`,Z)}return W},B=v,z=v.matchAll(R);for(let W of z){let[F,U,H,q]=W,ie=await T(F,U,H,q);B=B.replace(F,ie)}return B}async function bp(v,_,k="",R={}){return await ib(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,W,F,U)=>{try{let H=W;if(!$l.isAbsolute(W))H=$l.resolve($l.dirname(k),W);let q={};if(F)try{try{q=JSON.parse(F)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let ue=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let le of ue){let Ae=le.indexOf(":");if(Ae>0){let ve=le.substring(0,Ae).trim(),he=le.substring(Ae+1).trim(),Te=he.startsWith('"')&&he.endsWith('"'),De=he.startsWith("'")&&he.endsWith("'");if(Te||De)he=he.substring(1,he.length-1);q[ve]=he}}}}catch(ce){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ce)}let{content:ie,data:Z}=await ge(H,R),Q={..._,...Z,...q},oe=ie,ae=/\{\{([^}]+)\}\}/g;return oe=oe.replace(ae,(ce,ue)=>{let le=ue.trim();return Q[le]!==void 0?String(Q[le]):ce}),oe}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,U,z)}})}async function ib(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let W=T[0],F=T.index,U=T;R.push(k(...U).then((H)=>({match:W,replacement:H,index:F})))}let B=await Promise.all(R);B.sort((W,F)=>F.index-W.index);let z=v;for(let{match:W,replacement:F}of B)z=z.replace(W,()=>F);return z}function Ir(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Pr(v,_){let k=ob(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function ob(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function ab(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Kr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),W=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,W.lastIndex=B;let F=z.exec(v),U=W.exec(v),H=F?F.index:1/0,q=U?U.index:1/0;if(H<q)T++,B=H+F[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+U[0].length}else break}return-1}function vp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Pr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"if","endif",B);if(z===-1)return null;let W=v.slice(B,z),F=[],U=0,H="if",q=T.expression,ie=0,Z=0;while(U<W.length){let Q=W.indexOf("@",U);if(Q===-1)break;U=Q;let oe=W.substring(Q);if(ab(W,Q)){U++;continue}if(/^@if\s*\(/.test(oe)){Z++,U++;continue}if(/^@endif(?![a-z])/.test(oe)){Z--,U+=6;continue}if(Z===0){let ae=oe.match(/^@elseif\s*/);if(ae){F.push({type:H,condition:q,content:W.substring(ie,U),start:B+ie,end:B+U});let ce=U+ae[0].length,ue=Pr(W,ce);if(!ue){U++;continue}H="elseif",q=ue.expression,U=ue.endPos,ie=U;continue}else if(/^@else(?![a-z])/.test(oe)){F.push({type:H,condition:q,content:W.substring(ie,U),start:B+ie,end:B+U}),H="else",q=void 0,U+=5,ie=U;continue}}U++}return F.push({type:H,condition:q,content:W.slice(ie),start:B+ie,end:B+W.length}),{fullMatch:v.slice(_,z+6),branches:F,start:_,end:z+6}}function mo(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=vp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function ha(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((oe)=>B.index>oe.start&&B.index<oe.end)){B=T.exec(v);continue}let W=B.index,F=W+B[0].length-1,U=S(v,"(",")",F);if(U===-1){B=T.exec(v);continue}let H=v.slice(F+1,U),q=U+1,ie=Kr(v,_,k,q);if(ie===-1){B=T.exec(v);continue}let Z=v.slice(q,ie),Q=ie+`@${k}`.length;R.push({fullMatch:v.slice(W,Q),name:_,params:H,content:Z,start:W,end:Q}),T.lastIndex=Q,B=T.exec(v)}return R}function kl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=Pr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"switch","endswitch",B);if(z===-1)return null;let W=v.slice(B,z),F=[],U=0,H=null,q=0;while(U<W.length){let ie=W.slice(U),Z=ie.match(/^@switch\s*\(/),Q=ie.match(/^@endswitch(?![a-z])/);if(Z){if(q++,H)H.content+=Z[0];U+=Z[0].length;continue}if(Q){if(q--,H)H.content+=Q[0];U+=Q[0].length;continue}if(q>0){if(H)H.content+=W[U];U++;continue}let oe=ie.match(/^@case\s*/),ae=ie.match(/^@default(?![a-z])/),ce=ie.match(/^@break(?![a-z])/);if(oe&&ie.startsWith("@case")){if(H)F.push(H);let ue=U+oe[0].length,le=Pr(W,ue);if(!le){U++;continue}H={type:"case",value:le.expression,content:""},U=le.endPos}else if(ae&&ie.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},U+=ae[0].length}else if(ce&&ie.startsWith("@break"))U+=ce[0].length;else{if(H)H.content+=W[U];U++}}if(H)F.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:F,start:_,end:z+10}}function db(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=kl(R,z);if(!W)break;try{let F;if(p(W.expression))F=c(W.expression,Object.keys(_))(...Object.values(_));else F=l(W.expression,_);let U="",H=!1;for(let q of W.cases)if(q.type==="default"){if(!H)U=q.content.trim()}else try{let ie;if(q.value&&p(q.value))ie=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)ie=l(q.value,_);if(F===ie){U=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+U+R.substring(W.end),T=!0}catch(F){let U=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${U}`,t.EVALUATION_ERROR);R=R.substring(0,z)+H+R.substring(W.end);break}}return R}function fb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function pb(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function yr(v,_,k){let{masked:R,scripts:T}=fb(v);return pb(gb(R,_,k),T)}function gb(v,_,k){let R=v;R=db(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=Pr(R,W+7);if(!F)break;let U=F.endPos,H=Kr(R,"unless","endunless",U);if(H===-1){console.warn(`[stx] @unless directive at position ${W} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(U,H),ie=F.expression,Z=-1;{let oe=0,ae=/@(?:if|unless)\s*\(/g,ce=/@(?:endif|endunless)(?![a-z])/g,ue=/@else(?![a-z])/g,le=[],Ae;while((Ae=ae.exec(q))!==null)le.push({pos:Ae.index,type:"open"});while((Ae=ce.exec(q))!==null)le.push({pos:Ae.index,type:"close"});while((Ae=ue.exec(q))!==null)le.push({pos:Ae.index,type:"else"});le.sort((ve,he)=>ve.pos-he.pos);for(let ve of le)if(ve.type==="open")oe++;else if(ve.type==="close")oe--;else if(ve.type==="else"&&oe===0){Z=ve.pos;break}}let Q;if(Z!==-1){let oe=q.slice(0,Z),ae=q.slice(Z+5);Q=`@if (${ie})${ae}@else ${oe}@endif`}else Q=`@if (!(${ie}))${q}@endif`;R=R.substring(0,W)+Q+R.substring(H+10),B=!0}}R=Cl(R,_,k),R=Rl(R,_,k),R=El(R,_);let T=()=>{let B=mo(R);if(B.length===0)return!1;let z=Array(B.length);for(let U=B.length-1;U>=0;U--){let H=B[U];try{let q="",ie=!1;for(let Z of H.branches){if(ie)break;if(Z.type==="else")q=Z.content,ie=!0;else try{if(Z.condition?Ki(Z.condition,_):!1)q=Z.content,ie=!0}catch(Q){q=i(Z.type==="if"?"If":"Elseif",`Error in @${Z.type}(${Z.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),ie=!0}}z[U]=q}catch(q){let ie=q instanceof Error?q.message:String(q);z[U]=i("If",`Error processing @if block: ${ie}`,t.EVALUATION_ERROR)}}let W=Array(B.length*2+1),F=0;for(let U=0;U<B.length;U++){let H=B[U];W[U*2]=R.slice(F,H.start),W[U*2+1]=z[U],F=H.end}return W[B.length*2]=R.slice(F),R=W.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function wp(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function El(v,_){let k=v;function R(W,F,U,H){let q=1,ie=H,Z=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${U}(?![a-z])`,"g");while(ie<W.length&&q>0){Z.lastIndex=ie,Q.lastIndex=ie;let oe=Z.exec(W),ae=Q.exec(W),ce=oe?oe.index:1/0,ue=ae?ae.index:1/0;if(ce<ue)q++,ie=ce+oe[0].length;else if(ue<1/0){if(q--,q===0)return ue;ie=ue+ae[0].length}else break}return-1}function T(W,F,U){let H=0,q=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),ie=new RegExp(`@${U}(?![a-z])`,"g"),Z=/@else(?![a-z])/g,Q=[],oe;while((oe=q.exec(W))!==null)Q.push({pos:oe.index,type:"open"});while((oe=ie.exec(W))!==null)Q.push({pos:oe.index,type:"close"});while((oe=Z.exec(W))!==null)Q.push({pos:oe.index,type:"else"});Q.sort((ae,ce)=>ae.pos-ce.pos);for(let ae of Q)if(ae.type==="open")H++;else if(ae.type==="close")H--;else if(ae.type==="else"&&H===0)return ae.pos;return-1}{let W=!0;while(W){W=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let U=F.index,H,q,ie=k.slice(U+5),Z=wp(ie);if(Z)H=Z.value,q=U+5+Z.consumed;else q=U+5;let Q=R(k,"auth","endauth",q);if(Q===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let oe=k.slice(q,Q),ae=T(oe,"auth","endauth"),ce;if(!_.auth)ce=!1;else ce=H?Ir(`auth?.check && auth?.user?.[${H}]`,_):Ir("auth?.check",_);let ue;if(ae!==-1){let le=oe.slice(0,ae),Ae=oe.slice(ae+5);ue=ce?le:Ae}else ue=ce?oe:"";k=k.substring(0,U)+ue+k.substring(Q+8),W=!0}}{let W=!0;while(W){W=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let U=F.index,H,q,ie=k.slice(U+6),Z=wp(ie);if(Z)H=Z.value,q=U+6+Z.consumed;else q=U+6;let Q=R(k,"guest","endguest",q);if(Q===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let oe=k.slice(q,Q),ae=T(oe,"guest","endguest"),ce;if(!_.auth)ce=!0;else ce=H?Ir(`!auth?.check || !auth?.user?.[${H}]`,_):Ir("!auth?.check",_);let ue;if(ae!==-1){let le=oe.slice(0,ae),Ae=oe.slice(ae+5);ue=ce?le:Ae}else ue=ce?oe:"";k=k.substring(0,U)+ue+k.substring(Q+9),W=!0}}function B(W,F,U){if(_.userCan&&typeof _.userCan[W]==="boolean")return _.userCan[W];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[W];if(F)H.push(F);if(U){let q=Ir(U,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(W){let F=W.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let W of["can","cannot"]){let F=`end${W}`,U=W==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${W}\\s*\\(`));if(!q||q.index===void 0)break;let ie=q.index,Z=k.slice(ie+`@${W}`.length),Q=z(Z);if(!Q)break;let oe=ie+`@${W}`.length+Q.paramsEnd,ae=R(k,W,F,oe);if(ae===-1){console.warn(`[stx] @${W} directive at position ${ie} has no matching @${F} \u2014 the block was skipped.`);break}let ce=k.slice(oe,ae),ue=[],le=0,Ae=new RegExp(`@${W}\\s*\\(`,"g"),ve=new RegExp(`@${F}(?![a-z])`,"g"),he=new RegExp(`@${U}\\s*\\(`,"g"),Te=/@else(?![a-z])/g,De=[],Oe;while((Oe=Ae.exec(ce))!==null)De.push({pos:Oe.index,type:"open"});while((Oe=ve.exec(ce))!==null)De.push({pos:Oe.index,type:"close"});while((Oe=he.exec(ce))!==null)De.push({pos:Oe.index,type:"elseDirective"});while((Oe=Te.exec(ce))!==null)De.push({pos:Oe.index,type:"else"});De.sort((ze,je)=>ze.pos-je.pos);for(let ze of De){if(ze.type==="open"){le++;continue}if(ze.type==="close"){le--;continue}if(le===0)ue.push(ze)}let Me=[],Ne=0;for(let ze=0;ze<ue.length;ze++){let je=ue[ze];if(Me.push({content:ce.slice(Ne,je.pos),ability:void 0}),je.type==="elseDirective"){let He=ce.slice(je.pos+`@${U}`.length),mt=z(He);if(mt){Me[Me.length-1]={content:ce.slice(Ne,je.pos)},Ne=je.pos+`@${U}`.length+mt.paramsEnd,Me.push({content:"",ability:mt.ability,type:mt.type,id:mt.id}),Me.pop();let St=ue[ze+1],xt=St?St.pos:ce.length;Me.push({content:ce.slice(Ne,xt),ability:mt.ability,type:mt.type,id:mt.id}),Ne=xt}}else Ne=je.pos+5}if(Ne<ce.length){let ze=Me[Me.length-1];if(ue.length>0&&ue[ue.length-1].type==="else")Me.push({content:ce.slice(Ne),isFinalElse:!0});else if(Me.length===0)Me.push({content:ce.slice(Ne)})}let Ie=B(Q.ability,Q.type,Q.id),Le=W==="can"?Ie:!Ie,Fe="";if(Le)Fe=Me[0]?.content||"";else{let ze=!1;for(let je=1;je<Me.length;je++){let He=Me[je];if(He.isFinalElse){Fe=He.content,ze=!0;break}if(He.ability){let mt=B(He.ability,He.type,He.id);if(W==="can"?mt:!mt){Fe=He.content,ze=!0;break}}}if(!ze&&Me.length>0){let je=Me[Me.length-1];if(je.isFinalElse)Fe=je.content}}k=k.substring(0,ie)+Fe+k.substring(ae+`@${F}`.length),H=!0}}return k}function Cl(v,_,k){let R=v;function T(B,z,W,F,U){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),ie=B.match(q);if(!ie||ie.index===void 0)break;let Z=ie.index,Q=Pr(B,Z+`@${z}`.length);if(!Q)break;let oe=Q.endPos,ae=Kr(B,z,W,oe);if(ae===-1){console.warn(`[stx] @${z} directive at position ${Z} has no matching @${W} \u2014 the block was skipped.`);break}let ce=B.slice(oe,ae),ue=Q.expression,le=-1,Ae=0,ve=0;while(ve<ce.length){let he=ce.indexOf("@",ve);if(he===-1)break;let Te=ce.substring(he);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Te)){Ae++,ve=he+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Te)){Ae--,ve=he+1;continue}if(Ae===0&&/^@else(?![a-z])/.test(Te)){le=he;break}ve=he+1}try{let he=F(ue.trim()),Te;if(le!==-1){let De=ce.slice(0,le),Oe=ce.slice(le+5);Te=he?De:Oe}else Te=he?ce:"";B=B.substring(0,Z)+Te+B.substring(ae+`@${W}`.length),H=!0}catch(he){let Te=he instanceof Error?he.message:String(he),De=i(U,`Error processing @${z} directive: ${Te}`,t.EVALUATION_ERROR);B=B.substring(0,Z)+De+B.substring(ae+`@${W}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=Ir(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=Ir(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function Rl(v,_,k){let R=v,T="development";function B(z,W,F,U){let H=new RegExp(`@${W}(?![a-z])`,"g"),q=new RegExp(`@${F}(?![a-z])`,"g"),ie=new RegExp(`^@${W}(?![a-z])`),Z=new RegExp(`^@${F}(?![a-z])`),Q=z,oe=!0;while(oe){oe=!1,H.lastIndex=0;let ae=H.exec(Q);if(!ae)break;let ce=ae.index,ue=ce+ae[0].length;if(W==="env"){let Ie=Q.substring(ue).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!Ie)break;ue+=Ie[0].length,U=T===Ie[2]}let le=1,Ae=ue,ve=-1;while(le>0&&Ae<Q.length){H.lastIndex=Ae,q.lastIndex=Ae;let Ie=H.exec(Q),Le=q.exec(Q),Fe=Ie?Ie.index:1/0,ze=Le?Le.index:1/0;if(Fe<ze)le++,Ae=Fe+Ie[0].length;else if(ze<1/0){if(le--,le===0){ve=ze;break}Ae=ze+Le[0].length}else break}if(ve===-1){console.warn(`[stx] @${W} directive at position ${ce} has no matching @${F} \u2014 the block was skipped.`);break}let he=Q.substring(ue,ve),Te=-1,De=0,Oe=0;while(Oe<he.length){let Ie=he.indexOf("@",Oe);if(Ie===-1)break;let Le=he.substring(Ie);if(ie.test(Le)){De++,Oe=Ie+1;continue}if(Z.test(Le)){De--,Oe=Ie+1;continue}if(De===0&&/^@else(?![a-z])/.test(Le)){Te=Ie;break}Oe=Ie+1}let Me;if(Te!==-1){let Ie=he.slice(0,Te),Le=he.slice(Te+5);Me=U?Ie:Le}else Me=U?he:"";let Ne=`@${F}`.length;Q=Q.substring(0,ce)+Me+Q.substring(ve+Ne),oe=!0}return Q}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var Sp=new WeakMap;function $p(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function ya(v,_){if(!v)return _?.nonceGenerator?.()??$p();let k=Sp.get(v);if(!k)k=_?.nonceGenerator?.()??$p(),Sp.set(v,k);return k}function mb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function _p(v,_){return`<meta http-equiv="Content-Security-Policy" content="${mb(v,_).replace(/&/g,"&").replace(/"/g,""")}">`}function kp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let R=_.useNonce?ya(k,_):void 0,T=_p(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
|
|
2294
|
-
${T}`)}function Ep(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function Cp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?ya(_,B):void 0;return _p(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return ya(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=ya(_,B);return T}import hb from"crypto";var yb=40,Rp="_token",Al=null;function xb(v=yb){let _=hb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Al=_,_}function bb(){if(!Al)xb();return Al}function vb(v=Rp){let _=bb();return`<input type="hidden" name="${v}" value="${_}">`}function Ap(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>vb(R||Rp))}async function Tp(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await wb(T,B,_,k,R);else T=await Sb(T,B,_,k,R)}return T}async function wb(v,_,k,R,T){let{name:B,handler:z}=_,W=`@${B}`,F=`@end${B}`,U=v,H=Fr(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),q=[],ie=H.exec(U);while(ie!==null){let[Z,Q="",oe=""]=ie,ae=ie.index||0;try{let ce=Q?Ip(_,Q):[],ue=oe.trim(),le=await z(ue,ce,k,R);q.push({original:Z,processed:le,startIndex:ae})}catch(ce){let ue=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);q.push({original:Z,processed:i("CustomDirective",`Error in @${B}${Q?`(${Q})`:""}: ${ue}`,t.EVALUATION_ERROR),startIndex:ae})}ie=H.exec(U)}for(let Z=q.length-1;Z>=0;Z--){let{original:Q,processed:oe}=q[Z];U=U.replace(Q,oe)}return U}async function Sb(v,_,k,R,T){let{name:B,handler:z}=_,W=v,F=[],U=[];if(_.rawParams){for(let ie of qs(W,Fr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(ie.end!==-1)U.push({fullMatch:ie.call,paramString:ie.args,startIndex:ie.start})}else{let ie=Fr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");ie.lastIndex=0;let Z=ie.exec(W);while(Z!==null)U.push({fullMatch:Z[0],paramString:Z[1]??"",startIndex:Z.index||0}),Z=ie.exec(W)}for(let{fullMatch:ie,paramString:Z,startIndex:Q}of U)try{let oe=Ip(_,Z),ae=await z("",oe,k,R);F.push({original:ie,processed:ae,startIndex:Q})}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${B}:`,oe);F.push({original:ie,processed:i("CustomDirective",`Error in @${B}(${Z}): ${ae}`,t.EVALUATION_ERROR),startIndex:Q})}let H=Fr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(W);while(q!==null){let[ie]=q,Z=q.index||0;try{let Q=await z("",[],k,R);F.push({original:ie,processed:Q,startIndex:Z})}catch(Q){let oe=Q instanceof Error?Q.message:String(Q);if(T.debug)console.error(`Error processing custom directive @${B}:`,Q);F.push({original:ie,processed:i("CustomDirective",`Error in @${B}: ${oe}`,t.EVALUATION_ERROR),startIndex:Z})}q=H.exec(W)}for(let ie=F.length-1;ie>=0;ie--){let{original:Z,processed:Q}=F[ie];W=W.replace(Z,Q)}return W}function Ip(v,_){return v.rawParams?st(_):$b(_)}function $b(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var Pp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dp=/^[A-Za-z_$][\w$]*$/,_b=new Set(["light","dark","system"]);function Xr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function kb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Xr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Xr(R.key,"colorMode.key"),Xr(R.attribute,"colorMode.attribute"),Xr(R.default,"colorMode.default"),!Dp.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Pp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!_b.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Xr(k.key,"appearance.key"),Xr(k.attribute,"appearance.attribute"),Xr(k.default,"appearance.default"),!Dp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Pp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function Eb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Cb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Eb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Rb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Op(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Rb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=k.slice(B+1,z).trim(),F=l(`(${W})`,_),U=Cb(kb(F));k=k.slice(0,T.index)+U+k.slice(z+1),R.lastIndex=T.index+U.length}return k}import Ab from"crypto";function en(v){return String(v??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Np={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function xa(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function In(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function ei(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${en(_)}"`}function Tl(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${en(`${In(v)}-error`)}"`;return R}function Tb(){return Ab.randomUUID()}function ba(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=Tb();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${en(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${en(B)}">`;return R}),k}function jp(v,_,k=Np){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,W,F,U="")=>{let H=B||z||"POST",q=W||F||"",ie=Dr(U),Z=H.toUpperCase(),Q=["GET","POST"].includes(Z)?Z:"POST",oe=`<form method="${en(Q)}" action="${en(q)}"${ie?` ${ie}`:""}>`;if(oe+=`
|
|
2292
|
+
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Lt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Qf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:yp,hasEndTag:!1,description:"Include a web component in the template"},Ni,Mi,mr,hr,zf,Wf,Vf,Ff,Gf,Bf,cp,wl,...Rr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jx(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=sn.join(T,"resources","views"),z=sn.join(T,"resources","layouts");if(Fs.existsSync(B)&&Fs.existsSync(z))return{root:"resources",pagesDir:"views"};let F=sn.join(T,"resources","views","pages");if(Fs.existsSync(F))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var xp=new Set,ga=["partialsDir","componentsDir","layoutsDir"],Sl=new WeakMap;function Yx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function Qc(v,_){let k=!v.root,R=Jx(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!xp.has(T))xp.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Sl.has(v)){let T={};for(let B of ga){let z=v[B];if(typeof z==="string"&&z)T[B]=z}Sl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ga){let z=v[B];if(typeof z!=="string"||!z)continue;if(sn.isAbsolute(z)||Yx(z,T))continue;v[B]=sn.join(T,z)}}for(let T of ga){let B=v[T];if(typeof B!=="string"||!B||sn.isAbsolute(B))continue;v[T]=sn.resolve(_,B)}return v}function Qx(v,_){let k=Sl.get(v);for(let R of ga){let T=v[R];if(typeof T!=="string"||!T)continue;let B=sn.isAbsolute(T)?T:sn.join(_,T);if(Fs.existsSync(B))continue;let z=k?.[R]??T,F=v.root,W=!!F&&F!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(W?`, resolved under root "${F}".`:"."))}}function eb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function tb(v){if(zi(v.stateDir),v.stateDir=kn(),v.cachePath=Cn(v.cachePath),v.build)v.build.cacheDir=Cn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=Cn(v.media.cache.directory);if(v.story)v.story.outDir=Cn(v.story.outDir)}var Tr=null,qr=new Map,pa=new Map,go=null;async function Ls(v,_=Gx){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?sn.resolve(v):process.cwd(),k=pa.get(_);if(k&&k.signature!==pr(k.graph)){let B=qr.get(_);if(qr.delete(_),pa.delete(_),!v)Tr=null,go=null;let{clearComponentCache:z}=await import("./chunk-bx3qewwk.js"),{partialsCache:F}=await import("./chunk-afmzxwj1.js");if(z(),F.clear(),B&&k.configSignature===fr(k.graph)){let W=B.then(async(U)=>{let H={...k.graph};await Bs(H,_),pa.set(_,{graph:H,signature:pr(H),configSignature:fr(H)});let q={...U,_layerGraph:H};if(!v)Tr=q;return q});return qr.set(_,W),W}}if(!v){if(Tr)return Tr;if(go)return go}let R=qr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((ie)=>Fs.existsSync(sn.join(_,`stx.config${ie}`))),F=B.some((ie)=>Fs.existsSync(sn.join(_,"config",`ui${ie}`))),W;if(z&&F){let ie=await Ls({name:"ui",cwd:sn.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});W=(await Ls({name:"stx",alias:"ui",cwd:_,defaultConfig:ie.config,errorPolicy:"throw",verbose:!1})).config}else W=(await Ls({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(W.extends!==void 0||k){let ie=await Bi(_,A);W=ie.config,pa.set(_,{graph:ie.graph,signature:pr(ie.graph),configSignature:fr(ie.graph)})}if(W.runtimeConfig){let{resolveRuntimeConfig:ie}=await import("./chunk-138zjhwa.js");ie(W.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-et8wjgxw.js");await Z(_,W.runtimeConfig)}eb(W),tb(W),Qc(W,_),Qx(W,_);let U=[],H=new Set((W.plugins??[]).map((ie)=>typeof ie==="string"?ie:ie[0]));for(let ie of W.componentPackages??["@stacksjs/components"]){let Z=`${ie}/stx-plugin`;if(H.has(Z)||H.has(ie))continue;try{d.resolve(Z,{paths:[_]}),U.push(Z)}catch{}}let q=[...W.plugins??[],...U];if(q.length>0){let{pluginManager:ie}=await import("./chunk-p973efbe.js"),Z=[],Q=[];for(let oe of q){let ae=typeof oe==="string"?oe:oe[0],ce=typeof oe==="string"?{}:oe[1]||{};try{let ue,le;try{let ve=d.resolve(ae,{paths:[_]});ue=await import(ve),le=sn.dirname(ve)}catch{let ve=sn.resolve(_,ae);ue=await import(ve),le=sn.dirname(ve)}let Ae=ue.default||ue;if(!ie.has(Ae.name))await ie.register(Ae,W);if(Ae.components){let ve=Array.isArray(Ae.components)?Ae.components:[Ae.components];for(let he of ve)Z.push(sn.resolve(le,he))}if(Ae.pages){let ve=sn.resolve(le,Ae.pages),he=ce.path||"/";Q.push({dir:ve,prefix:he})}if(Ae.setup){let ve={addDirective:(he)=>{W.customDirectives=W.customDirectives||[],W.customDirectives.push(he)},addRoute:(he,Te)=>{W.apiRoutes=W.apiRoutes||{},W.apiRoutes[he]=Te},addMiddleware:(he)=>{W.middleware=W.middleware||[],W.middleware.push(he)},pluginDir:le,config:W};await Ae.setup(ce,ve)}process.stderr.write(`[stx] Plugin loaded: ${Ae.name||ae}
|
|
2293
|
+
`)}catch(ue){console.warn(`[stx] Failed to load plugin ${ae}:`,ue.message)}}W._pluginComponentDirs=Z,W._pluginPageDirs=Q}return W})();if(qr.set(_,T),T.catch(()=>{if(qr.get(_)===T)qr.delete(_)}),!v)go=T,T.then((B)=>{Tr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Tr&&_ in Tr)return Tr[_];if(!go)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function hd(v){return v}function yd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${B}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var _l=new Map;async function ge(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await nb.promises.stat(v)).mtime.getTime();if(_.cache&&_l.has(v)){let q=_l.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=er(T),F=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=Ve(z,{gfm:!0});if(F.syntaxHighlighting?.enabled&&F.syntaxHighlighting?.serverSide)U=await sb(U,F.syntaxHighlighting?.defaultTheme||"github-dark",F.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:U,data:B||{}};if(_.cache)_l.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var ma=null;async function sb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ma)try{ma=await rb({theme:_||"github-dark",cache:!0})}catch(F){return console.error("Failed to initialize ts-syntax-highlighter:",F),v}let T=async(F,W,U,H)=>{let q=H.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),ie=U||(k?"text":"");if(!ie)return F;try{if(!ma.getSupportedLanguages().includes(ie))return F;return(await ma.highlight(q,ie,{theme:_})).html}catch(Z){console.error(`Error highlighting code block with language ${U}:`,Z)}return F},B=v,z=v.matchAll(R);for(let F of z){let[W,U,H,q]=F,ie=await T(W,U,H,q);B=B.replace(W,ie)}return B}async function bp(v,_,k="",R={}){return await ib(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,F,W,U)=>{try{let H=F;if(!$l.isAbsolute(F))H=$l.resolve($l.dirname(k),F);let q={};if(W)try{try{q=JSON.parse(W)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let ue=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let le of ue){let Ae=le.indexOf(":");if(Ae>0){let ve=le.substring(0,Ae).trim(),he=le.substring(Ae+1).trim(),Te=he.startsWith('"')&&he.endsWith('"'),De=he.startsWith("'")&&he.endsWith("'");if(Te||De)he=he.substring(1,he.length-1);q[ve]=he}}}}catch(ce){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ce)}let{content:ie,data:Z}=await ge(H,R),Q={..._,...Z,...q},oe=ie,ae=/\{\{([^}]+)\}\}/g;return oe=oe.replace(ae,(ce,ue)=>{let le=ue.trim();return Q[le]!==void 0?String(Q[le]):ce}),oe}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,U,z)}})}async function ib(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let F=T[0],W=T.index,U=T;R.push(k(...U).then((H)=>({match:F,replacement:H,index:W})))}let B=await Promise.all(R);B.sort((F,W)=>W.index-F.index);let z=v;for(let{match:F,replacement:W}of B)z=z.replace(F,()=>W);return z}function Ir(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Pr(v,_){let k=ob(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function ob(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function ab(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Kr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),F=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,F.lastIndex=B;let W=z.exec(v),U=F.exec(v),H=W?W.index:1/0,q=U?U.index:1/0;if(H<q)T++,B=H+W[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+U[0].length}else break}return-1}function vp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Pr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"if","endif",B);if(z===-1)return null;let F=v.slice(B,z),W=[],U=0,H="if",q=T.expression,ie=0,Z=0;while(U<F.length){let Q=F.indexOf("@",U);if(Q===-1)break;U=Q;let oe=F.substring(Q);if(ab(F,Q)){U++;continue}if(/^@if\s*\(/.test(oe)){Z++,U++;continue}if(/^@endif(?![a-z])/.test(oe)){Z--,U+=6;continue}if(Z===0){let ae=oe.match(/^@elseif\s*/);if(ae){W.push({type:H,condition:q,content:F.substring(ie,U),start:B+ie,end:B+U});let ce=U+ae[0].length,ue=Pr(F,ce);if(!ue){U++;continue}H="elseif",q=ue.expression,U=ue.endPos,ie=U;continue}else if(/^@else(?![a-z])/.test(oe)){W.push({type:H,condition:q,content:F.substring(ie,U),start:B+ie,end:B+U}),H="else",q=void 0,U+=5,ie=U;continue}}U++}return W.push({type:H,condition:q,content:F.slice(ie),start:B+ie,end:B+F.length}),{fullMatch:v.slice(_,z+6),branches:W,start:_,end:z+6}}function mo(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=vp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function ha(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((oe)=>B.index>oe.start&&B.index<oe.end)){B=T.exec(v);continue}let F=B.index,W=F+B[0].length-1,U=S(v,"(",")",W);if(U===-1){B=T.exec(v);continue}let H=v.slice(W+1,U),q=U+1,ie=Kr(v,_,k,q);if(ie===-1){B=T.exec(v);continue}let Z=v.slice(q,ie),Q=ie+`@${k}`.length;R.push({fullMatch:v.slice(F,Q),name:_,params:H,content:Z,start:F,end:Q}),T.lastIndex=Q,B=T.exec(v)}return R}function kl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=Pr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"switch","endswitch",B);if(z===-1)return null;let F=v.slice(B,z),W=[],U=0,H=null,q=0;while(U<F.length){let ie=F.slice(U),Z=ie.match(/^@switch\s*\(/),Q=ie.match(/^@endswitch(?![a-z])/);if(Z){if(q++,H)H.content+=Z[0];U+=Z[0].length;continue}if(Q){if(q--,H)H.content+=Q[0];U+=Q[0].length;continue}if(q>0){if(H)H.content+=F[U];U++;continue}let oe=ie.match(/^@case\s*/),ae=ie.match(/^@default(?![a-z])/),ce=ie.match(/^@break(?![a-z])/);if(oe&&ie.startsWith("@case")){if(H)W.push(H);let ue=U+oe[0].length,le=Pr(F,ue);if(!le){U++;continue}H={type:"case",value:le.expression,content:""},U=le.endPos}else if(ae&&ie.startsWith("@default")){if(H)W.push(H);H={type:"default",content:""},U+=ae[0].length}else if(ce&&ie.startsWith("@break"))U+=ce[0].length;else{if(H)H.content+=F[U];U++}}if(H)W.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:W,start:_,end:z+10}}function db(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=kl(R,z);if(!F)break;try{let W;if(p(F.expression))W=c(F.expression,Object.keys(_))(...Object.values(_));else W=l(F.expression,_);let U="",H=!1;for(let q of F.cases)if(q.type==="default"){if(!H)U=q.content.trim()}else try{let ie;if(q.value&&p(q.value))ie=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)ie=l(q.value,_);if(W===ie){U=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+U+R.substring(F.end),T=!0}catch(W){let U=W instanceof Error?W.message:String(W),H=i("Switch",`Error evaluating @switch expression: ${U}`,t.EVALUATION_ERROR);R=R.substring(0,z)+H+R.substring(F.end);break}}return R}function fb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function pb(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function yr(v,_,k){let{masked:R,scripts:T}=fb(v);return pb(gb(R,_,k),T)}function gb(v,_,k){let R=v;R=db(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let F=z.index,W=Pr(R,F+7);if(!W)break;let U=W.endPos,H=Kr(R,"unless","endunless",U);if(H===-1){console.warn(`[stx] @unless directive at position ${F} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(U,H),ie=W.expression,Z=-1;{let oe=0,ae=/@(?:if|unless)\s*\(/g,ce=/@(?:endif|endunless)(?![a-z])/g,ue=/@else(?![a-z])/g,le=[],Ae;while((Ae=ae.exec(q))!==null)le.push({pos:Ae.index,type:"open"});while((Ae=ce.exec(q))!==null)le.push({pos:Ae.index,type:"close"});while((Ae=ue.exec(q))!==null)le.push({pos:Ae.index,type:"else"});le.sort((ve,he)=>ve.pos-he.pos);for(let ve of le)if(ve.type==="open")oe++;else if(ve.type==="close")oe--;else if(ve.type==="else"&&oe===0){Z=ve.pos;break}}let Q;if(Z!==-1){let oe=q.slice(0,Z),ae=q.slice(Z+5);Q=`@if (${ie})${ae}@else ${oe}@endif`}else Q=`@if (!(${ie}))${q}@endif`;R=R.substring(0,F)+Q+R.substring(H+10),B=!0}}R=Cl(R,_,k),R=Rl(R,_,k),R=El(R,_);let T=()=>{let B=mo(R);if(B.length===0)return!1;let z=Array(B.length);for(let U=B.length-1;U>=0;U--){let H=B[U];try{let q="",ie=!1;for(let Z of H.branches){if(ie)break;if(Z.type==="else")q=Z.content,ie=!0;else try{if(Z.condition?Ki(Z.condition,_):!1)q=Z.content,ie=!0}catch(Q){q=i(Z.type==="if"?"If":"Elseif",`Error in @${Z.type}(${Z.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),ie=!0}}z[U]=q}catch(q){let ie=q instanceof Error?q.message:String(q);z[U]=i("If",`Error processing @if block: ${ie}`,t.EVALUATION_ERROR)}}let F=Array(B.length*2+1),W=0;for(let U=0;U<B.length;U++){let H=B[U];F[U*2]=R.slice(W,H.start),F[U*2+1]=z[U],W=H.end}return F[B.length*2]=R.slice(W),R=F.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function wp(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function El(v,_){let k=v;function R(F,W,U,H){let q=1,ie=H,Z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${U}(?![a-z])`,"g");while(ie<F.length&&q>0){Z.lastIndex=ie,Q.lastIndex=ie;let oe=Z.exec(F),ae=Q.exec(F),ce=oe?oe.index:1/0,ue=ae?ae.index:1/0;if(ce<ue)q++,ie=ce+oe[0].length;else if(ue<1/0){if(q--,q===0)return ue;ie=ue+ae[0].length}else break}return-1}function T(F,W,U){let H=0,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),ie=new RegExp(`@${U}(?![a-z])`,"g"),Z=/@else(?![a-z])/g,Q=[],oe;while((oe=q.exec(F))!==null)Q.push({pos:oe.index,type:"open"});while((oe=ie.exec(F))!==null)Q.push({pos:oe.index,type:"close"});while((oe=Z.exec(F))!==null)Q.push({pos:oe.index,type:"else"});Q.sort((ae,ce)=>ae.pos-ce.pos);for(let ae of Q)if(ae.type==="open")H++;else if(ae.type==="close")H--;else if(ae.type==="else"&&H===0)return ae.pos;return-1}{let F=!0;while(F){F=!1;let W=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,H,q,ie=k.slice(U+5),Z=wp(ie);if(Z)H=Z.value,q=U+5+Z.consumed;else q=U+5;let Q=R(k,"auth","endauth",q);if(Q===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let oe=k.slice(q,Q),ae=T(oe,"auth","endauth"),ce;if(!_.auth)ce=!1;else ce=H?Ir(`auth?.check && auth?.user?.[${H}]`,_):Ir("auth?.check",_);let ue;if(ae!==-1){let le=oe.slice(0,ae),Ae=oe.slice(ae+5);ue=ce?le:Ae}else ue=ce?oe:"";k=k.substring(0,U)+ue+k.substring(Q+8),F=!0}}{let F=!0;while(F){F=!1;let W=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,H,q,ie=k.slice(U+6),Z=wp(ie);if(Z)H=Z.value,q=U+6+Z.consumed;else q=U+6;let Q=R(k,"guest","endguest",q);if(Q===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let oe=k.slice(q,Q),ae=T(oe,"guest","endguest"),ce;if(!_.auth)ce=!0;else ce=H?Ir(`!auth?.check || !auth?.user?.[${H}]`,_):Ir("!auth?.check",_);let ue;if(ae!==-1){let le=oe.slice(0,ae),Ae=oe.slice(ae+5);ue=ce?le:Ae}else ue=ce?oe:"";k=k.substring(0,U)+ue+k.substring(Q+9),F=!0}}function B(F,W,U){if(_.userCan&&typeof _.userCan[F]==="boolean")return _.userCan[F];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[F];if(W)H.push(W);if(U){let q=Ir(U,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(F){let W=F.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let F of["can","cannot"]){let W=`end${F}`,U=F==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${F}\\s*\\(`));if(!q||q.index===void 0)break;let ie=q.index,Z=k.slice(ie+`@${F}`.length),Q=z(Z);if(!Q)break;let oe=ie+`@${F}`.length+Q.paramsEnd,ae=R(k,F,W,oe);if(ae===-1){console.warn(`[stx] @${F} directive at position ${ie} has no matching @${W} \u2014 the block was skipped.`);break}let ce=k.slice(oe,ae),ue=[],le=0,Ae=new RegExp(`@${F}\\s*\\(`,"g"),ve=new RegExp(`@${W}(?![a-z])`,"g"),he=new RegExp(`@${U}\\s*\\(`,"g"),Te=/@else(?![a-z])/g,De=[],Oe;while((Oe=Ae.exec(ce))!==null)De.push({pos:Oe.index,type:"open"});while((Oe=ve.exec(ce))!==null)De.push({pos:Oe.index,type:"close"});while((Oe=he.exec(ce))!==null)De.push({pos:Oe.index,type:"elseDirective"});while((Oe=Te.exec(ce))!==null)De.push({pos:Oe.index,type:"else"});De.sort((Le,je)=>Le.pos-je.pos);for(let Le of De){if(Le.type==="open"){le++;continue}if(Le.type==="close"){le--;continue}if(le===0)ue.push(Le)}let Me=[],Ne=0;for(let Le=0;Le<ue.length;Le++){let je=ue[Le];if(Me.push({content:ce.slice(Ne,je.pos),ability:void 0}),je.type==="elseDirective"){let rt=ce.slice(je.pos+`@${U}`.length),gt=z(rt);if(gt){Me[Me.length-1]={content:ce.slice(Ne,je.pos)},Ne=je.pos+`@${U}`.length+gt.paramsEnd,Me.push({content:"",ability:gt.ability,type:gt.type,id:gt.id}),Me.pop();let mt=ue[Le+1],yt=mt?mt.pos:ce.length;Me.push({content:ce.slice(Ne,yt),ability:gt.ability,type:gt.type,id:gt.id}),Ne=yt}}else Ne=je.pos+5}if(Ne<ce.length){let Le=Me[Me.length-1];if(ue.length>0&&ue[ue.length-1].type==="else")Me.push({content:ce.slice(Ne),isFinalElse:!0});else if(Me.length===0)Me.push({content:ce.slice(Ne)})}let Ie=B(Q.ability,Q.type,Q.id),Be=F==="can"?Ie:!Ie,Fe="";if(Be)Fe=Me[0]?.content||"";else{let Le=!1;for(let je=1;je<Me.length;je++){let rt=Me[je];if(rt.isFinalElse){Fe=rt.content,Le=!0;break}if(rt.ability){let gt=B(rt.ability,rt.type,rt.id);if(F==="can"?gt:!gt){Fe=rt.content,Le=!0;break}}}if(!Le&&Me.length>0){let je=Me[Me.length-1];if(je.isFinalElse)Fe=je.content}}k=k.substring(0,ie)+Fe+k.substring(ae+`@${W}`.length),H=!0}}return k}function Cl(v,_,k){let R=v;function T(B,z,F,W,U){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),ie=B.match(q);if(!ie||ie.index===void 0)break;let Z=ie.index,Q=Pr(B,Z+`@${z}`.length);if(!Q)break;let oe=Q.endPos,ae=Kr(B,z,F,oe);if(ae===-1){console.warn(`[stx] @${z} directive at position ${Z} has no matching @${F} \u2014 the block was skipped.`);break}let ce=B.slice(oe,ae),ue=Q.expression,le=-1,Ae=0,ve=0;while(ve<ce.length){let he=ce.indexOf("@",ve);if(he===-1)break;let Te=ce.substring(he);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Te)){Ae++,ve=he+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Te)){Ae--,ve=he+1;continue}if(Ae===0&&/^@else(?![a-z])/.test(Te)){le=he;break}ve=he+1}try{let he=W(ue.trim()),Te;if(le!==-1){let De=ce.slice(0,le),Oe=ce.slice(le+5);Te=he?De:Oe}else Te=he?ce:"";B=B.substring(0,Z)+Te+B.substring(ae+`@${F}`.length),H=!0}catch(he){let Te=he instanceof Error?he.message:String(he),De=i(U,`Error processing @${z} directive: ${Te}`,t.EVALUATION_ERROR);B=B.substring(0,Z)+De+B.substring(ae+`@${F}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=Ir(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=Ir(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function Rl(v,_,k){let R=v,T="development";function B(z,F,W,U){let H=new RegExp(`@${F}(?![a-z])`,"g"),q=new RegExp(`@${W}(?![a-z])`,"g"),ie=new RegExp(`^@${F}(?![a-z])`),Z=new RegExp(`^@${W}(?![a-z])`),Q=z,oe=!0;while(oe){oe=!1,H.lastIndex=0;let ae=H.exec(Q);if(!ae)break;let ce=ae.index,ue=ce+ae[0].length;if(F==="env"){let Ie=Q.substring(ue).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!Ie)break;ue+=Ie[0].length,U=T===Ie[2]}let le=1,Ae=ue,ve=-1;while(le>0&&Ae<Q.length){H.lastIndex=Ae,q.lastIndex=Ae;let Ie=H.exec(Q),Be=q.exec(Q),Fe=Ie?Ie.index:1/0,Le=Be?Be.index:1/0;if(Fe<Le)le++,Ae=Fe+Ie[0].length;else if(Le<1/0){if(le--,le===0){ve=Le;break}Ae=Le+Be[0].length}else break}if(ve===-1){console.warn(`[stx] @${F} directive at position ${ce} has no matching @${W} \u2014 the block was skipped.`);break}let he=Q.substring(ue,ve),Te=-1,De=0,Oe=0;while(Oe<he.length){let Ie=he.indexOf("@",Oe);if(Ie===-1)break;let Be=he.substring(Ie);if(ie.test(Be)){De++,Oe=Ie+1;continue}if(Z.test(Be)){De--,Oe=Ie+1;continue}if(De===0&&/^@else(?![a-z])/.test(Be)){Te=Ie;break}Oe=Ie+1}let Me;if(Te!==-1){let Ie=he.slice(0,Te),Be=he.slice(Te+5);Me=U?Ie:Be}else Me=U?he:"";let Ne=`@${W}`.length;Q=Q.substring(0,ce)+Me+Q.substring(ve+Ne),oe=!0}return Q}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var Sp=new WeakMap;function $p(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function ya(v,_){if(!v)return _?.nonceGenerator?.()??$p();let k=Sp.get(v);if(!k)k=_?.nonceGenerator?.()??$p(),Sp.set(v,k);return k}function mb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function _p(v,_){return`<meta http-equiv="Content-Security-Policy" content="${mb(v,_).replace(/&/g,"&").replace(/"/g,""")}">`}function kp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let R=_.useNonce?ya(k,_):void 0,T=_p(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
|
|
2294
|
+
${T}`)}function Ep(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function Cp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?ya(_,B):void 0;return _p(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return ya(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=ya(_,B);return T}import hb from"crypto";var yb=40,Rp="_token",Al=null;function xb(v=yb){let _=hb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Al=_,_}function bb(){if(!Al)xb();return Al}function vb(v=Rp){let _=bb();return`<input type="hidden" name="${v}" value="${_}">`}function Ap(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>vb(R||Rp))}async function Tp(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await wb(T,B,_,k,R);else T=await Sb(T,B,_,k,R)}return T}async function wb(v,_,k,R,T){let{name:B,handler:z}=_,F=`@${B}`,W=`@end${B}`,U=v,H=Wr(`${F}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),q=[],ie=H.exec(U);while(ie!==null){let[Z,Q="",oe=""]=ie,ae=ie.index||0;try{let ce=Q?Ip(_,Q):[],ue=oe.trim(),le=await z(ue,ce,k,R);q.push({original:Z,processed:le,startIndex:ae})}catch(ce){let ue=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);q.push({original:Z,processed:i("CustomDirective",`Error in @${B}${Q?`(${Q})`:""}: ${ue}`,t.EVALUATION_ERROR),startIndex:ae})}ie=H.exec(U)}for(let Z=q.length-1;Z>=0;Z--){let{original:Q,processed:oe}=q[Z];U=U.replace(Q,oe)}return U}async function Sb(v,_,k,R,T){let{name:B,handler:z}=_,F=v,W=[],U=[];if(_.rawParams){for(let ie of qs(F,Wr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(ie.end!==-1)U.push({fullMatch:ie.call,paramString:ie.args,startIndex:ie.start})}else{let ie=Wr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");ie.lastIndex=0;let Z=ie.exec(F);while(Z!==null)U.push({fullMatch:Z[0],paramString:Z[1]??"",startIndex:Z.index||0}),Z=ie.exec(F)}for(let{fullMatch:ie,paramString:Z,startIndex:Q}of U)try{let oe=Ip(_,Z),ae=await z("",oe,k,R);W.push({original:ie,processed:ae,startIndex:Q})}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${B}:`,oe);W.push({original:ie,processed:i("CustomDirective",`Error in @${B}(${Z}): ${ae}`,t.EVALUATION_ERROR),startIndex:Q})}let H=Wr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(F);while(q!==null){let[ie]=q,Z=q.index||0;try{let Q=await z("",[],k,R);W.push({original:ie,processed:Q,startIndex:Z})}catch(Q){let oe=Q instanceof Error?Q.message:String(Q);if(T.debug)console.error(`Error processing custom directive @${B}:`,Q);W.push({original:ie,processed:i("CustomDirective",`Error in @${B}: ${oe}`,t.EVALUATION_ERROR),startIndex:Z})}q=H.exec(F)}for(let ie=W.length-1;ie>=0;ie--){let{original:Z,processed:Q}=W[ie];F=F.replace(Z,Q)}return F}function Ip(v,_){return v.rawParams?st(_):$b(_)}function $b(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var Pp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dp=/^[A-Za-z_$][\w$]*$/,_b=new Set(["light","dark","system"]);function Xr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function kb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Xr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Xr(R.key,"colorMode.key"),Xr(R.attribute,"colorMode.attribute"),Xr(R.default,"colorMode.default"),!Dp.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Pp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!_b.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Xr(k.key,"appearance.key"),Xr(k.attribute,"appearance.attribute"),Xr(k.default,"appearance.default"),!Dp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Pp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function Eb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Cb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Eb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Rb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Op(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Rb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let F=k.slice(B+1,z).trim(),W=l(`(${F})`,_),U=Cb(kb(W));k=k.slice(0,T.index)+U+k.slice(z+1),R.lastIndex=T.index+U.length}return k}import Ab from"crypto";function tn(v){return String(v??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Np={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function xa(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function In(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function ei(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${tn(_)}"`}function Tl(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${tn(`${In(v)}-error`)}"`;return R}function Tb(){return Ab.randomUUID()}function ba(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=Tb();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${tn(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${tn(B)}">`;return R}),k}function jp(v,_,k=Np){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,F,W,U="")=>{let H=B||z||"POST",q=F||W||"",ie=Dr(U),Z=H.toUpperCase(),Q=["GET","POST"].includes(Z)?Z:"POST",oe=`<form method="${tn(Q)}" action="${tn(q)}"${ie?` ${ie}`:""}>`;if(oe+=`
|
|
2295
2295
|
${ba("@csrf",_)}`,!["GET","POST"].includes(Z))oe+=`
|
|
2296
|
-
${ba(`@method('${Z}')`,_)}`;return oe}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,W,F,U="")=>{let H=B||z||"",q=W||F||"",ie=Dr(U),Z=ho(H,_),Q=Z!==void 0&&Z!==null?Z:q||"",oe=ie.match(/type=['"]([^'"]+)['"]/i),ae=oe?oe[1]:"text",ce=yo(H,_),ue=ie.match(/class=['"]([^'"]+)['"]/i),le=xa(ue?ue[1]:"",k.input,ce,k.inputError),Ae=ie.replace(/class=['"][^'"]+['"]/i,"");return Ae=Ae.replace(/type=['"][^'"]+['"]/i,""),`<input type="${en(ae)}" name="${en(H)}"${ei(ie,In(H))} value="${en(Q)}" class="${le}"${Tl(H,ce,ie)}${Ae?` ${Ae}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",W="")=>{let F=Dr(z),U=ho(B,_)||W.trim(),H=yo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),ie=xa(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${en(B)}"${ei(F,In(B))} class="${ie}"${Tl(B,H,F)}${Z?` ${Z}`:""}>${en(U)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",W)=>{let F=Dr(z),U=ho(B,_),H=yo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),ie=xa(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,""),Q=W;if(U!==void 0)Q=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(oe,ae,ce)=>{if((Array.isArray(U)?U.some((le)=>String(le)===ce):String(U)===ce)&&!ae.includes("selected"))return ae.replace(/(<option)/,"$1 selected");return oe});return`<select name="${en(B)}"${ei(F,In(B))} class="${ie}"${Tl(B,H,F)}${Z?` ${Z}`:""}>${Q}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=z===void 0?"1":z,U=z===void 0?In(B):`${In(B)}-${In(F)}`,H=Dr(W),q=ho(B,_),ie=q!==void 0&&(Array.isArray(q)?q.some((ae)=>String(ae)===F):q===!0||String(q)===F),Z=H.match(/class=['"]([^'"]+)['"]/i),Q=Z?Z[1]:k.checkInput,oe=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${en(B)}"${ei(H,U)} value="${en(F)}" class="${Q}"${ie?" checked":""}${oe?` ${oe}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=Dr(W),U=ho(B,_),H=U!==void 0&&U===z,q=F.match(/class=['"]([^'"]+)['"]/i),ie=q?q[1]:k.checkInput,Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${en(B)}"${ei(F,`${In(B)}-${In(z)}`)} value="${en(z)}" class="${ie}"${H?" checked":""}${Z?` ${Z}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let W=Dr(z),F=W.match(/accept=['"]([^'"]+)['"]/i),U=F?F[1]:"",H=W.includes("multiple"),q=yo(B,_),ie=W.match(/class=['"]([^'"]+)['"]/i),Z=xa(ie?ie[1]:"",k.input,q,k.inputError),Q=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),oe=[`<input type="file" name="${en(B)}"${ei(W,In(B))}`,`class="${Z}"`];if(U)oe.push(`accept="${en(U)}"`);if(H)oe.push("multiple");if(Q)oe.push(Q);return`${oe.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",W)=>{let F=Dr(z),U=F.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:k.label,q=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${en(In(B))}" class="${H}"${q?` ${q}`:""}>${W}</label>`}),R}function Lp(v,_,k=Np){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(yo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(W,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Mp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Mp(T,_)}let U=F.trim();if(p(U)){let H=l(U,_);return H!==void 0?String(H):U}return U}catch{return F}});return`<div id="${en(`${In(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function yo(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Mp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function ho(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function Dr(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var xo=/<\/?template\b[^>]*>/gi,Ib=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Pb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Ib.test(_)}function ne(v){xo.lastIndex=0;let _;while((_=xo.exec(v))!==null){if(_[0].startsWith("</")||Pb(_[0]))continue;let k=_.index,R=xo.lastIndex,T=1,B;while((B=xo.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:xo.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Kt from"path";import{existsSync as tw}from"fs";class Bp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=ec(v,R);if(T!==void 0)return T;for(let B of tc(v,_,k,R))if(await r(B))return B;return null}}var ti=new Bp;function Ut(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Or="\x00stx-boolean-attribute";function Il(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Db=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Pl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Db.has(_)}function Mr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(Ut(B));continue}if(T===Or){k.push(Ut(B));continue}k.push(`${Ut(B)}="${Ut(Il(String(T)))}"`)}return k}function Nr(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(Ut(B));continue}if(typeof T==="object")continue;k.push(`${Ut(B)}="${Ut(Il(String(T)))}"`)}return k}function ni(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ob(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var Dl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Ob(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",W=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(R.reactive)F.push(`:href="${ni(R.value)}"`);else F.push(`href="${ni(no(R.value,"navigable"))}"`);if(T)F.push(`class="${ni(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${ni(B)}"`),F.push(`data-stx-exact-active-class="${ni(z)}"`),W)F.push("data-stx-prefetch");let U=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(U)F.push(`data-stx-active-match="${ni(U)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...Mr(v,H)),F.push(...Nr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as Yp}from"crypto";import dn from"fs";import sn from"path";import{decode as Fb,generateThumbHash as Vb}from"ts-images";import{createImageDeliveryCatalog as Hp}from"ts-images/delivery";import Ol from"fs";function va(v,_,k){let R=Buffer.alloc(k),T=Ol.readSync(v,R,0,k,_);return R.subarray(0,T)}function Ml(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Nl(v){let _;try{_=Ol.openSync(v,"r");let k=va(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=va(_,T,8);if(z.length<8)return"unknown";let W=z.toString("latin1",4,8);if(W==="tRNS")return"possible";if(W==="IDAT"||W==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Ml(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)Ol.closeSync(_)}}import Mb from"fs";import wa from"os";import{join as zp}from"path";import{fileURLToPath as Wp}from"url";import{Worker as Fp}from"worker_threads";var $a=Symbol("stx.image-worker.unavailable");function Nb(v=typeof wa.availableParallelism==="function"?wa.availableParallelism():wa.cpus().length){return Math.max(1,Math.min(2,v-1))}var Sa=0,Up=[];async function jb(){if(Sa<Nb()){Sa++;return}await new Promise((v)=>Up.push(v)),Sa++}function Lb(){Sa--,Up.shift()?.()}var Bb="@stacksjs/stx/builtins/image-warmup-worker";function zb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Mb.existsSync(Wp(k)))return Wp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Bb,v):void 0;return k&&Wb(k)?k:void 0}catch{return}}function Wb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,zp(_.BUN_INSTALL||zp(wa.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Vp=!1;function bo(v){if(!Vp)Vp=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return $a}function jl(v){return v instanceof Error?v.message:String(v)}async function Ll(v,_){if(typeof Fp!=="function")return bo("node:worker_threads has no Worker in this runtime");let k=zb();if(!k)return bo("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await jb();try{return await new Promise((R,T)=>{let B;try{B=new Fp(k)}catch(U){R(bo(`could not start ${k}: ${jl(U)}`));return}let z=!1,W=!1,F=(U)=>{if(W)return;W=!0,U(),B.terminate()};B.on("message",(U)=>{if(U.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(U.type==="result"){F(()=>R(U.value));return}let H=Error(U.error?.message??"image worker failed");if(U.error?.name)H.name=U.error.name;if(U.error?.stack)H.stack=U.error.stack;F(()=>T(H))}),B.on("error",(U)=>{F(()=>z?T(U instanceof Error?U:Error(jl(U)||"image worker crashed")):R(bo(`the worker failed before it was ready: ${jl(U)}`)))}),B.on("exit",(U)=>{F(()=>z?T(Error("image worker exited before it finished")):R(bo(`the worker exited with code ${U} before it was ready`)))})})}finally{Lb()}}var Ub=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Hb=[320,640,960,1280,1920],vo="/_stx/images",qb=`stx:${vo}:alpha-1`,Kb=`stx:${vo}:opaque-1`,Xb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],_a;function Zb(v,_){let k=sn.dirname(Bun.resolveSync(v,_));while(k!==sn.dirname(k)){let R=sn.join(k,"package.json");if(dn.existsSync(R)){let T=JSON.parse(dn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=sn.dirname(k)}return}function qp(){if(_a!==void 0)return _a;let v;try{v=sn.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return _a=Xb.map((_)=>{let k;try{k=v?Zb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),_a}var Kp=Symbol.for("stx.image-delivery");function wo(){let v=globalThis;return v[Kp]??={catalog:new Map,transparent:new Set},v[Kp]}var Xp=new Set;function Gb(v){return`/${v.split(sn.sep).map(encodeURIComponent).join("/")}`}function Jb(v){let _=sn.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=Yp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function Zp(v,_=`stx:${vo}`){let k=(R)=>`${vo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=sn.join(v,R);try{let B=await dn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=sn.join(v,R);await dn.promises.mkdir(sn.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await dn.promises.writeFile(z,T),await dn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function Qp(v,_=v){let k=await dn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=sn.join(_,T.name);if(T.isDirectory()){R.push(...await Qp(v,B));continue}if(!T.isFile()||!Ub.has(sn.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:sn.relative(v,B)})}return R}function Gp(v,_){return v.map((k)=>({key:Gb(k.relativePath),input:k.absolutePath,name:Jb(k.relativePath),...Yb(k.absolutePath)?{options:{storage:_}}:{}}))}function Yb(v){return Nl(v)==="possible"}function Qb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function ev(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let W=z.variants.filter((F)=>F.format==="png").sort((F,U)=>F.width-U.width)[0];try{let F=await Fb(new Uint8Array(await dn.promises.readFile(W?.path??z.fallback.path)));if(Qb(F.data))k.add(B)}catch{k.add(B)}}));return k}function tv(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((W)=>W.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((W)=>{let F;try{return F=dn.openSync(W.path,"r"),!Ml(va(F,0,32))}catch{return!0}finally{if(F!==void 0)dn.closeSync(F)}}))continue;if(T.variants=T.variants.filter((W)=>W.format!=="webp"),delete T.sources.webp,k.push(R),!Xp.has(R))Xp.add(R),console.warn(`[stx-images] ${R} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function nv(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await Vb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Bl(v){return sn.join(v,"undecodable.json")}function rv(v){try{let _=dn.readFileSync(Bl(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function sv(v,_){try{dn.mkdirSync(sn.dirname(Bl(v)),{recursive:!0}),dn.writeFileSync(Bl(v),JSON.stringify(_))}catch{}}function Jp(v){try{let _=dn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function eg(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ys(v){let _=eg(v);return _?wo().catalog.get(_):void 0}function bs(v){let _=eg(v);return _?wo().transparent.has(_):!1}function vs(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function ud(v){let _=ys(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:vs(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:bs(v)?void 0:_.placeholder?.dataUrl}}function or(){let v=wo();v.catalog=new Map,v.transparent=new Set}function iv(v){let _=wo();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function dd(v,_,k={}){if(!v||!dn.existsSync(v))return or(),{count:0,fingerprint:""};if(k.offThread){let Q=await Ll("delivery",{publicDir:v,outputDir:_});if(Q!==$a)return iv(Q.state),Q.result}let R=await Qp(v);if(R.length===0)return or(),{count:0,fingerprint:""};let T=rv(_),B=R.filter((Q)=>{let oe=T[Q.relativePath];if(!oe)return!0;let ae=Jp(Q.absolutePath);return!ae||ae.mtimeMs!==oe.mtimeMs||ae.size!==oe.size});if(B.length===0)return or(),{count:0,fingerprint:""};let z=Zp(sn.join(_,"_stx","images"),`${qb}:${qp()}`),W={outDir:sn.join(_,"_stx","images"),storage:Zp(sn.join(_,"_stx","images"),`${Kb}:${qp()}`),baseUrl:vo,widths:Hb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=B,U;try{U=await Hp({...W,entries:Gp(B,z)})}catch(Q){if(F=await nv(B),F.length===B.length)throw Q;let oe=new Set(F.map((ce)=>ce.relativePath)),ae=!1;for(let ce of B){if(oe.has(ce.relativePath))continue;let ue=Jp(ce.absolutePath);if(!ue)continue;T[ce.relativePath]=ue,ae=!0}if(ae)sv(_,T);if(F.length===0)return or(),{count:0,fingerprint:""};U=await Hp({...W,entries:Gp(F,z)})}let H=await ev(U.entries),q=tv(U.entries,H),ie=wo();ie.catalog=new Map(Object.entries(U.entries)),ie.transparent=H;let Z=H.size===0&&q.length===0?U.fingerprint:Yp("sha256").update(U.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:F.length,fingerprint:Z}}var ov=new Map;function zl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return ov.get(_)}var av={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Wl=[320,640,768,1024,1280,1536,1920];function Qt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function an(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ka(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Fl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=av[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let W=Number.parseInt(T);if(!Number.isNaN(W))k.push(`(max-width: ${W}px) ${B}`)}}else k.push(R);return k.join(", ")}function Vl(v,_,k,R){return _.map((T)=>`${So(v,T,void 0,k,R)} ${T}w`).join(", ")}function cv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${So(v,z,void 0,R,T)} ${B}x`}).join(", ")}function So(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function lv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function uv(v,_,k="#e5e7eb"){let R=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(R)}`}var Ul={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=an(v,"src")||"",T=ys(R),B=an(v,"alt")||"",z=an(v,"width")||(T?String(T.source.width):void 0),W=an(v,"height")||(T?String(T.source.height):void 0),F=an(v,"sizes"),U=an(v,"srcset"),H=an(v,"densities"),q=an(v,"format"),ie=bs(R)||zl(R)?.transparent===!0,Z=an(v,"placeholder")||(T&&!ie?"thumbhash":void 0),Q=an(v,"placeholderColor")||"#e5e7eb",oe=an(v,"provider"),ae=an(v,"class")||an(v,"className")||"",ce=an(v,"style")||"",ue=an(v,"quality"),le=ka(v,"lazy",!0),Ae=ka(v,"preload",!1),ve=ka(v,"priority",!1),he=an(v,"loading"),Te=an(v,"decoding")||"async",De=!!T||ka(v,"picture",!1)||!!q,Oe=z?Number.parseInt(z):void 0,Me=W?Number.parseInt(W):void 0,Ne=U||"",Ie="";if(T)Ne=T.sources[T.fallback.format]||"",Ie=F?Fl(F):"100vw";else if(!Ne&&F&&oe&&oe!=="local"&&oe!=="static")Ne=Vl(R,Wl,oe,q),Ie=Fl(F);else if(!Ne&&H){let gt=H.split(/\s+/).map((ht)=>Number.parseFloat(ht.replace("x","")));Ne=cv(R,gt,Oe,oe,q)}else if(F)Ie=Fl(F);let Le=[];if(ce)Le.push(ce);if(Oe&&Me)Le.push(`aspect-ratio:${Oe}/${Me}`);let Fe=[],ze=Z==="blur"||Z==="color"||Z==="thumbhash";if(ze&&!ie){let gt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:Q}:zl(R);if(gt&&Z==="color")Le.push(`background-color:${gt.color}`),Fe.push("backgroundColor");else if(gt)Le.push(`background-color:${gt.color}`),Le.push(`background-image:url(${gt.dataUrl})`),Le.push("background-size:cover"),Le.push("background-repeat:no-repeat"),Fe.push("backgroundColor","backgroundImage");else{let ht=uv(Oe||16,Me||9,Q);Le.push(`background-image:url(${ht})`),Le.push("background-size:cover"),Le.push("background-repeat:no-repeat"),Fe.push("backgroundImage")}}else if(!ze&&Z&&Z!=="empty"&&Z!=="none")Le.push(`background-image:url(${Qt(Z)})`),Le.push("background-size:cover"),Le.push("background-repeat:no-repeat"),Fe.push("backgroundImage");let je=T?.fallback.url||So(R,Oe,Me,oe,q),He=[];if(He.push(`src="${Qt(no(je,"fetched"))}"`),He.push(`alt="${Qt(B)}"`),z)He.push(`width="${Qt(z)}"`);if(W)He.push(`height="${Qt(W)}"`);let mt=he||(ve||Ae?"eager":le?"lazy":"");if(mt)He.push(`loading="${Qt(mt)}"`);if(ve)He.push('fetchpriority="high"');if(He.push(`decoding="${Qt(Te)}"`),ae)He.push(`class="${Qt(ae)}"`);if(Le.length>0)He.push(`style="${Qt(Le.join(";"))}"`);if(Ne)He.push(`srcset="${Qt(no(Ne,"fetched"))}"`);if(Ie)He.push(`sizes="${Qt(Ie)}"`);let St=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Fe.length>0){let gt=typeof v.static.onload==="string"?v.static.onload:"",ht=lv(Fe)+(gt?`;${gt}`:"");He.push(`onload="${Qt(ht)}"`),St.add("onload")}He.push(...Mr(v,St)),He.push(...Nr(v,St));let xt=`<img ${He.join(" ")} />`,lt="";if(Ae){let ht=q==="webp"?"image/webp":q==="avif"?"image/avif":"";lt=`<link rel="preload" as="image" href="${Qt(je)}"${ht?` type="${ht}"`:""}${Ne?` imagesrcset="${Qt(Ne)}"`:""}${Ie?` imagesizes="${Qt(Ie)}"`:""} />
|
|
2297
|
-
`}if(
|
|
2298
|
-
${
|
|
2296
|
+
${ba(`@method('${Z}')`,_)}`;return oe}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,F,W,U="")=>{let H=B||z||"",q=F||W||"",ie=Dr(U),Z=ho(H,_),Q=Z!==void 0&&Z!==null?Z:q||"",oe=ie.match(/type=['"]([^'"]+)['"]/i),ae=oe?oe[1]:"text",ce=yo(H,_),ue=ie.match(/class=['"]([^'"]+)['"]/i),le=xa(ue?ue[1]:"",k.input,ce,k.inputError),Ae=ie.replace(/class=['"][^'"]+['"]/i,"");return Ae=Ae.replace(/type=['"][^'"]+['"]/i,""),`<input type="${tn(ae)}" name="${tn(H)}"${ei(ie,In(H))} value="${tn(Q)}" class="${le}"${Tl(H,ce,ie)}${Ae?` ${Ae}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",F="")=>{let W=Dr(z),U=ho(B,_)||F.trim(),H=yo(B,_),q=W.match(/class=['"]([^'"]+)['"]/i),ie=xa(q?q[1]:"",k.input,H,k.inputError),Z=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${tn(B)}"${ei(W,In(B))} class="${ie}"${Tl(B,H,W)}${Z?` ${Z}`:""}>${tn(U)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",F)=>{let W=Dr(z),U=ho(B,_),H=yo(B,_),q=W.match(/class=['"]([^'"]+)['"]/i),ie=xa(q?q[1]:"",k.input,H,k.inputError),Z=W.replace(/class=['"][^'"]+['"]/i,""),Q=F;if(U!==void 0)Q=F.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(oe,ae,ce)=>{if((Array.isArray(U)?U.some((le)=>String(le)===ce):String(U)===ce)&&!ae.includes("selected"))return ae.replace(/(<option)/,"$1 selected");return oe});return`<select name="${tn(B)}"${ei(W,In(B))} class="${ie}"${Tl(B,H,W)}${Z?` ${Z}`:""}>${Q}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,F="")=>{let W=z===void 0?"1":z,U=z===void 0?In(B):`${In(B)}-${In(W)}`,H=Dr(F),q=ho(B,_),ie=q!==void 0&&(Array.isArray(q)?q.some((ae)=>String(ae)===W):q===!0||String(q)===W),Z=H.match(/class=['"]([^'"]+)['"]/i),Q=Z?Z[1]:k.checkInput,oe=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${tn(B)}"${ei(H,U)} value="${tn(W)}" class="${Q}"${ie?" checked":""}${oe?` ${oe}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,F="")=>{let W=Dr(F),U=ho(B,_),H=U!==void 0&&U===z,q=W.match(/class=['"]([^'"]+)['"]/i),ie=q?q[1]:k.checkInput,Z=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${tn(B)}"${ei(W,`${In(B)}-${In(z)}`)} value="${tn(z)}" class="${ie}"${H?" checked":""}${Z?` ${Z}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let F=Dr(z),W=F.match(/accept=['"]([^'"]+)['"]/i),U=W?W[1]:"",H=F.includes("multiple"),q=yo(B,_),ie=F.match(/class=['"]([^'"]+)['"]/i),Z=xa(ie?ie[1]:"",k.input,q,k.inputError),Q=F.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),oe=[`<input type="file" name="${tn(B)}"${ei(F,In(B))}`,`class="${Z}"`];if(U)oe.push(`accept="${tn(U)}"`);if(H)oe.push("multiple");if(Q)oe.push(Q);return`${oe.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",F)=>{let W=Dr(z),U=W.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:k.label,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${tn(In(B))}" class="${H}"${q?` ${q}`:""}>${F}</label>`}),R}function Lp(v,_,k=Np){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(yo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(F,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return Mp(T,_);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Mp(T,_)}let U=W.trim();if(p(U)){let H=l(U,_);return H!==void 0?String(H):U}return U}catch{return W}});return`<div id="${tn(`${In(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function yo(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Mp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function ho(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function Dr(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var xo=/<\/?template\b[^>]*>/gi,Ib=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Pb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Ib.test(_)}function ne(v){xo.lastIndex=0;let _;while((_=xo.exec(v))!==null){if(_[0].startsWith("</")||Pb(_[0]))continue;let k=_.index,R=xo.lastIndex,T=1,B;while((B=xo.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:xo.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Kt from"path";import{existsSync as tw}from"fs";class Bp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=ec(v,R);if(T!==void 0)return T;for(let B of tc(v,_,k,R))if(await r(B))return B;return null}}var ti=new Bp;function Ut(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Or="\x00stx-boolean-attribute";function Il(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Db=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Pl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Db.has(_)}function Mr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(Ut(B));continue}if(T===Or){k.push(Ut(B));continue}k.push(`${Ut(B)}="${Ut(Il(String(T)))}"`)}return k}function Nr(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(Ut(B));continue}if(typeof T==="object")continue;k.push(`${Ut(B)}="${Ut(Il(String(T)))}"`)}return k}function ni(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ob(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var Dl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Ob(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",F=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,W=[];if(R.reactive)W.push(`:href="${ni(R.value)}"`);else W.push(`href="${ni(no(R.value,"navigable"))}"`);if(T)W.push(`class="${ni(T)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${ni(B)}"`),W.push(`data-stx-exact-active-class="${ni(z)}"`),F)W.push("data-stx-prefetch");let U=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(U)W.push(`data-stx-active-match="${ni(U)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return W.push(...Mr(v,H)),W.push(...Nr(v,H)),`<a ${W.join(" ")}>${_}</a>`}};import{createHash as Yp}from"crypto";import dn from"fs";import on from"path";import{decode as Wb,generateThumbHash as Vb}from"ts-images";import{createImageDeliveryCatalog as Hp}from"ts-images/delivery";import Ol from"fs";function va(v,_,k){let R=Buffer.alloc(k),T=Ol.readSync(v,R,0,k,_);return R.subarray(0,T)}function Ml(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Nl(v){let _;try{_=Ol.openSync(v,"r");let k=va(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=va(_,T,8);if(z.length<8)return"unknown";let F=z.toString("latin1",4,8);if(F==="tRNS")return"possible";if(F==="IDAT"||F==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Ml(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)Ol.closeSync(_)}}import Mb from"fs";import wa from"os";import{join as zp}from"path";import{fileURLToPath as Fp}from"url";import{Worker as Wp}from"worker_threads";var $a=Symbol("stx.image-worker.unavailable");function Nb(v=typeof wa.availableParallelism==="function"?wa.availableParallelism():wa.cpus().length){return Math.max(1,Math.min(2,v-1))}var Sa=0,Up=[];async function jb(){if(Sa<Nb()){Sa++;return}await new Promise((v)=>Up.push(v)),Sa++}function Lb(){Sa--,Up.shift()?.()}var Bb="@stacksjs/stx/builtins/image-warmup-worker";function zb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Mb.existsSync(Fp(k)))return Fp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Bb,v):void 0;return k&&Fb(k)?k:void 0}catch{return}}function Fb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,zp(_.BUN_INSTALL||zp(wa.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Vp=!1;function bo(v){if(!Vp)Vp=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return $a}function jl(v){return v instanceof Error?v.message:String(v)}async function Ll(v,_){if(typeof Wp!=="function")return bo("node:worker_threads has no Worker in this runtime");let k=zb();if(!k)return bo("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await jb();try{return await new Promise((R,T)=>{let B;try{B=new Wp(k)}catch(U){R(bo(`could not start ${k}: ${jl(U)}`));return}let z=!1,F=!1,W=(U)=>{if(F)return;F=!0,U(),B.terminate()};B.on("message",(U)=>{if(U.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(U.type==="result"){W(()=>R(U.value));return}let H=Error(U.error?.message??"image worker failed");if(U.error?.name)H.name=U.error.name;if(U.error?.stack)H.stack=U.error.stack;W(()=>T(H))}),B.on("error",(U)=>{W(()=>z?T(U instanceof Error?U:Error(jl(U)||"image worker crashed")):R(bo(`the worker failed before it was ready: ${jl(U)}`)))}),B.on("exit",(U)=>{W(()=>z?T(Error("image worker exited before it finished")):R(bo(`the worker exited with code ${U} before it was ready`)))})})}finally{Lb()}}var Ub=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Hb=[320,640,960,1280,1920],vo="/_stx/images",qb=`stx:${vo}:alpha-1`,Kb=`stx:${vo}:opaque-1`,Xb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],_a;function Zb(v,_){let k=on.dirname(Bun.resolveSync(v,_));while(k!==on.dirname(k)){let R=on.join(k,"package.json");if(dn.existsSync(R)){let T=JSON.parse(dn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=on.dirname(k)}return}function qp(){if(_a!==void 0)return _a;let v;try{v=on.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return _a=Xb.map((_)=>{let k;try{k=v?Zb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),_a}var Kp=Symbol.for("stx.image-delivery");function wo(){let v=globalThis;return v[Kp]??={catalog:new Map,transparent:new Set},v[Kp]}var Xp=new Set;function Gb(v){return`/${v.split(on.sep).map(encodeURIComponent).join("/")}`}function Jb(v){let _=on.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=Yp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function Zp(v,_=`stx:${vo}`){let k=(R)=>`${vo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=on.join(v,R);try{let B=await dn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=on.join(v,R);await dn.promises.mkdir(on.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await dn.promises.writeFile(z,T),await dn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function Qp(v,_=v){let k=await dn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=on.join(_,T.name);if(T.isDirectory()){R.push(...await Qp(v,B));continue}if(!T.isFile()||!Ub.has(on.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:on.relative(v,B)})}return R}function Gp(v,_){return v.map((k)=>({key:Gb(k.relativePath),input:k.absolutePath,name:Jb(k.relativePath),...Yb(k.absolutePath)?{options:{storage:_}}:{}}))}function Yb(v){return Nl(v)==="possible"}function Qb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function ev(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let F=z.variants.filter((W)=>W.format==="png").sort((W,U)=>W.width-U.width)[0];try{let W=await Wb(new Uint8Array(await dn.promises.readFile(F?.path??z.fallback.path)));if(Qb(W.data))k.add(B)}catch{k.add(B)}}));return k}function tv(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((F)=>F.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((F)=>{let W;try{return W=dn.openSync(F.path,"r"),!Ml(va(W,0,32))}catch{return!0}finally{if(W!==void 0)dn.closeSync(W)}}))continue;if(T.variants=T.variants.filter((F)=>F.format!=="webp"),delete T.sources.webp,k.push(R),!Xp.has(R))Xp.add(R),console.warn(`[stx-images] ${R} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function nv(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await Vb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Bl(v){return on.join(v,"undecodable.json")}function rv(v){try{let _=dn.readFileSync(Bl(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function sv(v,_){try{dn.mkdirSync(on.dirname(Bl(v)),{recursive:!0}),dn.writeFileSync(Bl(v),JSON.stringify(_))}catch{}}function Jp(v){try{let _=dn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function eg(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ys(v){let _=eg(v);return _?wo().catalog.get(_):void 0}function bs(v){let _=eg(v);return _?wo().transparent.has(_):!1}function vs(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function ud(v){let _=ys(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:vs(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:bs(v)?void 0:_.placeholder?.dataUrl}}function or(){let v=wo();v.catalog=new Map,v.transparent=new Set}function iv(v){let _=wo();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function dd(v,_,k={}){if(!v||!dn.existsSync(v))return or(),{count:0,fingerprint:""};if(k.offThread){let Q=await Ll("delivery",{publicDir:v,outputDir:_});if(Q!==$a)return iv(Q.state),Q.result}let R=await Qp(v);if(R.length===0)return or(),{count:0,fingerprint:""};let T=rv(_),B=R.filter((Q)=>{let oe=T[Q.relativePath];if(!oe)return!0;let ae=Jp(Q.absolutePath);return!ae||ae.mtimeMs!==oe.mtimeMs||ae.size!==oe.size});if(B.length===0)return or(),{count:0,fingerprint:""};let z=Zp(on.join(_,"_stx","images"),`${qb}:${qp()}`),F={outDir:on.join(_,"_stx","images"),storage:Zp(on.join(_,"_stx","images"),`${Kb}:${qp()}`),baseUrl:vo,widths:Hb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},W=B,U;try{U=await Hp({...F,entries:Gp(B,z)})}catch(Q){if(W=await nv(B),W.length===B.length)throw Q;let oe=new Set(W.map((ce)=>ce.relativePath)),ae=!1;for(let ce of B){if(oe.has(ce.relativePath))continue;let ue=Jp(ce.absolutePath);if(!ue)continue;T[ce.relativePath]=ue,ae=!0}if(ae)sv(_,T);if(W.length===0)return or(),{count:0,fingerprint:""};U=await Hp({...F,entries:Gp(W,z)})}let H=await ev(U.entries),q=tv(U.entries,H),ie=wo();ie.catalog=new Map(Object.entries(U.entries)),ie.transparent=H;let Z=H.size===0&&q.length===0?U.fingerprint:Yp("sha256").update(U.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:W.length,fingerprint:Z}}var ov=new Map;function zl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return ov.get(_)}var av={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Fl=[320,640,768,1024,1280,1536,1920];function Qt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function en(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ka(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Wl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=av[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let F=Number.parseInt(T);if(!Number.isNaN(F))k.push(`(max-width: ${F}px) ${B}`)}}else k.push(R);return k.join(", ")}function Vl(v,_,k,R){return _.map((T)=>`${So(v,T,void 0,k,R)} ${T}w`).join(", ")}function cv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${So(v,z,void 0,R,T)} ${B}x`}).join(", ")}function So(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function lv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function uv(v,_,k="#e5e7eb"){let R=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(R)}`}var Ul={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=en(v,"src")||"",T=ys(R),B=en(v,"alt")||"",z=en(v,"width")||(T?String(T.source.width):void 0),F=en(v,"height")||(T?String(T.source.height):void 0),W=en(v,"sizes"),U=en(v,"srcset"),H=en(v,"densities"),q=en(v,"format"),ie=bs(R)||zl(R)?.transparent===!0,Z=en(v,"placeholder")||(T&&!ie?"thumbhash":void 0),Q=en(v,"placeholderColor")||"#e5e7eb",oe=en(v,"provider"),ae=en(v,"class")||en(v,"className")||"",ce=en(v,"style")||"",ue=en(v,"objectFit")||en(v,"fit"),le=en(v,"objectPosition")||en(v,"position"),Ae=en(v,"quality"),ve=ka(v,"lazy",!0),he=ka(v,"preload",!1),Te=ka(v,"priority",!1),De=en(v,"loading"),Oe=en(v,"decoding")||"async",Me=!!T||ka(v,"picture",!1)||!!q,Ne=z?Number.parseInt(z):void 0,Ie=F?Number.parseInt(F):void 0,Be=U||"",Fe="";if(T)Be=T.sources[T.fallback.format]||"",Fe=W?Wl(W):"100vw";else if(!Be&&W&&oe&&oe!=="local"&&oe!=="static")Be=Vl(R,Fl,oe,q),Fe=Wl(W);else if(!Be&&H){let xt=H.split(/\s+/).map((at)=>Number.parseFloat(at.replace("x","")));Be=cv(R,xt,Ne,oe,q)}else if(W)Fe=Wl(W);let Le=[];if(ce)Le.push(ce);if(ue)Le.push(`object-fit:${ue}`);if(le)Le.push(`object-position:${le}`);if(Ne&&Ie)Le.push(`aspect-ratio:${Ne}/${Ie}`);let je=[],rt=Z==="blur"||Z==="color"||Z==="thumbhash";if(rt&&!ie){let xt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:Q}:zl(R);if(xt&&Z==="color")Le.push(`background-color:${xt.color}`),je.push("backgroundColor");else if(xt)Le.push(`background-color:${xt.color}`),Le.push(`background-image:url(${xt.dataUrl})`),Le.push("background-size:cover"),Le.push("background-repeat:no-repeat"),je.push("backgroundColor","backgroundImage");else{let at=uv(Ne||16,Ie||9,Q);Le.push(`background-image:url(${at})`),Le.push("background-size:cover"),Le.push("background-repeat:no-repeat"),je.push("backgroundImage")}}else if(!rt&&Z&&Z!=="empty"&&Z!=="none")Le.push(`background-image:url(${Qt(Z)})`),Le.push("background-size:cover"),Le.push("background-repeat:no-repeat"),je.push("backgroundImage");let gt=T?.fallback.url||So(R,Ne,Ie,oe,q),mt=[];if(mt.push(`src="${Qt(no(gt,"fetched"))}"`),mt.push(`alt="${Qt(B)}"`),z)mt.push(`width="${Qt(z)}"`);if(F)mt.push(`height="${Qt(F)}"`);let yt=De||(Te||he?"eager":ve?"lazy":"");if(yt)mt.push(`loading="${Qt(yt)}"`);if(Te)mt.push('fetchpriority="high"');if(mt.push(`decoding="${Qt(Oe)}"`),ae)mt.push(`class="${Qt(ae)}"`);if(Le.length>0)mt.push(`style="${Qt(Le.join(";"))}"`);if(Be)mt.push(`srcset="${Qt(no(Be,"fetched"))}"`);if(Fe)mt.push(`sizes="${Qt(Fe)}"`);let ut=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(je.length>0){let xt=typeof v.static.onload==="string"?v.static.onload:"",at=lv(je)+(xt?`;${xt}`:"");mt.push(`onload="${Qt(at)}"`),ut.add("onload")}mt.push(...Mr(v,ut)),mt.push(...Nr(v,ut));let $t=`<img ${mt.join(" ")} />`,St="";if(he){let at=q==="webp"?"image/webp":q==="avif"?"image/avif":"";St=`<link rel="preload" as="image" href="${Qt(gt)}"${at?` type="${at}"`:""}${Be?` imagesrcset="${Qt(Be)}"`:""}${Fe?` imagesizes="${Qt(Fe)}"`:""} />
|
|
2297
|
+
`}if(Me){let xt=[];if(T)for(let at of vs(T))xt.push(`<source type="image/${at.format}" srcset="${Qt(at.srcset)}"${Fe?` sizes="${Qt(Fe)}"`:""} />`);if(!T&&(q==="avif"||q==="auto")){let at=So(R,Ne,Ie,oe,"avif"),kt=Be?Vl(R,Fl,oe,"avif"):`${at}`;xt.push(`<source type="image/avif" srcset="${Qt(kt)}"${Fe?` sizes="${Qt(Fe)}"`:""} />`)}if(!T&&(q==="webp"||q==="auto")){let at=So(R,Ne,Ie,oe,"webp"),kt=Be?Vl(R,Fl,oe,"webp"):`${at}`;xt.push(`<source type="image/webp" srcset="${Qt(kt)}"${Fe?` sizes="${Qt(Fe)}"`:""} />`)}return`${St}<picture>
|
|
2298
|
+
${xt.join(`
|
|
2299
2299
|
`)}
|
|
2300
|
-
${
|
|
2301
|
-
</picture>`}return`${
|
|
2302
|
-
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${B};background:${U};z-index:${
|
|
2300
|
+
${$t}
|
|
2301
|
+
</picture>`}return`${St}${$t}`}};var tg="/images/safe-image-default.svg";function $o(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ri(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var dv=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${tg}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Hl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let R=ri(v,"src")||"",T=ri(v,"alt")||"",B=ri(v,"fallback")||tg,z=ri(v,"class")||ri(v,"className")||"",F=ri(v,"fallbackClassName")||"",W=[];if(W.push(`src="${$o(R)}"`),W.push(`alt="${$o(T)}"`),z)W.push(`class="${$o(z)}"`);if(W.push(`data-fallback="${$o(B)}"`),F)W.push(`data-fallback-class="${$o(F)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...Mr(v,U)),W.push(...Nr(v,U));let H=`<img ${W.join(" ")} />`,q=k.context;if(!q.__safeImageHandlerEmitted)return q.__safeImageHandlerEmitted=!0,`${dv}${H}`;return H}};function ql(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function _o(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Ea(v,_,k){let R=_o(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var Kl={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let R=ql(_o(v,"color")||"#6366f1"),T=ql(_o(v,"initialColor")||_o(v,"initial-color")||""),B=ql(_o(v,"height")||"3px"),z=Ea(v,"duration",2000),F=Ea(v,"throttle",200),W=Ea(v,"zIndex",999999)||Ea(v,"z-index",999999),U=T?`linear-gradient(to right, ${T}, ${R})`:R;return`
|
|
2302
|
+
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${B};background:${U};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
2303
2303
|
<div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
|
|
2304
2304
|
</div>
|
|
2305
2305
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
2306
2306
|
<script>
|
|
2307
|
-
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${
|
|
2307
|
+
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${F})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
2308
2308
|
</script>`}};function rg(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function fv(v,_,k){let R=rg(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var ng={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},Xl={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let R=Ut(rg(v,"position")||"top-right"),T=fv(v,"max",5),B=ng[R]||ng["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${R}" data-stx-toast-max="${T}" style="position:fixed;${B};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
2309
2309
|
<style>
|
|
2310
2310
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
@@ -2313,8 +2313,8 @@ ${xt}
|
|
|
2313
2313
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
2314
2314
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
2315
2315
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
2316
|
-
</style>`}};function Ca(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var sg={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},Zl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let R=Ca(v,"id");if(!R)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Ut(R),B=Ca(v,"size")||"md",z=Ca(v,"closeOnBackdrop")!=="false",
|
|
2317
|
-
<div class="stx-modal-panel" style="${
|
|
2316
|
+
</style>`}};function Ca(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var sg={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},Zl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let R=Ca(v,"id");if(!R)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Ut(R),B=Ca(v,"size")||"md",z=Ca(v,"closeOnBackdrop")!=="false",F=Ca(v,"closeOnEscape")!=="false",W=sg[B]||sg.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${z}" data-close-escape="${F}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
2317
|
+
<div class="stx-modal-panel" style="${W};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
2318
2318
|
<div style="padding:1.5rem">${_}</div>
|
|
2319
2319
|
</div>
|
|
2320
2320
|
</div>
|
|
@@ -2322,7 +2322,7 @@ ${xt}
|
|
|
2322
2322
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2323
2323
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2324
2324
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2325
|
-
</style>`}};function si(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var ig={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Gl={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let R=si(v,"id");if(!R)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Ut(R),B=si(v,"side")||"right",z=si(v,"size")||"md",
|
|
2325
|
+
</style>`}};function si(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var ig={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Gl={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let R=si(v,"id");if(!R)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Ut(R),B=si(v,"side")||"right",z=si(v,"size")||"md",F=si(v,"closeOnBackdrop")!=="false",W=si(v,"closeOnEscape")!=="false",U=si(v,"overlay")!=="false",H=ig[z]||ig.md,q=B==="left",ie=q?"left:0":"right:0",Z=q?"translateX(-100%)":"translateX(100%)",Q=q?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${F}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
2326
2326
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${ie};width:${H};max-width:100vw;transform:${Z};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
2327
2327
|
<div style="padding:1.5rem">${_}</div>
|
|
2328
2328
|
</div>
|
|
@@ -2331,7 +2331,7 @@ ${xt}
|
|
|
2331
2331
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2332
2332
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2333
2333
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2334
|
-
</style>`}};import{existsSync as pv,readFileSync as gv}from"fs";var Ra=new Map,og=new Set;function mv(v){if(og.has(v))return;og.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function hv(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(pv(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return d.resolve(k)}catch{}return null}function yv(v){if(Ra.has(v))return Ra.get(v);let _=hv(v);if(!_)return mv(v),null;try{let k=JSON.parse(gv(_,"utf8"));return Ra.set(v,k.icons),k.icons}catch{return null}}function Di(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var Jl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=Di(v,"name")??Di(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let ue=R.split(":");T=ue[0],B=ue[1]}let z=Ut(Di(v,"size")||"24"),
|
|
2334
|
+
</style>`}};import{existsSync as pv,readFileSync as gv}from"fs";var Ra=new Map,og=new Set;function mv(v){if(og.has(v))return;og.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function hv(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(pv(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return d.resolve(k)}catch{}return null}function yv(v){if(Ra.has(v))return Ra.get(v);let _=hv(v);if(!_)return mv(v),null;try{let k=JSON.parse(gv(_,"utf8"));return Ra.set(v,k.icons),k.icons}catch{return null}}function Di(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var Jl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=Di(v,"name")??Di(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let ue=R.split(":");T=ue[0],B=ue[1]}let z=Ut(Di(v,"size")||"24"),F=Ut(Di(v,"color")||"currentColor"),W=Ut(Di(v,"class")||""),U=Ut(Di(v,"style")||""),H=Ra.get(T)??yv(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let q=H[B];if(!q)return`<!-- Icon: "${B}" not found in ${T} -->`;let ie=q.width||24,Z=q.height||24,Q=`0 0 ${ie} ${Z}`,oe=q.body;if(F!=="currentColor")oe=oe.replace(/currentColor/g,F);let ae=W?` class="${W}"`:"",ce=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${z}" height="${z}" viewBox="${Q}" fill="none"${ae}${ce}>${oe}</svg>`}};function Yl(){return`
|
|
2335
2335
|
(function(){
|
|
2336
2336
|
var tip=null,hideTimer=null,currentEl=null;
|
|
2337
2337
|
|
|
@@ -2434,8 +2434,8 @@ document.addEventListener("focusout",function(e){
|
|
|
2434
2434
|
if(el) hideTip();
|
|
2435
2435
|
});
|
|
2436
2436
|
})();
|
|
2437
|
-
`}function ag(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}function cg(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),R=v.match(k);if(!R)return{region:null,rest:v};return{region:R[2],rest:v.replace(R[0],"")}}var Ql={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=cg(_,"fallback"),T=R.rest,B=cg(T,"error"),z=B.rest,
|
|
2438
|
-
`||Oe==="\t"){let Me=bv(v,Te+ae.length);if(v[Me-1]!=="/")ue++;le=Me+1}else le=Te+ae.length}else{if(ue--,ue===0){Ae=De;break}le=De+ce.length}}if(Ae===-1){T=Z;continue}let ve=v.slice(Z,Ae),he=Ae+ce.length;R.push({fullMatch:v.slice(z,he),tagName:U,attributes:oe,content:ve,startIndex:z,endIndex:he,isSelfClosing:!1}),T=he}}return R}function tu(v){return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function gg(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function nu(v,_){let k=0,R="",T=_;while(T<v.length){let B=v[T];if(R){if(B==="\\")T++;else if(B===R)R=""}else if(B==='"'||B==="'"||B==="`")R=B;else if(B==="{")k++;else if(B==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function mg(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(nu(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var vv=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),wv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Sv(v){return ru(v).map((_)=>[_.start,_.end])}function ru(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",B=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!B)continue;let z=cs(B[1]??B[2]??B[3]??""),
|
|
2437
|
+
`}function ag(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}function cg(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),R=v.match(k);if(!R)return{region:null,rest:v};return{region:R[2],rest:v.replace(R[0],"")}}var Ql={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=cg(_,"fallback"),T=R.rest,B=cg(T,"error"),z=B.rest,F=R.region??ag(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=B.region??ag(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${F}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${z}</div></div>`}};function Aa(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}var eu={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let R=(Aa(v,"name")||"v").replace(/["'<>]/g,""),T=(Aa(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",B=Aa(v,"class"),z=Aa(v,"id"),F=[`data-stx-transition-group="${R}"`,B?`class="${B}"`:"",z?`id="${z}"`:""].filter(Boolean).join(" ");return`<${T} ${F}>${_}</${T}>`}};function lg(v=ti){v.registerBuiltin(Dl),v.registerBuiltin(Ul),v.registerBuiltin(Hl),v.registerBuiltin(Kl),v.registerBuiltin(Xl),v.registerBuiltin(Zl),v.registerBuiltin(Gl),v.registerBuiltin(Jl),v.registerBuiltin(Ql),v.registerBuiltin(eu)}var ug=new Map;function xv(v){let _=ug.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),ug.set(v.source,_);return _}var dg=new WeakMap;function fg(v){let _=dg.get(v);if(!_)_=new Set([...v].map((R)=>R.toLowerCase())),dg.set(v,_);let k=_;return(R)=>!/[a-z]/.test(R)&&k.has(R.toLowerCase())}function bv(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function pg(v,_,k){let R=[],T=0,B=typeof k==="function"?k:k?(z)=>k.has(z.toLowerCase()):void 0;while(T<v.length){let z=v.indexOf("<",T);if(z===-1)break;let F=xv(_);F.lastIndex=z+1;let W=F.exec(v);if(!W){T=z+1;continue}let U=W[1];if(B&&B(U)){let ae=z+1+U.length;while(ae<v.length&&v[ae]!==">")ae++;T=ae+1;continue}let H=z+1+U.length,q=null,ie=H,Z=-1,Q=!1;while(H<v.length){let ae=v[H];if(q){if(ae==="\\"&&H+1<v.length){H+=2;continue}if(ae===q)q=null;H++;continue}if(ae==='"'||ae==="'"){q=ae,H++;continue}if(ae==="/"&&H+1<v.length&&v[H+1]===">"){Z=H+2,Q=!0;break}if(ae===">"){Z=H+1;break}H++}if(Z===-1){T=z+1;continue}let oe=v.slice(ie,Q?Z-2:Z-1).trim();if(Q)R.push({fullMatch:v.slice(z,Z),tagName:U,attributes:oe,content:"",startIndex:z,endIndex:Z,isSelfClosing:!0}),T=Z;else{let ae=`<${U}`,ce=`</${U}>`,ue=1,le=Z,Ae=-1;while(ue>0&&le<v.length){let Te=v.indexOf(ae,le),De=v.indexOf(ce,le);if(De===-1)break;if(Te!==-1&&Te<De){let Oe=v[Te+ae.length];if(Oe===" "||Oe===">"||Oe==="/"||Oe===`
|
|
2438
|
+
`||Oe==="\t"){let Me=bv(v,Te+ae.length);if(v[Me-1]!=="/")ue++;le=Me+1}else le=Te+ae.length}else{if(ue--,ue===0){Ae=De;break}le=De+ce.length}}if(Ae===-1){T=Z;continue}let ve=v.slice(Z,Ae),he=Ae+ce.length;R.push({fullMatch:v.slice(z,he),tagName:U,attributes:oe,content:ve,startIndex:z,endIndex:he,isSelfClosing:!1}),T=he}}return R}function tu(v){return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function gg(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function nu(v,_){let k=0,R="",T=_;while(T<v.length){let B=v[T];if(R){if(B==="\\")T++;else if(B===R)R=""}else if(B==='"'||B==="'"||B==="`")R=B;else if(B==="{")k++;else if(B==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function mg(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(nu(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var vv=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),wv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Sv(v){return ru(v).map((_)=>[_.start,_.end])}function ru(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",B=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!B)continue;let z=cs(B[1]??B[2]??B[3]??""),F=R.index,W=F+R[0].length,U=R[1].toLowerCase();if(R[0].endsWith("/>")||wv.has(U)){_.push({start:F,end:W,names:z});continue}let H=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=W;let ie=1,Z=W,Q;while((Q=q.exec(v))!==null)if(Q[0].startsWith("</")){if(ie--,ie===0){Z=Q.index+Q[0].length;break}}else if(!Q[0].endsWith("/>"))ie++;_.push({start:F,end:Z,names:z})}return _}function hg(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>hg(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function yg(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,R=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],B;while((B=R.exec(v))!==null)T.push([B.index,B.index+B[0].length]);T.push(...Sv(v));let z=new Set(Er(_));function F(ie){return T.some(([Z,Q])=>ie>=Z&&ie<Q)}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,U=[],H=new Map,q=256;while((B=W.exec(k))!==null){if(F(B.index))continue;let ie=B[0],Z=B[2];if(!Z||!Z.includes(":"))continue;let Q=/(?:^|\s)data-native(?:\s|=|$)/i.test(Z.replace(/"[^"]*"|'[^']*'/g,"")),oe=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,ae,ce=Z,ue=!1;while((ae=oe.exec(Z))!==null){let le=ae[1],Ae=ae[2];if(Zi(le))continue;if(Fr(Ae,z))continue;if(Ae.includes("()")&&!Ae.includes(".get(")||Ae.includes("$store")||Ae.includes("$ref"))continue;try{let ve=Object.keys(_),he=Object.values(_),Te=Ae.match(/^([a-zA-Z_$][\w$]*)/);if(Te&&!ve.includes(Te[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Te[1]))continue;let De=JSON.stringify([ve,Ae]),Oe=H.get(De);if(!Oe){if(Oe=Function(...ve,`return (${Ae})`),H.size>=q)H.clear();H.set(De,Oe)}let Me=Oe(...he);if(le==="class"){let Ne=hg(Me);if(Ne){let Ie=ce.match(/\sclass="([^"]*)"/);if(Ie)ce=ce.replace(Ie[0],` class="${Ie[1]} ${Ne}"`);else ce=ce.replace(ae[0],` class="${Ne}"`)}else ce=ce.replace(ae[0],"");ue=!0;continue}if(vv.has(le)){if(Me)ce=ce.replace(ae[0],` ${le}`);else ce=ce.replace(ae[0],"");ue=!0;continue}if(Me===null||Me===void 0||Me===!1)ce=ce.replace(ae[0],"");else{let Ie=(Q&&typeof Me==="object"?JSON.stringify(Me):String(Me)).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");ce=ce.replace(ae[0],` ${le}="${Ie}"`)}ue=!0}catch{continue}}if(ue){let le=B[3]?" /":"",ve=`<${B[1]}${ce}${le}>`;U.push({start:B.index,end:B.index+ie.length,replacement:ve})}}if(U.length>0){let ie=Array(U.length*2+1),Z=0;for(let Q=0;Q<U.length;Q++){let{start:oe,end:ae,replacement:ce}=U[Q];ie[Q*2]=k.slice(Z,oe),ie[Q*2+1]=ce,Z=ae}ie[U.length*2]=k.slice(Z),k=ie.join("")}return k}var K=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];import Tg from"path";import iu from"fs";import Eo from"path";function xg(v,_,k,R){let T=0;for(let B=_;B<v.length;B++)if(v[B]===k)T++;else if(v[B]===R&&!(R===">"&&v[B-1]==="=")){if(--T===0)return B}return-1}function $v(v){let _=s(v),k=0,R=0,T=[];for(let B=0;B<_.length;B++)if("([{".includes(_[B]))k++;else if(")]}".includes(_[B]))k--;else if(_[B]===","&&k===0)T.push(v.slice(R,B).trim()),R=B+1;return T.push(v.slice(R).trim()),T}function su(v,_){let k=s(v),R=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(R)){let B=T.index+T[0].length,z="";if(k[B]==="<"){let W=xg(k,B,"<",">");if(W<0)continue;z=v.slice(B+1,W),B=W+1;while(/\s/.test(k[B]||"")&&B<k.length)B++}if(k[B]!=="(")continue;let F=xg(k,B,"(",")");if(F>=0)return{type:z,args:$v(v.slice(B+1,F))}}return null}var bg=`
|
|
2439
2439
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
2440
2440
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
2441
2441
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -2444,36 +2444,36 @@ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ?
|
|
|
2444
2444
|
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
2445
2445
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
2446
2446
|
`;function vg(v,_){let k=[],R={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),B=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(ie,Z,Q,oe,ae)=>{if(T.slice(ae,ae+6)!=="import")return ie;if(oe.endsWith(".stx"))return"";let ce=`${_}Import${k.length}`;if(k.push(`import * as ${ce} from ${JSON.stringify(oe)};`),Z.startsWith("*"))return`import ${Z.replace(/^\*\s+as\s+/,"")} = ${ce};`;if(!Z.startsWith("{"))return`import ${Z} = ${ce}.default;`;return Z.slice(1,-1).split(",").map((ue)=>{let[le,Ae=le]=ue.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!le)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(oe)&&le in R)R[le].push(Ae);return`import ${Ae} = ${ce}.${le};`}).join(`
|
|
2447
|
-
`)}),z=su(v,R.defineProps),
|
|
2447
|
+
`)}),z=su(v,R.defineProps),F=su(v,R.defineEmits),W=su(v,R.withDefaults);if(!z&&!F)return{declarations:"",props:null,events:null};let U=[],H=null,q=null;if(z){U.push(`const __options = (${z.args[0]||"{}"}) as const;`),U.push(`const __defaults = (${W?.args[1]||"{}"});`);let ie=z.type||"__StxOptions<typeof __options>";U.push(`export type __StxProps = __StxDefaults<${ie}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),H=`${_}.__StxProps`}if(F)U.push(`const __events = (${F.args[0]||"[]"}) as const;`),U.push(`export type __StxEvents = ${F.type||"Record<(typeof __events)[number], any[]>"};`),q=`${_}.__StxEvents`;return{declarations:`${k.join(`
|
|
2448
2448
|
`)}
|
|
2449
2449
|
namespace ${_} {
|
|
2450
2450
|
${B}
|
|
2451
2451
|
${U.join(`
|
|
2452
2452
|
`)}
|
|
2453
|
-
}`,props:H,events:q}}var ko=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function xn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...ko].some((_)=>_.toLowerCase()===v.toLowerCase());return ko.has(v)||/[A-Z]/.test(v)}function*_v(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let R=_.lastIndex,T=[];while(R<v.length){while(/\s/.test(v[R]||""))R++;if(v[R]===">"||v.slice(R,R+2)==="/>"){R+=v[R]===">"?1:2;break}let B=/^[^\s=/>]+/.exec(v.slice(R))?.[0];if(!B){R++;continue}let z=R;R+=B.length;while(/\s/.test(v[R]||""))R++;if(v[R]!=="="){T.push({name:B,value:!0,offset:z,braced:!1});continue}R++;while(/\s/.test(v[R]||""))R++;let
|
|
2453
|
+
}`,props:H,events:q}}var ko=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function xn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...ko].some((_)=>_.toLowerCase()===v.toLowerCase());return ko.has(v)||/[A-Z]/.test(v)}function*_v(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let R=_.lastIndex,T=[];while(R<v.length){while(/\s/.test(v[R]||""))R++;if(v[R]===">"||v.slice(R,R+2)==="/>"){R+=v[R]===">"?1:2;break}let B=/^[^\s=/>]+/.exec(v.slice(R))?.[0];if(!B){R++;continue}let z=R;R+=B.length;while(/\s/.test(v[R]||""))R++;if(v[R]!=="="){T.push({name:B,value:!0,offset:z,braced:!1});continue}R++;while(/\s/.test(v[R]||""))R++;let F=v[R],W=F==="{",U=F==='"'||F==="'";if(U||W)R++;let H=R;if(W){let q=s(v.slice(R)),ie=1,Z=0;for(;Z<q.length;Z++){if(q[Z]==="{")ie++;if(q[Z]==="}"&&--ie===0)break}R+=Z}else if(U)while(R<v.length&&v[R]!==F)R++;else while(R<v.length&&!/[\s/>]/.test(v[R]))R++;if(T.push({name:B,value:v.slice(H,R),offset:H,braced:W}),U||W)R++}_.lastIndex=R,yield{name:k[1],offset:k.index,attributes:T}}}function wg(v,_,k){let R=[],T=[bg,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],B=new Map,z=new Map,F=new Map,W=k.scriptCode(v,k.filePath),U=s(W);for(let Q of W.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(U.slice(Q.index,Q.index+6)!=="import")continue;let oe=Q[2],ae=Eo.isAbsolute(oe)||oe.startsWith(".")?Eo.resolve(Eo.dirname(k.filePath),oe):Vo(oe,Eo.dirname(k.filePath));if(!ae)continue;let ce=ae.endsWith(".stx")?ae:iu.existsSync(`${ae}.stx`)?`${ae}.stx`:void 0,ue=ce?null:Wo(ae,!1),le=Q[1].startsWith("{")?Q[1].slice(1,-1).split(","):[Q[1]];for(let Ae of le){let[ve,he=ve]=Ae.trim().split(/\s+as\s+/),Te=ce||ue?.get(ve)||ue?.get(ve.toLowerCase());if(Te)F.set(he,Te),F.set(he.toLowerCase(),Te),F.set(he.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Te)}}for(let Q of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let oe of Q[1].matchAll(/['"]([^'"]+)['"]/g)){let ae=Uo(oe[1],k.filePath,k).find((ce)=>iu.statSync(ce,{throwIfNoEntry:!1})?.isFile());if(ae)F.set(Eo.basename(oe[1]).replace(/\.stx$/,""),ae)}let H={__importedComponents:F},q=new Map,ie=(Q,oe,ae)=>{let ce=v.slice(0,Q);return{code:oe,offset:Q,attribute:ae,anchor:!0,kind:"directive",line:ce.split(`
|
|
2454
2454
|
`).length,column:Q-ce.lastIndexOf(`
|
|
2455
2455
|
`)}},Z=(Q,oe,ae)=>R.push({expression:Q,statement:{text:oe+Q.code+ae,prefixLength:oe.length}});for(let Q of _v(_)){if(xn(Q.name)||Q.name==="component")continue;let oe=Uu(Q.name,k.filePath,k,H);if(!oe)continue;let ae=q.get(oe);if(!ae){let ue;try{ue=k.readComponent?k.readComponent(oe):iu.readFileSync(oe,"utf8")}catch{continue}if(ue===void 0)continue;z.set(oe,ue),ae=vg(k.scriptCode(ue,oe),`__StxComponent${q.size}`),q.set(oe,ae),T.push(ae.declarations)}let ce=[];for(let ue of Q.attributes){let{name:le,offset:Ae}=ue,ve=ue.value===!0?"true":ue.value;if(le.startsWith("@")||le.startsWith("v-on:")){if(ae.events&&ue.value!==!0)B.set(Ae,`__StxEvent<${ae.events}, ${JSON.stringify(le.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let he=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(le);if(le.startsWith("v-")&&!le.startsWith("v-bind:")&&!he)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(le))continue;let Te=(he?he[1]||"modelValue":le.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Me,Ne)=>Ne.toUpperCase());if(ce.push(Te),!ae.props)continue;let Oe=le.startsWith(":")||le.startsWith("v-bind:")||!!he||ue.braced?ve:ue.value!==!0?JSON.stringify(ve):"true";Z(ie(Ae,Oe,le),";void ((",`) satisfies __StxProp<${ae.props}, ${JSON.stringify(Te)}>);`)}if(ae.props){let ue=[...new Set(ce)].map((Ae)=>`${JSON.stringify(Ae)}: undefined as any`).join(", "),le=ie(Q.offset,`<${Q.name}>`);R.push({expression:le,statement:{text:`;void ({ ${ue} } satisfies ${ae.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:q.size?T.join(`
|
|
2456
|
-
`):"",checks:R,events:B,dependencies:z}}var Sg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function kv(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Je(v){let _=[],k=kv(v);Sg.lastIndex=0;let R;while((R=Sg.exec(k))!==null){let T=(R[1]||"").trim(),B=(R[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=(R[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,
|
|
2456
|
+
`):"",checks:R,events:B,dependencies:z}}var Sg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function kv(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Je(v){let _=[],k=kv(v);Sg.lastIndex=0;let R;while((R=Sg.exec(k))!==null){let T=(R[1]||"").trim(),B=(R[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=(R[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,F=R.index+B,W=R.index+R[0].length-z,U=v.slice(F,W);if(/\bsrc\s*=/.test(T))continue;let H=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let q=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",ie=Co(v,F);_.push({kind:q,code:U,startLine:ie,startColumn:Ro(v,F),offset:F,attrs:T})}return _}function Co(v,_){let k=1;for(let R=0;R<_&&R<v.length;R++)if(v.charCodeAt(R)===10)k++;return k}function Ro(v,_){let k=v.lastIndexOf(`
|
|
2457
2457
|
`,_-1)+1;return _-k+1}function Ta(v){let _=v.split(""),k=(T,B)=>{for(let z=T;z<B&&z<_.length;z++)if(_[z]!==`
|
|
2458
2458
|
`)_[z]=" "},R=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of R){T.lastIndex=0;let B;while((B=T.exec(v))!==null)k(B.index,B.index+B[0].length)}return _.join("")}function Ev(v){let _=0,k="";for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k="";continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{"){_++;continue}if(T===")"||T==="]"||T==="}"){_--;continue}if(T==="|"&&_===0){if(v[R+1]==="|"){R++;continue}if(v[R-1]==="|")continue;return v.slice(0,R)}}return v}var Ig=new Set([":for","x-for","v-for"]),Ia=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,ou="__stx_interpolated",$g="__StxElement",Pg="__StxTemplateValue",Cv=`type ${Pg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function _g(v){return v.replace(/\{\{[\s\S]*?\}\}/g,ou).replace(/\{!![\s\S]*?!!\}/g,ou)}function ws(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
|
|
2459
2459
|
`).length-1,R=_.length-k;return`0${" ".repeat(Math.max(0,R-1))}${`
|
|
2460
|
-
`.repeat(k)}`})}var Rv=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Av=new RegExp(String.raw`^[ \t]*@(?:${Rv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function xs(v){return v.replace(Av,(_)=>_.replace(/[^\n]/g," "))}var kg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Ac(v){let _=Ta(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let
|
|
2461
|
-
`)}function mi(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Dg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,R=!1,T=new Set,B=s(v);while((k=_.exec(B))!==null){R=!0;for(let z of Ov(k[1])){let
|
|
2460
|
+
`.repeat(k)}`})}var Rv=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Av=new RegExp(String.raw`^[ \t]*@(?:${Rv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function xs(v){return v.replace(Av,(_)=>_.replace(/[^\n]/g," "))}var kg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Ac(v){let _=Ta(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let F=T[2]??T[4]??"",W=T[2]!==void 0?2:3,U=Ev(F);if(!U.trim())continue;let H=T.index+W+(U.length-U.trimStart().length);k.push({code:U.trim(),line:Co(_,H),column:Ro(_,H),offset:H,kind:"interpolation"})}let B=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=B.exec(_))!==null){let z=T.index+T[0].length-1,F=0,W=z;for(;W<_.length;W++){let ie=_[W];if(ie==="(")F++;else if(ie===")"){if(F--,F===0)break}}if(F!==0)continue;let U=_.slice(z+1,W),H=U.trim();if(B.lastIndex=W+1,!H)continue;let q=z+1+(U.length-U.trimStart().length);k.push({code:H,line:Co(_,q),column:Ro(_,q),offset:T.index,kind:"condition"})}Ia.lastIndex=0;while((T=Ia.exec(_))!==null){let z=T[1],F=T[3]??"",W=z.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(kg.has(W)||kg.has(z))continue;if(!F.trim())continue;let U=T.index+T[0].indexOf(T[2],T[0].indexOf(z)+z.length)+1;if(Ig.has(W)){let q=F.match(/\s+(?:in|of)\s+/);if(!q||q.index===void 0)continue;let ie=F.slice(q.index+q[0].length),Z=q.index+q[0].length+(ie.length-ie.trimStart().length);k.push({code:_g(ie.trim()),line:Co(_,U+Z),column:Ro(_,U+Z),offset:U+Z,kind:"directive",attribute:W});continue}let H=F.length-F.trimStart().length;k.push({code:_g(F.trim()),line:Co(_,U+H),column:Ro(_,U+H),offset:U+H,kind:"directive",attribute:W})}return k.sort((z,F)=>z.line-F.line||z.column-F.column),k}var Tv=2000;function Iv(v,_){let k=0,R=Math.min(v.length,_+Tv);for(let T=_;T<R;T++){let B=v[T];if(B==="(")k++;else if(B===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function Pv(v){let _=new Map,k=(F,W)=>{let U=F.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of U){let q=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(q))continue;let ie=U.length===1?W:void 0,Z=_.get(q);if(!Z)_.set(q,{name:q,iterable:ie});else if(Z.iterable!==ie)Z.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(F)=>{let W=F.trim();return R.test(W)?W:void 0};for(let F of v.matchAll(/@for(?:each|else)\s*\(/g)){let W=Iv(v,F.index+F[0].length-1);if(W===null)continue;let U=Pt(W);if(!U)continue;k(U.itemVar.replace(/=>/g," "),T(U.arrayExpr))}for(let F of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(F[1],F[2]==="of"?T(F[3]):void 0);for(let F of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(F[1]);let B=Ta(v);Ia.lastIndex=0;let z;while((z=Ia.exec(B))!==null){let F=z[1].replace(/\..*$/,"");if(!Ig.has(F))continue;let W=z[3].match(/\s+(?:in|of)\s+/);if(!W||W.index===void 0)continue;k(z[3].slice(0,W.index),T(z[3].slice(W.index+W[0].length)))}for(let F of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let W of F[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(W[1]);return[..._.values()].sort((F,W)=>F.name.localeCompare(W.name))}function pe(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let R of k[1].split(",")){let T=R.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var au=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Dv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function gi(v=new Set){return[...au.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Dv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
|
|
2461
|
+
`)}function mi(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Dg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,R=!1,T=new Set,B=s(v);while((k=_.exec(B))!==null){R=!0;for(let z of Ov(k[1])){let F=z.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(F))T.add(F)}}return R?[...T]:null}function Ov(v){let _=[],k=0,R="";for(let T of v){if(T===","&&k===0){_.push(R),R="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;R+=T}return _.push(R),_.filter((T)=>T.trim().length>0)}function Mv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],R=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
|
|
2462
2462
|
`).map(()=>"").join(`
|
|
2463
2463
|
`)));return{imports:k.join(`
|
|
2464
|
-
`),body:R}}function Og(v){let _=s(v),k=Array(_.length),R=0;for(let
|
|
2465
|
-
`&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,q-40),q)))){U=ie===";"?q+1:q;break}}}T.push({name:
|
|
2464
|
+
`),body:R}}function Og(v){let _=s(v),k=Array(_.length),R=0;for(let F=0;F<_.length;F++){let W=_[F];if(W==="}"||W===")"||W==="]")R=Math.max(0,R-1);if(k[F]=R,W==="{"||W==="("||W==="[")R++}let T=[],B=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,z;while((z=B.exec(_))!==null){if(k[z.index]!==0)continue;let F=z[1],W=z[2],U;if(F==="interface"){let H=_.indexOf("{",z.index);if(H===-1)continue;let q=0;U=-1;for(let ie=H;ie<_.length;ie++)if(_[ie]==="{")q++;else if(_[ie]==="}"&&--q===0){U=ie+1;break}if(U===-1)continue}else{let H=0;U=_.length;for(let q=_.indexOf("=",z.index)+1;q<_.length;q++){let ie=_[q];if(ie==="{"||ie==="["||ie==="("||ie==="<")H++;else if(ie==="}"||ie==="]"||ie===")"||ie===">")H--;else if(H<=0&&(ie===";"||ie===`
|
|
2465
|
+
`&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,q-40),q)))){U=ie===";"?q+1:q;break}}}T.push({name:W,text:v.slice(z.index,U).replace(/^[ \t]*export[ \t]+/,"")}),B.lastIndex=U}return T}function Nv(v){return new Set(Og(v).map((_)=>_.name))}function hi(v,_=""){let k=Dg(v),R=Nv(_),T=Og(v).filter((U)=>!R.has(U.name)).map((U)=>U.text);if(!k){let U=pe(v).filter((H)=>!to(_,H));if(U.length===0&&T.length===0)return"";return["",`// ${jv}`,...T,...U.map((H)=>`declare var ${H}: any`)].join(`
|
|
2466
2466
|
`)}if(k.length===0)return T.length>0?["",`// ${Eg}`,...T].join(`
|
|
2467
|
-
`):"";let{imports:B,body:z}=Mv(v),
|
|
2467
|
+
`):"";let{imports:B,body:z}=Mv(v),F=z.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),W=["",`// ${Eg}`];if(B)W.push(B);return W.push(...T),W.push(`async function ${Cg}() {`,F,` return { ${k.join(", ")} }`,"}",`type ${Rg} = Awaited<ReturnType<typeof ${Cg}>>`,...k.map((U)=>`declare var ${U}: ${Rg}[${JSON.stringify(U)}]`)),W.join(`
|
|
2468
2468
|
`)}function cu(v){let k=s(v).split(""),R=0;for(let T=0;T<k.length;T++){let B=k[T];if(B==="{"||B==="("||B==="["){R++;continue}if(B==="}"||B===")"||B==="]"){R=Math.max(0,R-1);continue}if(R>0&&B!==`
|
|
2469
|
-
`)k[T]=" "}return pe(k.join(""))}function yi(v,_){if(Dg(v)!==null)return[];let k=cu(v),R=Rt(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(to(_,B))return!1;return R.has(B)})}var Eg="stx: types for the declared client payload (#1868)",jv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Cg="__stxServerScope",Rg="__StxClientPayload";var Ag=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Lv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Bv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=Ee(T);if(!z)continue;let
|
|
2469
|
+
`)k[T]=" "}return pe(k.join(""))}function yi(v,_){if(Dg(v)!==null)return[];let k=cu(v),R=Rt(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(to(_,B))return!1;return R.has(B)})}var Eg="stx: types for the declared client payload (#1868)",jv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Cg="__stxServerScope",Rg="__StxClientPayload";var Ag=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Lv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Bv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=Ee(T);if(!z)continue;let F=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let W of T.matchAll(F)){let U=W.index??0;if(B[U+W[1].length]!==0)continue;let H=W[2],q=U+W[0].length-W[3].length,ie=R.slice(q,U+W[0].length).trim().replace(/;$/,"").trim(),Z=W[3],Q=k.test(Z)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(Z)&&!/[,+\-*/%&|?:=]$/.test(ie)&&Ee(Z).balanced;_.set(H,_.has(H)||!Q?null:ie)}}return new Map([..._].filter((R)=>R[1]!==null))}function Mg(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),B="",z=0;for(let F of T.matchAll(/[A-Za-z_$][\w$]*/g)){let W=F.index??0,U=F[0],H=_.get(U);if(!H||R.has(U))continue;let q=T.slice(0,W).trimEnd(),ie=T.slice(W+U.length).trimStart();if(q.endsWith(".")||/^:(?!:)/.test(ie)&&/[{,]$/.test(q))continue;if(W>0&&/[\w$]/.test(T[W-1]))continue;B+=`${v.slice(z,W)}(${Mg(H,_,k+1,new Set([...R,U]))})`,z=W+U.length}return B+v.slice(z)}function zv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,R=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let B=T[1];if(T.index===_){if(B==="elseif"){let F=R[R.length-1];if(F?.current)F.seen.push(F.current);if(F)F.current=null}break}if(B==="endif"||B==="endunless"){R.pop();continue}let z="";if(T[2]==="("){let F=0,W=T.index+T[0].length-1,U=W+1;for(;W<v.length;W++){let H=v[W];if(H==="(")F++;else if(H===")"){if(F--,F===0)break}}z=v.slice(U,W).trim(),k.lastIndex=W+1}if(B==="if")R.push({seen:[],current:z});else if(B==="unless")R.push({seen:[],current:`!(${z})`});else if(B==="elseif"||B==="else"){let F=R[R.length-1];if(!F)continue;if(F.current)F.seen.push(F.current);F.current=B==="elseif"?z:null}}return R.flatMap((B)=>[...B.seen.map((z)=>`!(${z})`),...B.current?[B.current]:[]]).filter(Boolean)}function Fv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Lv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Wv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function ir(v,_){if(!_)return v;return v.replace(Wv,(k,R,T,B)=>{let z=Tg.resolve(_,B).replace(/\\/g,"/");return`${R}${T}${z}${T}`})}function Ss(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function Vv(v){let _=new Set,k=s(v);for(let R of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=R[1],B=/\{([^}]*)\}/.exec(T);for(let U of B?.[1].split(",")??[]){let H=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let z=T.replace(/\{[^}]*\}/,""),F=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(z);if(F)_.add(F[1]);let W=/^\s*([A-Z_$][\w$]*)/i.exec(z);if(W&&W[1]!=="type")_.add(W[1])}return[..._].sort()}function bi(v,_={}){let k=Je(v),R=v.split(`
|
|
2470
2470
|
`),T=Array.from({length:R.length},()=>""),B=new Map,z=_.filePath&&_.templateExpressions!==!1?wg(v,Ta(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(q,ie)=>Je(q).map((Z)=>ir(Z.code,Tg.dirname(ie))).join(`
|
|
2471
|
-
`)}):void 0,
|
|
2472
|
-
`);Z.forEach((Q,oe)=>{let ae=q.startLine-1+oe;if(ae<T.length)T[ae]=oe===0?Ss(q)+Q:Q,
|
|
2471
|
+
`)}):void 0,F=new Set,W=[];for(let q of k){let ie=xs(ws(q.code)),Z=ir(ie,_.originDir??"").split(`
|
|
2472
|
+
`);Z.forEach((Q,oe)=>{let ae=q.startLine-1+oe;if(ae<T.length)T[ae]=oe===0?Ss(q)+Q:Q,F.add(ae)}),W.push(q.startLine-1+Z.length-1)}for(let q of W){let ie=T[q]?.trim()===""?q:q+1;if(ie<T.length&&T[ie].trim()===""&&(ie===q||!F.has(ie)))T[ie]=";"}let U=(q,ie)=>{for(let[Z,Q]of q.split(`
|
|
2473
2473
|
`).entries())if(T.push(Q),ie)B.set(T.length,Z===0?ie:{...ie,line:ie.line+Z,column:1,prefixLength:0})};if(_.globals!==!1){U("");let q=new Set([...k.flatMap((oe)=>pe(oe.code)),...k.flatMap((oe)=>Vv(oe.code))]),ie=(oe)=>{if(!q.has(oe))U(`declare var ${oe}: any`)};if(_.runtimeGlobals!==!1){if(!q.has("window"))U("declare var window: any");for(let oe of y)ie(oe)}let Z=[...new Set([...au,...K,...Ag])].filter((oe)=>_.runtimeGlobals!==!1||!y.includes(oe));if(_.contextScope==="global"){U("declare global {");for(let oe of Z)U(` var ${oe}: any`);U("}")}else{for(let oe of au)ie(oe);for(let oe of K)ie(oe);for(let oe of Ag)ie(oe)}U(`declare var ${ou}: any`);let Q=new Set(k.flatMap((oe)=>pe(oe.code)));U(`type ${$g}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let oe of Pv(v)){if(Q.has(oe.name))continue;let ae=oe.iterable&&Q.has(oe.iterable)?`${$g}<typeof ${oe.iterable}>`:"any";U(`declare var ${oe.name}: ${ae}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let ie of z.declarations.split(`
|
|
2474
|
-
`))U(ie);let q=Ac(v).map((ie)=>{let Z=z?.events.get(ie.offset??-1);if(Z){ie.anchor=!0;let Q=ie.code.trim(),oe=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),ae=oe?`void ((${oe[2]}) satisfies __StxAssignedValue<typeof ${oe[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${Z}) => unknown)`:Q,ce=`;(($event: ${Z}): void => { `;return{expression:ie,statement:{text:`${ce}${ae} });`,prefixLength:ce.length}}}return{expression:ie,statement:
|
|
2475
|
-
`),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function vi(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function wi(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Ng from"fs";import jg from"path";var Lg=!1;function Uv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),W=(q)=>{if(z.size===0)return!1;let ie=s(q),Z=ie.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&z.has(Z))return!0;for(let Q of z){let oe=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${oe}\\s*\\(`).test(ie))return!0}return!1},F=new Set(Qi),U=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(ie,Z)=>Z.toUpperCase())},H=(q,ie)=>{let Z=U(q);if(B.static[Z]=ie,Z!==q)B.staticNames[Z]=q};for(let[q,ie]of Object.entries(v)){let Z=q.startsWith("x-")&&!F.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(Z.startsWith("@")){B.events[Z]=ie;continue}if(Z.startsWith("__stx_")){let Q=U(Z.slice(6));B.serverDynamic[Q]=gg(ie,k);continue}if(Z.startsWith(":")){let Q=U(Z.slice(1)),oe=ie===Or?Q:ie;if(Q==="if"||Q==="for"||Q==="show"){B.clientReactive[Q]=oe;continue}if(R){B.clientReactive[Q]=oe;continue}if(Wr(oe,T)){B.clientReactive[Q]=oe;continue}if(W(oe)){B.clientReactive[Q]=oe;continue}try{if(!p(oe)){if(k.debug)console.error(`Unsafe expression in :${Q} binding: ${oe}`);B.clientReactive[Q]=oe;continue}let ae=Object.keys(_),ce=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),ue=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Re(oe).some((he)=>!ce.has(he)&&!ae.includes(he)&&(!(he in globalThis)||ue.has(he)))){B.clientReactive[Q]=oe;continue}let ve=c(oe,ae)(...Object.values(_));if(B.serverDynamic[Q]=ve,Q!==Z.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[Q]=Z.slice(1)}catch{B.clientReactive[Q]=oe}continue}if(typeof ie==="string"&&ie.includes("{{")&&ie.includes("}}")){let Q=Hv(ie,T);if(Q!==null){B.clientReactive[U(Z)]=Q;continue}let oe=ie.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(oe)try{let ae=oe[1];if(p(ae)){let ue=c(ae,Object.keys(_))(...Object.values(_));H(Z,ue!=null?String(ue):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${ae}`);H(Z,ie)}}catch(ae){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,ae);H(Z,ie)}else{let ae=ie,ce=/\{\{\s*([\s\S]+?)\s*\}\}/g,ue;while((ue=ce.exec(ie))!==null)try{let le=ue[1];if(!p(le)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${le}`);continue}let ve=c(le,Object.keys(_))(...Object.values(_));ae=ae.replace(ue[0],String(ve??""))}catch(le){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,le)}H(Z,ae)}continue}H(Z,ie===Or?"true":tu(ie))}return B}function Hv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((W)=>Wr(W[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let W of R)B+=v.slice(z,W.index).replace(/[`\\$]/g,(F)=>`\\${F}`),B+=`\${${W[1]}}`,z=W.index+W[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(W)=>`\\${W}`),`\`${B}\``}var qv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Kv(v,_,k){if(!v.includes("@"))return v;if(!qv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return yr(v,_,k)}catch{return v}}function Wg(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let W=v[k];if(W==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(W===z){k++;break}B+=W,k++}}else if(v[k]==="{"){B=nu(v,k),k+=B.length;let z=mg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=Or}return _}function Bg(v){return Object.entries(v).map(([_,k])=>k===Or?_:`${_}="${Xv(k)}"`).join(" ")}function Xv(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Zv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(ti.isBuiltin(T))_.add(T)}return[..._].sort()}async function Pc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=jg.dirname(k),W=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(F)){let[ie,Z,Q]=q,oe=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ae=Q,ce,ue=[];while((ce=oe.exec(Q))!==null){let[le,Ae,ve,he]=ce,Te=null,De=null;if(he.startsWith(".")||he.startsWith("/")){let Ne=jg.resolve(z,he);if(Ne.endsWith(".stx"))De=Ne;else{let Ie=`${Ne}.stx`;try{if(Ng.statSync(Ie).isFile())De=Ie}catch{try{if(Ng.statSync(Ne).isDirectory())Te=Ne}catch{}}}}else Te=Vo(he,z);if(!Te&&!De)continue;let Oe=!1,Me=(Ne,Ie)=>{B.set(Ne,Ie),B.set(Ne.toLowerCase(),Ie);let Le=Ne.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(Le,Ie),T.add(Ie)};if(ve&&De)Me(ve,De),Oe=!0;else if(Ae){let Ne=Ae.slice(1,-1).split(",").map((Le)=>Le.trim()).filter(Boolean).map((Le)=>{let Fe=Le.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Fe)return{source:Fe[1],local:Fe[2]};return{source:Le,local:Le}}),Ie=Te?Fo(Te):null;for(let{source:Le,local:Fe}of Ne){let ze=null;if(De)ze=De;else if(Ie)ze=Ie.get(Le)??Ie.get(Le.toLowerCase())??Ie.get(Le.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(ze)Me(Fe,ze),Oe=!0}}if(Oe)ue.push({start:ce.index,end:ce.index+le.length})}if(ue.length===0)continue;for(let le=ue.length-1;le>=0;le--)ae=ae.slice(0,ue[le].start)+ae.slice(ue[le].end);W.push({start:q.index,end:q.index+ie.length,value:`<script${Z}>${ae}</script>`})}if(W.length===0)return v;let U=[],H=0;for(let q of W)U.push(v.slice(H,q.start),q.value),H=q.end;return U.push(v.slice(H)),U.join("")}async function Gv(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=W.exec(B))!==null){let[U,H]=F,q=H.split(",").map((ie)=>ie.trim().replace(/^['"]|['"]$/g,"")).filter((ie)=>ie.length>0);for(let ie of q){let Z=ie.split("/"),oe=Z[Z.length-1].replace(/\.stx$/,""),ae=oe.includes("-")?oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""):oe.charAt(0).toUpperCase()+oe.slice(1),ce=null,ue=Uo(ie,k,R);for(let le of ue)try{if(await Bun.file(le).exists()){ce=le;break}}catch{}if(ce){z.set(ae,ce),z.set(oe,ce),z.set(oe.toLowerCase(),ce);let le=ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(le,ce),T.add(ce),R.debug)console.log(`Imported component: ${ae} -> ${ce}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${ie}`)}B=B.replace(U,""),W.lastIndex=0}return B}async function Jv(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=/@component\s*\(/g,U;while((U=F.exec(B))!==null){let H=U.index,q=H+U[0].length-1,ie=1,Z=q+1;while(Z<B.length&&ie>0){if(B[Z]==="(")ie++;else if(B[Z]===")"){if(ie--,ie===0)break}Z++}if(ie!==0)break;let Q=B.substring(q+1,Z),oe=Z+1,ae=Q.match(/^\s*['"]([^'"]+)['"]/);if(!ae){F.lastIndex=0;continue}let ce=ae[1],ue,le=Q.slice(ae[0].length),Ae=le.match(/^\s*,\s*/);if(Ae)ue=le.slice(Ae[0].length).trim();let ve={};if(ue)try{ve=D(ue,_)}catch(Ne){let Ie=Ne instanceof Error?Ne.message:String(Ne);B=B.replace(B.substring(H,oe),`[Error parsing component props: ${Ie}]`);continue}let he="",Te=oe,Oe=B.substring(oe).match(/^([\s\S]*?)@endcomponent/);if(Oe)he=Oe[1].trim(),Te=oe+Oe[0].length;let Me=await et(ce,ve,he,z,_,k,R,W,T);B=B.substring(0,H)+Me+B.substring(Te),F.lastIndex=0}return B}async function Yv(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=ew(B);if(F.size>0){let oe=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...oe,...F])]}let U=pn(B);B=U.output;let H=Er(_);return B=await Q(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await Q(B,/[A-Z][a-zA-Z0-9]*/,!0,fg(ko)),B=await Q(B,/[a-z][a-z0-9]*/,!1,ko),B=U.restore(B),B;async function Q(oe,ae,ce,ue){if(!oe)return oe;let le=oe,Ae=pg(le,ae,ue),ve=ru(le),he=new Map;for(let Oe=Ae.length-1;Oe>=0;Oe--){let Me=Ae[Oe],Ne=ce?un(Me.tagName):Me.tagName,Ie=Wg(Kv(Me.attributes,_,k)),Le=ve.filter(({start:ht,end:kt})=>Me.startIndex>=ht&&Me.startIndex<kt),Fe=Le.length>0,ze=new Set(H);for(let ht of Le)for(let kt of ht.names)ze.add(kt);let je=Uv(Ie,_,R,Fe,ze);if(typeof je.clientReactive.for==="string")for(let ht of cs(je.clientReactive.for))ze.add(ht);let He=ti.getBuiltin(Me.tagName),mt=He?await lr(Me.tagName,z,_,k,R):!1;if(He&&!mt){let ht={context:_,filePath:k,options:R,dependencies:T},kt=He.render(je,Me.content,ht);if(Object.keys(je.events).length>0){let ft=Bg(je.events);kt=kt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ft}`)}if(Object.keys(je.clientReactive).length>0)kt=zg(kt,je.clientReactive);he.set(Oe,kt);continue}if(!ce&&Me.tagName.includes("-")&&!await lr(Ne,z,_,k,R))continue;let St={};for(let[ht,kt]of Object.entries(je.static))St[ht]=kt;for(let[ht,kt]of Object.entries(je.serverDynamic))St[ht]=kt;let xt={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(je.clientReactive)},gt=await et(Ne,St,U.restore(Me.content),z,_,k,R,W,T,[...ze],xt,Me.tagName);if(gt=Qv(gt,je,xt.declaredProps,xt.consumedProps,R._nativeHostAttrs),R._nativeHostAttrs){let ht=xt.reactiveProps.filter((ft)=>!xt.consumedProps.has(ft)&&!["if","for","show","key","ref"].includes(ft)).map(un),kt=Fg(gt);if(ht.length&&kt){gt=gt.slice(0,kt.insertPos)+' data-stx-native-host-root="true"'+gt.slice(kt.insertPos);let ft=Pa(gt);gt=gt.slice(0,ft.insertPos)+` data-stx-native-forward="${ht.join(" ")}"`+gt.slice(ft.insertPos)}}if(Object.keys(je.events).length>0){let ht=Pa(gt);if(ht){let kt=Bg(je.events),ft=Object.keys(je.events).map((Tt)=>Tt.replace(/^@/,"").split(".")[0]).join(" ");gt=gt.substring(0,ht.insertPos)+` data-stx-parent-events="${ft}" ${kt}`+gt.substring(ht.insertPos)}}if(Object.keys(je.clientReactive).length>0)gt=zg(gt,je.clientReactive);he.set(Oe,gt)}if(he.size===0)return le;let Te="",De=0;for(let Oe=0;Oe<Ae.length;Oe++){let Me=he.get(Oe);if(Me===void 0)continue;Te+=le.slice(De,Ae[Oe].startIndex),Te+=Me,De=Ae[Oe].endIndex}return Te+=le.slice(De),Te}}function zg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>un(H)).join(" "),z=v,W=T.length>0?Pa(z):null;if(W){let H=T.map(([ie,Z])=>`:${un(ie)}="${Z.replace(/"/g,""")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,W.insertPos)+`${q} ${H}`+z.substring(W.insertPos)}let F=_.if;if(F)z=`<template :if="${F.replace(/"/g,""")}">${z}</template>`;let U=_.for;if(U)z=`<template :for="${U.replace(/"/g,""")}">${z}</template>`;return z}function Qv(v,_,k=new Set,R=new Set,T=!1){let B=Fg(v);if(!B)return v;let z=v.slice(B.insertPos,B.tagEnd),W=_.serverDynamic.class??_.static.class;if(T&&typeof W==="string"&&W&&!R.has("class")){let Q=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,oe=Q.test(z)?z.replace(Q,(ae,ce,ue,le,Ae)=>`${ce}class="${Ut(`${tu(ue??le??Ae)} ${W}`)}"`):` class="${Ut(W)}"${z}`;v=v.slice(0,B.insertPos)+oe+v.slice(B.tagEnd),B.tagEnd+=oe.length-z.length,z=oe}let F=T||/\bdata-native(?:\s|=)/i.test(z),U=F?R:k,H=new Set(Object.keys(Wg(z))),q=new Set(["class","className"]);for(let Q of Object.keys(_.static)){let oe=_.staticNames[Q]??Q;if(H.has(oe)||U.has(Q)||!F&&!Pl(oe))q.add(Q)}for(let Q of Object.keys(_.serverDynamic)){let oe=_.serverDynamicNames?.[Q]??Q;if(H.has(oe)||U.has(Q)||!F&&!Pl(oe))q.add(Q)}let ie=[];if(F){for(let[Q,oe]of Object.entries(_.static)){if(q.has(Q)||oe!==!0&&oe!==Or)continue;q.add(Q),ie.push(`${Ut(_.staticNames?.[Q]??Q)}="true"`)}for(let[Q,oe]of Object.entries(_.serverDynamic)){if(q.has(Q)||oe!==!0)continue;q.add(Q),ie.push(`${Ut(_.serverDynamicNames?.[Q]??Q)}="true"`)}}let Z=[...Mr(_,q),...Nr(_,q),...ie];if(F){for(let[Q,oe]of Object.entries(_.serverDynamic)){if(q.has(Q)||oe!==!1)continue;let ae=_.serverDynamicNames?.[Q]??Q;Z.push(`${Ut(ae)}="false"`)}for(let[Q,oe]of Object.entries(_.serverDynamic)){if(q.has(Q)||oe===null||typeof oe!=="object")continue;let ae=JSON.stringify(oe);if(ae!==void 0){let ce=_.serverDynamicNames?.[Q]??Q;Z.push(`${Ut(ce)}="${Ut(ae)}"`)}}}if(Z.length===0)return v;return`${v.slice(0,B.insertPos)} ${Z.join(" ")}${v.slice(B.insertPos)}`}function Pa(v){let _=Vg(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:Ug(v,k.index+1+k[1].length)};return null}function Fg(v){let _=Pa(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Vg(v,_.tagEnd+1)}function Vg(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let W=v.indexOf("-->",k+4);if(W===-1)return null;k=W+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let W=`</${B[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(W,k+B[0].length);if(F===-1)return null;k=F+W.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:Ug(v,k+1+z[1].length)}}return null}function Ug(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function ew(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of cu(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function ks(v,_,k,R,T){if(!Lg)lg(ti),Lg=!0;let B=await Pc(v,_,k,R,T);B=await Gv(B,_,k,R,T),B=await Jv(B,_,k,R,T);let z=[];for(let W=0;W<3;W++){let F=z.length,U=Fn(B,We,(q,ie)=>`\x00STX_COMPONENT_COMMENT_${F+ie}\x00`,`STX_COMPONENT_COMMENT:${F}`);z.push(...U.tokens);let H=B;if(B=await Yv(U.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,F)=>z[Number(F)]??"");if(R.debug){let W=Zv(B);if(W.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${W.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function lu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function nw(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,W=z+B[0].length-1,F=1,U=W+1;while(U<R.length&&F>0){if(R[U]==="(")F++;else if(R[U]===")")F--;U++}if(F!==0)break;let H=R.substring(W+1,U-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(U),T.lastIndex=z+q.length,B=T.exec(R)}return R}function rw(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Xg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,W=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},F=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')W(_[B]);else if(_[B]==="`")F();else B++;continue}B++}},U=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
|
|
2476
|
-
`)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},H=()=>{if(T!==0)return;let q=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Q=q[2];if(!R.has(Q))k.push(Q),R.add(Q);return}let ie=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Q=ie[1];if(!R.has(Q))k.push(Q),R.add(Q);return}let Z=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!R.has(Q))k.push(Q),R.add(Q)}};while(B<z){if(U())continue;if(_[B]==="'"||_[B]==='"'){
|
|
2474
|
+
`))U(ie);let q=Ac(v).map((ie)=>{let Z=z?.events.get(ie.offset??-1);if(Z){ie.anchor=!0;let Q=ie.code.trim(),oe=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),ae=oe?`void ((${oe[2]}) satisfies __StxAssignedValue<typeof ${oe[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${Z}) => unknown)`:Q,ce=`;(($event: ${Z}): void => { `;return{expression:ie,statement:{text:`${ce}${ae} });`,prefixLength:ce.length}}}return{expression:ie,statement:Fv(ie)}}).filter((ie)=>ie.statement!==null);if(q.push(...z?.checks||[]),q.length>0){let ie=Ta(v),Z=Bv(k.map((ce)=>ce.code)),oe=[...new Set(k.flatMap((ce)=>pe(ce.code)))].filter((ce)=>/^[A-Z_$][\w$]*$/i.test(ce)),ae=0;if(oe.length>0){U(Cv);for(let ce of oe)U(`type __StxT_${ce} = ${Pg}<typeof ${ce}>`);U(`;((${oe.map((ce)=>`${ce}: __StxT_${ce}`).join(", ")}) => {`),ae=1}for(let{expression:ce,statement:ue}of q){let le=" ".repeat(ae),Ae=ce.offset===void 0?[]:zv(ie,ce.offset),ve=Ae.length>0?`${Ae.map((Te)=>`if (${Mg(Te,Z)}) `).join("")}{ `:"",he=Ae.length>0?" }":"";U(le+ve+ue.text+he,{line:ce.line,column:ce.column,expression:ce,prefixLength:ue.prefixLength+le.length+ve.length,guardPrefixLength:le.length+ve.length})}if(ae>0)U("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return U("export {}"),{text:T.join(`
|
|
2475
|
+
`),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function vi(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function wi(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Ng from"fs";import jg from"path";var Lg=!1;function Uv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),F=(q)=>{if(z.size===0)return!1;let ie=s(q),Z=ie.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&z.has(Z))return!0;for(let Q of z){let oe=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${oe}\\s*\\(`).test(ie))return!0}return!1},W=new Set(Qi),U=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(ie,Z)=>Z.toUpperCase())},H=(q,ie)=>{let Z=U(q);if(B.static[Z]=ie,Z!==q)B.staticNames[Z]=q};for(let[q,ie]of Object.entries(v)){let Z=q.startsWith("x-")&&!W.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(Z.startsWith("@")){B.events[Z]=ie;continue}if(Z.startsWith("__stx_")){let Q=U(Z.slice(6));B.serverDynamic[Q]=gg(ie,k);continue}if(Z.startsWith(":")){let Q=U(Z.slice(1)),oe=ie===Or?Q:ie;if(Q==="if"||Q==="for"||Q==="show"){B.clientReactive[Q]=oe;continue}if(R){B.clientReactive[Q]=oe;continue}if(Fr(oe,T)){B.clientReactive[Q]=oe;continue}if(F(oe)){B.clientReactive[Q]=oe;continue}try{if(!p(oe)){if(k.debug)console.error(`Unsafe expression in :${Q} binding: ${oe}`);B.clientReactive[Q]=oe;continue}let ae=Object.keys(_),ce=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),ue=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Re(oe).some((he)=>!ce.has(he)&&!ae.includes(he)&&(!(he in globalThis)||ue.has(he)))){B.clientReactive[Q]=oe;continue}let ve=c(oe,ae)(...Object.values(_));if(B.serverDynamic[Q]=ve,Q!==Z.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[Q]=Z.slice(1)}catch{B.clientReactive[Q]=oe}continue}if(typeof ie==="string"&&ie.includes("{{")&&ie.includes("}}")){let Q=Hv(ie,T);if(Q!==null){B.clientReactive[U(Z)]=Q;continue}let oe=ie.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(oe)try{let ae=oe[1];if(p(ae)){let ue=c(ae,Object.keys(_))(...Object.values(_));H(Z,ue!=null?String(ue):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${ae}`);H(Z,ie)}}catch(ae){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,ae);H(Z,ie)}else{let ae=ie,ce=/\{\{\s*([\s\S]+?)\s*\}\}/g,ue;while((ue=ce.exec(ie))!==null)try{let le=ue[1];if(!p(le)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${le}`);continue}let ve=c(le,Object.keys(_))(...Object.values(_));ae=ae.replace(ue[0],String(ve??""))}catch(le){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,le)}H(Z,ae)}continue}H(Z,ie===Or?"true":tu(ie))}return B}function Hv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((F)=>Fr(F[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let F of R)B+=v.slice(z,F.index).replace(/[`\\$]/g,(W)=>`\\${W}`),B+=`\${${F[1]}}`,z=F.index+F[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(F)=>`\\${F}`),`\`${B}\``}var qv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Kv(v,_,k){if(!v.includes("@"))return v;if(!qv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return yr(v,_,k)}catch{return v}}function Fg(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let F=v[k];if(F==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(F===z){k++;break}B+=F,k++}}else if(v[k]==="{"){B=nu(v,k),k+=B.length;let z=mg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=Or}return _}function Bg(v){return Object.entries(v).map(([_,k])=>k===Or?_:`${_}="${Xv(k)}"`).join(" ")}function Xv(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Zv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(ti.isBuiltin(T))_.add(T)}return[..._].sort()}async function Pc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=jg.dirname(k),F=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(W)){let[ie,Z,Q]=q,oe=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ae=Q,ce,ue=[];while((ce=oe.exec(Q))!==null){let[le,Ae,ve,he]=ce,Te=null,De=null;if(he.startsWith(".")||he.startsWith("/")){let Ne=jg.resolve(z,he);if(Ne.endsWith(".stx"))De=Ne;else{let Ie=`${Ne}.stx`;try{if(Ng.statSync(Ie).isFile())De=Ie}catch{try{if(Ng.statSync(Ne).isDirectory())Te=Ne}catch{}}}}else Te=Vo(he,z);if(!Te&&!De)continue;let Oe=!1,Me=(Ne,Ie)=>{B.set(Ne,Ie),B.set(Ne.toLowerCase(),Ie);let Be=Ne.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(Be,Ie),T.add(Ie)};if(ve&&De)Me(ve,De),Oe=!0;else if(Ae){let Ne=Ae.slice(1,-1).split(",").map((Be)=>Be.trim()).filter(Boolean).map((Be)=>{let Fe=Be.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Fe)return{source:Fe[1],local:Fe[2]};return{source:Be,local:Be}}),Ie=Te?Wo(Te):null;for(let{source:Be,local:Fe}of Ne){let Le=null;if(De)Le=De;else if(Ie)Le=Ie.get(Be)??Ie.get(Be.toLowerCase())??Ie.get(Be.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Le)Me(Fe,Le),Oe=!0}}if(Oe)ue.push({start:ce.index,end:ce.index+le.length})}if(ue.length===0)continue;for(let le=ue.length-1;le>=0;le--)ae=ae.slice(0,ue[le].start)+ae.slice(ue[le].end);F.push({start:q.index,end:q.index+ie.length,value:`<script${Z}>${ae}</script>`})}if(F.length===0)return v;let U=[],H=0;for(let q of F)U.push(v.slice(H,q.start),q.value),H=q.end;return U.push(v.slice(H)),U.join("")}async function Gv(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,F=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=F.exec(B))!==null){let[U,H]=W,q=H.split(",").map((ie)=>ie.trim().replace(/^['"]|['"]$/g,"")).filter((ie)=>ie.length>0);for(let ie of q){let Z=ie.split("/"),oe=Z[Z.length-1].replace(/\.stx$/,""),ae=oe.includes("-")?oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""):oe.charAt(0).toUpperCase()+oe.slice(1),ce=null,ue=Uo(ie,k,R);for(let le of ue)try{if(await Bun.file(le).exists()){ce=le;break}}catch{}if(ce){z.set(ae,ce),z.set(oe,ce),z.set(oe.toLowerCase(),ce);let le=ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(le,ce),T.add(ce),R.debug)console.log(`Imported component: ${ae} -> ${ce}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${ie}`)}B=B.replace(U,""),F.lastIndex=0}return B}async function Jv(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let F=_.__processedComponents,W=/@component\s*\(/g,U;while((U=W.exec(B))!==null){let H=U.index,q=H+U[0].length-1,ie=1,Z=q+1;while(Z<B.length&&ie>0){if(B[Z]==="(")ie++;else if(B[Z]===")"){if(ie--,ie===0)break}Z++}if(ie!==0)break;let Q=B.substring(q+1,Z),oe=Z+1,ae=Q.match(/^\s*['"]([^'"]+)['"]/);if(!ae){W.lastIndex=0;continue}let ce=ae[1],ue,le=Q.slice(ae[0].length),Ae=le.match(/^\s*,\s*/);if(Ae)ue=le.slice(Ae[0].length).trim();let ve={};if(ue)try{ve=D(ue,_)}catch(Ne){let Ie=Ne instanceof Error?Ne.message:String(Ne);B=B.replace(B.substring(H,oe),`[Error parsing component props: ${Ie}]`);continue}let he="",Te=oe,Oe=B.substring(oe).match(/^([\s\S]*?)@endcomponent/);if(Oe)he=Oe[1].trim(),Te=oe+Oe[0].length;let Me=await et(ce,ve,he,z,_,k,R,F,T);B=B.substring(0,H)+Me+B.substring(Te),W.lastIndex=0}return B}async function Yv(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let F=_.__processedComponents,W=ew(B);if(W.size>0){let oe=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...oe,...W])]}let U=pn(B);B=U.output;let H=Er(_);return B=await Q(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await Q(B,/[A-Z][a-zA-Z0-9]*/,!0,fg(ko)),B=await Q(B,/[a-z][a-z0-9]*/,!1,ko),B=U.restore(B),B;async function Q(oe,ae,ce,ue){if(!oe)return oe;let le=oe,Ae=pg(le,ae,ue),ve=ru(le),he=new Map;for(let Oe=Ae.length-1;Oe>=0;Oe--){let Me=Ae[Oe],Ne=ce?un(Me.tagName):Me.tagName,Ie=Fg(Kv(Me.attributes,_,k)),Be=ve.filter(({start:St,end:xt})=>Me.startIndex>=St&&Me.startIndex<xt),Fe=Be.length>0,Le=new Set(H);for(let St of Be)for(let xt of St.names)Le.add(xt);let je=Uv(Ie,_,R,Fe,Le);if(typeof je.clientReactive.for==="string")for(let St of cs(je.clientReactive.for))Le.add(St);let rt=ti.getBuiltin(Me.tagName),gt=rt?await lr(Me.tagName,z,_,k,R):!1;if(rt&&!gt){let St={context:_,filePath:k,options:R,dependencies:T},xt=rt.render(je,Me.content,St);if(Object.keys(je.events).length>0){let at=Bg(je.events);xt=xt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${at}`)}if(Object.keys(je.clientReactive).length>0)xt=zg(xt,je.clientReactive);he.set(Oe,xt);continue}if(!ce&&Me.tagName.includes("-")&&!await lr(Ne,z,_,k,R))continue;let mt={};for(let[St,xt]of Object.entries(je.static))mt[St]=xt;for(let[St,xt]of Object.entries(je.serverDynamic))mt[St]=xt;let yt={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(je.clientReactive)},$t=await et(Ne,mt,U.restore(Me.content),z,_,k,R,F,T,[...Le],yt,Me.tagName);if($t=Qv($t,je,yt.declaredProps,yt.consumedProps,R._nativeHostAttrs),R._nativeHostAttrs){let St=yt.reactiveProps.filter((at)=>!yt.consumedProps.has(at)&&!["if","for","show","key","ref"].includes(at)).map(un),xt=Wg($t);if(St.length&&xt){$t=$t.slice(0,xt.insertPos)+' data-stx-native-host-root="true"'+$t.slice(xt.insertPos);let at=Pa($t);$t=$t.slice(0,at.insertPos)+` data-stx-native-forward="${St.join(" ")}"`+$t.slice(at.insertPos)}}if(Object.keys(je.events).length>0){let St=Pa($t);if(St){let xt=Bg(je.events),at=Object.keys(je.events).map((kt)=>kt.replace(/^@/,"").split(".")[0]).join(" ");$t=$t.substring(0,St.insertPos)+` data-stx-parent-events="${at}" ${xt}`+$t.substring(St.insertPos)}}if(Object.keys(je.clientReactive).length>0)$t=zg($t,je.clientReactive);he.set(Oe,$t)}if(he.size===0)return le;let Te="",De=0;for(let Oe=0;Oe<Ae.length;Oe++){let Me=he.get(Oe);if(Me===void 0)continue;Te+=le.slice(De,Ae[Oe].startIndex),Te+=Me,De=Ae[Oe].endIndex}return Te+=le.slice(De),Te}}function zg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>un(H)).join(" "),z=v,F=T.length>0?Pa(z):null;if(F){let H=T.map(([ie,Z])=>`:${un(ie)}="${Z.replace(/"/g,""")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,F.insertPos)+`${q} ${H}`+z.substring(F.insertPos)}let W=_.if;if(W)z=`<template :if="${W.replace(/"/g,""")}">${z}</template>`;let U=_.for;if(U)z=`<template :for="${U.replace(/"/g,""")}">${z}</template>`;return z}function Qv(v,_,k=new Set,R=new Set,T=!1){let B=Wg(v);if(!B)return v;let z=v.slice(B.insertPos,B.tagEnd),F=_.serverDynamic.class??_.static.class;if(T&&typeof F==="string"&&F&&!R.has("class")){let Q=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,oe=Q.test(z)?z.replace(Q,(ae,ce,ue,le,Ae)=>`${ce}class="${Ut(`${tu(ue??le??Ae)} ${F}`)}"`):` class="${Ut(F)}"${z}`;v=v.slice(0,B.insertPos)+oe+v.slice(B.tagEnd),B.tagEnd+=oe.length-z.length,z=oe}let W=T||/\bdata-native(?:\s|=)/i.test(z),U=W?R:k,H=new Set(Object.keys(Fg(z))),q=new Set(["class","className"]);for(let Q of Object.keys(_.static)){let oe=_.staticNames[Q]??Q;if(H.has(oe)||U.has(Q)||!W&&!Pl(oe))q.add(Q)}for(let Q of Object.keys(_.serverDynamic)){let oe=_.serverDynamicNames?.[Q]??Q;if(H.has(oe)||U.has(Q)||!W&&!Pl(oe))q.add(Q)}let ie=[];if(W){for(let[Q,oe]of Object.entries(_.static)){if(q.has(Q)||oe!==!0&&oe!==Or)continue;q.add(Q),ie.push(`${Ut(_.staticNames?.[Q]??Q)}="true"`)}for(let[Q,oe]of Object.entries(_.serverDynamic)){if(q.has(Q)||oe!==!0)continue;q.add(Q),ie.push(`${Ut(_.serverDynamicNames?.[Q]??Q)}="true"`)}}let Z=[...Mr(_,q),...Nr(_,q),...ie];if(W){for(let[Q,oe]of Object.entries(_.serverDynamic)){if(q.has(Q)||oe!==!1)continue;let ae=_.serverDynamicNames?.[Q]??Q;Z.push(`${Ut(ae)}="false"`)}for(let[Q,oe]of Object.entries(_.serverDynamic)){if(q.has(Q)||oe===null||typeof oe!=="object")continue;let ae=JSON.stringify(oe);if(ae!==void 0){let ce=_.serverDynamicNames?.[Q]??Q;Z.push(`${Ut(ce)}="${Ut(ae)}"`)}}}if(Z.length===0)return v;return`${v.slice(0,B.insertPos)} ${Z.join(" ")}${v.slice(B.insertPos)}`}function Pa(v){let _=Vg(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:Ug(v,k.index+1+k[1].length)};return null}function Wg(v){let _=Pa(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Vg(v,_.tagEnd+1)}function Vg(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let F=v.indexOf("-->",k+4);if(F===-1)return null;k=F+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let F=`</${B[1].toLowerCase()}>`,W=v.toLowerCase().indexOf(F,k+B[0].length);if(W===-1)return null;k=W+F.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:Ug(v,k+1+z[1].length)}}return null}function Ug(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function ew(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of cu(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function ks(v,_,k,R,T){if(!Lg)lg(ti),Lg=!0;let B=await Pc(v,_,k,R,T);B=await Gv(B,_,k,R,T),B=await Jv(B,_,k,R,T);let z=[];for(let F=0;F<3;F++){let W=z.length,U=Wn(B,We,(q,ie)=>`\x00STX_COMPONENT_COMMENT_${W+ie}\x00`,`STX_COMPONENT_COMMENT:${W}`);z.push(...U.tokens);let H=B;if(B=await Yv(U.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(F,W)=>z[Number(W)]??"");if(R.debug){let F=Zv(B);if(F.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${F.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function lu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function nw(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,F=z+B[0].length-1,W=1,U=F+1;while(U<R.length&&W>0){if(R[U]==="(")W++;else if(R[U]===")")W--;U++}if(W!==0)break;let H=R.substring(F+1,U-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(U),T.lastIndex=z+q.length,B=T.exec(R)}return R}function rw(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Xg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,F=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},W=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')F(_[B]);else if(_[B]==="`")W();else B++;continue}B++}},U=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
|
|
2476
|
+
`)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},H=()=>{if(T!==0)return;let q=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Q=q[2];if(!R.has(Q))k.push(Q),R.add(Q);return}let ie=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Q=ie[1];if(!R.has(Q))k.push(Q),R.add(Q);return}let Z=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!R.has(Q))k.push(Q),R.add(Q)}};while(B<z){if(U())continue;if(_[B]==="'"||_[B]==='"'){F(_[B]);continue}if(_[B]==="`"){W();continue}if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))H();B++}return k.join(", ")}function sw(v,_=""){let k=Xg(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
|
|
2477
2477
|
(function() {
|
|
2478
2478
|
${Ht("var",k)}
|
|
2479
2479
|
var __destroyHooks = [];
|
|
@@ -2511,26 +2511,26 @@ ${T}
|
|
|
2511
2511
|
} finally {
|
|
2512
2512
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2513
2513
|
}
|
|
2514
|
-
})();`}function cw(v,_){if(qn(v)){let T=qn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],
|
|
2515
|
-
${bt}`}if(
|
|
2516
|
-
`;continue}if(Xt)try{let{extractVariables:
|
|
2517
|
-
`}}if(Ne.length>0){let{interpolateScriptExpressions:
|
|
2518
|
-
`+Me;if(
|
|
2519
|
-
`+
|
|
2520
|
-
`)})}import*as fu from"path";async function Zg(v,_,k=""){if(fu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Jg(v,_,k,"@js","@endjs")}async function Gg(v,_,k=""){if(fu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return Jg(v,_,k,"@ts","@endts")}async function Jg(v,_,k,R,T){let B=v,z=
|
|
2514
|
+
})();`}function cw(v,_){if(qn(v)){let T=qn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],F=k[2],W=k[3];return{html:`${z}${F} data-stx-scope="${_}"${W}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var lw=0;function qg(v,_){let k=Kt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++lw}`}var uu=new Set,du=new Set;function fd(){uu.clear(),du.clear()}var uw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Vc(v){let _=(F)=>F.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let F=z[1]==="/",W=z[2],U=z[3]==="/"||uw.has(W.toLowerCase());if(F){T=Math.max(0,T-1);continue}if(T===0)R.push(W);if(!U)T++}return R}function Kg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var _e=new M(500),$i=new Set;function gd(){$i.clear()}function dw(v){if(v.__onceStore instanceof Set)return v.__onceStore;return $i}async function As(v,_,k,R,T,B=new Set){let z=R.partialsDir||Kt.join(Kt.dirname(k),"partials");if(z&&!Kt.isAbsolute(z))z=Kt.resolve(process.cwd(),z);let F=nw(v,"@partial","@include"),W=dw(_);F=F.replace(/@once([\s\S]*?)@endonce/g,(oe,ae,ce)=>{let ue=ae.trim(),le=`${k}:${ue}`;if(W.has(le))return"";return W.add(le),ae});{let oe=/@includeIf\s*\(/g,ae;while((ae=oe.exec(F))!==null){let ce=ae.index,ue=ce+ae[0].length-1,le=1,Ae=ue+1;while(Ae<F.length&&le>0){if(F[Ae]==="(")le++;else if(F[Ae]===")")le--;Ae++}if(le!==0)break;let ve=F.substring(ue+1,Ae-1),he=ve.match(/^\s*['"]([^'"]+)['"]/);if(!he){oe.lastIndex=Ae;continue}let Te=he[1],De=U(Te,z,k),Oe="";if(De&&await Bun.file(De).exists())T.add(De),Oe=`@include(${ve})`;F=F.substring(0,ce)+Oe+F.substring(Ae),oe.lastIndex=0}}for(let[oe,ae]of[["@includeWhen",!1],["@includeUnless",!0]]){let ce=new RegExp(`${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ue;while((ue=ce.exec(F))!==null){let le=ue.index,Ae=le+ue[0].length-1,ve=1,he=Ae+1;while(he<F.length&&ve>0){if(F[he]==="(")ve++;else if(F[he]===")")ve--;he++}if(ve!==0)break;let Te=F.substring(Ae+1,he-1),De=lu(Te,0);if(De===-1){ce.lastIndex=he;continue}let Oe=Te.substring(0,De).trim(),Me=Te.substring(De+1).trim(),Ne=Me.match(/^\s*['"]([^'"]+)['"]/);if(!Ne){ce.lastIndex=he;continue}let Ie=Ne[1],Be=Me.substring(Ne[0].length),Fe,Le=lu(Be,0);if(Le!==-1)Fe=Be.substring(Le+1).trim();try{let je=`Boolean(${Oe})`,rt;if(p(je)){let yt=c(je,Object.keys(_));rt=Boolean(yt(...Object.values(_)))}else rt=Boolean(l(je,_));let gt=ae?!rt:rt,mt="";if(gt){let yt=U(Ie,z,k);if(yt&&await Bun.file(yt).exists())T.add(yt);mt=`@include('${Ie}'${Fe?`, ${Fe}`:""})`}F=F.substring(0,le)+mt+F.substring(he),ce.lastIndex=0}catch(je){let rt=je instanceof Error?je.message:String(je),gt=g("Include",`Error evaluating ${oe} condition: ${rt}`,k,v,le);F=F.substring(0,le)+gt+F.substring(he),ce.lastIndex=0}}}{let oe=/@each\s*\(/g,ae;while((ae=oe.exec(F))!==null){let ce=ae.index,ue=ce+ae[0].length-1,le=1,Ae=ue+1;while(Ae<F.length&&le>0){if(F[Ae]==="(")le++;else if(F[Ae]===")"){if(le--,le===0)break}Ae++}if(le!==0)break;let ve=F.substring(ue+1,Ae),he=F.substring(ce,Ae+1),Te=ve.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Te){oe.lastIndex=0,F=F.replace(he,"");continue}let[,De,Oe,Me,Ne]=Te;try{let Ie,Be=Oe.trim();if(p(Be))Ie=c(Be,Object.keys(_))(...Object.values(_));else Ie=l(Be,_);let Fe="";if(Array.isArray(Ie)&&Ie.length>0)for(let Le of Ie){let je={..._,[Me]:Le},rt=await ie(De,je,v,ce);Fe+=rt}else if(Ne)Fe=await ie(Ne,{},v,ce);F=F.substring(0,ce)+Fe+F.substring(Ae+1),oe.lastIndex=0}catch(Ie){let Be=Ie instanceof Error?Ie.message:String(Ie);F=F.substring(0,ce)+g("Each",`Error in @each: ${Be}`,k,v,ce)+F.substring(Ae+1),oe.lastIndex=0}}}{let oe=/@includeFirst\s*\(/g,ae;while((ae=oe.exec(F))!==null){let ce=ae.index,ue=ce+ae[0].length-1,le=1,Ae=ue+1;while(Ae<F.length&&le>0){if(F[Ae]==="(")le++;else if(F[Ae]===")"){if(le--,le===0)break}Ae++}if(le!==0)break;let ve=F.substring(ue+1,Ae),he=F.substring(ce,Ae+1),Te=ve.match(/^\s*(\[[^\]]+\])/);if(!Te){oe.lastIndex=0,F=F.replace(he,"");continue}let De=Te[1],Oe=ve.slice(Te[0].length),Me,Ne=Oe.match(/^\s*,\s*\{/);if(Ne){Oe=Oe.slice(Ne[0].length-1);let Fe=1,Le=1;while(Le<Oe.length&&Fe>0){if(Oe[Le]==="{")Fe++;else if(Oe[Le]==="}"){if(Fe--,Fe===0)break}Le++}Me=Oe.substring(0,Le+1),Oe=Oe.slice(Le+1)}let Ie,Be=Oe.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Be)Ie=Be[1];try{let Fe=JSON.parse(De.replace(/'/g,'"')),Le={};if(Me)try{Le=D(Me,_)}catch(rt){let gt=rt instanceof Error?rt.message:String(rt);if(R.debug){let mt=g("Include",`Error parsing includeFirst variables: ${gt}`,k,v,ce,he);F=F.replace(he,()=>mt)}else F=F.replace(he,()=>Ie||"");continue}let je=!1;for(let rt of Fe){let gt=U(rt,z,k);if(!gt)continue;if(await r(gt)){let mt=await ie(rt,Le,v,ce);F=F.replace(he,()=>mt),je=!0;break}}if(!je)if(Ie!==void 0)F=F.replace(he,()=>Ie);else if(R.debug){let rt=g("Include",`None of the includeFirst paths exist: ${De}`,k,v,ce,he);F=F.replace(he,()=>rt)}else F=F.replace(he,"")}catch(Fe){let Le=Fe instanceof Error?Fe.message:String(Fe),je=g("Include",`Error processing @includeFirst: ${Le}`,k,v,ce,he);F=F.replace(he,()=>je)}oe.lastIndex=0}}function U(oe,ae,ce){try{let ue=oe;if(!oe.endsWith(".stx"))ue=`${oe}.stx`;let le=Kt.resolve(ae),Ae=Kt.resolve(Kt.dirname(ce)),ve;if(!ue.startsWith("./")&&!ue.startsWith("../")){for(let Ne of R._layerPartialDirs??[]){let Ie=Kt.resolve(Ne,ue);if(Ie.startsWith(`${Kt.resolve(Ne)}${Kt.sep}`)&&tw(Ie))return Ie}ve=Kt.resolve(ae,ue)}else ve=Kt.resolve(Ae,ue);let he=Kt.normalize(ve),Te=he.startsWith(le+Kt.sep)||he===le,De=he.startsWith(Ae+Kt.sep)||he===Ae,Oe=!1,Me=Kt.dirname(Ae);if(he.startsWith(Me+Kt.sep)){if(!Kt.relative(Me,he).split(Kt.sep).some((Fe)=>Fe.startsWith(".")&&Fe!=="."&&Fe!==".."))Oe=!0}if(!Te&&!De&&!Oe)return console.error(`Security: Path traversal attempt blocked for include path: ${oe}`),console.error(` Resolved to: ${he}`),console.error(` Allowed dirs: ${le}, ${Ae}`),null;return he}catch(ue){return console.error(`Error resolving path ${oe}: ${ue}`),null}}let H=Kt.resolve(k);B.add(H);function q(oe,ae,ce,ue){return R.onIncludeError?.({includePath:oe,templatePath:k,message:ae,partialsDir:z}),g("Include",ae,k,ce,ue)}async function ie(oe,ae={},ce,ue){let le=U(oe,z,k);if(!le)return q(oe,`Could not resolve path for include: ${oe}`,ce,ue);let Ae=Kt.resolve(le);if(B.has(Ae)){let ve=[...B,Ae].map((he)=>Kt.basename(he)).join(" -> ");return q(oe,`Circular include detected: ${ve}`,ce,ue)}try{T.add(le);let ve;if(!ve)try{ve=await Bun.file(le).text()}catch(at){let kt=at instanceof Error?at.message:String(at);return q(oe,`Error loading include file ${oe}: ${kt}`,ce,ue)}if(ve)ve=ve.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ve&&ve.includes("@stream")){let{processStreamDirectives:at}=await import("./chunk-djqmzzn6.js");ve=at(ve,_)}if(ve&&(R.debug||!E()&&!Dn()))try{let{warnUnbalancedTags:at}=await import("./chunk-xfe2nzxd.js");at(ve,le)}catch{}try{let{processESImports:at}=await import("./chunk-7ejmya3v.js");ve=await at(ve,_,le,R,T)}catch(at){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${le}:`,at instanceof Error?at.message:at)}let he=ve,Te=ne(he);if(Te)he=Te.content.trim();let Oe=ve.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Me="";if(Oe)Me=`<style${Oe[1]}>${Oe[2]}</style>`;let Ne=[];he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(at,kt,bt)=>{if(!Kg(kt))return"";return Ne.push({attrs:kt,body:bt}),`__STX_DATA_BLOCK_${Ne.length-1}__`}),he=he.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let Ie={..._};Ie.__stx_signals_gate=Se(ve,le);for(let[at,kt]of Object.entries(ae))Ie[at]=kt;let Be=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Fe=[...ve.matchAll(Be)].sort((at,kt)=>{let bt=(at[1]||"").includes("server"),Xt=(kt[1]||"").includes("server");return Number(Xt)-Number(bt)}),Le="",je=null,rt=!1,gt=!1;for(let at of Fe){let kt=at[1]||"",bt=at[2]||"";if(Kg(kt))continue;let Xt=kt.includes("server"),Fn=Ze(kt);if(!Xt&&bt.trim()){let{interpolateScriptExpressions:dt}=await import("./chunk-bpz3yv92.js");bt=dt(bt,Ie,oe)}let Nn="";try{let{extractAndStripCssImports:dt,renderVendorStyleTags:vt}=await import("./chunk-eactb0nz.js"),zt=dt(bt,{filePath:le,projectRoot:process.cwd()});bt=zt.code,Nn=vt(zt.styles)}catch(dt){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${le}:`,dt instanceof Error?dt.message:dt)}if(Fn&&bt.trim())bt=Qe(bt);if(!Xt){try{let{injectBrowserCoreAutoImports:vt}=await import("./chunk-eactb0nz.js");bt=vt(bt).code;let{hasUserImports:zt,bundleClientScript:Zt}=await import("./chunk-t9914jjh.js");if(zt(bt))bt=await Zt(bt,le,{projectRoot:process.cwd()})}catch(vt){if(R.debug)console.warn(`[stx] bundler skipped for ${le}:`,vt instanceof Error?vt.message:vt)}let{stripStxRuntimeImports:dt}=await import("./chunk-00vp75pj.js");bt=dt(bt)}let ht=rw(bt);if(!Xt){let{extractBridgeData:dt,generateServerDataBridge:vt}=await import("./chunk-eactb0nz.js"),zt=vt(bt,dt(Ie));if(zt)bt=`${zt}
|
|
2515
|
+
${bt}`}if(ht&&!Xt){rt=!0,je=qg(le,_);let dt=O(bt),vt=Hg(dt,je);Le+=`${Nn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}">${vt}</script>
|
|
2516
|
+
`;continue}if(Xt)try{let{extractVariables:dt}=await import("./chunk-8txwa114.js");await dt(bt,Ie,le)}catch(dt){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${le}:`,dt)}if(!Xt&&!ht){let dt=kt.replace(/\bclient\b/i,"").trim();je=qg(le,_);let vt=O(bt),zt=Hg(vt,je);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(zt))gt=!0;Le+=`${Nn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}"${dt?` ${dt}`:""}>${zt}</script>
|
|
2517
|
+
`}}if(Ne.length>0){let{interpolateScriptExpressions:at}=await import("./chunk-bpz3yv92.js");he=he.replace(/__STX_DATA_BLOCK_(\d+)__/g,(kt,bt)=>{let Xt=Ne[Number(bt)];return`<script${Xt.attrs}>${at(Xt.body,Ie,oe)}</script>`})}if(je){let at=cw(he,je);if(he=at.html,at.mergedIntoExisting){let bt=je,Xt=at.mergedIntoExisting;Le=Le.split(`'${bt}'`).join(`'${Xt}'`).split(`"${bt}"`).join(`"${Xt}"`),je=Xt}else if(!at.stamped&&rt&&!uu.has(le))uu.add(le),console.warn(`[stx] ${Kt.relative(process.cwd(),le)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(at.stamped&&at.root!=="body"&&(rt||gt)&&!du.has(le)){let bt=Vc(he);if(bt.length>1)du.add(le),console.warn(`[stx] ${Kt.relative(process.cwd(),le)} declares ${rt?"signals":"bindings"} and has ${bt.length} top-level elements (${bt.map((Xt)=>`<${Xt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let kt=at.stamped&&at.root!==null&&xn(at.root);Le=ow(Le,kt?je:null)}if(he.includes("@include")||he.includes("@partial"))he=await As(he,Ie,le,R,T,B);let{processLoops:mt,reportDeferredLoopWarnings:yt}=await import("./chunk-r4adpej7.js"),ut=mt(he,Ie,le,void 0,!0);ut=yr(ut,Ie,le),ut=yt(ut);let{processMetaDirectives:$t,processSeoDirective:St,processStructuredData:xt}=await import("./chunk-3q312svf.js");if(ut=$t(ut,Ie,le,R),ut=xt(ut,Ie,le),ut=St(ut,Ie,le,R),ut=X(ut,Ie,le),Me)ut+=`
|
|
2518
|
+
`+Me;if(Le)ut+=`
|
|
2519
|
+
`+Le;return ut}catch(ve){let he=ve instanceof Error?ve.message:String(ve);return q(oe,`Error processing include ${oe}: ${he}`,ce,ue)}}let Z=/@include\s*\(/g,Q;while((Q=Z.exec(F))!==null){let oe=Q.index,ae=oe+Q[0].length-1,ce=1,ue=ae+1;while(ue<F.length&&ce>0){if(F[ue]==="(")ce++;else if(F[ue]===")")ce--;ue++}if(ce!==0)break;let le=F.substring(oe,ue),Ae=F.substring(ae+1,ue-1),ve=Ae.match(/^\s*['"]([^'"]+)['"]/);if(!ve){Z.lastIndex=ue;continue}let he=ve[1],Te,De=Ae.substring(ve[0].length),Oe=lu(De,0);if(Oe!==-1)Te=De.substring(Oe+1).trim();let Me={};if(Te)try{Me=D(Te,_)}catch(Ie){let Be=Ie instanceof Error?Ie.message:String(Ie);F=F.replace(le,g("Include",`Error parsing include variables for ${he}: ${Be}`,k,v,oe)),Z.lastIndex=0;continue}let Ne=await ie(he,Me,v,oe);F=F.substring(0,oe)+Ne+F.substring(ue),Z.lastIndex=0}return F}function Ps(v,_){let k=v;function R(T,B,z,F){let W=T,U=!0;while(U){U=!1;let H=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),q=W.match(H);if(!q||q.index===void 0)break;let ie=q.index,Z=q[1],Q=ie+q[0].length,oe=new RegExp(`@${B}\\(`),ae=new RegExp(`@${z}(?![a-z])`),ce=1,ue=Q,le=-1;while(ce>0&&ue<W.length){let ve=W.slice(ue),he=ve.match(oe),Te=ve.match(ae),De=he?ue+he.index:1/0,Oe=Te?ue+Te.index:1/0;if(De<Oe)ce++,ue=De+(he[0].length||1);else if(Oe<1/0){if(ce--,ce===0){le=Oe;break}ue=Oe+z.length+1}else break}if(le===-1)break;let Ae=W.slice(Q,le);if(!_[Z])_[Z]=[];if(F)_[Z].unshift(Ae);else _[Z].push(Ae);W=W.substring(0,ie)+W.substring(le+`@${z}`.length),U=!0}return W}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function Is(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
|
|
2520
|
+
`)})}import*as fu from"path";async function Zg(v,_,k=""){if(fu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Jg(v,_,k,"@js","@endjs")}async function Gg(v,_,k=""){if(fu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return Jg(v,_,k,"@ts","@endts")}async function Jg(v,_,k,R,T){let B=v,z=Wr(`${R}([\\s\\S]*?)${T}`,"g"),F=[],W;while((W=z.exec(v))!==null)F.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:U,content:H,index:q}of F)try{let ie={..._,global:_},Z=Object.keys(ie),Q=Object.values(ie),oe=H.trim();if(R==="@ts")oe=oe.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 ce=(oe.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((he)=>he.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ue=ce.length>0?`return { ${ce.join(", ")} };`:"return {};",le=`
|
|
2521
2521
|
${oe}
|
|
2522
2522
|
${ue}
|
|
2523
|
-
`,ve=Function(...Z,le)(...Q);if(ve&&typeof ve==="object")Object.assign(_,ve);B=B.replace(U,"")}catch(ie){console.error(`Error executing ${R} code block in ${k}:`,ie);let Z=ie instanceof Error?ie.message:String(ie),Q=g(`${R} Directive`,`Error executing code: ${Z}`,k,v,q,U);console.error(Q),B=B.replace(U,"")}return B}var fw=1000,pw=!1;function gw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,W=B.index+B[0].indexOf("("),F=S(v,"(",")",W);if(F===-1)continue;let U=v.slice(z,F).trim();if(!U)continue;if(!Object.keys(_).some((ie)=>new RegExp(`(?:^|[^\\w$.])${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let q;try{let ie=D(U,_);if(!ie||typeof ie!=="object")continue;q=JSON.stringify(ie)}catch{continue}R+=v.slice(T,z)+q,T=F,k.lastIndex=F}return T===0?v:R+v.slice(T)}function mw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,W=z+T[0].length-1,F=1,U=W+1;while(U<R.length&&F>0){if(R[U]==="(")F++;else if(R[U]===")"){if(F--,F===0)break}U++}if(F!==0)continue;let H=R.substring(W+1,U),q=U+1,ie=H.match(/^\s*['"]([^'"]+)['"]/);if(!ie)continue;let Z=ie[1],Q=H.slice(ie[0].length),oe=Q.match(/^\s*,\s*/);if(!oe)continue;let ae=Q.slice(oe[0].length).trim();if(!ae)continue;try{let ce=D(ae,_),ue=JSON.stringify(ce),le=`@component('${Z}', ${ue})`;B.push({start:z,end:q,replacement:le})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:U}=B[z];R=R.substring(0,W)+U+R.substring(F)}return R}function Da(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,W=z+B[0].length-1,F=1,U=W+1,H=null,q=!1;while(U<R.length&&F>0){let Q=R[U];if(q){q=!1,U++;continue}if(Q==="\\"&&H){q=!0,U++;continue}if(H){if(Q===H)H=null;U++;continue}if(Q==='"'||Q==="'"||Q==="`"){H=Q,U++;continue}if(Q==="(")F++;else if(Q===")"){if(F--,F===0)break}U++}if(F!==0)break;let ie=R.substring(W+1,U),Z=k(ie);R=R.substring(0,z)+Z+R.substring(U+1)}return R}function hw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),W=Object.values(_);Ys(B);let U=c(B,z)(...W),H=JSON.stringify(U);if(H===void 0){if(!Re(B).some((Z)=>!(Z in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var Oa="<!--__STX_BREAK__-->",Ma="<!--__STX_CONTINUE__-->";function yw(v,_){let k=v;return k=Da(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?Oa:""}catch{return""}}),k=Da(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?Ma:""}catch{return""}}),k}function xw(v){let _=v;return _=_.replace(/@break(?!\()/g,Oa),_=_.replace(/@continue(?!\()/g,Ma),_}function Yg(v){let _=v.includes(Oa),k=_?v.substring(0,v.indexOf(Oa)):v;return{hasBreak:_,content:k}}function Qg(v){let _=v.includes(Ma),k=_?v.substring(0,v.indexOf(Ma)):v;return{hasContinue:_,content:k}}function tm(v){let _=v;return _=Da(_,"@break",(k)=>{let R=k.trim();if(!kr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=Da(_,"@continue",(k)=>{let R=k.trim();if(!kr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function bw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let W=[],F=0;for(let H of R)F+=H.delta,W.push({pos:H.pos,depth:F});function U(H){let q=0,ie=W.length-1,Z=0;while(q<=ie){let Q=q+ie>>1;if(W[Q].pos<=H)Z=W[Q].depth,q=Q+1;else ie=Q-1}return Z}while((k=_.exec(v))!==null){if(U(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,ie=1,Z=q+1,Q=-1;while(Z<v.length&&ie>0){if(v[Z]==="(")ie++;else if(v[Z]===")"){if(ie--,ie===0){Q=Z;break}}Z++}if(Q===-1)continue;let oe=v.substring(q+1,Q),ae=Pt(oe);if(!ae)continue;let{arrayExpr:ce,itemVar:ue}=ae,le=Q+1,Ae=1,ve=le,he=/@forelse\s*\(/g,Te=/@endforelse/g,De=-1;while(Ae>0&&ve<v.length){he.lastIndex=ve,Te.lastIndex=ve;let Fe=he.exec(v),ze=Te.exec(v);if(!ze)break;if(Fe&&Fe.index<ze.index)Ae++,ve=Fe.index+Fe[0].length;else{if(Ae--,Ae===0){De=ze.index;break}ve=ze.index+11}}if(De===-1)continue;let Oe=v.substring(le,De),Me=De+11,Ne=-1,Ie=0,Le=0;while(Le<Oe.length){let Fe=Oe.indexOf("@",Le);if(Fe===-1)break;let ze=Oe.substring(Fe);if(/^@forelse\s*\(/.test(ze))Ie++,Le=Fe+1;else if(ze.startsWith("@endforelse"))Ie--,Le=Fe+11;else if(Ie===0&&ze.startsWith("@empty")){if(Oe.length<=Fe+6||!/[a-z]/i.test(Oe[Fe+6])){Ne=Fe;break}Le=Fe+1}else Le=Fe+1}if(Ne===-1)continue;return{start:H,end:Me,arrayExpr:ce,itemVar:ue,foreachContent:Oe.substring(0,Ne),emptyContent:Oe.substring(Ne+6)}}return null}function em(v,_){let k=v;while(!0){let R=bw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:W,foreachContent:F,emptyContent:U}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=U;else q=`@foreach (${z} as ${W})${F}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),ie=i("Forelse",`Error in @forelse(${z} as ${W}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+ie+k.substring(B)}}return k}var nm="<!--stx:foreach-not-iterable:",vw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function ww(v,_){return`${nm}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Sw(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Rs(v){if(!v.includes(nm))return v;return v.replace(vw,(_,k,R)=>(Sw(decodeURIComponent(k),decodeURIComponent(R)),""))}function Ti(v,_,k,R,T=!1){let B=v;B=em(B,_);function z(U){let H=/@foreach\s*\(/g,q;while((q=H.exec(U))!==null){let ie=q.index,Z=q.index+q[0].length-1,Q=1,oe=Z+1,ae=-1;while(oe<U.length&&Q>0){if(U[oe]==="(")Q++;else if(U[oe]===")"){if(Q--,Q===0){ae=oe;break}}oe++}if(ae===-1)continue;let ce=U.substring(Z+1,ae),ue=Pt(ce);if(!ue)continue;let le=ie,{arrayExpr:Ae,itemVar:ve}=ue,he=ae+1,Te=1,De=he,Oe=/@foreach\s*\(/g,Me=/@endforeach/g;while(Te>0&&De<U.length){Oe.lastIndex=De,Me.lastIndex=De;let Ne=Oe.exec(U),Ie=Me.exec(U);if(!Ie)break;if(Ne&&Ne.index<Ie.index)Te++,De=Ne.index+Ne[0].length;else{if(Te--,Te===0){let Le=U.substring(he,Ie.index),Fe=Ie.index+11;return{start:le,end:Fe,arrayExpr:Ae,itemVar:ve,content:Le}}De=Ie.index+11}}}return null}function W(U,H){let q=U;while(!0){let ie=z(q);if(!ie)break;let{start:Z,end:Q,arrayExpr:oe,itemVar:ae,content:ce}=ie;try{let ue=oe.trim(),le;if(p(ue))le=c(ue,Object.keys(H))(...Object.values(H));else le=l(ue,H);let Ae=!1;if(!Array.isArray(le))if(le instanceof Map)le=Array.from(le),Ae=!0;else if(le instanceof Set)le=Array.from(le);else if(typeof le==="string")le=Array.from(le);else if(le&&typeof le==="object"&&!(le instanceof Date)&&!(le instanceof RegExp))le=Object.entries(le),Ae=!0;else{let Ie=ww(ue,k)+i("Foreach",`Error in @foreach: ${ue} is not iterable`,t.TYPE_ERROR);q=q.substring(0,Z)+Ie+q.substring(Q);continue}let ve=R?.loops?.useAltLoopVariable??pw,he=ae.trim(),Te=null,De,Oe=!1;if(he.includes("=>")){let Ie=he.split("=>").map((Le)=>Le.trim());if(Ie.length===2&&Ie[0]&&Ie[1])Te=Ie[0],De=Ie[1];else De=he}else if(!he.startsWith("[")&&!he.startsWith("{")&&he.includes(",")){let Ie=he.split(",").map((Le)=>Le.trim());if(Ie.length===2&&Ie[0]&&Ie[1])De=Ie[0],Te=Ie[1],Oe=!0;else De=he}else De=he;let Me="",Ne=le;for(let Ie=0;Ie<Ne.length;Ie++){let Le=Ne[Ie],Fe={index:Ie,iteration:Ie+1,first:Ie===0,last:Ie===Ne.length-1,count:Ne.length},ze={...H,loop:Fe,$loop:Fe};if(De.startsWith("[")&&De.endsWith("]")){let St=De.slice(1,-1).split(",").map((xt)=>xt.trim());if(Array.isArray(Le))St.forEach((xt,lt)=>{if(xt)ze[xt]=Le[lt]});else ze[De]=Le}else if(De.startsWith("{")&&De.endsWith("}")){let St=De.slice(1,-1).split(",").map((xt)=>xt.trim()).filter(Boolean);if(Le!==null&&typeof Le==="object")St.forEach((xt)=>{let lt=xt.indexOf(":"),gt=(lt===-1?xt:xt.slice(0,lt)).trim(),ht=lt===-1?gt:xt.slice(lt+1).trim();if(gt&&ht)ze[ht]=Le[gt]});else ze[De]=Le}else ze[De]=Le;if(Te)if(!Oe&&Ae&&Array.isArray(Le)&&Le.length===2)ze[Te]=Le[0],ze[De]=Le[1];else ze[Te]=Ie;let je=yw(ce,ze),He=Qg(je);if(He.hasContinue){Me+=He.content;continue}let mt=Yg(je);if(mt.hasBreak){Me+=mt.content;break}if(je=em(je,ze),je=W(je,ze),je=yr(je,ze,k),je=xw(je),mt=Yg(je),mt.hasBreak){Me+=mt.content;break}if(He=Qg(je),He.hasContinue){Me+=He.content;continue}je=X(je,ze,k),je=hw(je,ze),je=mw(je,ze),je=gw(je,ze),Me+=je}q=q.substring(0,Z)+Me+q.substring(Q)}catch(ue){let le=i("Foreach",`Error in @foreach(${oe.trim()} as ${ae.trim()}): ${ue instanceof Error?ue.message:String(ue)}`,t.EVALUATION_ERROR);q=q.substring(0,Z)+le+q.substring(Q)}}return q}B=W(B,_),B=sm(B,_,k,R);let F=R?.loops?.maxWhileIterations??fw;return B=kw(B,_,F),T?B:Rs(B)}function Hc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function rm(v){return kr(v)}function sm(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=W+z[0].length-1,U=S(T,"(",")",F);if(U===-1)break;let H=Hc(T.slice(F+1,U)),q=U+1,ie=ha(T.slice(W),"for","endfor");if(ie.length===0)break;let Z=ie[0].content,Q=W+ie[0].end;if(!rm(H)){let oe=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,W)+oe+T.substring(Q),B=!0;continue}try{let oe=$w(H),ae=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(oe.length>0&&ae){let he=_w({forExpr:H,content:Z,iterVarNames:oe,context:_,filePath:k,options:R});T=T.substring(0,W)+he+T.substring(Q),B=!0;continue}let ce=Object.keys(_),ue=Object.values(_),le=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(he,Te)=>`\${${Te}}`);le=tm(le);let ve=Function(...ce,`
|
|
2523
|
+
`,ve=Function(...Z,le)(...Q);if(ve&&typeof ve==="object")Object.assign(_,ve);B=B.replace(U,"")}catch(ie){console.error(`Error executing ${R} code block in ${k}:`,ie);let Z=ie instanceof Error?ie.message:String(ie),Q=g(`${R} Directive`,`Error executing code: ${Z}`,k,v,q,U);console.error(Q),B=B.replace(U,"")}return B}var fw=1000,pw=!1;function gw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,F=B.index+B[0].indexOf("("),W=S(v,"(",")",F);if(W===-1)continue;let U=v.slice(z,W).trim();if(!U)continue;if(!Object.keys(_).some((ie)=>new RegExp(`(?:^|[^\\w$.])${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let q;try{let ie=D(U,_);if(!ie||typeof ie!=="object")continue;q=JSON.stringify(ie)}catch{continue}R+=v.slice(T,z)+q,T=W,k.lastIndex=W}return T===0?v:R+v.slice(T)}function mw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,F=z+T[0].length-1,W=1,U=F+1;while(U<R.length&&W>0){if(R[U]==="(")W++;else if(R[U]===")"){if(W--,W===0)break}U++}if(W!==0)continue;let H=R.substring(F+1,U),q=U+1,ie=H.match(/^\s*['"]([^'"]+)['"]/);if(!ie)continue;let Z=ie[1],Q=H.slice(ie[0].length),oe=Q.match(/^\s*,\s*/);if(!oe)continue;let ae=Q.slice(oe[0].length).trim();if(!ae)continue;try{let ce=D(ae,_),ue=JSON.stringify(ce),le=`@component('${Z}', ${ue})`;B.push({start:z,end:q,replacement:le})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:F,end:W,replacement:U}=B[z];R=R.substring(0,F)+U+R.substring(W)}return R}function Da(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,F=z+B[0].length-1,W=1,U=F+1,H=null,q=!1;while(U<R.length&&W>0){let Q=R[U];if(q){q=!1,U++;continue}if(Q==="\\"&&H){q=!0,U++;continue}if(H){if(Q===H)H=null;U++;continue}if(Q==='"'||Q==="'"||Q==="`"){H=Q,U++;continue}if(Q==="(")W++;else if(Q===")"){if(W--,W===0)break}U++}if(W!==0)break;let ie=R.substring(F+1,U),Z=k(ie);R=R.substring(0,z)+Z+R.substring(U+1)}return R}function hw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),F=Object.values(_);Ys(B);let U=c(B,z)(...F),H=JSON.stringify(U);if(H===void 0){if(!Re(B).some((Z)=>!(Z in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var Oa="<!--__STX_BREAK__-->",Ma="<!--__STX_CONTINUE__-->";function yw(v,_){let k=v;return k=Da(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let F=c(B,Object.keys(_));z=Boolean(F(...Object.values(_)))}else z=Boolean(l(B,_));return z?Oa:""}catch{return""}}),k=Da(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let F=c(B,Object.keys(_));z=Boolean(F(...Object.values(_)))}else z=Boolean(l(B,_));return z?Ma:""}catch{return""}}),k}function xw(v){let _=v;return _=_.replace(/@break(?!\()/g,Oa),_=_.replace(/@continue(?!\()/g,Ma),_}function Yg(v){let _=v.includes(Oa),k=_?v.substring(0,v.indexOf(Oa)):v;return{hasBreak:_,content:k}}function Qg(v){let _=v.includes(Ma),k=_?v.substring(0,v.indexOf(Ma)):v;return{hasContinue:_,content:k}}function tm(v){let _=v;return _=Da(_,"@break",(k)=>{let R=k.trim();if(!kr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=Da(_,"@continue",(k)=>{let R=k.trim();if(!kr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function bw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let F=[],W=0;for(let H of R)W+=H.delta,F.push({pos:H.pos,depth:W});function U(H){let q=0,ie=F.length-1,Z=0;while(q<=ie){let Q=q+ie>>1;if(F[Q].pos<=H)Z=F[Q].depth,q=Q+1;else ie=Q-1}return Z}while((k=_.exec(v))!==null){if(U(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,ie=1,Z=q+1,Q=-1;while(Z<v.length&&ie>0){if(v[Z]==="(")ie++;else if(v[Z]===")"){if(ie--,ie===0){Q=Z;break}}Z++}if(Q===-1)continue;let oe=v.substring(q+1,Q),ae=Pt(oe);if(!ae)continue;let{arrayExpr:ce,itemVar:ue}=ae,le=Q+1,Ae=1,ve=le,he=/@forelse\s*\(/g,Te=/@endforelse/g,De=-1;while(Ae>0&&ve<v.length){he.lastIndex=ve,Te.lastIndex=ve;let Fe=he.exec(v),Le=Te.exec(v);if(!Le)break;if(Fe&&Fe.index<Le.index)Ae++,ve=Fe.index+Fe[0].length;else{if(Ae--,Ae===0){De=Le.index;break}ve=Le.index+11}}if(De===-1)continue;let Oe=v.substring(le,De),Me=De+11,Ne=-1,Ie=0,Be=0;while(Be<Oe.length){let Fe=Oe.indexOf("@",Be);if(Fe===-1)break;let Le=Oe.substring(Fe);if(/^@forelse\s*\(/.test(Le))Ie++,Be=Fe+1;else if(Le.startsWith("@endforelse"))Ie--,Be=Fe+11;else if(Ie===0&&Le.startsWith("@empty")){if(Oe.length<=Fe+6||!/[a-z]/i.test(Oe[Fe+6])){Ne=Fe;break}Be=Fe+1}else Be=Fe+1}if(Ne===-1)continue;return{start:H,end:Me,arrayExpr:ce,itemVar:ue,foreachContent:Oe.substring(0,Ne),emptyContent:Oe.substring(Ne+6)}}return null}function em(v,_){let k=v;while(!0){let R=bw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:F,foreachContent:W,emptyContent:U}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=U;else q=`@foreach (${z} as ${F})${W}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),ie=i("Forelse",`Error in @forelse(${z} as ${F}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+ie+k.substring(B)}}return k}var nm="<!--stx:foreach-not-iterable:",vw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function ww(v,_){return`${nm}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Sw(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Rs(v){if(!v.includes(nm))return v;return v.replace(vw,(_,k,R)=>(Sw(decodeURIComponent(k),decodeURIComponent(R)),""))}function Ti(v,_,k,R,T=!1){let B=v;B=em(B,_);function z(U){let H=/@foreach\s*\(/g,q;while((q=H.exec(U))!==null){let ie=q.index,Z=q.index+q[0].length-1,Q=1,oe=Z+1,ae=-1;while(oe<U.length&&Q>0){if(U[oe]==="(")Q++;else if(U[oe]===")"){if(Q--,Q===0){ae=oe;break}}oe++}if(ae===-1)continue;let ce=U.substring(Z+1,ae),ue=Pt(ce);if(!ue)continue;let le=ie,{arrayExpr:Ae,itemVar:ve}=ue,he=ae+1,Te=1,De=he,Oe=/@foreach\s*\(/g,Me=/@endforeach/g;while(Te>0&&De<U.length){Oe.lastIndex=De,Me.lastIndex=De;let Ne=Oe.exec(U),Ie=Me.exec(U);if(!Ie)break;if(Ne&&Ne.index<Ie.index)Te++,De=Ne.index+Ne[0].length;else{if(Te--,Te===0){let Be=U.substring(he,Ie.index),Fe=Ie.index+11;return{start:le,end:Fe,arrayExpr:Ae,itemVar:ve,content:Be}}De=Ie.index+11}}}return null}function F(U,H){let q=U;while(!0){let ie=z(q);if(!ie)break;let{start:Z,end:Q,arrayExpr:oe,itemVar:ae,content:ce}=ie;try{let ue=oe.trim(),le;if(p(ue))le=c(ue,Object.keys(H))(...Object.values(H));else le=l(ue,H);let Ae=!1;if(!Array.isArray(le))if(le instanceof Map)le=Array.from(le),Ae=!0;else if(le instanceof Set)le=Array.from(le);else if(typeof le==="string")le=Array.from(le);else if(le&&typeof le==="object"&&!(le instanceof Date)&&!(le instanceof RegExp))le=Object.entries(le),Ae=!0;else{let Ie=ww(ue,k)+i("Foreach",`Error in @foreach: ${ue} is not iterable`,t.TYPE_ERROR);q=q.substring(0,Z)+Ie+q.substring(Q);continue}let ve=R?.loops?.useAltLoopVariable??pw,he=ae.trim(),Te=null,De,Oe=!1;if(he.includes("=>")){let Ie=he.split("=>").map((Be)=>Be.trim());if(Ie.length===2&&Ie[0]&&Ie[1])Te=Ie[0],De=Ie[1];else De=he}else if(!he.startsWith("[")&&!he.startsWith("{")&&he.includes(",")){let Ie=he.split(",").map((Be)=>Be.trim());if(Ie.length===2&&Ie[0]&&Ie[1])De=Ie[0],Te=Ie[1],Oe=!0;else De=he}else De=he;let Me="",Ne=le;for(let Ie=0;Ie<Ne.length;Ie++){let Be=Ne[Ie],Fe={index:Ie,iteration:Ie+1,first:Ie===0,last:Ie===Ne.length-1,count:Ne.length},Le={...H,loop:Fe,$loop:Fe};if(De.startsWith("[")&&De.endsWith("]")){let mt=De.slice(1,-1).split(",").map((yt)=>yt.trim());if(Array.isArray(Be))mt.forEach((yt,ut)=>{if(yt)Le[yt]=Be[ut]});else Le[De]=Be}else if(De.startsWith("{")&&De.endsWith("}")){let mt=De.slice(1,-1).split(",").map((yt)=>yt.trim()).filter(Boolean);if(Be!==null&&typeof Be==="object")mt.forEach((yt)=>{let ut=yt.indexOf(":"),$t=(ut===-1?yt:yt.slice(0,ut)).trim(),St=ut===-1?$t:yt.slice(ut+1).trim();if($t&&St)Le[St]=Be[$t]});else Le[De]=Be}else Le[De]=Be;if(Te)if(!Oe&&Ae&&Array.isArray(Be)&&Be.length===2)Le[Te]=Be[0],Le[De]=Be[1];else Le[Te]=Ie;let je=yw(ce,Le),rt=Qg(je);if(rt.hasContinue){Me+=rt.content;continue}let gt=Yg(je);if(gt.hasBreak){Me+=gt.content;break}if(je=em(je,Le),je=F(je,Le),je=yr(je,Le,k),je=xw(je),gt=Yg(je),gt.hasBreak){Me+=gt.content;break}if(rt=Qg(je),rt.hasContinue){Me+=rt.content;continue}je=X(je,Le,k),je=hw(je,Le),je=mw(je,Le),je=gw(je,Le),Me+=je}q=q.substring(0,Z)+Me+q.substring(Q)}catch(ue){let le=i("Foreach",`Error in @foreach(${oe.trim()} as ${ae.trim()}): ${ue instanceof Error?ue.message:String(ue)}`,t.EVALUATION_ERROR);q=q.substring(0,Z)+le+q.substring(Q)}}return q}B=F(B,_),B=sm(B,_,k,R);let W=R?.loops?.maxWhileIterations??fw;return B=kw(B,_,W),T?B:Rs(B)}function Hc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function rm(v){return kr(v)}function sm(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let F=z.index,W=F+z[0].length-1,U=S(T,"(",")",W);if(U===-1)break;let H=Hc(T.slice(W+1,U)),q=U+1,ie=ha(T.slice(F),"for","endfor");if(ie.length===0)break;let Z=ie[0].content,Q=F+ie[0].end;if(!rm(H)){let oe=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,F)+oe+T.substring(Q),B=!0;continue}try{let oe=$w(H),ae=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(oe.length>0&&ae){let he=_w({forExpr:H,content:Z,iterVarNames:oe,context:_,filePath:k,options:R});T=T.substring(0,F)+he+T.substring(Q),B=!0;continue}let ce=Object.keys(_),ue=Object.values(_),le=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(he,Te)=>`\${${Te}}`);le=tm(le);let ve=Function(...ce,`
|
|
2524
2524
|
let result = '';
|
|
2525
2525
|
for (${H}) {
|
|
2526
2526
|
result += \`${le}\`;
|
|
2527
2527
|
}
|
|
2528
2528
|
return result;
|
|
2529
|
-
`)(...ue);T=T.substring(0,
|
|
2529
|
+
`)(...ue);T=T.substring(0,F)+ve+T.substring(Q),B=!0}catch(oe){let ae=i("For",`Error in @for(${H}): ${oe instanceof Error?oe.message:String(oe)}`,t.EVALUATION_ERROR);T=T.substring(0,F)+ae+T.substring(Q),B=!0}}return T}function $w(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let B=k[1];return B.slice(1,-1).split(",").map((F)=>{let W=F.trim();if(!W)return"";let U=W.indexOf(":");if(U>=0&&B.startsWith("{")){let ie=W.slice(U+1).trim(),Z=ie.indexOf("=");return(Z>=0?ie.slice(0,Z):ie).trim()}let H=W.indexOf("="),q=(H>=0?W.slice(0,H):W).trim();return/^[A-Za-z_$][\w$]*$/.test(q)?q:""}).filter(Boolean)}let R=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(R)return[R[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function _w(v){let{forExpr:_,content:k,iterVarNames:R,context:T,filePath:B,options:z}=v,F=Object.keys(T),W=Object.values(T),U=Function(...F,"__pushIter",`
|
|
2530
2530
|
for (${_}) {
|
|
2531
2531
|
__pushIter([${R.join(", ")}])
|
|
2532
2532
|
}
|
|
2533
|
-
`),H=[];U(...
|
|
2533
|
+
`),H=[];U(...W,(Z)=>{H.push(Z)});let q=B??"inline.stx",ie="";for(let Z of H){let Q={...T};R.forEach((ae,ce)=>{Q[ae]=Z[ce]});let oe=sm(k,Q,B,z);oe=yr(oe,Q,q),oe=X(oe,Q,q),ie+=oe}return ie}function kw(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@while\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,W=S(R,"(",")",F);if(W===-1)break;let U=R.slice(F+1,W),H=ha(R.slice(z),"while","endwhile");if(H.length===0)break;let q=H[0].content,ie=z+H[0].end;if(!rm(U)){let Z=i("While",`Unsafe expression in @while: ${U}`,t.UNSAFE_EXPRESSION);R=R.substring(0,z)+Z+R.substring(ie),T=!0;continue}try{let Z=Object.keys(_),Q=Object.values(_),oe=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ue,le)=>`\${${le}}`);oe=tm(oe);let ce=Function(...Z,`
|
|
2534
2534
|
let result = '';
|
|
2535
2535
|
let maxIterations = ${k}; // Configurable safety limit
|
|
2536
2536
|
let counter = 0;
|
|
@@ -2542,30 +2542,30 @@ ${bt}`}if(yt&&!Xt){He=!0,je=qg(le,_);let ut=O(bt),vt=Hg(ut,je);ze+=`${Nn}<script
|
|
|
2542
2542
|
result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
2543
2543
|
}
|
|
2544
2544
|
return result;
|
|
2545
|
-
`)(...Q);R=R.substring(0,z)+ce+R.substring(ie),T=!0}catch(Z){let Q=i("While",`Error in @while(${U}): ${Z instanceof Error?Z.message:String(Z)}`,t.EVALUATION_ERROR);R=R.substring(0,z)+Q+R.substring(ie),T=!0}}return R}function Ew(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function im(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,R,T,B)=>Ew(R,B||"_method"))}async function om(v,_,k,R,T){if(!R.middleware||R.middleware.length===0)return v;let B=v,z=R.middleware.filter((
|
|
2545
|
+
`)(...Q);R=R.substring(0,z)+ce+R.substring(ie),T=!0}catch(Z){let Q=i("While",`Error in @while(${U}): ${Z instanceof Error?Z.message:String(Z)}`,t.EVALUATION_ERROR);R=R.substring(0,z)+Q+R.substring(ie),T=!0}}return R}function Ew(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function im(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,R,T,B)=>Ew(R,B||"_method"))}async function om(v,_,k,R,T){if(!R.middleware||R.middleware.length===0)return v;let B=v,z=R.middleware.filter((F)=>F.timing===T);if(z.length===0)return B;for(let F of z){if(!F.name||typeof F.handler!=="function"){if(R.debug)console.warn("Invalid middleware:",F);continue}try{let W=await F.handler(B,_,k,R);if(typeof W==="string")B=W;else if(R.debug)console.warn(`Middleware ${F.name} did not return a string`)}catch(W){if(R.debug)console.error(`Error in middleware ${F.name}:`,W);if(R.debug){let U=g("Middleware",`Error in middleware '${F.name}': ${W instanceof Error?W.message:String(W)}`,k,v);B=B.replace(/<body[^>]*>/,`$&
|
|
2546
2546
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(U)}</div>
|
|
2547
|
-
`)}}}return B}async function am(v,_,k,R){return om(v,_,k,R,"before")}async function cm(v,_,k,R){return om(v,_,k,R,"after")}function lm(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,R,T,B)=>{try{let z=T?D(T,{}):{};return Bn(R,z,B==="true")}catch(z){return console.error(`Error processing @route directive: ${z}`),"#route-error"}})}var Ao={patterns:[],exact:{}};async function um(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Ao.exact[v])for(let R of Ao.exact[v])await Promise.resolve(R(_,v));if(Ao.exact[k])for(let R of Ao.exact[k])await Promise.resolve(R(_,v));for(let{pattern:R,callback:T}of Ao.patterns)if(R.test(v)||R.test(k))await Promise.resolve(T(_,v))}var Cw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rw=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Gr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let R=k.exec(v);if(!R)return null;let T=/\/\s*>$/.test(R[0])||R[1]===R[1].toLowerCase()&&Cw.has(R[1]),B=T?R[2].replace(/\/\s*$/,""):R[2];return{full:R[0],tag:R[1],attrs:B,selfClosing:T,start:R.index,end:R.index+R[0].length}}function Aw(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),z=new RegExp(`</${_}\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T;let
|
|
2547
|
+
`)}}}return B}async function am(v,_,k,R){return om(v,_,k,R,"before")}async function cm(v,_,k,R){return om(v,_,k,R,"after")}function lm(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,R,T,B)=>{try{let z=T?D(T,{}):{};return Bn(R,z,B==="true")}catch(z){return console.error(`Error processing @route directive: ${z}`),"#route-error"}})}var Ao={patterns:[],exact:{}};async function um(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Ao.exact[v])for(let R of Ao.exact[v])await Promise.resolve(R(_,v));if(Ao.exact[k])for(let R of Ao.exact[k])await Promise.resolve(R(_,v));for(let{pattern:R,callback:T}of Ao.patterns)if(R.test(v)||R.test(k))await Promise.resolve(T(_,v))}var Cw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rw=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Gr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let R=k.exec(v);if(!R)return null;let T=/\/\s*>$/.test(R[0])||R[1]===R[1].toLowerCase()&&Cw.has(R[1]),B=T?R[2].replace(/\/\s*$/,""):R[2];return{full:R[0],tag:R[1],attrs:B,selfClosing:T,start:R.index,end:R.index+R[0].length}}function Aw(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),z=new RegExp(`</${_}\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T;let F=B.exec(v),W=z.exec(v);if(!W)return-1;if(F&&F.index<W.index)R++,T=F.index+F[0].length;else{if(R--,R===0)return W.index+W[0].length;T=W.index+W[0].length}}return-1}function Zr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Aw(v,_.tag,_.end);if(k===-1)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};return{outerStart:_.start,outerEnd:k,innerHTML:v.slice(_.end,k-`</${_.tag}>`.length)}}function dm(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function To(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return R?R[1]:null}function jr(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return v.replace(new RegExp(`\\s*${k}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${k}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${k}(?=\\s|$|>|/)`,"g"),"")}function ji(v,_,k){let R=_.selfClosing?" /":"",T=`<${_.tag}${k}${R}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function Tw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Iw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-for");if(T===null){k=R.end;continue}let B=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!B){k=R.end;continue}let z=B[1].trim(),F=B[2].trim(),W;if(z.includes(",")){let ae=z.split(",").map((le)=>le.trim()),ce=ae[0],ue=ae[1];W=`${F} as ${ue} => ${ce}`}else W=`${F} as ${z}`;let U=jr(R.attrs,"v-for"),H=jr(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),q=Zr(_,R),ie=_.slice(q.outerStart,q.outerEnd),Z=ji(ie,{...R,start:0,end:R.end-R.start},H),Q=`@foreach(${W})
|
|
2548
2548
|
`,oe=`${Q}${Z}
|
|
2549
|
-
@endforeach`;_=_.slice(0,q.outerStart)+oe+_.slice(q.outerEnd),k=q.outerStart+Q.length}return _}function Pw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-if");if(T===null){k=R.end;continue}let B=[],z=Zr(_,R),
|
|
2549
|
+
@endforeach`;_=_.slice(0,q.outerStart)+oe+_.slice(q.outerEnd),k=q.outerStart+Q.length}return _}function Pw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-if");if(T===null){k=R.end;continue}let B=[],z=Zr(_,R),F=jr(R.attrs,"v-if"),W=ji(_.slice(z.outerStart,z.outerEnd),{...R,start:0,end:R.end-R.start},F);B.push({type:"if",expr:T,outerStart:z.outerStart,outerEnd:z.outerEnd,element:W,parsedTag:R});let U=z.outerEnd,H=!0;while(H){let oe=_.slice(U).match(/^\s*/),ae=oe?oe[0].length:0,ce=Gr(_,U+ae);if(!ce){H=!1;break}let ue=To(ce.attrs,"v-else-if"),le=dm(ce.attrs,"v-else");if(ue!==null){let Ae=Zr(_,ce),ve=jr(ce.attrs,"v-else-if"),he=ji(_.slice(Ae.outerStart,Ae.outerEnd),{...ce,start:0,end:ce.end-ce.start},ve);B.push({type:"else-if",expr:ue,outerStart:U,outerEnd:Ae.outerEnd,element:he,parsedTag:ce}),U=Ae.outerEnd}else if(le){let Ae=Zr(_,ce),ve=jr(ce.attrs,"v-else"),he=ji(_.slice(Ae.outerStart,Ae.outerEnd),{...ce,start:0,end:ce.end-ce.start},ve);B.push({type:"else",outerStart:U,outerEnd:Ae.outerEnd,element:he,parsedTag:ce}),H=!1}else H=!1}let q=[];for(let oe of B)if(oe.type==="if")q.push(`@if(${oe.expr})
|
|
2550
2550
|
${oe.element}`);else if(oe.type==="else-if")q.push(`@elseif(${oe.expr})
|
|
2551
2551
|
${oe.element}`);else q.push(`@else
|
|
2552
2552
|
${oe.element}`);q.push("@endif");let ie=q.join(`
|
|
2553
|
-
`),Z=B[0].outerStart,Q=B[B.length-1].outerEnd;_=_.slice(0,Z)+ie+_.slice(Q),k=Z+ie.length}return _}function Dw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Ow(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=Rw.has(R.tag),B=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(W,
|
|
2553
|
+
`),Z=B[0].outerStart,Q=B[B.length-1].outerEnd;_=_.slice(0,Z)+ie+_.slice(Q),k=Z+ie.length}return _}function Dw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Ow(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=Rw.has(R.tag),B=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(F,W,U)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(W);if(!H||!U||!/^["']/.test(U))return F;let q=H[1]||"modelValue",ie=H[2];if(T&&!H[1])return`@model${ie}=${U}`;let Z=U[0],Q=U.slice(1,-1),oe=`:${q}=${U} @update:${q}=${Z}${Q} = $event${Z}`;if(ie){let ae=H[1]?`${q}Modifiers`:"modelModifiers",ce=ie.slice(1).split(".").map((ue)=>`${ue}: true`).join(", ");oe+=` :${ae}="{ ${ce} }"`}return oe});if(B===R.attrs){k=R.end;continue}let z=ji(R.full,{...R,start:0,end:R.full.length},B);_=_.slice(0,R.start)+z+_.slice(R.end),k=R.start+z.length}return _}function Mw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Nw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function jw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-html");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Zr(_,R),z=jr(R.attrs,"v-html"),F=R.selfClosing?" /":"",W=`<${R.tag}${z}${F}>{!! ${T} !!}</${R.tag}>`;_=_.slice(0,B.outerStart)+W+_.slice(B.outerEnd),k=B.outerStart+W.length}return _}function Lw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-text");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Zr(_,R),z=jr(R.attrs,"v-text"),F=R.selfClosing?" /":"",W=`<${R.tag}${z}${F}>{{ ${T} }}</${R.tag}>`;_=_.slice(0,B.outerStart)+W+_.slice(B.outerEnd),k=B.outerStart+W.length}return _}function Bw(v){return v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function zw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;if(!dm(R.attrs,"v-once")){k=R.end;continue}let T=jr(R.attrs,"v-once"),B=Zr(_,R),z=_.slice(B.outerStart,B.outerEnd),W=`@once
|
|
2554
2554
|
${ji(z,{...R,start:0,end:R.end-R.start},T)}
|
|
2555
|
-
@endonce`;_=_.slice(0,B.outerStart)+
|
|
2556
|
-
<meta name="stx-build" content="${_}">`}function Hw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let R=null,T=!1,B=[],z={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(H){if(z.updateReady)try{H()}catch{}else B.push(H);return()=>{let q=B.indexOf(H);if(q!==-1)B.splice(q,1)}},applyUpdate(){let H=R&&R.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let
|
|
2555
|
+
@endonce`;_=_.slice(0,B.outerStart)+W+_.slice(B.outerEnd),k=B.outerStart+W.length}return _}function Fw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ww(v){return v.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function fm(v){if(!Tw(v))return v;let _=v;return _=Iw(_),_=Pw(_),_=zw(_),_=Mw(_),_=Nw(_),_=Ow(_),_=Dw(_),_=Ww(_),_=jw(_),_=Lw(_),_=Bw(_),_=Fw(_),_}function Na(v){return v.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var pu=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),Vw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function pm(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),R=k?k[1]:v,T=l(R,_);if(T&&typeof T==="string")return T;let B=R.trim();return pu.has(B)?B:null}function gm(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function mm(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(Vw.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function hm(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,F=[],W;while((W=z.exec(B))!==null)F.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let U=F.length-1;U>=0;U--){let H=F[U];try{let q=pm(H.expr,_);if(!q||typeof q!=="string"){let ue=`<!-- dynamic component: could not resolve "${Na(gm(H.expr))}" -->`;B=B.slice(0,H.index)+ue+B.slice(H.index+H.full.length);continue}if(pu.has(q)){let ue=mm(q,H.attrs,H.slotContent);B=B.slice(0,H.index)+ue+B.slice(H.index+H.full.length);continue}let ie=H.attrs.trim(),Z={},Q=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,oe;while((oe=Q.exec(ie))!==null){let ue=oe[1]||oe[2],le=oe[3];if(oe[1])try{Z[ue]=l(le,_)}catch{Z[ue]=le}else Z[ue]=le}let ae=R.componentsDir||"components",ce=await et(q,Z,H.slotContent,ae,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+ce+B.slice(H.index+H.full.length)}catch(q){let ie=q instanceof Error?q.message:String(q),Z=`<!-- dynamic component error: ${Na(ie)} -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}}return B=await Uw(B,_,k,R,T),B}async function Uw(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,F=[],W;while((W=z.exec(B))!==null)F.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let U=F.length-1;U>=0;U--){let H=F[U];try{let q=pm(H.expr,_);if(!q||typeof q!=="string"){let Q=`<!-- dynamic component: could not resolve "${Na(gm(H.expr))}" -->`;B=B.slice(0,H.index)+Q+B.slice(H.index+H.full.length);continue}if(pu.has(q)){let Q=mm(q,H.attrs,"");B=B.slice(0,H.index)+Q+B.slice(H.index+H.full.length);continue}let ie=R.componentsDir||"components",Z=await et(q,{},"",ie,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}catch(q){let ie=q instanceof Error?q.message:String(q),Z=`<!-- dynamic component error: ${Na(ie)} -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}}return B}var Ri="X-STX-Build",gu=Symbol.for("stx.buildId");function Os(){let v=globalThis;if(!v[gu])v[gu]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[gu]}function ym(v,_=Os()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
|
|
2556
|
+
<meta name="stx-build" content="${_}">`}function Hw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let R=null,T=!1,B=[],z={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(H){if(z.updateReady)try{H()}catch{}else B.push(H);return()=>{let q=B.indexOf(H);if(q!==-1)B.splice(q,1)}},applyUpdate(){let H=R&&R.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let F=(H)=>{if(!H.waiting||!_.controller||z.updateReady)return;z.updateReady=!0;let q=B.splice(0);for(let ie of q)try{ie()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let q=H.data||{};if(q.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:q.url,kind:q.kind,fragment:!!q.fragment}}))}catch{}if(q.type==="stx:reachability"){if(k.stxOffline.reachable=q.reachable!==!1,Number(q.at)>0)k.stxOffline.reachedAt=Number(q.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:q.reachable!==!1,at:Number(q.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&R&&R.waiting)R.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let W=()=>{_.register(v,{scope:"/"}).then((H)=>{R=H;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(H.waiting)F(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let q=H.installing;if(!q)return;q.addEventListener("statechange",()=>{if(q.state==="installed")F(H)})})}).catch(()=>{})},U=()=>{let H=(q)=>{setTimeout(q,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>H(W));else H(W)};if(!_.controller)if(document.readyState==="complete")U();else addEventListener("load",U);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",U);else U()}function qw(){let v=`(${Hw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var xm=`<script data-stx-offline>${qw()}</script>`;import{AsyncLocalStorage as Kw}from"async_hooks";var bm=new Kw;function Sn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function vm(v,_){return bm.run(Sn(v),_)}async function wm(v,_){let k=bm.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let R=k.pending.get(v);if(R)return R;let T=Promise.resolve().then(_).then((B)=>{let z=JSON.stringify(B,(W,U)=>{if(U===void 0||typeof U==="function"||typeof U==="symbol"||typeof U==="bigint"||typeof U==="number"&&!Number.isFinite(U))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(U&&typeof U==="object"&&!Array.isArray(U)&&Object.getPrototypeOf(U)!==Object.prototype&&Object.getPrototypeOf(U)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return U}),F=JSON.parse(z);return k.values.set(v,F),F}).catch((B)=>{throw k.pending.delete(v),B});return k.pending.set(v,T),T}function cr(v){let _=v.__stx_server_data;if(!_?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(_.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var Xw=/<\/(script)/gi;function Li(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Xw,"<\\/$1")}import Sm from"path";function L(v,_={}){return new jn(v,_).routes}var $m=new Map;async function _m(v,_){let k=v,R=_;if(!k||!R)try{let F=await o();k||=F?.pagesDir||"pages",R||=F?.root||"."}catch{k||="pages",R||="."}let T=Sm.isAbsolute(k)?k:Sm.join(R,k),B=$m.get(T);if(B)return B;let z=[];try{z=L(".",{pagesDir:T,emit:!1}).map((F)=>F.regex.source).filter(Boolean)}catch{z=[]}return $m.set(T,z),z}function Gw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function km(v){return Gw(JSON.stringify(v))}function fe(v){return v.includes("data-stx-runtime")}function Em(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let R=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(R))continue;return!0}return!1}function mu(v,_){let k=lo(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
|
|
2557
2557
|
`+v.slice(k);let T=En(v);if(T!==null)return`${v.slice(0,T)}
|
|
2558
2558
|
${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
|
|
2559
2559
|
`+v.slice(z)}if(qn(v))return fs(v,(z)=>`${z}
|
|
2560
2560
|
${_}`);return`${_}
|
|
2561
|
-
${v}`}async function ja(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-
|
|
2561
|
+
${v}`}async function ja(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-wf2wnmjg.js"),{url:B}=await T("runtime",_.debug===!0);return mu(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return mu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-wf2wnmjg.js"),R=await k(_.debug);return mu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function Jw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Cm(v){if(v.includes("data-stx-tooltip-runtime")||!Jw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Yl()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
|
|
2562
2562
|
${_}`;return`${v.slice(0,k)}${_}
|
|
2563
|
-
${v.slice(k)}`}var Yw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Qw(v){return Yw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function J(v,_){if(!v.includes("</body>"))return v;if(Qw(v))return v;let k=_?.router,R="";{let
|
|
2564
|
-
`}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-
|
|
2565
|
-
</body>`+v.slice(
|
|
2566
|
-
`)}else{if(!Im(oe,k,_,
|
|
2567
|
-
`)H++;return H},
|
|
2568
|
-
`)Q++;q=Q;continue}if(Z==="/"&&v[q+1]==="*"){let Q=q+2;while(Q<B-1&&!(v[Q]==="*"&&v[Q+1]==="/"))Q++;q=Q+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let Q=q+1;while(Q<B){if(v[Q]==="\\"){Q+=2;continue}if(v[Q]===Z){Q++;break}Q++}q=Q;continue}if(Z==="("||Z==="["||Z==="{"){ie++,q++;continue}if(Z===")"||Z==="]"||Z==="}"){ie--,q++;continue}if(Z===";"&&ie===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=
|
|
2563
|
+
${v.slice(k)}`}var Yw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Qw(v){return Yw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function J(v,_){if(!v.includes("</body>"))return v;if(Qw(v))return v;let k=_?.router,R="";{let W={};if(k){if(k.container)W.container=k.container;if(k.interceptAllLinks!==void 0)W.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)W.progress=k.progress;if(k.viewTransitions!==void 0)W.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)W.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)W.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)W.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)W.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)W.prefetch=k.prefetch;if(k.cache!==void 0)W.cache=k.cache;if(k.progressColor!==void 0)W.progressColor=k.progressColor;if(k.progressHeight!==void 0)W.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)W.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)W.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)W.keepOpening=k.keepOpening}try{let U=await _m(_?.pagesDir,_?.root);if(U.length>0)W.ownedRoutes=U}catch{}if(Object.keys(W).length>0)R=`<script>window.__stxRouterConfig=${km(W)};</script>
|
|
2564
|
+
`}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-wf2wnmjg.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,F=v.lastIndexOf("</body>");return v.slice(0,F)+R+z+`
|
|
2565
|
+
</body>`+v.slice(F+7)}var Rm=Symbol.for("stx.lazy-module-promises");function eS(){let v=globalThis;return v[Rm]??=new Map,v[Rm]}function wt(v,_){let k=eS(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var hu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Mm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,tS=65536,nS=4,Ba=new Map;function pd(){Ba.clear()}function rS(v){let _=[];for(let k of ee(v,V)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function Ic(v,_={}){let k=v.length>=tS,R=k?Ba.get(v):void 0;if(R===void 0){if(R=rS(v),k)Id(Ba,nS),Ba.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function Cs(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:F}=Am(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:F}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:F}=Am(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:F}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Am(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function _s(v,_){return Yi(v,_)}function sS(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Nm(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function iS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${hu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ee(v,(B,z)=>{_.lastIndex=z;let F=_.exec(B);if(!F||F.index!==z||!k.test(F[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let F=z[2].match(k),W=Cs(F?.[1]??F?.[2]??""),U=[W.itemVar,W.indexVar].filter(Boolean);if(U.length===0)continue;let H=z[1],ie=/\/\s*>$/.test(B.token)||za.has(H.toLowerCase())?B.end:xu(v,B.start,H,B.end);if(ie!==-1)T.push({start:B.start,end:ie,vars:new Set(U)})}return T}var Tm=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 oS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Im(v,_,k,R){if(!v)return!1;let T=oS(v),B=!1,z=!1,F=!1,W=/([a-zA-Z_$][\w$]*)/g,U;while((U=W.exec(T))!==null){let Z=U[1];if(T.slice(0,U.index).trimEnd().endsWith("."))continue;if(Tm.has(Z))continue;if(_.has(Z)||R?.has(Z))B=!0;else if(k&&Z in k)z=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=H.exec(T))!==null){let Z=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if(Tm.has(Z)||k&&Z in k)continue;F=!0}return(B||F)&&!z}function La(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,""")}"`,T=v.trim(),B=T.match(Mm);if(B&&aS(B[3],B[1])){let[,z,F,W]=B;return`<${z}${F}${R}>${W}</${z}>`}return`<template${R}>${T}</template>`}function aS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function xi(v,_){let k=Nm(v);function R(T){let B=T,z=iS(T),F=(q)=>{let ie=new Set;for(let Z of z)if(q>Z.start&&q<Z.end)for(let Q of Z.vars)ie.add(Q);return ie},W=/@if\s*\(/g,U,H=[];while((U=W.exec(B))!==null){let q=U.index,ie=q+U[0].length,Z=1,Q=ie;while(Q<B.length&&Z>0){if(B[Q]==="(")Z++;else if(B[Q]===")")Z--;Q++}if(Z!==0)continue;let oe=B.substring(ie,Q-1).trim(),ae=Q,ce=1,ue=ae,le=/@(if\s*\(|endif)/g;le.lastIndex=ae;let Ae;while((Ae=le.exec(B))!==null)if(Ae[1].startsWith("if"))ce++;else if(Ae[1]==="endif"){if(ce--,ce===0){ue=Ae.index+Ae[0].length;break}}if(ce!==0)continue;let ve=B.substring(ae,ue-6).trim(),he;if(sS(ve)){let Te=mo(B.substring(q,ue));if(Te.length===0)continue;let De=Te[0].branches.filter((Ie)=>Ie.type!=="else"),Oe=F(q);if(!(De.length>0&&De.every((Ie)=>Im(Ie.condition,k,_,Oe))))continue;he=Te[0].branches.map((Ie)=>{let Be=R(Ie.content);if(Ie.type==="elseif")return La(Be,"@else-if",Ie.condition??"");if(Ie.type==="else")return La(Be,"@else");return La(Be,"@if",Ie.condition??"")}).join(`
|
|
2566
|
+
`)}else{if(!Im(oe,k,_,F(q)))continue;he=La(R(ve),"@if",oe)}H.push({start:q,end:ue,replacement:he}),W.lastIndex=ue}for(let q=H.length-1;q>=0;q--){let{start:ie,end:Z,replacement:Q}=H[q];B=B.substring(0,ie)+Q+B.substring(Z)}return B}return R(v)}function cS(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var za=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Pm=/<(script|style)\b/iy,lS=/<\/script/gi,uS=/<\/style/gi;function xu(v,_,k,R){if(za.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,F=R;while(F<B){let W=v.indexOf("<",F);if(W===-1)return-1;if(F=W,v.startsWith("<!--",F)){let ie=v.indexOf("-->",F+4);if(ie===-1)return-1;F=ie+3;continue}Pm.lastIndex=F;let U=Pm.exec(v);if(U){let ie=v.indexOf(">",F);if(ie===-1)return-1;if(v[ie-1]==="/"){F=ie+1;continue}let Z=U[1].toLowerCase()==="script"?lS:uS;Z.lastIndex=F;let Q=Z.exec(v);if(Q===null)return-1;let oe=v.indexOf(">",Q.index);if(oe===-1)return-1;F=oe+1;continue}if(v[F+1]==="/"){let ie=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(F,F+64));if(!ie){F++;continue}if(ie[1].toLowerCase()===T){if(z--,F+=ie[0].length,z===0)return F;continue}F+=ie[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(F,F+64));if(!H){F++;continue}let q=v.indexOf(">",F);if(q===-1)return-1;if(H[1].toLowerCase()===T){let ie=v.slice(F,q+1);if(!(/\/\s*>$/.test(ie)||za.has(T)))z++}F=q+1}return-1}var dS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function fS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return dS.test(B)}function Si(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(q)=>_.some(([ie,Z])=>q>=ie&&q<Z),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],F;while((F=B.exec(v))!==null){if(T(F.index))continue;let[q,ie,Z,Q,oe,ae,ce]=F,ue=cS(oe);if(ue===void 0)continue;let le=F.index,Ae=le+q.length,Te=!!ce||/\/\s*>$/.test(q)||za.has(ie.toLowerCase())?Ae:xu(v,le,ie,Ae);if(Te===-1)continue;if((Q===":if"||Q==="x-if"||Q==="@if")&&fS(v,Te)){B.lastIndex=Ae;continue}if(ue===!0){let Oe=`<${ie}${Z}${ae}${ce}>`;z.push({start:le,end:Ae,replacement:Oe});continue}z.push({start:le,end:Te,replacement:""}),B.lastIndex=Te}if(z.length===0)return v;z.sort((q,ie)=>q.start-ie.start);let W=[],U=-1;for(let q of z){if(q.start<U)continue;W.push(q),U=q.end}let H=v;for(let q=W.length-1;q>=0;q--){let{start:ie,end:Z,replacement:Q}=W[q];H=H.substring(0,ie)+Q+H.substring(Z)}return H}var Dm=[":for","@for","x-for"];function Es(v,_){if(!_||Object.keys(_).length===0)return v;if(!Dm.some((F)=>v.includes(`${F}=`)))return v;let k=Nm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let F of _.__stx_client_signal_names)if(typeof F==="string")k.add(F)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[F,W,U]=z,H=z.index,q=H+F.length,ie=Dm.map((he)=>({attr:he,m:new RegExp(`\\s${he}="([^"]*)"`).exec(U)})).find((he)=>he.m!==null);if(!ie||!ie.m)continue;let Z=Cs(ie.m[1]);if(!Z.iterable||!Z.itemVar)continue;let Q=Z.iterable.trim().split(/[.[(]/)[0].trim();if(!Q||k.has(Q)||!(Q in _))continue;let oe=xu(R,H,W,q);if(oe===-1)continue;let ae=U.replace(new RegExp(`\\s${ie.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ce=R.slice(q,oe-`</${W}>`.length),ue={..._,[Z.itemVar]:void 0};if(Z.indexVar)ue[Z.indexVar]=void 0;let le=Es(ce,ue),Ae=Z.indexVar?`${Z.iterable} as ${Z.indexVar} => ${Z.itemVar}`:`${Z.iterable} as ${Z.itemVar}`,ve=W.toLowerCase()==="template"?le:`<${W}${ae}>${le}</${W}>`;T.push({start:H,end:oe,replacement:`@foreach(${Ae})${ve}@endforeach`}),B.lastIndex=oe}for(let F=T.length-1;F>=0;F--){let{start:W,end:U,replacement:H}=T[F];R=R.slice(0,W)+H+R.slice(U)}return R}function Ts(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let F=T[1],W=T.index,U=W+T[0].length,H=1,q=U;while(q<k.length&&H>0){if(k[q]==="(")H++;else if(k[q]===")")H--;q++}if(H!==0)continue;let ie=k.substring(U,q-1).trim(),Z=q,Q=Cs(ie),oe=F==="for"?"@endfor":"@endforeach",ae=1,ce=Z,ue=F==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${F}\\s*\\(|end${F})`,"g");ue.lastIndex=Z;let le;while((le=ue.exec(k))!==null)if(le[1].startsWith(F))ae++;else if(ae--,ae===0){ce=le.index+le[0].length;break}if(ae!==0)continue;let Ae=()=>{let Me=[Q.itemVar,Q.indexVar].filter(Boolean);if(Me.length)z.push({start:W,end:ce,vars:Me})};if(Q.iterable){let Me=Q.iterable.trim();if(Me.startsWith("[")||Me.startsWith("{")||Me.startsWith("'")||Me.startsWith('"')||Me.startsWith("`")||/^-?\d/.test(Me)){Ae();continue}let Ne=Me.split(/[.[(]/)[0].trim(),Ie=_?Ne in _:!1,Be=z.some((Fe)=>W>Fe.start&&W<Fe.end&&Fe.vars.includes(Ne));if(Ne&&(Ie||Be)){Ae();continue}}if(Q.style==="as")ie=Q.indexVar?`(${Q.itemVar}, ${Q.indexVar}) in ${Q.iterable}`:`${Q.itemVar} in ${Q.iterable}`;let ve=k.substring(Z,ce-oe.length).trim(),he=_?{..._}:{};if(Q.itemVar)delete he[Q.itemVar];if(Q.indexVar)delete he[Q.indexVar];let Te=Ts(ve,he),De=Te.match(Mm),Oe;if(De){let[,Me,Ne,Ie]=De;Oe=`<${Me}${Ne} @for="${ie}">${Ie}</${Me}>`}else Oe=`<template @for="${ie}">${Te}</template>`;B.push({start:W,end:ce,replacement:Oe}),R.lastIndex=ce}for(let F=B.length-1;F>=0;F--){let{start:W,end:U,replacement:H}=B[F];k=k.substring(0,W)+H+k.substring(U)}return k}function pS(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(H)=>{let q=R+1;while(q<B){let ie=v[q];if(ie==="\\"){q+=2;continue}if(ie===H)return q+1;q++}return B},F=()=>{let H=R+2;while(H<B&&v[H]!==`
|
|
2567
|
+
`)H++;return H},W=()=>{let H=R+2;while(H<B-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return B},U=(H)=>{let q=H,ie=0;while(q<B){let Z=v[q];if(Z==="/"&&v[q+1]==="/"){let Q=q+2;while(Q<B&&v[Q]!==`
|
|
2568
|
+
`)Q++;q=Q;continue}if(Z==="/"&&v[q+1]==="*"){let Q=q+2;while(Q<B-1&&!(v[Q]==="*"&&v[Q+1]==="/"))Q++;q=Q+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let Q=q+1;while(Q<B){if(v[Q]==="\\"){Q+=2;continue}if(v[Q]===Z){Q++;break}Q++}q=Q;continue}if(Z==="("||Z==="["||Z==="{"){ie++,q++;continue}if(Z===")"||Z==="]"||Z==="}"){ie--,q++;continue}if(Z===";"&&ie===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let Z=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Z){let Q=Z[2],oe=U(R+Z[0].length);if(_.has(Q)){k.push(`/* stx: deduped const ${Q} */`),R=oe;continue}_.add(Q),k.push(v.slice(R,oe)),R=oe;continue}}}k.push(H),R++}return k.join("")}var gS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function yu(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function mS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!yu(T,T+_.length,k))return!0;R=T+_.length}return!1}function hS(v,_){if(mS(v,"<body",_)){let T=new RegExp(`<body(${hu})>`,"g"),B;while((B=T.exec(v))!==null)if(!yu(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${hu})>`,"gi"),R;while((R=k.exec(v))!==null){if(yu(R.index,R.index+R[0].length,_))continue;if(gS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function yS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,F=!1,W=(U)=>{if(k!==null&&!F&&k>=z&&k<=U)T.push(v.slice(z,k),B,v.slice(k,U)),F=!0;else T.push(v.slice(z,U))};for(let U of _){if(U.start<z)continue;W(U.start),z=U.end}return W(v.length),T.join("")}async function ar(v,_,k,R={}){let T=Ic(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|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*\(/,z=[],{hasUserImports:F,bundleClientScript:W}=await wt("stx/client-script-bundler",()=>import("./chunk-t9914jjh.js"));for(let le of T){let Ae=le.body;if(Ze(le.attrs))Ae=Qe(Ae);if(R.forceClientSetup||B.test(Ae)){z.push({content:Ae,start:le.start,end:le.end});continue}if(!F(Ae))continue;try{let ve=await W(At(Ae).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(ve))z.push({content:Ae,start:le.start,end:le.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let U=`${_??""}\x00${z.map((le)=>le.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,q=[];for(let le=0;le<z.length;le++){let Ae=z[le].bundled??At(z[le].content).code;if(!z[le].bundled&&F(Ae))Ae=await W(Ae,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});Ae=Ye(Ae);let ve=O(Ae);q.push(`// \u2500\u2500 merged signal script #${le+1} \u2500\u2500
|
|
2569
2569
|
${ve}`)}let ie=q.join(`
|
|
2570
2570
|
|
|
2571
2571
|
`);ie=pS(ie);let Z=Oc(ie),Q=Z.split(",").map((le)=>le.trim()).filter(Boolean),oe=mn(ie,k),ae=`
|
|
@@ -2577,114 +2577,114 @@ ${Li(`${oe}${ie}`)}
|
|
|
2577
2577
|
}
|
|
2578
2578
|
window.__stx_latestSetup=${H};
|
|
2579
2579
|
if(window.stx)window.stx._latestSetup=${H};
|
|
2580
|
-
</script>`,ce=hS(v,z);return{output:yS(v,z,ce,H),setupCode:ae}}function Oc(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,
|
|
2581
|
-
${T.slice(
|
|
2580
|
+
</script>`,ce=hS(v,z);return{output:yS(v,z,ce,H),setupCode:ae}}function Oc(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,F=()=>{if(T!==0)return;let W=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(W){let Z=W[2];if(!R.has(Z))k.push(Z),R.add(Z);return}let U=_.slice(B).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((Z)=>{let Q=Z.trim();if(!Q)return;let oe=Q.indexOf(":"),ce=(oe>=0?Q.slice(oe+1).trim():Q).split(/[\s=]/)[0];if(ce&&!R.has(ce))k.push(ce),R.add(ce)});return}let H=_.slice(B).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((Z)=>{let Q=Z.trim().replace(/^\.\.\./,"");if(!Q)return;let oe=Q.split(/[\s=]/)[0];if(oe&&!R.has(oe))k.push(oe),R.add(oe)});return}let q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let Z=q[1];if(!R.has(Z))k.push(Z),R.add(Z);return}let ie=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Z=ie[1];if(!R.has(Z))k.push(Z),R.add(Z)}};while(B<z){if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))F();B++}return k.join(", ")}async function ki(v,_,k,R){if(!_s(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:B,setupCode:z}=await ar(T,k,R);if(T=B,!z){let F=qn(T);if(F&&!/data-stx/.test(F.attrs)&&!/data-stx-auto/.test(F.attrs)){let W=F.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,F.index)+W+T.slice(F.index+F.tag.length)}}if(T=await ja(T,_),z){let F=Ci(T,/<\/head>/i),W=F===-1?Ci(T,/<body[^>]*>/i):-1;if(F!==-1)T=`${T.slice(0,F)}${z}
|
|
2581
|
+
${T.slice(F)}`;else if(W!==-1){let U=/<body[^>]*>/i.exec(T.slice(W))[0],H=W+U.length;T=`${T.slice(0,H)}
|
|
2582
2582
|
${z}${T.slice(H)}`}else T=`${T}
|
|
2583
|
-
${z}`}return T}function Ci(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,R=[],T;while((T=k.exec(v))!==null)R.push([T.index,T.index+T[0].length]);let B=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),z=0;while(z<v.length){let
|
|
2583
|
+
${z}`}return T}function Ci(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,R=[],T;while((T=k.exec(v))!==null)R.push([T.index,T.index+T[0].length]);let B=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),z=0;while(z<v.length){let F=B.exec(v.slice(z));if(!F)return-1;let W=z+F.index;if(!R.some(([H,q])=>W>=H&&W<q))return W;z=W+Math.max(F[0].length,1)}return-1}var Om="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Dc(v){let _=[];for(let k of v.split(",")){let R=k.trim();if(!R||R.startsWith("type "))continue;let T=R.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T&&T[1]!==T[2])_.push(`${T[2]} = ${T[1]}`)}if(_.length===0)return Om;return`var ${_.join(", ")}; ${Om}`}var xS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Ye(v){return v.replace(xS,(_,k)=>Dc(k))}import Fi from"path";import bS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[R,T]of Object.entries(bS.env)){if(!R.startsWith(v)||T===void 0)continue;_[`import.meta.env.${R}`]=JSON.stringify(T),k[R]=T}return _["import.meta.env"]=JSON.stringify(k),_}function jm(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function Lm(v,_,k){try{let R;if(v.startsWith("/")){let T=_;for(let B=0;B<5;B++){let z=Fi.join(T,v);if(await Bun.file(z).exists())return z;T=Fi.dirname(T)}R=Fi.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))R=Fi.resolve(_,v);else R=Fi.resolve(_,v);if(await Bun.file(R).exists())return R;return null}catch{return null}}var Bm=Symbol.for("stx.inline-assets.import-meta");function vS(v,_){if(!v.includes("import.meta"))return;let k=Error(`[stx] ${_} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
2584
2584
|
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw k[Bm]=!0,k}async function zm(v,_,k){let R=v,T=Fi.dirname(_),B=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,z;while((z=B.exec(R))!==null){let[U,H,q,ie]=z;if(jm(q))continue;let Z=await Lm(q,T,_);if(Z)try{let Q=await Bun.file(Z).text();if(k.add(Z),q.endsWith(".ts")||q.endsWith(".tsx")){let ae=await Bun.build({entrypoints:[Z],target:"browser",minify:!0,define:w()});if(ae.outputs.length>0)Q=await ae.outputs[0].text(),vS(Q,q)}let oe=`<script>
|
|
2585
2585
|
// Source: ${q}
|
|
2586
2586
|
${Q}
|
|
2587
|
-
</script>`;R=R.replace(U,oe),B.lastIndex=0}catch(Q){if(Q?.[Bm])throw Q}}let
|
|
2587
|
+
</script>`;R=R.replace(U,oe),B.lastIndex=0}catch(Q){if(Q?.[Bm])throw Q}}let F=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=F.exec(R))!==null){let[U,H,q,ie]=W,Z=H+ie;if(jm(q))continue;if(/rel=["']stylesheet["']/.test(Z)||q.endsWith(".css")){let oe=await Lm(q,T,_);if(oe)try{let ae=await Bun.file(oe).text();k.add(oe);let ce=`<style>
|
|
2588
2588
|
/* Source: ${q} */
|
|
2589
2589
|
${ae}
|
|
2590
|
-
</style>`;R=R.replace(U,ce),
|
|
2590
|
+
</style>`;R=R.replace(U,ce),F.lastIndex=0}catch(ae){}}}return R}function Ds(v,_){let k=v,R=/@json\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index,z=B+T[0].length-1,F=1,W=z+1,U=null,H=!1;while(W<k.length&&F>0){let le=k[W];if(H){H=!1,W++;continue}if(le==="\\"&&U){H=!0,W++;continue}if(U){if(le===U)U=null;W++;continue}if(le==='"'||le==="'"||le==="`"){U=le,W++;continue}if(le==="(")F++;else if(le===")"){if(F--,F===0)break}W++}if(F!==0)break;let q=k.substring(z+1,W).trim(),ie=k.substring(B,W+1),Z=-1,Q=0,oe=null,ae=!1;for(let le=0;le<q.length;le++){let Ae=q[le];if(ae){ae=!1;continue}if(Ae==="\\"&&oe){ae=!0;continue}if(oe){if(Ae===oe)oe=null;continue}if(Ae==='"'||Ae==="'"||Ae==="`"){oe=Ae;continue}if(Ae==="("||Ae==="["||Ae==="{")Q++;else if(Ae===")"||Ae==="]"||Ae==="}")Q--;if(Ae===","&&Q===0){Z=le;break}}let ce=Z>=0?q.substring(0,Z).trim():q,ue=Z>=0?q.substring(Z+1).trim():void 0;try{let le=ce.trim(),Ae;if(p(le))Ae=c(le,Object.keys(_))(...Object.values(_));else Ae=void 0;let ve;if(ue==="true")ve=JSON.stringify(Ae,null,2);else ve=JSON.stringify(Ae);let he=ve.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,B)+he+k.substring(W+1),R.lastIndex=B+he.length}catch(le){I.log(le instanceof Error?le:Error(String(le)),{directive:"@json"},"error"),R.lastIndex=B+ie.length}}return k}function Ns(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Um(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let B=R.index,z=B+R[0].length,F=1,W=z;while(W<_.length&&F>0){if(_[W]==="(")F++;else if(_[W]===")")F--;W++}if(F!==0)continue;let U=_.slice(z,W-1).trim(),H=W,q=_.slice(H),ie=q.indexOf("@endmemo");if(ie===-1)continue;let Z=q.slice(0,ie),Q=H+ie+8,oe=Z.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ae=oe?oe[0].length:0,ce=Z.slice(ae),ue=Z.match(/(\s*)$/),le=ue?ue[0].length:0,Ae=ce.slice(0,ce.length-le),ve=Ae.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),he;if(ve){let[Te,De,Oe="",Me]=ve,Ne=`<${De}${Oe} data-stx-memo="${U}"${Me}>`;he=Z.slice(0,ae)+Ne+Ae.slice(Te.length)+Z.slice(ae+Ae.length)}else he=`${Z.slice(0,ae)}<div data-stx-memo="${U}">${Ae}</div>${Z.slice(ae+Ae.length)}`;T.push({start:B,end:Q,replacement:he}),k.lastIndex=Q}for(let B=T.length-1;B>=0;B--){let z=T[B];_=_.slice(0,z.start)+z.replacement+_.slice(z.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function bu(v){let _=v.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return _=_.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),_}function Hm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=ee(v,(W,U)=>{k.lastIndex=U;let H=k.exec(W);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],B=0,z=0,F=[];for(let{start:W,end:U,token:H}of R){let q=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let Z;while(Z=T.pop()){if(Z.scoped)B--;if(Z.name===q)break}continue}let ie=/\sdata-stx-scope\s*=/.test(H);if(!B&&!ie&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))F.push(v.slice(z,W),H.replace(/\s*\/?>$/,(Z)=>` data-stx-ref-caller="${_}"${Z}`)),z=U;if(!qm.has(q)&&!/\/>$/.test(H)){if(T.push({name:q,scoped:ie}),ie)B++}}return F.push(v.slice(z)),F.join("")}var qm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Km=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Fm=/<\/?\s*([a-z][\w-]*)/iy,wS=/\s/;function SS(v,_){let k=_-1;while(k>=0&&wS.test(v[k]))k--;return k>=0&&v[k]==="/"}function $S(v,_){let k=!1,R=!1;for(let T=_;T<v.length;T++){let B=v[T];if(k){if(B==="'")k=!1}else if(R){if(B==='"')R=!1}else if(B==="'")k=!0;else if(B==='"')R=!0;else if(B===">")return T}return-1}function _S(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,R=_,T=!1,B=!1,z=!1;while(R<v.length){let F=v.indexOf("<",R),W=F===-1?v.length:F;if(W>R){if(k===0)while(R<W){let q=v.indexOf(B?"}":"{",R);if(q===-1||q>=W){if(B)z=!1;else T=!1;break}if(q>R)if(B)z=!1;else T=!1;if(B){if(z)return!0;z=!0}else if(T)B=!0,z=!1;else T=!0;R=q+1}R=W;continue}if(v.startsWith("<!--",R)){let q=v.indexOf("-->",R);R=q===-1?v.length:q+3;continue}let U=$S(v,R);if(U===-1)break;Fm.lastIndex=R;let H=Fm.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!SS(v,U)&&!qm.has(H))k++;R=U+1}return!1}var Wm=m(256);function Xm(v){if(v.length<1024)return Vm(v);let _=h(v),k=Wm.get(_);if(k!==void 0)return k;let R=Vm(v);return Wm.set(_,R),R}function Vm(v){if(v.length>=32768&&!Td(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index,F=z+B[0].length,W=!1,U=!1,H=-1;while(F<v.length){let ie=v[F];if(W){if(ie==="'")W=!1}else if(U){if(ie==='"')U=!1}else if(ie==="'")W=!0;else if(ie==='"')U=!0;else if(ie===">"){H=F;break}F++}if(H===-1)continue;let q=v.slice(z,H+1);if(Km.test(q))continue;if(q.includes("x-cloak"))continue;if(_S(v,H+1))R+=v.slice(T,H)+" x-cloak>",T=H+1}return R+=v.slice(T),R}var kS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,ES=/<\/script>/gi,CS=/<\/style>/gi;function Zm(v){let _=/<[a-z][\w-]*/gi,k="",R=0,T;while((T=_.exec(v))!==null){let B=T.index,z=T[0].slice(1).toLowerCase();if(z==="script"||z==="style"){let Q=z==="script"?ES:CS;Q.lastIndex=B;let oe=Q.exec(v);if(oe!==null)_.lastIndex=oe.index+oe[0].length;continue}let F=B+T[0].length,W=!1,U=!1,H=-1;while(F<v.length){let Q=v[F];if(W){if(Q==="'")W=!1}else if(U){if(Q==='"')U=!1}else if(Q==="'")W=!0;else if(Q==='"')U=!0;else if(Q===">"){H=F;break}F++}if(H===-1)continue;let q=v.slice(B+T[0].length,H);if(Km.test(q))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(q))continue;if(!kS.test(q))continue;let ie=v[H-1]==="/",Z=ie?H-1:H;k+=`${v.slice(R,Z)} x-cloak${ie?" ":""}`,R=Z}return k+=v.slice(R),k}var vu=m(256),RS=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],Gm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function AS(v){let _=Array.from(v,(T)=>T===`
|
|
2591
2591
|
`?`
|
|
2592
2592
|
`:" "),k=0,R="";while(k<v.length){let T=v[k],B=v[k+1];if(R){if(T==="\\"){k+=2;continue}if(T===R)R="";k++;continue}if(T==='"'||T==="'"||T==="`"){R=T,k++;continue}if(T==="/"&&B==="/"){while(k<v.length&&v[k]!==`
|
|
2593
|
-
`)_[k]=v[k],k++;continue}if(T==="/"&&B==="*"){let z=v.indexOf("*/",k+2),
|
|
2593
|
+
`)_[k]=v[k],k++;continue}if(T==="/"&&B==="*"){let z=v.indexOf("*/",k+2),F=z===-1?v.length:z+2;for(;k<F;k++)_[k]=v[k];continue}if(T==="{"&&B==="{"&&v.slice(k,k+4)==="{{--"){let z=v.indexOf("--}}",k+4),F=z===-1?v.length:z+4;for(;k<F;k++)_[k]=v[k];continue}k++}return _.join("")}function TS(v){let _=new Map,k=AS(v).split(`
|
|
2594
2594
|
`),R=v.split(`
|
|
2595
|
-
`);return k.forEach((T,B)=>{Gm.lastIndex=0;for(let z of T.matchAll(Gm)){let
|
|
2595
|
+
`);return k.forEach((T,B)=>{Gm.lastIndex=0;for(let z of T.matchAll(Gm)){let F=z[1]==="-next-line",W=(R[B]??"").slice(0,z.index).trim(),U=F||W===""?B+2:B+1,q=(z[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),ie=q.filter((Q)=>/\w/.test(Q));if(q.length>0&&ie.length===0)continue;let Z=_.get(U);if(Z&&Z.size===0)continue;if(ie.length===0){_.set(U,new Set);continue}if(Z)ie.forEach((Q)=>Z.add(Q));else _.set(U,new Set(ie))}}),_}function IS(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function Ms(v,_,k,R){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let B=h(v,_,R,JSON.stringify(T)),z=vu.get(B);if(z!==void 0){if(z&&T.failOnViolation)throw Error(z);return}let F=T.allowPatterns??[],W=TS(v),U=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(Q)=>Q.replace(/[^\n]/g," ")));for(let{pattern:Q,message:oe,suggestion:ae}of RS){if(F.some((ue)=>/\w/.test(ue)&&oe.includes(ue)))continue;Q.lastIndex=0;let ce=H.match(Q);if(ce&&ce.length>0){let ue=H.split(`
|
|
2596
2596
|
`),le=v.split(`
|
|
2597
|
-
`),Ae=[];if(ue.forEach((De,Oe)=>{if(Q.lastIndex=0,Q.test(De)&&!IS(
|
|
2597
|
+
`),Ae=[];if(ue.forEach((De,Oe)=>{if(Q.lastIndex=0,Q.test(De)&&!IS(W,Oe+1,oe))Ae.push(Oe+1)}),Ae.length===0&&ue.some((De)=>(Q.lastIndex=0,Q.test(De))))continue;let ve=Ae.length>0?` (script line${Ae.length>1?"s":""} ${Ae.join(", ")})`:"",he=Ae.slice(0,3).map((De)=>` ${De} | ${(le[De-1]??"").trim().slice(0,100)}`).join(`
|
|
2598
2598
|
`),Te=he?`
|
|
2599
2599
|
${he}`:"";U.push(` \u2717 ${oe}${ve}
|
|
2600
2600
|
\u2192 ${ae}${Te}`)}}if(U.length===0){vu.set(B,"");return}let q=(Q)=>{let oe=`${process.cwd()}/`;return Q.startsWith(oe)?Q.slice(oe.length):Q},Z=`[STX] DOM API violation in ${R&&R!==_?`${q(R)} (composed into ${q(_)})`:q(_)}:
|
|
2601
2601
|
${U.join(`
|
|
2602
2602
|
`)}
|
|
2603
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(vu.set(B,Z),T.failOnViolation)throw Error(Z);else console.warn(Z)}import wu from"path";var PS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,DS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function OS(v,_){if(!_||!v.includes("/"))return v;let k=wu.dirname(_);return v.replace(PS,(R,T,B,z)=>{let
|
|
2604
|
-
`,R+2),R===-1)return-1;R+=1,T=!0;continue}if(
|
|
2605
|
-
`){
|
|
2606
|
-
`)break;R++}T=!1;continue}if(
|
|
2603
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(vu.set(B,Z),T.failOnViolation)throw Error(Z);else console.warn(Z)}import wu from"path";var PS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,DS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function OS(v,_){if(!_||!v.includes("/"))return v;let k=wu.dirname(_);return v.replace(PS,(R,T,B,z)=>{let F=wu.resolve(k,z);return`${T}${B}${F.split(wu.sep).join("/")}${B}`})}function Jm(v,_){if(!_||!v.includes("<script"))return v;return v.replace(DS,(k,R,T,B)=>`${R}${OS(T,_)}${B}`)}var Jr="<!--PARENT_CONTENT_PLACEHOLDER-->";function Ym(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ih(v,_){let k=v.length,R=_,T=!0,B=[],z=(F)=>F+9<=k&&v[F]==="<"&&v[F+1]==="/"&&(v[F+2]==="s"||v[F+2]==="S")&&(v[F+3]==="c"||v[F+3]==="C")&&(v[F+4]==="r"||v[F+4]==="R")&&(v[F+5]==="i"||v[F+5]==="I")&&(v[F+6]==="p"||v[F+6]==="P")&&(v[F+7]==="t"||v[F+7]==="T")&&(v[F+8]===">"||/\s/.test(v[F+8]));while(R<k){let F=v[R];if(z(R))return R;if(F==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
|
|
2604
|
+
`,R+2),R===-1)return-1;R+=1,T=!0;continue}if(F==="/"&&v[R+1]==="*"){let W=v.indexOf("*/",R+2);if(W===-1)return-1;R=W+2,T=!0;continue}if(F==="/"&&T){let W=R+1,U=!1;while(W<k){let H=v[W];if(H==="\\"){W+=2;continue}if(H==="[")U=!0;else if(H==="]")U=!1;else if(H==="/"&&!U){W++;break}else if(H===`
|
|
2605
|
+
`){W=-1;break}W++}if(W===-1){R++,T=!1;continue}while(W<k&&/[a-z]/.test(v[W]))W++;R=W,T=!1;continue}if(F==="'"||F==='"'){let W=F;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===W){R++;break}if(v[R]===`
|
|
2606
|
+
`)break;R++}T=!1;continue}if(F==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(F==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(F));else if(/[)\].\w$]/.test(F))T=!1;else T=!0;R++}return-1}function oh(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var NS=4096;async function Qm(v,_,k){if(k.buildMode!=="serve"||_.length<NS)return null;let{registerServeModuleBundle:R}=await import("./chunk-wf2wnmjg.js");return`<script ${v} src="${R(_)}"></script>`}async function eh(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await wt("stx/client-module-registry",()=>import("./chunk-bn7fzfc2.js")),B=[],z=await T(R(...v),{minify:Zs(_.buildMode),collectInputs:B});for(let F of B)k?.add(F);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:F}=await import("./chunk-wf2wnmjg.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${F(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function jS(v,_=""){let k=oh(v,"data-stx-runtime");if(!k)return v;let R=lo(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
|
|
2607
2607
|
`+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),B=v.slice(0,k.start)+v.slice(k.end),z=lo(B);if(z===-1)return T+_+`
|
|
2608
2608
|
`+B;return B.slice(0,z)+T+_+`
|
|
2609
|
-
`+B.slice(z)}function LS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=Se(v,k);let B=!_.__stxProcessingDepth;Sn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await _n(_,k,R.runtimeConfig);if(B)qu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Gs(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Dn())&&k&&k.endsWith(".stx"))so(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await BS(v,_,k,R,T);if(B)z=bu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let
|
|
2610
|
-
`),...U.htmlAttrs&&{htmlAttrs:Ui(
|
|
2609
|
+
`+B.slice(z)}function LS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=Se(v,k);let B=!_.__stxProcessingDepth;Sn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await _n(_,k,R.runtimeConfig);if(B)qu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Gs(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Dn())&&k&&k.endsWith(".stx"))so(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await BS(v,_,k,R,T);if(B)z=bu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let F=ye(R.app?.head,{known:Pn,source:"app.head"}),U=(_.__stx_runtime_head||null)??Xs(),H=(_.__stx_head_raw||"").trim(),q,ie=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(ie)q=ie[1].trim(),H=H.replace(ie[0],"").trim();let Z=_.__sections?.title,Q=U.title||q||Z,oe=!U.title&&(!!q||!!Z),ae=U.meta||[],ce=new Set(ae.map((Te)=>$e(Te)).filter(Boolean)),ue={...F,...Q&&{title:Q},meta:[...(F.meta||[]).filter((Te)=>!ce.has($e(Te))),...ae],link:[...F.link||[],...U.link||[]],script:[...F.script||[],...U.script||[]],headRaw:[F.headRaw,H].filter(Boolean).join(`
|
|
2610
|
+
`),...U.htmlAttrs&&{htmlAttrs:Ui(F.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...F.bodyAttrs||{},...U.bodyAttrs}}},le=Ks(z);if(z=Rn(z,ue,{...oe&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},le),le)z=qi(z,F),z=$n(z,ue.htmlAttrs);let Ae=z.match(/<!-- stx-layout: ([^ ]+) -->/);if(Ae&&z.includes("<head")){let Te=Ae[1],De=$r(Te);z=z.replace(/<head\b[^>]*>/i,(Oe)=>`${Oe}
|
|
2611
2611
|
<meta name="stx-layout" content="${Ym(Te)}">
|
|
2612
|
-
<meta name="stx-layout-group" content="${Ym(De)}">`)}let ve=z.match(/function (__stx_setup_\w+)\(/),he=ve?qn(z):null;if(ve&&he&&!/\bdata-stx=/.test(he.tag)){z=fs(z,(De,Oe)=>`<body${Oe} data-stx="${ve[1]}">`);let Te=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ve[1]}"`,"i");z=z.replace(Te,"$1")}}if(B){let
|
|
2613
|
-
${Q}`).join("");z=jS(z,Z)}else{let
|
|
2614
|
-
`+z.slice(U)}}if(B)z=Vi(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=oo(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=LS(z),B&&_.__stx_runtime_config)z=nt(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let
|
|
2615
|
-
${
|
|
2616
|
-
@endsection`}if(!ce&&!le&&
|
|
2617
|
-
${
|
|
2618
|
-
@endsection`}}if(ce&&
|
|
2612
|
+
<meta name="stx-layout-group" content="${Ym(De)}">`)}let ve=z.match(/function (__stx_setup_\w+)\(/),he=ve?qn(z):null;if(ve&&he&&!/\bdata-stx=/.test(he.tag)){z=fs(z,(De,Oe)=>`<body${Oe} data-stx="${ve[1]}">`);let Te=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ve[1]}"`,"i");z=z.replace(Te,"$1")}}if(B){let F=_.__stx_head_injections??Gs(),W=Wi(z);if(W!==null)F.beforeClose.push(W);let U=ym(z);if(U!==null)F.afterOpen.push(U);if(R.offline?.enabled&&!z.includes("data-stx-offline"))F.beforeClose.push(xm);z=Hi(z,F);let H=R.app?.colorMode;if(H)z=Tn(z,H)}if(B)if(oh(z,"data-stx-runtime")){let W=null,U=null,H=null,q=null,ie=null;try{let{getStoreScript:Q}=await wt("stx/store-loader",()=>import("./chunk-esac5ych.js")),oe=R.storesDir,ae=await Q(oe);if(ae)H=`<script data-stx-stores>${ae}</script>`,U=await Qm("data-stx-stores",ae,R)??H}catch{}W=await eh([z,H],R,T);try{let{getFrameworkComposableScript:Q}=await wt("stx/framework-composables",()=>import("./chunk-hvqjs9ps.js"));ie=await Q(z)}catch{}try{let{getComposableScript:Q}=await wt("stx/composable-loader",()=>import("./chunk-hvd9qc98.js")),oe=R.composablesDir,ae=[W,H,ie].filter((ue)=>ue!==null),ce=await Q(R._layerComposableDirs??oe,z,ae);if(ce)q=await Qm('data-stx-scoped data-stx-run="always" data-stx-composables',ce,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ce}</script>`}catch{}let Z=[W,U,q,ie].filter((Q)=>Q!==null).map((Q)=>`
|
|
2613
|
+
${Q}`).join("");z=jS(z,Z)}else{let W=await eh([z],R,T);if(W){let U=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(U!==-1)z=z.slice(0,U)+W+`
|
|
2614
|
+
`+z.slice(U)}}if(B)z=Vi(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=oo(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=LS(z),B&&_.__stx_runtime_config)z=nt(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let F=cr(_);if(F){let W=/<head\b[^>]*>/i.exec(z),U=W?W.index+W[0].length:0;z=z.slice(0,U)+F+z.slice(U)}}return z})}catch(z){if(z instanceof xr)throw z;let F=z instanceof Error?z.message:String(z),W=new Y(`Template processing failed: ${F}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(I.log(W,{filePath:k,context:_}),Ft.logDetailedError(W,{filePath:k,template:v.substring(0,500)}),R.debug)throw W;return Js.createFallbackContent("Template Processing",W)}}async function BS(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!cn.isAbsolute(R.partialsDir)?cn.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!cn.isAbsolute(R.componentsDir)?cn.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!cn.isAbsolute(R.layoutsDir)?cn.resolve(B,R.layoutsDir):R.layoutsDir},F=z,W=v;await WS(k,_),FS(_,F),W=await se(()=>am(W,_,k,F),W,(ve)=>{I.log(ve,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ve.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Wn(W,We,(ve,he)=>`\x00STX_HTML_COMMENT_${he}\x00`);W=U.output;let H=U.tokens,q=(ve)=>H.length===0?ve:ve.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(he,Te)=>H[Number(Te)]??""),ie="\x00STX_ESCAPED_AT\x00",Z="\x00STX_ESC_MUSTACHE_OPEN\x00",Q="\x00STX_ESC_MUSTACHE_CLOSE\x00";W=W.replace(/@@/g,ie),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(ve,he)=>`${Z}${he}${Q}`),W=fm(W),W=await zm(W,k,T);let oe={};W=Ps(W,oe);let ae={..._.__sections||{}},ce="",ue=Hf(Ge(v)),le=/@nolayout\b/.test(W)||ue===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let Ae=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Ae)ce=Ae[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ue==="string"){if(ce=ue,!/@section\s*\(/.test(W))W=`@section('content')
|
|
2615
|
+
${W.trim()}
|
|
2616
|
+
@endsection`}if(!ce&&!le&&F.defaultLayout){let ve=Bt(W),he=/@section\s*\(/.test(W);if(!ve||he){let Te="",De=cn.dirname(k),Oe=F.layoutsDir?cn.dirname(F.layoutsDir):process.cwd();for(let Me=0;Me<20;Me++){let Ne=cn.join(De,"_layout.stx");if(await r(Ne)){Te=Ne;break}let Ie=cn.dirname(De);if(Ie===De||Ie.length<Oe.length)break;De=Ie}if(Te)ce=Te;else if(F.layoutsDir){let Me=cn.isAbsolute(F.layoutsDir)?F.layoutsDir:cn.resolve(process.cwd(),F.layoutsDir),Ne=cn.join(Me,`${F.defaultLayout}.stx`);if(await r(Ne))ce=Ne}if(ce&&!he)W=`@section('content')
|
|
2617
|
+
${W.trim()}
|
|
2618
|
+
@endsection`}}if(ce&&W.includes("<script")){let ve=pn(W),he=ve.scripts.map((Te)=>th(Te,k)??Te);W=as(ve.output,he)}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ve,he,Te)=>(ae[he]=Te,"")),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ve,he,Te)=>{if(/^(['"]).*\1$/.test(Te.trim()))return ve;try{let De=l(Te.trim(),_);if(De===void 0)return ve;return ae[he]=String(De??""),""}catch{return ve}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ve,he,Te)=>{if(Te.includes("@parent"))ae[he]=Te.replace("@parent",Jr);else ae[he]=Te.trim();return""}),_.__sections=ae,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ve,he,Te)=>ae[he]||Te||""),!("slot"in _)||_.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>ae.content||"");if(W=Is(W,oe),ce){let ve=[],he=pn(W),Te=Wn(he.output,os,(De,Oe)=>`\x00STX_ORPHAN_STYLE_${Oe}\x00`);if(W=Te.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(De,Oe,Me)=>{let Ne=Oe==="SCRIPT"?th(he.scripts[Number(Me)],k):Te.tokens[Number(Me)];if(Ne)ve.push(Ne);return""}),ve.length>0){let De=ve.join(`
|
|
2619
2619
|
`);ae.content=ae.content?`${ae.content}
|
|
2620
|
-
${De}`:De,_.__sections=ae}}if(ce)try{let ve;if(cn.isAbsolute(ce))ve=ce,T.add(ce);else ve=await se(()=>ur(ce,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ce}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Ne=(Fe)=>{if(!Fe)return[];try{let
|
|
2621
|
-
${
|
|
2622
|
-
`;if(B=Me(B,_),B=Ne(B,_,k),B=lm(B),B=El(B,_),B=Ap(B),B=im(B),B=await As(B,_,k,z,T),B=await ks(B,_,k,z,T),_.__stxProcessingDepth===1)B=xd(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=bu(B),B=yr(B,_,k),B=Rs(B),B=qf(B,_,{filePath:k,buildMode:z.buildMode}),B=Cl(B,_),B=Rl(B,_),B=ba(B,_),B=jp(B,_),B=Lp(B,_),B=await bp(B,_,k,z),B=await Yf(B,_,k),B=await Ii(B,_,k,z),B=Oi(B,_,k,z),B=Hs(B,_,k,z),B=Vs(B,_,k),B=Us(B,_,k,z),B=Cp(B,_,k,z),B=Ds(B,_),B=Ns(B),B=Um(B),!z.skipEventDirectives)B=ju(B,_,k);if(B=Zf(B,_,k),z.debug){let
|
|
2620
|
+
${De}`:De,_.__sections=ae}}if(ce)try{let ve;if(cn.isAbsolute(ce))ve=ce,T.add(ce);else ve=await se(()=>ur(ce,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ce}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Ne=(Fe)=>{if(!Fe)return[];try{let Le=cn.isAbsolute(Fe)?Fe:cn.resolve(process.cwd(),Fe);return MS.readdirSync(Le).filter((je)=>je.endsWith(".stx")).map((je)=>je.replace(/\.stx$/,""))}catch{return[]}},Ie=[...Ne(z.layoutsDir),...Ne(z.fallbackLayoutsDir)].filter((Fe,Le,je)=>je.indexOf(Fe)===Le).sort(),Be=`Layout not found: ${ce} (referenced from ${k})`+(Ie.length>0?`. Available layouts: ${Ie.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(I.log(Error(Be),{layoutPath:ce,filePath:k,available:Ie},"error"),console.error(`[stx] ${Be}`),z.debug)throw new Y(Be,k);return W}let he=await se(()=>Bun.file(ve).text(),"",()=>{throw new Y(`Failed to read layout file: ${ve}`,k,void 0,void 0,"Layout content could not be loaded")});he=Jm(he,ve);let Te=he.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Te){if(z.debug)console.log(`Found nested layout: ${Te[1]} in ${ve}`);let Ne={},Ie=he.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Le,je,rt)=>(Ne[je]=rt.trim(),""));for(let[Le,je]of Object.entries(Ne))if(ae[Le]&&ae[Le].includes(Jr)){let rt=ae[Le].indexOf(Jr);ae[Le]=ae[Le].slice(0,rt)+je+ae[Le].slice(rt+Jr.length)}else if(!ae[Le])ae[Le]=je;let Be={..._,__sections:ae},Fe=`@layout('${Te[1]}')${Ie}`;return await n(Fe,Be,ve,z,T)}let De=he.replace(/\{\{--[\s\S]*?--\}\}/g,""),Oe=Ps(De,oe),Me={};return Oe=Oe.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ne,Ie,Be)=>(Me[Ie]=Be.trim(),`@slot('${Ie}')`)),Oe=Oe.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Ne,Ie,Be)=>{if(ae[Ie]){let Fe=ae[Ie];if(Fe.includes(Jr)){let Le=Me[Ie]||"",je=Fe.indexOf(Jr);Fe=Fe.slice(0,je)+Le+Fe.slice(je+Jr.length)}return Fe}return Be||""}),Oe=zS(Oe,ae),Oe=Oe.replace(/\{\{\s*slot\s*\}\}/g,()=>ae.content||""),Oe=Is(Oe,oe),_.__originalFilePath=k,W=await sh(Oe,_,ve,z,T),W=`<!-- stx-layout: ${ce} -->
|
|
2621
|
+
${W}`,q(W)}catch(ve){return I.log(ve instanceof Error?ve:Error(String(ve)),{layoutPath:ce,filePath:k},"error"),`[Error processing layout: ${ve instanceof Error?ve.message:String(ve)}]`}return q(await sh(W,_,k,z,T))}function zS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function FS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function WS(v,_){await se(()=>um(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Su="data-stx-source";function th(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Su))return v;return`<script ${Su}="${encodeURIComponent(_)}"${v.slice(7)}`}function VS(v){let _=new RegExp(`${Su}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function nh(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function rh(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${nh(v)}</span><span style="display:block;margin-top:4px">${nh(k)}</span></div>`}async function US(v,_,k,R){let{scanScriptTags:T}=await wt("stx/signal-processing",()=>import("./chunk-00vp75pj.js")),B=[],z=!E()&&!Dn();for(let W of T(v)){let U=W.attrs;if(!/\bserver\b/.test(U))continue;let H=W.start+W.fullMatch.indexOf(">")+1,q=ih(v,H);if(q===-1)continue;let ie=v.slice(H,q);if(!ie.trim())continue;let Z=VS(U)??k,Q={index:W.start,length:q+9-W.start};try{let{extractVariables:oe}=await wt("stx/variable-extractor",()=>import("./chunk-8txwa114.js"));await oe(ie,_,Z,{preserveExisting:!0,onFailure:(ae)=>{if(ae.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:Z,kind:ae.kind,message:ae.message}),!z)return;B.push({...Q,markup:rh(Z,ae.kind,ae.message)})}})}catch(oe){let ae=oe instanceof Error?oe:Error(String(oe));if(I.log(ae,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${ae.message}`),z)B.push({...Q,markup:rh(Z,"unknown",ae.message)})}}if(B.length===0)return v;let F=v;for(let W of B.sort((U,H)=>H.index-U.index))F=F.slice(0,W.index)+W.markup+F.slice(W.index+W.length);return F}async function HS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await wt("stx/expressions",()=>import("./chunk-bpz3yv92.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function sh(v,_,k,R,T){let B=v,z=R;if(B=await US(B,_,k,R),B=await HS(B,_,k),B=await Zg(B,_,k),B=await Gg(B,_,k),B=await Tp(B,_,k,z),Se(B))B=xi(B,_),B=Ts(B,_),B=Es(B,_);B=Si(B);let{processStreamDirectives:F}=await wt("stx/streaming",()=>import("./chunk-djqmzzn6.js"));B=F(B,_),B=Ti(B,_,k,z,!0),B=await hm(B,_,k,z,T),B=await ks(B,_,k,z,T),B=Uf(B,_,k,z);let{processDeferDirectives:W}=await wt("stx/defer",()=>import("./chunk-8992smwz.js"));B=W(B,_,k);let{processTeleportDirectives:U}=await wt("stx/teleport",()=>import("./chunk-7dkwf9h5.js"));B=U(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await wt("stx/transitions",()=>import("./chunk-0hpw65yr.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:ie,stripRenderFailedMarkers:Z}=await wt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=ie(B,_,k),B=Z(B);let{processSuspenseDirectives:Q}=await wt("stx/suspense",()=>import("./chunk-2wb1w0p6.js"));B=Q(B,_,k);let{processAsyncDirectives:oe}=await wt("stx/async-components",()=>import("./chunk-2c7ysn9s.js"));B=oe(B,_,k);let{processKeepAliveDirectives:ae}=await wt("stx/keep-alive",()=>import("./chunk-esj49jvz.js"));B=ae(B,_,k);let{processVirtualListDirectives:ce,processVirtualGridDirectives:ue,processInfiniteListDirectives:le}=await wt("stx/virtual-scrolling",()=>import("./chunk-r0e743c3.js"));B=ce(B,_,k),B=ue(B,_,k),B=le(B,_,k);let{processPartialHydrationDirectives:Ae,processStaticDirectives:ve}=await wt("stx/partial-hydration",()=>import("./chunk-shzesarq.js"));B=Ae(B,_,k),B=ve(B);let{processComputedDirectives:he,processWatchDirectives:Te}=await wt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=he(B,_,k),B=Te(B,_,k);let{processFormValidationDirectives:De}=await wt("stx/forms-validation",()=>import("./chunk-wr6gw263.js"));B=De(B,_,k);let{processHeadDirective:Oe,processTitleDirective:Me,processMetaDirective:Ne,resetHead:Ie}=await wt("stx/head",()=>import("./chunk-2qt63502.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)Ie();let Be=Oe(B);if(B=Be.content,Be.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Be.headContent}
|
|
2622
|
+
`;if(B=Me(B,_),B=Ne(B,_,k),B=lm(B),B=El(B,_),B=Ap(B),B=im(B),B=await As(B,_,k,z,T),B=await ks(B,_,k,z,T),_.__stxProcessingDepth===1)B=xd(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=bu(B),B=yr(B,_,k),B=Rs(B),B=qf(B,_,{filePath:k,buildMode:z.buildMode}),B=Cl(B,_),B=Rl(B,_),B=ba(B,_),B=jp(B,_),B=Lp(B,_),B=await bp(B,_,k,z),B=await Yf(B,_,k),B=await Ii(B,_,k,z),B=Oi(B,_,k,z),B=Hs(B,_,k,z),B=Vs(B,_,k),B=Us(B,_,k,z),B=Cp(B,_,k,z),B=Ds(B,_),B=Ns(B),B=Um(B),!z.skipEventDirectives)B=ju(B,_,k);if(B=Zf(B,_,k),z.debug){let ht=/\bx-data\s*=/.test(B),dt=_s(v);if(ht&&dt)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2623
2623
|
Both work on the same page, but they manage separate scopes.
|
|
2624
|
-
Prefer signals (state/derived/effect) for new components.`)}B=yg(B,_),B=await X(B,_,k),B=Xm(B),B=Zm(B),B=Mf(B);let{processXElementDirectives:Fe}=await wt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Fe(B);let
|
|
2625
|
-
</head>`);if(/<head\b[^>]*>/i.test(
|
|
2626
|
-
${
|
|
2624
|
+
Prefer signals (state/derived/effect) for new components.`)}B=yg(B,_),B=await X(B,_,k),B=Xm(B),B=Zm(B),B=Mf(B);let{processXElementDirectives:Fe}=await wt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Fe(B);let Le=_.__originalFilePath||k,je=we(_);if(B=await ki(B,z,Le,je),B=Op(B,_),B=await cm(B,_,k,z),z.media?.image?.autoSiblings){let ht=z.publicDir||"public",{rewriteImagesWithSiblings:dt}=await wt("stx/image-optimization/auto-sibling",()=>import("./chunk-qq59xzwc.js"));B=await dt(B,{publicDir:ht})}if(z.seo?.enabled)B=Ws(B,_,z);let rt=(ht,dt,vt=!0)=>{if(!dt)return ht;let zt=dt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Zt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(ht),Jt=Zt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Zt[0]):null;if(zt&&Zt&&Jt){if(vt){let ln=Zt.index+Jt.index;ht=ht.slice(0,ln)+zt[0]+ht.slice(ln+Jt[0].length)}if(dt=dt.replace(zt[0],"").trim(),!dt)return ht}if(/<\/head>/i.test(ht))return ht.replace(/<\/head>/i,`${dt}
|
|
2625
|
+
</head>`);if(/<head\b[^>]*>/i.test(ht))return ht.replace(/(<head\b[^>]*>)/i,`$1
|
|
2626
|
+
${dt}`);if(/<html\b[^>]*>/i.test(ht))return ht.replace(/(<html\b[^>]*>)/i,`$1
|
|
2627
2627
|
<head>
|
|
2628
|
-
${
|
|
2629
|
-
</head>`);return
|
|
2628
|
+
${dt}
|
|
2629
|
+
</head>`);return ht},{renderHead:gt,getHead:mt}=await wt("stx/head",()=>import("./chunk-2qt63502.js")),ut=_.__stx_runtime_head??mt();if(ut.title||ut.meta?.length||ut.link?.length){let ht=gt(ut);if(ht)B=rt(B,ht)}if(Be.headContent)B=rt(B,Be.headContent,!ut.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=kp(B,z.csp,_);if(z.analytics?.enabled)B=Nf(B,z);if(z.heatmap?.enabled)B=Lf(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:ht}=await wt("stx/pwa/inject",()=>import("./chunk-ffykng6w.js"));B=ht(B,z)}let $t=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),St=/\bSTX\.\w+/.test(B),xt=/window\.STX\s*=/.test(B);if($t&&St&&!xt){let dt=`<script data-stx-scoped data-stx-run="once">
|
|
2630
2630
|
${Pf()}
|
|
2631
|
-
</script>`;if(B.includes("</head>")){let vt=B.indexOf("</head>"),Zt=B.slice(0,vt).indexOf("<script");if(Zt!==-1){let Jt=B.slice(0,Zt),ln=B.slice(Zt);B=Jt+
|
|
2632
|
-
`+ln}else B=B.replace("</head>",`${
|
|
2631
|
+
</script>`;if(B.includes("</head>")){let vt=B.indexOf("</head>"),Zt=B.slice(0,vt).indexOf("<script");if(Zt!==-1){let Jt=B.slice(0,Zt),ln=B.slice(Zt);B=Jt+dt+`
|
|
2632
|
+
`+ln}else B=B.replace("</head>",`${dt}
|
|
2633
2633
|
</head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
|
|
2634
|
-
${
|
|
2635
|
-
`+B}{let{scanScriptTags:
|
|
2636
|
-
`+B.slice(vt)}_.__stx_event_bindings=[]}}if(!fe(B)&&Em(B))B=await ja(B,z);if(B=Cm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=Ep(B,_.cspNonce);return B}var qS=[{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"}],KS=[{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')"}],XS=[{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 Uc(v){let _=[],k=[];return ZS(v,_),GS(v,_,k),JS(v,k),YS(v,_),{valid:_.length===0,errors:_,warnings:k}}function ZS(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function GS(v,_,k){for(let R of qS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,
|
|
2634
|
+
${dt}`);else B=dt+`
|
|
2635
|
+
`+B}{let{scanScriptTags:ht}=await wt("stx/signal-processing",()=>import("./chunk-00vp75pj.js")),dt=[];for(let vt of ht(B)){if(!/\bserver\b/i.test(vt.attrs))continue;let zt=vt.start+vt.fullMatch.indexOf(">")+1,Zt=ih(B,zt);if(Zt===-1)continue;let Jt=Zt+9;while(Jt<B.length&&/\s/.test(B[Jt]))Jt++;dt.push({start:vt.start,end:Jt})}if(dt.length>0){let vt=Array(dt.length+1),zt=0;for(let Zt=0;Zt<dt.length;Zt++){let{start:Jt,end:ln}=dt[Zt];vt[Zt]=B.slice(zt,Jt),zt=ln}vt[dt.length]=B.slice(zt),B=vt.join("")}}let at=ra(B,k);if(at.hasScoped)B=at.html;let kt=_.__stx_event_bindings||[],bt=!1,Xt=[],Fn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Nn}=await wt("stx/signal-processing",()=>import("./chunk-00vp75pj.js"));for(let ht of Nn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Xt.push({match:ht.fullMatch,attrs:ht.attrs,content:ht.body});for(let{match:ht,attrs:dt,content:vt}of Xt){bt=!0;let zt=vt;Ms(vt,k,R.strict,_.__originalFilePath);let Zt=await xe(vt,{eventBindings:kt,attrs:dt,hasColonDirectives:Fn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Zs(R.buildMode),serverData:je});B=B.replace(ht,()=>Zt)}if(bt)_.__stx_event_bindings=[];if(!bt&&_.__stxProcessingDepth===1){let ht=_.__stx_event_bindings||[];if(ht.length>0){let dt=Ja(ht);if(dt){let vt=B.lastIndexOf("</body>");B=vt===-1?B+dt:B.slice(0,vt)+dt+`
|
|
2636
|
+
`+B.slice(vt)}_.__stx_event_bindings=[]}}if(!fe(B)&&Em(B))B=await ja(B,z);if(B=Cm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=Ep(B,_.cspNonce);return B}var qS=[{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"}],KS=[{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')"}],XS=[{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 Uc(v){let _=[],k=[];return ZS(v,_),GS(v,_,k),JS(v,k),YS(v,_),{valid:_.length===0,errors:_,warnings:k}}function ZS(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function GS(v,_,k){for(let R of qS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,F=(v.match(B)||[]).length;if(R.altClose){let W=new RegExp(R.altClose,"g");F+=(v.match(W)||[]).length}if(z>F)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${F} closing`,suggestion:`Add ${z-F} missing ${R.close} tag(s)`});else if(F>z)k.push({type:"directive",message:`Extra ${R.close} found: ${F-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function JS(v,_){for(let k of KS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function YS(v,_){for(let k of XS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Wc(v,_){let k=v.slice(0,_).split(`
|
|
2637
2637
|
`);return{line:k.length,column:k[k.length-1].length+1}}function qc(v,_,k){let R=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))R.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(k.length===0)R.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)R.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)R.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return R}function Gc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Kc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let R of _){let T=R[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Kn from"path";import Gi from"process";var Mt=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","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"];var ah=new Set(Mt),QS=new Set(["props","$props","defineProps"]),e0=new Set(["stx","@stacksjs/stx"]),ch=m(128),lh=m(64);function t0(v){let _=[],k=0,R=v.split(`
|
|
2638
|
-
`);for(let T of R){let B=k,z=null,
|
|
2638
|
+
`);for(let T of R){let B=k,z=null,F=!1;for(let W=0;W<T.length;W++){let U=T[W];if(F){F=!1;continue}if(U==="\\"){F=!0;continue}if(z){if(U===z)z=null;continue}if(U==="'"||U==='"'||U==="`"){z=U;continue}if(U==="/"&&W+1<T.length&&T[W+1]==="/")break;if(U==="{")k++;else if(U==="}")k--}if(B===0){let W=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)_.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let U=T.match(/(?:const|let|var)\s+(\w+)/);if(U)_.push(U[1])}else{let U=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let q=U[1].slice(1,-1).split(",").map((ie)=>{let Z=ie.split(":");return(Z.length>1?Z[1]:Z[0]).trim()}).filter((ie)=>/^\w+$/.test(ie));_.push(...q)}}}}return[...new Set(_)]}function Nc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(R){if(!R.includes(":"))return R;let T=[],B="",z=0,F=0,W=null;for(let U=0;U<R.length;U++){let H=R[U];if(W){if(B+=H,H===W)W=null;continue}if(H==='"'||H==="'"||H==="`"){W=H,B+=H;continue}if(H==="<")z++;else if(H===">"&&z>0)z--;else if(H==="(")F++;else if(H===")")F--;if(H===","&&z===0&&F===0){T.push(B),B="";continue}B+=H}if(B)T.push(B);return T.map((U)=>{let H=U.trim(),q=H.startsWith("..."),ie=q?H.slice(3):H,Z=-1,Q=0;for(let ve=0;ve<ie.length;ve++)if(ie[ve]==="<")Q++;else if(ie[ve]===">")Q--;else if(ie[ve]===":"&&Q===0){Z=ve;break}if(Z===-1)return U;let ae=ie.substring(0,Z).trim().replace(/\?$/,""),ce=ie.substring(Z+1),ue=-1,le=0;for(let ve=0;ve<ce.length;ve++)if(ce[ve]==="<")le++;else if(ce[ve]===">")le--;else if(ce[ve]==="="&&le===0){ue=ve;break}let Ae=q?"...":"";if(ue!==-1)return`${Ae}${ae} = ${ce.substring(ue+1).trim()}`;return`${Ae}${ae}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,B)=>{if(!B.includes(":"))return R;return`${T}(${k(B)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,B=[];while((T=R.exec(_))!==null){let z=T.index+T[0].length-1,F=1,W=z+1,U=0,H=null;while(W<_.length&&F>0){let Z=_[W];if(H){if(Z===H)H=null;W++;continue}if(Z==='"'||Z==="'"||Z==="`"){H=Z,W++;continue}if(Z==="<")U++;else if(Z===">"&&U>0)U--;else if(U===0){if(Z==="(")F++;else if(Z===")")F--}if(F>0)W++}if(F!==0)continue;let q=_.substring(z+1,W);if(!q.includes(":"))continue;let ie=k(q);B.push({start:z+1,end:W,replacement:ie})}for(let z=B.length-1;z>=0;z--){let{start:F,end:W,replacement:U}=B[z];_=_.substring(0,F)+U+_.substring(W)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(R,T)=>{if(!T.includes(":"))return R;if(T.includes("{")||T.includes("}"))return R;return`(${T.split(",").map((z)=>{let[F,...W]=z.split("="),U=F.split(":")[0].trim();if(W.length>0)return`${U} = ${W.join("=").trim()}`;return U}).join(", ")}) =>`}),_=_.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"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
|
|
2639
2639
|
|
|
2640
|
-
`),_}function Mc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function Lc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function jc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Bc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var uh=new Set;async function u(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=ch.get(B);if(z===void 0){try{let
|
|
2641
|
-
`),Oo=_.params??{},Mo=[],br=[];for(let ot=0;ot<
|
|
2642
|
-
${
|
|
2640
|
+
`),_}function Mc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function Lc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function jc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Bc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var uh=new Set;async function u(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=ch.get(B);if(z===void 0){try{let ze=j({loader:"ts",target:"browser",define:T}),He=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");He=He.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=ze.transformSync(He)}catch{z=Nc(v)}ch.set(B,z)}let F={exports:{}},W=F.exports,U=Gi.cwd(),H={},q=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ze)=>ze[1]).filter((ze)=>!ze.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ze)),ie=new Map;for(let ze of q)try{if(ze.startsWith(".")){H[ze]=await import(Kn.resolve(Kn.dirname(k),ze));continue}let He=Kn.resolve(U,"node_modules",ze),ft=Kn.join(He,"package.json"),Et=JSON.parse(d("fs").readFileSync(ft,"utf8")),Wt=Et.main||"index.js";if(Et.exports){let nn=typeof Et.exports==="string"?Et.exports:Et.exports["."];if(typeof nn==="string")Wt=nn;else if(nn?.bun)Wt=nn.bun;else if(nn?.import)Wt=nn.import;else if(nn?.default)Wt=nn.default}H[ze]=await import(Kn.resolve(He,Wt))}catch(He){if(ze.startsWith("."))ie.set(ze,He instanceof Error?He.message:String(He))}let Z=(ze)=>{if(H[ze])return H[ze];let He=ie.get(ze);if(He!==void 0)throw Error(`Cannot require '${ze}' from ${k}: ${He}`);return d(ze)},Q=_.props||{},oe=(ze)=>{if(!ze)return Q;let He={};for(let[ft,Et]of Object.entries(ze)){let Wt=Q[ft];if(Wt!==void 0)He[ft]=Wt;else if(typeof Et==="function")He[ft]=Et();else He[ft]=Et}return He};for(let[ze,He]of Object.entries(Q))Object.defineProperty(oe,ze,{value:He,enumerable:!0,configurable:!0,writable:!0});let ae=(ze,He=!1)=>{if(ze===void 0||ze===null)return He;if(typeof ze==="string"){let ft=ze.trim().toLowerCase();if(ft===""||ft==="true"||ft==="1"||ft==="on"||ft==="yes")return!0;if(ft==="false"||ft==="0"||ft==="off"||ft==="no")return!1;return!0}return Boolean(ze)},ce=(ze,He=0)=>{if(ze===void 0||ze===null)return He;if(typeof ze==="string"){let Et=ze.trim();if(Et==="")return He;let Wt=Number(Et);return Number.isFinite(Wt)?Wt:He}let ft=Number(ze);return Number.isFinite(ft)?ft:He};for(let ze of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(Q,ze))continue;try{Object.defineProperty(oe,ze,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ue=(ze)=>{if(!ze)return Q;let He={...Q};for(let[ft,Et]of Object.entries(ze)){let Wt=Et&&typeof Et==="object"&&!Array.isArray(Et)?Et:{type:Et};if(He[ft]===void 0&&Wt.default!==void 0)He[ft]=typeof Wt.default==="function"?Wt.default():Wt.default}return He},le=()=>_.slots||{},Ae=(ze,He)=>{let ft={...ze};for(let[Et,Wt]of Object.entries(He))if(ft[Et]===void 0)if(typeof Wt==="function")ft[Et]=Wt();else ft[Et]=Wt;return ft},ve=(ze)=>{let He=()=>ze;return He.set=(ft)=>{},He.update=(ft)=>{},He},he=(ze)=>{let He,ft=!1;return()=>{if(!ft)try{He=ze(),ft=!0}catch{He=void 0}return He}},Te=(ze)=>{},De=(ze)=>ze(),Oe=(ze)=>{},Me=(ze)=>{},Ne=sr(_);function Ie(ze){let He=ze||{};if(He.title!==void 0||He.description!==void 0)rt({title:He.title,description:He.description})}function Be(ze){if(!ze||typeof ze!=="object")return;let He=_.__stxClientPayload??{};Object.assign(He,ze),_.__stxClientPayload=He}let Fe=()=>{let ze=_.__stxServeContext,He=_.__stxServeSearch??ze?.search??"",ft=ze?.path??"",Et=Object.fromEntries(new URLSearchParams(He)),Wt=_.query,nn=Object.keys(Et).length>0?Et:Wt??{},Qr=He||(Object.keys(nn).length>0?`?${new URLSearchParams(nn).toString()}`:"");return{params:_.params??{},query:nn,path:ft,name:"",fullPath:ft+Qr,hash:"",matched:[]}},Le=()=>({push:(ze)=>{},replace:(ze)=>{},back:()=>{},forward:()=>{},go:(ze)=>{}}),je=(ze)=>{let He=_.__stx_runtime_head||{};_.__stx_runtime_head=be(He,ye(ze||{},{known:vr,source:"useHead()"}))},rt=(ze)=>{je(wr(ze||{}))},gt=(ze)=>({value:ze}),mt=(ze)=>ze,yt=(ze)=>({value:typeof ze==="function"?ze():ze}),ut=(ze,He)=>{},$t=(ze)=>{},St=(ze)=>{},xt=(ze)=>ze?ze():Promise.resolve(),at=(ze)=>(He,...ft)=>{},kt=(ze)=>{},bt=(ze,He)=>{},Xt=(ze,He)=>He,Fn=()=>({value:"light"}),Nn=()=>ve(!1),ht=(ze)=>ve(!1),dt=()=>ve(!1),vt=()=>ht("(prefers-color-scheme: dark)"),zt=()=>ht("(prefers-color-scheme: light)"),Zt=()=>ht("(prefers-reduced-motion: reduce)"),Jt=()=>ht("(prefers-contrast: more)"),ln={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Ua=new Proxy(ln,{get(ze,He){if(He in ze)return ze[He];return},set(ze,He,ft){return ze[He]=ft,!0}}),Xn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ha=console;try{let ze=$s(z,k),He=new Set(Object.keys(Q)),ft=Object.keys(_).filter((ot)=>!He.has(ot)&&!QS.has(ot)&&it(ot)),Et=ft.map((ot)=>_[ot]);if(!ft.includes("__stxServeContext"))ft.push("__stxServeContext"),Et.push(void 0);if(!He.has("cookies")){let ot=_.cookies??_.__stxServeContext?.cookies??{},qt=ft.indexOf("cookies");if(qt<0)ft.push("cookies"),Et.push(ot);else Et[qt]=ot}let Wt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),nn=[],Qr=[];for(let[ot,qt]of Object.entries(Q)){if(!it(ot))continue;if(Wt.has(ot))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ot}\\b`).test(ze))continue;nn.push(ot),Qr.push(qt)}let Do=t0(ze).map((ot)=>`module.exports.${ot} = typeof ${ot} !== 'undefined' ? ${ot} : module.exports.${ot};`).join(`
|
|
2641
|
+
`),Oo=_.params??{},Mo=[],br=[];for(let ot=0;ot<ft.length;ot++){if(ft[ot]==="params")continue;Mo.push(ft[ot]),br.push(Et[ot])}let es=[...Mt,...nn,...Mo],Zn=`return (async () => {
|
|
2642
|
+
${ze}
|
|
2643
2643
|
${Do}
|
|
2644
2644
|
return module.exports
|
|
2645
|
-
})()`,
|
|
2646
|
-
`),B=[],z=0;while(z<T.length){let
|
|
2647
|
-
`),ie=[];for(let Z of["title","description"]){let Q=new RegExp(`\\b${Z}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(q);if(Q)ie.push(`${Z}: ${JSON.stringify(Q[2])}`)}if(ie.length>0)B.push(`useSeoMeta({ ${ie.join(", ")} });`);continue}if(
|
|
2648
|
-
`+Z;if(q<=0&&ie>=z)break}B.push(H),B.push(`module.exports.${U} = ${U};`),z=ie+1}else B.push(
|
|
2649
|
-
`),k,R)}function r0(v,_,k){let R=v.length,T="",B=0,z=null,
|
|
2650
|
-
`)
|
|
2645
|
+
})()`,an=h(Zn,es.join("\x00")),ct=lh.get(an);if(!ct)ct=Function(...es,Zn),lh.set(an,ct);let pt=_.__stx_options?.runtimeConfig;if(pt||/\buse(?:Server)?RuntimeConfig\b/.test(z))await _n(_,k,pt);let _t=await me(_.__stx_runtime_config??jt()??C(),()=>vm(_,()=>ct(F,W,Z,Q,oe,ae,ce,ue,Ae,Be,wm,zs,gr,ve,he,Te,De,Oe,Me,Ie,Fe,Le,je,rt,Ne.setResponseStatus,Ne.setResponseHeader,Ne.notFound,gt,mt,yt,ut,$t,St,xt,at,kt,le,bt,Xt,Fn,Nn,ht,dt,vt,zt,Zt,Jt,Ua,Xn,Ha,ln.confirm,ln.alert,ln.fetch,Oo,...Qr,...br)));if(R.preserveExisting){for(let[ot,qt]of Object.entries(_t))if(!(ot in _)||_[ot]===void 0)_[ot]=qt}else Object.assign(_,_t);for(let[ot,qt]of Object.entries(Q))if(!(ot in _))_[ot]=qt}catch(ze){if(_.__stx_strict_hydration)throw ze;let He=Mc(ze instanceof Error?ze.message:String(ze));if(Lc(He))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${He}`),R.onFailure?.({kind:"module-resolution",message:He,error:ze});else if(jc(ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${He}`),R.onFailure?.({kind:"syntax",message:He,error:ze});else if(Bc(He))console.warn(`[stx] server <script> in ${k??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${He}`),R.onFailure?.({kind:"missing-binding",message:He,error:ze});else{let ft=`${k??"<unknown>"}\x00${He}`;if(Gi.env.STX_DEBUG||!uh.has(ft))uh.add(ft),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${He}`);R.onFailure?.({kind:"unknown",message:He,error:ze})}try{await a0(z,_,k)}catch(ft){if(Gi.env.STX_DEBUG){let Et=ft instanceof Error?ft.message:String(ft);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${Et}`)}}}}function Fc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var n0=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function $s(v,_){let k=_?Kn.dirname(_):Gi.cwd(),R=Gi.cwd(),T=v.split(`
|
|
2646
|
+
`),B=[],z=0;while(z<T.length){let F=T[z].trim();if(F.startsWith("interface ")||F.startsWith("export interface ")||F.startsWith("type ")||F.startsWith("export type ")){if(F.includes("{")&&!F.includes("}")){let W=0;for(;z<T.length;z++){for(let U of T[z])if(U==="{")W++;else if(U==="}")W--;if(W<=0)break}}z++;continue}if(F.startsWith("definePageMeta(")){let W=0,U=!1,H=z;for(let Z=z;Z<T.length&&!U;Z++){let Q=null,oe=!1,ae=T[Z];for(let ce=0;ce<ae.length;ce++){let ue=ae[ce];if(oe){oe=!1;continue}if(ue==="\\"){oe=!0;continue}if(Q){if(ue===Q)Q=null;continue}if(ue==='"'||ue==="'"||ue==="`"){Q=ue;continue}if(ue==="(")W++;else if(ue===")"){if(W--,W===0){z=Z+1,U=!0;break}}}}if(!U)z=T.length;let q=T.slice(H,z).join(`
|
|
2647
|
+
`),ie=[];for(let Z of["title","description"]){let Q=new RegExp(`\\b${Z}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(q);if(Q)ie.push(`${Z}: ${JSON.stringify(Q[2])}`)}if(ie.length>0)B.push(`useSeoMeta({ ${ie.join(", ")} });`);continue}if(F.startsWith("import ")||F==="import"||F.startsWith("import{")||/^import['"]/.test(F)){let W=F,U=0;while(!Fc(W)&&z+U+1<T.length)U++,W=`${W} ${T[z+U].trim()}`;z+=U;let H=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),ie=W.match(/^import\s*['"](.+?)['"]/),Z=W,Q=(oe)=>{if(oe.startsWith("."))return Kn.resolve(k,oe);if(oe.startsWith("~/")||oe.startsWith("@/"))return Kn.resolve(R,oe.slice(2));try{return Bun.resolveSync(oe,k)}catch{return oe}};if(H){let[,oe,ae]=H,ce=Q(ae);B.push(`const ${oe} = (await import('${ce}')).default`),B.push(`module.exports.${oe} = ${oe};`)}else if(q){let[,oe,ae]=q,ce=Q(ae),ue=[],le=[],Ae=e0.has(ae);for(let ve of oe.split(",")){let he=ve.trim();if(!he)continue;let Te=he.split(/\s+as\s+/);if(Te.length===2){let[De,Oe]=[Te[0].trim(),Te[1].trim()];if(Ae&&ah.has(De)){B.push(`const ${Oe} = ${De};`);continue}ue.push(`${De}: ${Oe}`),le.push(Oe)}else{if(Ae&&ah.has(he))continue;ue.push(he),le.push(he)}}if(ue.length>0)B.push(`const { ${ue.join(", ")} } = await import('${ce}')`);for(let ve of le)B.push(`module.exports.${ve} = ${ve};`)}else if(ie){let oe=Q(ie[1]);B.push(`await import('${oe}')`)}else B.push(Z);z++;continue}if(n0.test(F))B.push(T[z]),z++;else if(F.startsWith("export const ")||F.startsWith("export let ")||F.startsWith("export var ")){let W=fh(T,z),{type:U,name:H,value:q}=W;B.push(`${U} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=W.nextIndex}else if(F.startsWith("export function ")||F.startsWith("export async function ")){let W=$u(T,z);B.push(W.functionCode),B.push(`module.exports.${W.name} = ${W.name};`),z=W.nextIndex}else if(F.startsWith("const ")||F.startsWith("let ")||F.startsWith("var ")){let W=fh(T,z),{type:U,name:H,value:q}=W;B.push(`${U} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=W.nextIndex}else if(F.startsWith("function ")||F.startsWith("async function ")){let W=$u(T,z);B.push(W.functionCode),B.push(`module.exports.${W.name} = ${W.name};`),z=W.nextIndex}else if(F.startsWith("export default function ")||F.startsWith("export default async function ")){let W=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...T];U[z]=W;let H=$u(U,z);if(B.push(H.functionCode),H.name)B.push(`module.exports.default = ${H.name};`);z=H.nextIndex}else if(F.startsWith("export default ")){let W=F.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${W};`),z++}else if(F.startsWith("class ")||F.startsWith("export class ")){let W=F.match(/(?:export\s+)?class\s+(\w+)/);if(W){let U=W[1],H=T[z].replace(/^export\s+/,""),q=0,ie=z;for(;ie<T.length;ie++){let Z=T[ie];for(let Q of Z)if(Q==="{")q++;else if(Q==="}")q--;if(ie>z)H+=`
|
|
2648
|
+
`+Z;if(q<=0&&ie>=z)break}B.push(H),B.push(`module.exports.${U} = ${U};`),z=ie+1}else B.push(F),z++}else if(F.includes("module.exports"))B.push(F),z++;else if(F.trim()&&!F.startsWith("//"))B.push(F),z++;else z++}return r0(B.join(`
|
|
2649
|
+
`),k,R)}function r0(v,_,k){let R=v.length,T="",B=0,z=null,F=!1,W=!1,U=0;while(B<R){let H=v[B],q=v[B+1];if(F){if(T+=H,H===`
|
|
2650
|
+
`)F=!1;B++;continue}if(W){if(T+=H,H==="*"&&q==="/"){T+=q,B+=2,W=!1;continue}B++;continue}if(!z&&H==="/"&&q==="/"){F=!0,T+=H,B++;continue}if(!z&&H==="/"&&q==="*"){W=!0,T+=H,B++;continue}if(z){if(T+=H,H==="\\"){T+=q,B+=2;continue}if(H===z&&z!=="`"){z=null,B++;continue}if(z==="`"){if(H==="$"&&q==="{"){U++,T+=q,B+=2;continue}if(H==="`"){z=null,B++;continue}}B++;continue}if(U>0){if(H==="{")U++;else if(H==="}")U--}if(H==='"'||H==="'"||H==="`"){z=H,T+=H,B++;continue}if(H==="a"&&v.startsWith("await",B)){let ie=s0(v,B);if(ie){let{quote:Z,path:Q,end:oe}=ie;if(Q.startsWith(".")||Q.startsWith("~/")||Q.startsWith("@/")){let ae=Q.startsWith(".")?Kn.resolve(_,Q):Kn.resolve(k,Q.slice(2));T+=`await import(${Z}${ae}${Z})`,B=oe;continue}}}T+=H,B++}return T}function s0(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let R=v[k];if(R!=="'"&&R!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==R)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let B=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:R,path:B,end:k+1}}function hh(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function yh(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let R=0,T=0,B="";while(R<k.length){let z=k[R];if(z==="{"||z==="["){let F=T===0?hh(k,R):null;if(F){_.push(...yh(F.pattern)),R=F.endPos,B="";continue}T++}else if(z==="}"||z==="]")T--;if(T>0){R++;continue}if(z===","){if(B.trim())_.push(B.trim());B="",R++;continue}if(z===":"){B="",R++;continue}if(z==="="){if(B.trim())_.push(B.trim());B="",R++;while(R<k.length&&k[R]!==","&&T===0){if(k[R]==="{"||k[R]==="[")T++;else if(k[R]==="}"||k[R]==="]")T--;R++}continue}if(/[\w$]/.test(z))B+=z;R++}if(B.trim())_.push(B.trim());return _}function zc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,R=(T)=>T===" "||T==="\t";while(k<v.length&&R(v[k]))k++;if(v[k]===":"){let T=0,B=null;k++;for(;k<v.length;k++){let z=v[k];if(B){if(z==="\\"){k++;continue}if(z===B)B=null;continue}if(z==="'"||z==='"'||z==="`"){B=z;continue}if(z==="("||z==="["||z==="{"||z==="<"){T++;continue}if(z===")"||z==="]"||z==="}"||z===">"){T--;continue}if(z==="="&&T<=0){let F=v[k+1],W=v[k-1];if(F!=="="&&F!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&R(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function dh(v,_,k,R){let T=null,B=!1;for(let z of v){if(B){B=!1;continue}if(z==="\\"){B=!0;continue}if(T){if(z===T)T=null;continue}if(z==="'"||z==='"'||z==="`"){T=z;continue}if(z===_)R++;else if(z===k)R--}return R}function fh(v,_){let k=v[_].trim(),R=zc(k),T=R?[k,R.type,R.name,R.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let q=k.slice(H[0].length),ie=_;if(q.startsWith("{")||q.startsWith("[")){let Q=q[0],oe=Q==="{"?"}":"]",ae=dh(q,Q,oe,0),ce=q;for(let ue=_+1;ue<v.length&&ae>0;ue++)ce+=` ${v[ue].trim()}`,ie=ue,ae=dh(v[ue],Q,oe,ae);if(ae>0)ce=q,ie=_;q=ce}let Z=hh(q,0);if(Z){let Q=H[1],oe=Z.pattern,ae=q.slice(Z.endPos).trim();if(ae.startsWith("=")){let ce=ae.slice(1).trim(),ue=ce,le=Math.max(ie,_);if(ph(ce)){let Te=gh(v,le,ce);ue=Te.value,le=Te.nextIndex}else le=le+1;ue=ue.trim().replace(/;$/,"");let Ae=yh(oe),ve=`__stx_src_${_}`,he=Ae.map((Te)=>`module.exports.${Te} = ${Te};`).join(`
|
|
2651
2651
|
`);return{type:Q,name:ve,value:`${ue}; ${Q} ${oe} = ${ve};
|
|
2652
|
-
${he}`,nextIndex:le}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,B,z,
|
|
2653
|
-
${v[U]}`,U++;else break}return
|
|
2652
|
+
${he}`,nextIndex:le}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,B,z,F]=T,W=F,U=_;if(ph(F)){let H=gh(v,_,F);W=H.value,U=H.nextIndex}else U=_+1;while(U<v.length){let H=v[U].trim();if(H.startsWith(".")||H.startsWith("?."))W+=`
|
|
2653
|
+
${v[U]}`,U++;else break}return W=W.trim().replace(/;$/,""),{type:B,name:z,value:W,nextIndex:U}}function $u(v,_){let k=v[_].trim(),R=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!R)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=R,B=k.replace(/^export\s+/,""),z=_;if(i0(k)){let F=o0(v,_,B);B=F.functionCode,z=F.nextIndex}else z=_+1;return{name:T,functionCode:B,nextIndex:z}}function ph(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!xh(_)}function xh(v){let _={paren:0,bracket:0,brace:0},k=null,R=0;for(let T=0;T<v.length;T++){let B=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((B==='"'||B==="'")&&!k){k=B;continue}if(B===k&&k!=="`"){k=null;continue}if(B==="`"&&!k){k="`";continue}if(B==="`"&&k==="`"&&R===0){k=null;continue}if(k==="`"&&B==="$"&&v[T+1]==="{"){R++,T++;continue}if(R>0&&B==="{"){R++;continue}if(R>0&&B==="}"){R--;continue}if(k)continue;if(B==="(")_.paren++;else if(B===")")_.paren--;else if(B==="[")_.bracket++;else if(B==="]")_.bracket--;else if(B==="{")_.brace++;else if(B==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function bh(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function i0(v){let _=bh(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function gh(v,_,k){let R=k,T=_+1;while(T<v.length&&!xh(R)){let B=v[T];R+=`
|
|
2654
2654
|
${B}`,T++}while(T<v.length){let B=v[T].trim();if(B.startsWith(".")||B.startsWith("?."))R+=`
|
|
2655
2655
|
${v[T]}`,T++;else break}return{value:R,nextIndex:T}}function o0(v,_,k){let R=k,T=_+1;while(T<v.length){let B=bh(R);if(B!==-1){if(S(R,"{","}",B)!==-1)break}let z=v[T];R+=`
|
|
2656
|
-
${z}`,T++}return{functionCode:R,nextIndex:T}}function mh(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...Gi.env}})},T=Object.keys(R).filter(it),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function a0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,
|
|
2657
|
-
`)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},U=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let Q=H[2].split(",").map((oe)=>{let ae=oe.trim().split(":");return ae[ae.length-1].trim()});for(let oe of Q)if(oe&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(oe)&&!k.has(oe))_.push(oe),k.add(oe);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Q=q[2];if(!k.has(Q))_.push(Q),k.add(Q);return}let ie=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Q=ie[1];if(!k.has(Q))_.push(Q),k.add(Q);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!k.has(Q))_.push(Q),k.add(Q)}};while(T<B){if(
|
|
2656
|
+
${z}`,T++}return{functionCode:R,nextIndex:T}}function mh(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...Gi.env}})},T=Object.keys(R).filter(it),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function a0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,F]=B;try{let W=F.trim().replace(/;$/,""),U=mh(W,_);if(U!==void 0)_[z]=U}catch(W){console.warn(`Failed to parse export ${z} in fallback:`,W)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let B of T){let[,,z,F]=B;if(!(z in _))try{let W=F.trim().replace(/;$/,""),U=mh(W,_);if(U!==void 0)_[z]=U}catch{}}}function _i(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",R=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:R}}function Ei(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Io=new M(500),Wa=new M(1000),ku=new M(2000),Eu=new M(500),Ch=33554432,Cu=Ch;function c0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Cu)return;Cu=_,Va.setMaxBytes(_)}var Va=new M(2000,{maxBytes:Ch,sizeOf:(v)=>v.output.length});function l0(v){let _=new WeakSet;try{let k=(R)=>{if(R===void 0)return{__stxType:"undefined"};if(typeof R==="bigint")return{__stxType:"bigint",value:R.toString()};if(typeof R==="function"||typeof R==="symbol")throw TypeError("Non-serializable component input");if(R===null||typeof R!=="object")return R;if(_.has(R))throw TypeError("Circular component input");_.add(R);try{if(R instanceof Date)return{__stxType:"date",value:R.toISOString()};if(Array.isArray(R))return R.map(k);let T=Object.getPrototypeOf(R);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let B={};for(let z of Object.keys(R).sort())B[z]=k(R[z]);return B}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function u0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function vh(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Xc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ze(v){return!Xc(v)}var Fa=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Fa.get(_);if(k)return k;if(Fa.size>=16)Fa.clear();let R=new Bun.Transpiler(v);return Fa.set(_,R),R}var wh=new WeakMap,d0=256;function Qe(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=wh.get(_);if(!k)k=new Map,wh.set(_,k);let R=k.get(v);if(R!==void 0)return R;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let B=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(F)=>{let W=B.length;return B.push(F),`"__STX_EXPR_${W}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(F)=>{let W=B.length;return B.push(F),`"__STX_EXPR_${W}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(F)=>{let W=B.length;return B.push(F),`"__STX_EXPR_${W}__"`});let z=_.transformSync(T);for(let F=0;F<B.length;F++)z=z.replace(`"__STX_EXPR_${F}__"`,B[F]),z=z.replace(`'__STX_EXPR_${F}__'`,B[F]);if(k.size>=d0){let F=k.keys().next();if(!F.done)k.delete(F.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function f0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(H)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},F=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<B&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")F();else T++;continue}T++}},W=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<B&&v[T]!==`
|
|
2657
|
+
`)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},U=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let Q=H[2].split(",").map((oe)=>{let ae=oe.trim().split(":");return ae[ae.length-1].trim()});for(let oe of Q)if(oe&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(oe)&&!k.has(oe))_.push(oe),k.add(oe);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Q=q[2];if(!k.has(Q))_.push(Q),k.add(Q);return}let ie=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Q=ie[1];if(!k.has(Q))_.push(Q),k.add(Q);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!k.has(Q))_.push(Q),k.add(Q)}};while(T<B){if(W())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){F();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))U();T++}return _}function p0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function g0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function m0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let W=v[R];if(W==="}")B++;else if(W==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let F=v.slice(z+1,T);for(let W of p0(F)){let U=W.trim();if(!U||U.startsWith("..."))continue;let H=g0(U);if(H===-1)continue;let q=U.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let ie=U.slice(H+1).trim();if(!ie)continue;try{let Z=Object.keys(_).filter(it),Q=Function(...Z,`"use strict"; return (${ie});`);_[q]=Q(...Z.map((oe)=>_[oe]))}catch{}}}catch{}}var h0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Jc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let R=k[2].toLowerCase();if(!h0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(U,H)=>(T.lastIndex=H,T.exec(U)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,F=!1;for(let U of B){if(z+=U.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(U.end).trim())return null;F=!0;break}}if(!F)return null;let W=k[0].length;return v.slice(0,W)+_+v.slice(W)}async function lr(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(ve)=>ve.split("-").map((he)=>he.charAt(0).toUpperCase()+he.slice(1)).join(""),F=k.__importedComponents;if(F){for(let ve of[B,B.toLowerCase(),z(B),un(B)])if(F.has(ve))return!0}let W=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${un(B)}.stx`])],U=typeof T.root==="string"?lt.resolve(T.root):void 0,H=U??lt.dirname(R),q=[],ie=(ve)=>{if(ve&&!q.includes(ve))q.push(ve)},Z=k.__originalFilePath;if(Z)ie(lt.join(lt.dirname(Z),"components"));ie(_),ie(T._rootComponentsDir),ie(lt.join(lt.dirname(R),"components")),ie(T.componentsDir);let Q=T._targetComponentFallbackNames?.some((ve)=>ve.toLowerCase()===B.toLowerCase());if(!Q)for(let ve of T._targetComponentDirs??[])ie(ve);if(U)ie(lt.resolve(U,"resources/views/components")),ie(lt.resolve(U,"resources/components")),ie(lt.resolve(U,"src/components")),ie(lt.resolve(U,"components"));for(let ve of T._layerComponentDirs??[])ie(ve);let oe=T._pluginComponentDirs;if(Array.isArray(oe))for(let ve of oe)ie(typeof ve==="string"?ve:null);if(ie(T.fallbackComponentsDir),Q)for(let ve of T._targetComponentDirs??[])ie(ve);if(B.startsWith("./")||B.startsWith("../"))return r(lt.resolve(lt.dirname(R),`${B}.stx`));let ae=Sh(lt.resolve(import.meta.dir,"components")),ce=q.map((ve)=>lt.isAbsolute(ve)?ve:lt.resolve(H,ve)),ue=`${W.join("\x00")}\x00\x00${ce.join("\x00")}`,le=ku.get(ue);if(le!==void 0)return le;let Ae=!1;e:for(let ve of ce){if(Sh(ve)===ae)continue;for(let he of W)if(await r(lt.join(ve,he))){Ae=!0;break e}}return ku.set(ue,Ae),Ae}function Sh(v){let _=Eu.get(v);if(_!==void 0)return _;let k=v;try{k=Eh.realpathSync(v)}catch{}return Eu.set(v,k),k}function Yc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function Ai(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function y0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let F=String(z);if(/<\/style/i.test(F))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return F};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var $h=new Set;function _h(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&$h.has(T))return;$h.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",F=k.length>0?`
|
|
2658
2658
|
searched:
|
|
2659
|
-
${k.map((
|
|
2660
|
-
`)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${
|
|
2661
|
-
`)}`}if(k&&
|
|
2659
|
+
${k.map((W)=>` - ${W}`).join(`
|
|
2660
|
+
`)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${F}`)}function kh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Zc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function et(v,_,k,R,T,B,z,F=new Set,W,U=Er(T),H,q=v){let{extractVariables:ie}=await wt("stx/variable-extractor",()=>import("./chunk-8txwa114.js")),Z=F??new Set;if(Z.has(v))return`[Circular component reference: ${v}]`;let Q=new Set(Z);Q.add(v);let oe=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ae=oe&&oe!=="load"&&Yc(oe)?oe:"";try{let ce=(ct)=>ct.split("-").map((pt)=>pt.charAt(0).toUpperCase()+pt.slice(1)).join(""),ue=q.endsWith(".stx")?q.slice(0,-4):q,le=null,Ae=T.__importedComponents;if(Ae){let ct=[ue,ue.toLowerCase(),ce(ue),un(ue)];for(let pt of ct)if(Ae.has(pt)){le=Ae.get(pt);break}}let ve=[];if(!le){let ct=[`${ue}.stx`,`${ce(ue)}.stx`,`${un(ue)}.stx`],pt=[...new Set(ct)],_t=T.__originalFilePath,ot=[];if(ot.push(...z._layerComponentDirs??[]),_t){let Ct=lt.join(lt.dirname(_t),"components");ot.push(Ct)}if(R)ot.push(R);let qt=z._rootComponentsDir;if(typeof qt==="string"&&!ot.includes(qt))ot.push(qt);let Yt=lt.join(lt.dirname(B),"components");if(!ot.includes(Yt))ot.push(Yt);if(z.componentsDir&&z.componentsDir!==R&&!ot.includes(z.componentsDir))ot.push(z.componentsDir);let Gn=z._targetComponentFallbackNames?.some((Ct)=>Ct.toLowerCase()===ue.toLowerCase());for(let Ct of Gn?[]:z._targetComponentDirs??[])if(Ct&&!ot.includes(Ct))ot.push(Ct);let Ln=typeof z.root==="string"?lt.resolve(z.root):void 0,ts=Ln??lt.dirname(B),Sr=[];if(Ln)Sr.push(lt.resolve(Ln,"resources/views/components")),Sr.push(lt.resolve(Ln,"resources/components")),Sr.push(lt.resolve(Ln,"src/components")),Sr.push(lt.resolve(Ln,"components"));Sr.push(lt.resolve(import.meta.dir,"components"));for(let Ct of Sr)if(!ot.includes(Ct))ot.push(Ct);let Lr=z._pluginComponentDirs;if(Array.isArray(Lr)){for(let Ct of Lr)if(typeof Ct==="string"&&!ot.includes(Ct))ot.push(Ct)}if(z.fallbackComponentsDir&&!ot.includes(z.fallbackComponentsDir))ot.push(z.fallbackComponentsDir);if(Gn){for(let Ct of z._targetComponentDirs??[])if(Ct&&!ot.includes(Ct))ot.push(Ct)}let eo=[...new Set(ot.map((Ct)=>{if(!Ct)return Ct;return lt.isAbsolute(Ct)?Ct:lt.resolve(ts,Ct)}))];ot.length=0,ot.push(...eo);let ns=`${ue}\x00${B}\x00${eo.join("\x00")}`,rs=Wa.get(ns);if(rs)if(await r(rs))le=rs;else Wa.delete(ns);if(!le&&(ue.startsWith("./")||ue.startsWith("../")))le=lt.resolve(lt.dirname(B),`${ue}.stx`),ve.push(le);else if(!le)for(let Ct of ot){if(!Ct)continue;for(let Br of pt){let No=lt.join(Ct,Br);if(ve.push(No),await r(No)){le=No;break}}if(le)break;if(!le)try{let Br=await import("fs");if(!Br.statSync(Ct,{throwIfNoEntry:!1})?.isDirectory())continue;let Dh=8,Ka=[{path:Ct,depth:0}];while(Ka.length>0&&!le){let jo=Ka.pop();if(jo.depth>=Dh)continue;let Au;try{Au=Br.readdirSync(jo.path,{withFileTypes:!0})}catch{continue}for(let Lo of Au){if(!Lo.isDirectory())continue;if(Lo.name==="node_modules"||Lo.name.startsWith("."))continue;let Tu=lt.join(jo.path,Lo.name);for(let Oh of pt){let Xa=lt.join(Tu,Oh);if(ve.push(Xa),await r(Xa)){le=Xa;break}}if(le)break;Ka.push({path:Tu,depth:jo.depth+1})}}}catch{}if(le)break}if(le)Wa.set(ns,le)}if(!le||!await r(le))return _h(v,B,ve),kh(v);W.add(le);let he;if(Io.has(le))he=Io.get(le);else try{he=await Bun.file(le).text(),Io.set(le,he)}catch(ct){let pt=ct instanceof Error?ct.message:String(ct);return _h(v,B,[le],pt),kh(v)}if(H)for(let ct of new Set([...Object.keys(_),...H.reactiveProps??[]])){let pt=ct.toLowerCase();if(pt.startsWith("aria-")||pt.startsWith("data-"))continue;let _t=ct.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_t}\\b`).test(he))H.declaredProps.add(ct);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_t}\\b|\\[\\s*['"]${_t}['"]\\s*\\])`).test(he)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_t}['"]`).test(he))H.consumedProps?.add(ct)}let Te=new Set(["__originalFilePath","__importedComponents",Ho,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),De={};for(let[ct,pt]of Object.entries(T))if(!ct.startsWith("__")||Te.has(ct))De[ct]=pt;let Oe=U.length>0?{[Yo]:[...U]}:{},Me=k;if(k.includes("@include")){let{processIncludes:ct}=await wt("stx/includes",()=>import("./chunk-afmzxwj1.js"));Me=await ct(k,T,B,z,W)}if(/<[A-Z][\w.-]*[\s/>]/.test(Me)){let{processComponents:ct}=await wt("stx/component-renderer",()=>import("./chunk-7ejmya3v.js"));Me=await ct(Me,{...T,__processedComponents:Z,...Oe},B,z,W)}let Ne=[];if(Ai(Me)){let{processExpressions:ct}=await wt("stx/expressions",()=>import("./chunk-bpz3yv92.js")),pt=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Oe}:U.length>0?{...T,...Oe}:T;Me=ct(Me,pt,B);for(let _t of Me.matchAll(/\{\{([\s\S]*?)\}\}/g))Ne.push(_t[1].trim())}let Ie=pn(Me),Be=[],Fe=Ie.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ct,pt)=>{let _t=Ie.scripts[Number(pt)]||"",ot=_t.match(/^<script\b([^>]*)>/i)?.[1]||"",qt=ot.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Yt=!qt||["module","text/javascript","application/javascript"].includes(qt),Gn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${ot}`);if(!/\bserver\b/i.test(ot)&&Yt&&!Gn)return Be.push(_t),"";return _t}),{extractSlotContent:Le}=await wt("stx/slots",()=>import("./chunk-jjs6nqh1.js")),je=Le(Fe),rt={};if(je.defaultSlot?.trim())rt.default=je.defaultSlot;for(let[ct,pt]of je.namedSlots)rt[ct]=pt.content;let gt=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},yt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,ut={...De,$uid:yt,..._,props:_,slot:Fe,$slots:rt,__processedComponents:Q,__sections:{},__stx_signals_gate:Se(he)||Ai(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Ne]};m0(he,ut);let $t=he,St=ne($t);if(St)$t=St.content.trim();let xt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,at=[...he.matchAll(xt)],kt=[],bt=null,Xt=at.some((ct)=>/\bserver\b/.test(ct[1]||"")&&/\bcache\b/.test(ct[1]||"")),Fn=null,Nn=null,ht=null,dt=0,vt=null;if(c0(z),Xt&&Cu>0){let ct=l0({props:_,slot:Me,slotContext:k.trim()?u0(De):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...U].sort(),layers:z._layerGraph?.layers.map((pt)=>pt.configFile),uid:yt});if(ct!==null){Fn=`${le}\x00${h(he)}\x00${ct}`;let pt=Va.get(Fn);if(pt){for(let _t of pt.dependencies)W.add(_t);if(wd(T,pt.clientFactories),gt.n+=pt.uidsConsumed,pt.preservedClientExpressions.length>0){let _t=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ot of pt.preservedClientExpressions)_t.add(ot);T.__stx_preserved_client_expressions=[..._t]}return pt.output}Nn=new Set(W),ht=bd(T),dt=gt.n,vt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let ct of at){let pt=ct[1]||"",_t=ct[2]||"",ot=pt.includes("server");if(Ze(pt)&&_t.trim())_t=Qe(_t);if(ot&&_t){for(let Yt of pe(_t))zt.add(Yt);try{await ie(_t,ut,le,{onFailure:(Yt)=>{if(Yt.kind!=="unknown")bt=Yt.kind}})}catch(Yt){}}if(!ot){let Yt=_t.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Gn=Yt.includes("{{")&&Yt.includes("}}"),Ln=Yt.includes("{!!")&&Yt.includes("!!}");if(Gn||Ln)Yt=hs(Yt,ut,le);let ts=pt.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");kt.push(`<script${ts}>${Yt}</script>`)}}let Jt=pn(he).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),ln=Jt?Jt[1]:"",Ua=Jt?Jt[2]:"",Xn="",Ha=ln&&/\bscoped\b/i.test(ln);if(Jt)Xn=`<style${ln}>${y0(Ua,ut,le)}</style>`;let ze=$t;if(ze=ze.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Jt)ze=ze.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ct=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,pt=[];if(ze=ze.replace(ct,(_t,ot)=>{let qt=ot.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(qt)pt.push(`<style${qt[1]}>${qt[2]}</style>`);return""}),ze=ze.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),pt.length>0)Xn=`${Xn}${pt.join(`
|
|
2661
|
+
`)}`}if(k&&ze.includes("{{ text || slot }}"))ze=ze.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:He}=await wt("stx/slots",()=>import("./chunk-jjs6nqh1.js")),{defaultSlot:ft,namedSlots:Et}=je,Wt=kt.some((ct)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ct)),nn=(ct)=>Wt?Hm(ct,yt):ct,Qr=new Map([...Et].map(([ct,pt])=>[ct,{...pt,content:nn(pt.content)}]));ze=await He(ze,nn(ft),Qr,ut);let qa=Zc(kt),Do=(Array.isArray(ut.__stx_client_signal_names)?ut.__stx_client_signal_names:[]).filter((ct)=>!zt.has(ct));if(qa.length>0||Do.length>0)ut.__stx_client_signal_names=[...new Set([...Do,...qa])];else delete ut.__stx_client_signal_names;let Oo=U.filter((ct)=>!zt.has(ct)&&!(ct in _));if(Oo.length>0)ut[Yo]=Oo;let Mo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:lt.dirname(le),skipSignalsRuntime:!0,skipEventDirectives:z._nativeHostAttrs===!0||Wt||kt.length===0,defaultLayout:void 0};ut.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let br=await n(ze,ut,le,Mo,W),es=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ct of br.matchAll(/\{\{([\s\S]*?)\}\}/g))es.add(ct[1].trim());if(es.size>0)T.__stx_preserved_client_expressions=[...es];let Zn=yt,an=br;if(Wt){let ct="";if(Object.keys(_).length>0)try{ct=` data-stx-props="${vh(JSON.stringify(_))}"`}catch{}let pt=ae?` stx-hydrate="${vh(ae)}"`:"",_t=` data-stx-scope="${Zn}"${ct}${pt}`,ot=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(br),qt=ot?"span":"div";an=Jc(br,_t)??`<${qt}${_t} data-stx-component-wrapper${ot?' style="display:contents"':""}>${br}</${qt}>`;let Yt=await Promise.all(kt.map(async(Gn)=>{let Ln=Gn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Ln)return Gn;let[,ts,Sr]=Ln,Lr=await v0(Sr,le,z.buildMode==="compile"),eo=mn(Lr.clientCode,we(ut)),{vendorStyleTags:ns}=Lr,rs=eo?`function(__scopeId) {
|
|
2662
2662
|
${eo}
|
|
2663
2663
|
return (${Lr.factoryBody})(__scopeId);
|
|
2664
|
-
}`:Lr.factoryBody,
|
|
2664
|
+
}`:Lr.factoryBody,Ct=ae?null:nc(T,rs),Br=Ct?`window.__stxComponentFactories[${JSON.stringify(Ct)}](${JSON.stringify(Zn)});`:`(${rs})(${JSON.stringify(Zn)});`;if(ae)return`${ns}<script type="stx/island" data-stx-island="${Zn}" data-stx-scoped data-stx-owner="${Zn}"${ts}>${Br}</script>`;return`${ns}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Zn}"${ts}>${Br}</script>`}));if(an=an+`
|
|
2665
2665
|
`+Yt.join(`
|
|
2666
|
-
`),Xn)
|
|
2667
|
-
`+Xn}else{if(Xn)
|
|
2668
|
-
`+Xn;if(
|
|
2669
|
-
|
|
2670
|
-
`),
|
|
2671
|
-
${
|
|
2672
|
-
`)}`:
|
|
2673
|
-
`),
|
|
2674
|
-
`);break}}else if(k){let z=v.indexOf(k);if(z>=0)return Pi(v,z)}}catch{}return{lineNumber:R,lineContent:T,context:B}}var
|
|
2666
|
+
`),Xn)an+=`
|
|
2667
|
+
`+Xn}else{if(Xn)an+=`
|
|
2668
|
+
`+Xn;if(kt.length>0){let ct=ut.__stx_event_bindings||[],pt=we(ut),_t=await Promise.all(kt.map(async(ot)=>{let qt=ot.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!qt)return ot;return await xe(qt[1],{eventBindings:ct,templateContent:an,filePath:le,projectRoot:process.cwd(),serverData:pt,instanceId:yt})}));an+=`
|
|
2669
|
+
`+_t.join(`
|
|
2670
|
+
`),ut.__stx_event_bindings=[]}}if(Ha){let ct=ra(an,le);if(ct.hasScoped)an=ct.html}if(Fn&&Nn){let ct=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Va.set(Fn,{output:an,dependencies:[...W].filter((pt)=>!Nn.has(pt)),clientFactories:ht?vd(T,ht):[],uidsConsumed:gt.n-dt,preservedClientExpressions:vt?ct.filter((pt)=>!vt.has(pt)):[]})}if(bt)an=`<!--stx-render-failed:${bt}-->${an}`;return Be.length>0?`${an}
|
|
2671
|
+
${Be.join(`
|
|
2672
|
+
`)}`:an}catch(ce){return`[Error processing component: ${ce instanceof Error?ce.message:String(ce)}]`}finally{Z.delete(v)}}async function r(v){return Bun.file(v).exists()}function Ru(v,_){let k=lt.resolve(_),R=lt.resolve(v),T=k.endsWith(lt.sep)?k:k+lt.sep;if(R===k||R.startsWith(T))return R;return null}async function x0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=lt.join(v,T);for(let z of B.endsWith(".stx")?[B]:[B,`${B}.stx`])if(await r(z)){if(R)console.log(`Found layout in ${v}: ${z}`);return k?.add(z),z}return null}async function ur(v,_,k,R){let T=await b0(v,_,k,R);if(T===null)return null;let B=Ru(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((F)=>typeof F==="string"&&F.length>0);for(let F of z){let W=lt.isAbsolute(F)?F:lt.resolve(process.cwd(),F);if(Ru(T,W))return lt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function b0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=lt.dirname(_),B=process.cwd();if(v.startsWith("/")){let ie=lt.join(B,v),Z=Ru(ie,B);if(!Z)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${Z}`);if(await r(Z)&&R)R.add(Z);return Z}let z=lt.join(T,v);if(await r(z)){if(k.debug)console.log(`Found direct path: ${z}`);if(R)R.add(z);return z}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let ie of[".stx",".tsx",".jsx"]){let Z=`${z}${ie}`;if(await r(Z)){if(k.debug)console.log(`Found direct path with extension: ${Z}`);if(R)R.add(Z);return Z}}let F=[];if(F.push(...k._layerLayoutDirs??[]),k.layoutsDir)F.push(lt.isAbsolute(k.layoutsDir)?k.layoutsDir:lt.resolve(process.cwd(),k.layoutsDir));let W=lt.resolve(T),U=process.cwd();for(let ie=0;ie<10;ie++){let Z=lt.join(W,"layouts"),Q=!1;try{Q=Eh.statSync(Z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(Q){F.push(Z);break}let oe=lt.dirname(W);if(oe===W||oe.length<U.length)break;W=oe}for(let ie of F){let Z=await x0(ie,v,R,k.debug);if(Z)return Z}if(k.fallbackLayoutsDir){let ie=lt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:lt.resolve(process.cwd(),k.fallbackLayoutsDir),Z=v.startsWith("layouts/")?v.slice(8):v,Q=[lt.join(ie,Z)];if(!v.endsWith(".stx"))Q.push(`${Q[0]}.stx`);for(let oe of Q)if(await r(oe)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${oe}`);if(R)R.add(oe);return oe}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let ie=v.split("layouts/"),Z=lt.join(k.partialsDir||T,"layouts",ie[1]);if(await r(Z)){if(k.debug)console.log(`Found in layouts path: ${Z}`);if(R)R.add(Z);return Z}if(!Z.endsWith(".stx")){let Q=`${Z}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in layouts path with extension: ${Q}`);if(R)R.add(Q);return Q}}}if(k.partialsDir){let ie=lt.join(k.partialsDir,"layouts");if(await r(ie)){let Z=lt.join(ie,v);if(await r(Z)){if(k.debug)console.log(`Found in partials layouts dir: ${Z}`);if(R)R.add(Z);return Z}if(!v.endsWith(".stx")){let Q=`${Z}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${Q}`);if(R)R.add(Q);return Q}}}}let H=k.partialsDir||lt.join(process.cwd(),"views"),q=lt.join(H,v);if(await r(q)){if(k.debug)console.log(`Found in views path: ${q}`);if(R)R.add(q);return q}if(!v.endsWith(".stx")){let ie=`${q}.stx`;if(await r(ie)){if(k.debug)console.log(`Found in views path with extension: ${ie}`);if(R)R.add(ie);return ie}}if(T.includes("temp")){let ie=lt.join(lt.dirname(T),"layouts",v);if(await r(ie)){if(k.debug)console.log(`Found in temp layouts dir: ${ie}`);if(R)R.add(ie);return ie}if(!v.endsWith(".stx")){let Z=`${ie}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${Z}`);if(R)R.add(Z);return Z}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function Pi(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
|
|
2673
|
+
`),F=0;for(let W=0;W<z.length;W++)if(F+=z[W].length+1,F>=_){R=W+1,T=z[W].trim();let U=Math.max(0,W-2),H=Math.min(z.length,W+3);B=z.slice(U,H).map((q,ie)=>{let Z=U+ie+1;return`${Z===R?"> ":" "}${Z}: ${q}`}).join(`
|
|
2674
|
+
`);break}}else if(k){let z=v.indexOf(k);if(z>=0)return Pi(v,z)}}catch{}return{lineNumber:R,lineContent:T,context:B}}var Tt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(v,_,k,R,T,B){let{lineNumber:z,context:F}=Pi(R,T,B),W=k.split("/").pop(),U=0;if(typeof T==="number"&&T>=0&&R){let q=R.lastIndexOf(`
|
|
2675
2675
|
`,Math.max(0,T-1));U=T-(q+1)+1}let H="";if(z>0)H+=`
|
|
2676
2676
|
${k}:${z}${U>0?`:${U}`:""}: ${v.toLowerCase()} error: ${_}
|
|
2677
2677
|
`;if(H+=`
|
|
2678
|
-
${
|
|
2679
|
-
`,H+=`${
|
|
2680
|
-
`,H+=`${
|
|
2678
|
+
${Tt.bold}${Tt.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Tt.reset}
|
|
2679
|
+
`,H+=`${Tt.bold}${Tt.red}\u2502${Tt.reset} ${Tt.bold}${Tt.bgRed} ERROR ${Tt.reset} ${Tt.red}${v} Error${Tt.reset}${" ".repeat(Math.max(0,43-v.length))}${Tt.bold}${Tt.red}\u2502${Tt.reset}
|
|
2680
|
+
`,H+=`${Tt.bold}${Tt.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Tt.reset}
|
|
2681
2681
|
`,H+=`
|
|
2682
|
-
${
|
|
2683
|
-
${
|
|
2684
|
-
`,
|
|
2685
|
-
${
|
|
2686
|
-
${
|
|
2687
|
-
`;return H}function re(){Io.clear(),
|
|
2682
|
+
${Tt.cyan}${Tt.bold}File:${Tt.reset} ${Tt.dim}${W}${Tt.reset}`,z>0)H+=` ${Tt.gray}(line ${z}${U>0?`, col ${U}`:""})${Tt.reset}`;if(H+=`
|
|
2683
|
+
${Tt.yellow}${Tt.bold}Message:${Tt.reset} ${_}
|
|
2684
|
+
`,F)H+=`
|
|
2685
|
+
${Tt.blue}${Tt.bold}Context:${Tt.reset}
|
|
2686
|
+
${Tt.dim}${F}${Tt.reset}
|
|
2687
|
+
`;return H}function re(){Io.clear(),Wa.clear(),ku.clear(),Eu.clear(),Va.clear()}function md(){return{size:Io.size,maxSize:500}}var _u=m(128);async function v0(v,_,k){let R=h(v,_,k),T=_u.get(R);if(T){if(gn(T.deps))return T;_u.delete(R)}let B=ds(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,F=ps(B.styles);z=At(z).code;let{hasUserImports:W,bundleClientScript:U}=await wt("stx/client-script-bundler",()=>import("./chunk-t9914jjh.js")),H=[],q=!1;if(W(z)){let ce=z;z=await U(ce,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ce}let{stripStxRuntimeImports:ie}=await wt("stx/signal-processing",()=>import("./chunk-00vp75pj.js"));z=ie(z);let Z=O(z),Q=f0(Z),oe=`function(__scopeId) {
|
|
2688
2688
|
${Ht("const",[...Xi,...Q],Z)}
|
|
2689
2689
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2690
2690
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -2748,15 +2748,15 @@ finally {
|
|
|
2748
2748
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2749
2749
|
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
2750
2750
|
}
|
|
2751
|
-
}`,ae={vendorStyleTags:
|
|
2751
|
+
}`,ae={vendorStyleTags:F,factoryBody:oe,clientCode:Z,deps:qd([...H,...B.styles.map((ce)=>ce.resolvedPath)])};if(!q&&B.unresolved.length===0)_u.set(R,ae);return ae}var w0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function S0(v){if(v.startsWith(".")||v.startsWith("/"))return null;if(v.startsWith("@")){let k=v.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let _=v.match(/^([^/]+)(\/.*)?$/);if(!_)return null;return{pkg:_[1],subpath:_[2]||""}}function $0(v,_){let k=_;while(!0){let R=Yr.join(k,"node_modules",v,"package.json");if(Po.existsSync(R))return Yr.dirname(R);let T=Yr.dirname(k);if(T===k)return null;k=T}}function _0(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let R=null;for(let T of Object.keys(v)){let B=T.indexOf("*");if(B===-1)continue;let z=T.slice(0,B),F=T.slice(B+1);if(!_.startsWith(z)||!_.endsWith(F))continue;if(_.length<z.length+F.length)continue;if(!R||z.length>R.prefix.length)R={pattern:T,prefix:z,suffix:F}}if(R){let T=_.slice(R.prefix.length,_.length-R.suffix.length),B=k(v[R.pattern]);if(B)return B.replace("*",T)}return null}function k0(v,_){let k=S0(v);if(!k||!k.subpath)return null;let R=$0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(Po.readFileSync(Yr.join(R,"package.json"),"utf8"))}catch{return null}let B=`.${k.subpath}`,z=_0(T.exports,B);if(!z)return null;let F=Yr.resolve(R,z);return Po.existsSync(F)?F:null}function ds(v,_){let k=_.filePath?Yr.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,B=[],z=[];return{code:v.replace(w0,(W,U)=>{let H;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(H=U.startsWith("/")?U:Yr.resolve(k,U),!Po.existsSync(H))throw Error(`file not found: ${H}`)}else{let q=null;try{q=Bun.resolveSync(U,R)}catch{q=k0(U,R)}if(!q)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);H=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${_.filePath||"<unknown>"}): ${q?.message||q}`),z.push(U),""}if(T.has(H))return"";T.add(H);try{let q=Po.readFileSync(H,"utf8");B.push({source:U,resolvedPath:H,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${H}: ${q?.message||q}`),z.push(U)}return""}),styles:B,unresolved:z}}function E0(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ps(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${E0(_.source)}" data-stx-layer="vendor">
|
|
2752
2752
|
@layer vendor {
|
|
2753
2753
|
${_.contents}
|
|
2754
2754
|
}
|
|
2755
2755
|
</style>`).join(`
|
|
2756
2756
|
`)}
|
|
2757
|
-
`}var hc=y,Rh=m(256);function At(v){let _=h(v),k=Rh.get(_);if(!k)k=C0(v),Rh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function C0(v){let _=s(v),k=new Set;for(let
|
|
2757
|
+
`}var hc=y,Rh=m(256);function At(v){let _=h(v),k=Rh.get(_);if(!k)k=C0(v),Rh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function C0(v){let _=s(v),k=new Set;for(let F of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of F[1].split(",")){let U=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(U)k.add(U)}let R=zo(_),T=K.filter((F)=>{if(k.has(F)||R.has(F))return!1;return gs(_,F,!0)}),B=Ph(_).filter((F)=>!k.has(F)&&!R.has(F));if(T.length===0&&B.length===0)return{code:v,imports:T,models:B};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",B.length>0?"import '@stacksjs/browser'":"",B.length>0?`const { ${B.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2758
2758
|
`)}
|
|
2759
|
-
${v}`,imports:T,models:B}}var R0=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function Ph(v){let _=new Set,k=Qa(v),R=zo(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let B of k.code.matchAll(T)){let z=B[1];if(R0.has(z)||R.has(z)||z.length<3)continue;if(k.shadows(z,B.index??0))continue;_.add(z)}return Array.from(_)}function A0(v){return zo(v)}var Ah=m(128);function oi(v){let _=h(v),k=Ah.get(_);if(!k)k=T0(v),Ah.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function T0(v){let _=new Set,k=new Set,R=v;R=R.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,B=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,z;while((z=B.exec(v))!==null){let q=z[1],ie=z[2];if(z[0].includes("import type"))continue;let Z=[];for(let oe of q.split(",")){let ae=oe.trim();if(!ae||ae.startsWith("type "))continue;let ce=ae.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ce)continue;let ue=ce[1],le=ce[2]||ue;if(T.add(ue),T.add(le),ie==="stx"||ie==="@stacksjs/stx")_.add(ue);else k.add(ue);if(le!==ue)Z.push(`${le} = ${ue}`)}let Q=Z.length>0?`var ${Z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(z[0],Q)}let
|
|
2759
|
+
${v}`,imports:T,models:B}}var R0=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function Ph(v){let _=new Set,k=Qa(v),R=zo(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let B of k.code.matchAll(T)){let z=B[1];if(R0.has(z)||R.has(z)||z.length<3)continue;if(k.shadows(z,B.index??0))continue;_.add(z)}return Array.from(_)}function A0(v){return zo(v)}var Ah=m(128);function oi(v){let _=h(v),k=Ah.get(_);if(!k)k=T0(v),Ah.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function T0(v){let _=new Set,k=new Set,R=v;R=R.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,B=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,z;while((z=B.exec(v))!==null){let q=z[1],ie=z[2];if(z[0].includes("import type"))continue;let Z=[];for(let oe of q.split(",")){let ae=oe.trim();if(!ae||ae.startsWith("type "))continue;let ce=ae.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ce)continue;let ue=ce[1],le=ce[2]||ue;if(T.add(ue),T.add(le),ie==="stx"||ie==="@stacksjs/stx")_.add(ue);else k.add(ue);if(le!==ue)Z.push(`${le} = ${ue}`)}let Q=Z.length>0?`var ${Z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(z[0],Q)}let F=A0(R);for(let q of hc){if(T.has(q)||F.has(q))continue;if(gs(R,q,!0))_.add(q)}let W=s(R),U=new Set;for(let q of R.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let ie of q[1].split(",")){let Z=ie.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Q of Z){let oe=Q.trim();if(oe)U.add(oe)}}for(let q of K){if(T.has(q)||F.has(q)||U.has(q))continue;if(gs(W,q))k.add(q)}let H=Ph(W);for(let q of H)if(!T.has(q)&&!F.has(q))k.add(q);return{code:R,stxImports:Array.from(_),browserImports:Array.from(k)}}function gs(v,_,k=!1){let R=Qa(v);v=R.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let B of v.matchAll(T)){let z=B.index??0;if(R.shadows(_,z))continue;let F=z+_.length,W=z-1;while(W>=0&&/\s/.test(v[W]))W--;if(v[W]==="."&&v.slice(Math.max(0,W-2),W+1)!=="...")continue;let U=F;while(U<v.length&&/\s/.test(v[U]))U++;if(v[U]===":"&&v[U+1]!==":"&&(v[W]==="{"||v[W]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(F)))continue;if(I0(v,F))continue;return!0}return!1}function I0(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let R=0;for(;k<v.length;k++){let T=v[k];if(T==="(")R++;else if(T===")"){if(R--,R===0)break}}if(R!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function ii(v,_){let k=[];if(v.length>0)k.push(` var { ${v.join(", ")} } = window.stx || window;`);if(_.length>0)k.push(` var { ${_.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
2760
2760
|
${k.join(`
|
|
2761
2761
|
`)}
|
|
2762
2762
|
${P0(v,_)}`;return""}function Gu(v,_=[]){let{browserImports:k}=oi(v),R=new Set(_);return ii([],k.filter((T)=>!R.has(T)))}function P0(v,_){let k=[...v.map((R)=>`['${R}', typeof ${R}, 'stx']`),..._.map((R)=>`['${R}', typeof ${R}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
@@ -2768,10 +2768,10 @@ ${P0(v,_)}`;return""}function Gu(v,_=[]){let{browserImports:k}=oi(v),R=new Set(_
|
|
|
2768
2768
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2769
2769
|
);
|
|
2770
2770
|
});
|
|
2771
|
-
`}function we(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let R={};for(let T in _){let B=_[T];if(typeof B==="function")continue;R[T]=B}return R.__stxDeclaredPayload=!0,R}let k={};for(let R in v){if(R.startsWith("__")||R.startsWith("$"))continue;let T=v[R];if(typeof T==="function")continue;k[R]=T}return k}var D0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Th=new Set;function O0(v,_){let k=D0.test(v),R=_.length>32768;if(!k&&!R)return;if(Th.has(v))return;if(Th.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(R)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function mn(v,_){if(!_)return"";let k=Rt(v,new Set(Object.keys(_))),R=_.__stxDeclaredPayload===!0,T=[],B=Object.entries(_).sort(([z],[
|
|
2771
|
+
`}function we(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let R={};for(let T in _){let B=_[T];if(typeof B==="function")continue;R[T]=B}return R.__stxDeclaredPayload=!0,R}let k={};for(let R in v){if(R.startsWith("__")||R.startsWith("$"))continue;let T=v[R];if(typeof T==="function")continue;k[R]=T}return k}var D0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Th=new Set;function O0(v,_){let k=D0.test(v),R=_.length>32768;if(!k&&!R)return;if(Th.has(v))return;if(Th.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(R)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function mn(v,_){if(!_)return"";let k=Rt(v,new Set(Object.keys(_))),R=_.__stxDeclaredPayload===!0,T=[],B=Object.entries(_).sort(([z],[F])=>z<F?-1:z>F?1:0);for(let[z,F]of B){if(!/^[A-Za-z_$][\w$]*$/.test(z))continue;if(z.startsWith("__")||z.startsWith("$"))continue;if(!R&&!k.has(z))continue;if(to(v,z)){if(R)console.warn(`[stx] defineClientPayload declares "${z}", but this client block also declares "${z}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${z}" from defineClientPayload.`);continue}let W;try{W=JSON.stringify(F)}catch{continue}if(W===void 0)continue;O0(z,W),T.push(` var ${z} = ${W.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2772
2772
|
${T.join(`
|
|
2773
2773
|
`)}
|
|
2774
|
-
`}var M0={left:0,middle:1,right:2};function N0(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((R)=>`$event.key === '${R}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=M0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function j0(v,_){let{elementId:k,event:R,modifiers:T}=v,B=Ga(v.handler),z=N0(T),
|
|
2774
|
+
`}var M0={left:0,middle:1,right:2};function N0(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((R)=>`$event.key === '${R}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=M0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function j0(v,_){let{elementId:k,event:R,modifiers:T}=v,B=Ga(v.handler),z=N0(T),F=[];if(T.once)F.push("once: true");if(T.capture)F.push("capture: true");if(Za(R,T))F.push("passive: true");let W=F.length>0?`, { ${F.join(", ")} }`:"",U="";if(z)U+=`${z}; `;let H=B.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),q=`var $emit = function(name, detail) {
|
|
2775
2775
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2776
2776
|
};`;function ie(Z){if(/\$emit\s*\(/.test(Z))return`${q}
|
|
2777
2777
|
${Z}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -2788,7 +2788,7 @@ else {
|
|
|
2788
2788
|
$el.addEventListener('${R}', function($event) {
|
|
2789
2789
|
${z?z+"; ":""}clearTimeout(__timer)
|
|
2790
2790
|
__timer = setTimeout(function() { ${ie(B)} }, ${T.debounce})
|
|
2791
|
-
}${
|
|
2791
|
+
}${W})
|
|
2792
2792
|
})()`;if(T.throttle!==null)return` ;(function() {
|
|
2793
2793
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
2794
2794
|
var $el = document.getElementById('${k}')
|
|
@@ -2800,12 +2800,12 @@ else {
|
|
|
2800
2800
|
__last = __now
|
|
2801
2801
|
${ie(B)}
|
|
2802
2802
|
}
|
|
2803
|
-
}${
|
|
2803
|
+
}${W})
|
|
2804
2804
|
})()`;if(/\$emit\s*\(/.test(B))return` var $el = document.getElementById('${k}')
|
|
2805
2805
|
if ($el) $el.addEventListener('${R}', function($event) {
|
|
2806
2806
|
${U}${q}
|
|
2807
2807
|
${B}
|
|
2808
|
-
}${
|
|
2808
|
+
}${W})`;return` var $el = document.getElementById('${k}')
|
|
2809
2809
|
if ($el) $el.addEventListener('${R}', function($event) {
|
|
2810
2810
|
${U}var scope = $el.closest('[data-stx-scope]');
|
|
2811
2811
|
if (scope && scope.__stx_execute) {
|
|
@@ -2814,15 +2814,15 @@ else {
|
|
|
2814
2814
|
else {
|
|
2815
2815
|
${B}
|
|
2816
2816
|
}
|
|
2817
|
-
}${
|
|
2817
|
+
}${W})`}function L0(v){if(v.length===0)return"";return`
|
|
2818
2818
|
// STX: auto-generated event bindings
|
|
2819
2819
|
${v.map((k,R)=>j0(k,R)).join(`
|
|
2820
|
-
`)}`}function Ih(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let
|
|
2821
|
-
`)z++;continue}if(
|
|
2820
|
+
`)}`}function Ih(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let F=R[z];if(F==="'"||F==='"'||F==="`"){let W=F;if(z++,W==="`"){let U=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&U===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){U++,z+=2;continue}if(R[z]==="}"&&U>0){U--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===W){z++;break}z++}continue}if(F==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
|
|
2821
|
+
`)z++;continue}if(F==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(F==="{"){T++,z++;continue}if(F==="}"){T--,z++;continue}if(T===0){let W=R.slice(z),U=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let ie=U[1];if(!ie.startsWith("_")&&!k.has(ie))_.push(ie),k.add(ie);z+=U[0].length;continue}let H=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((ie)=>{let Z=ie.trim(),Q=Z.indexOf(":"),oe=Q>=0?Z.slice(Q+1).trim().split(/[\s=]/)[0]:Z.split(/[\s=]/)[0];if(oe&&!oe.startsWith("_")&&!k.has(oe))_.push(oe),k.add(oe)}),z+=H[0].length;continue}let q=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let ie=q[1];if(!ie.startsWith("_")&&!k.has(ie))_.push(ie),k.add(ie);z+=q[0].length;continue}}z++}return _}var B0=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 z0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(ie){let Z;while((Z=k.exec(ie))!==null){let Q=Z[0];if(!B0.has(Q))_.add(Q)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let F=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=F.exec(v))!==null)R(B[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=W.exec(v))!==null)R(B[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=U.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function xe(v,_={}){let k=v,R="",T=!1,B=[],z=ds(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let F=ps(z.styles),W=At(k);k=W.code,B=[...W.imports,...W.models];let{hasUserImports:U,bundleClientScript:H}=await wt("stx/client-script-bundler",()=>import("./chunk-t9914jjh.js"));if(U(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let le=oi(k);k=le.code,R=ii(le.stxImports,le.browserImports.filter((Ae)=>!B.includes(Ae)))}if(R=`${mn(k,_.serverData)}${R}`,k=O(k),!T&&Ze(_.attrs||""))k=Qe(k);let q=L0(_.eventBindings||[]),ie=(_.attrs||"").trim(),Z=/\btype\s*=\s*["']module["']/i.test(ie),Q=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(Z){let le=ie.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Ae=`type="module" data-stx-scoped${Q}${le?` ${le}`:""}`;return`${F}<script ${Ae}>
|
|
2822
2822
|
${Li(`${R}${k}
|
|
2823
2823
|
${q}`)}
|
|
2824
2824
|
</script>`}let oe=Qs(v),ae=/function __stx_setup_/.test(k),ce=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function ue(le){let Ae=le.length>0?`
|
|
2825
|
-
return { ${le.join(", ")} };`:"",ve=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${
|
|
2825
|
+
return { ${le.join(", ")} };`:"",ve=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${F}<script data-stx-scoped data-stx-run="always"${Q}>
|
|
2826
2826
|
window.stx.mount(function() {
|
|
2827
2827
|
'use strict';
|
|
2828
2828
|
try {
|
|
@@ -2832,7 +2832,7 @@ ${q}${Ae}`)}
|
|
|
2832
2832
|
console.error(${ve}, error);
|
|
2833
2833
|
return {};
|
|
2834
2834
|
}
|
|
2835
|
-
})</script>`}if(!ce&&!ae){if(oe)return ue(Ih(v));if(_.templateContent){let le=Ih(v);if(le.length>0){let Ae=z0(_.templateContent);if(le.some((he)=>Ae.has(he)))return ue(le)}}}return`${
|
|
2835
|
+
})</script>`}if(!ce&&!ae){if(oe)return ue(Ih(v));if(_.templateContent){let le=Ih(v);if(le.length>0){let Ae=z0(_.templateContent);if(le.some((he)=>Ae.has(he)))return ue(le)}}}return`${F}<script data-stx-scoped data-stx-run="always"${Q}>
|
|
2836
2836
|
;(function() {
|
|
2837
2837
|
'use strict';
|
|
2838
2838
|
try {
|