@stacksjs/stx 0.2.418 → 0.2.420
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3senpdjt.js → chunk-014gmm8w.js} +2 -2
- package/dist/{chunk-wweasgq9.js → chunk-09hhrjk9.js} +6 -6
- package/dist/chunk-0n76c3g8.js +2 -0
- package/dist/{chunk-w5zmvn7b.js → chunk-0varh725.js} +3 -3
- package/dist/{chunk-wpkxbggq.js → chunk-0y7x0hvr.js} +1 -1
- package/dist/{chunk-9r5ycpdg.js → chunk-10967rws.js} +3 -3
- package/dist/chunk-10fh9qhe.js +2 -0
- package/dist/{chunk-xvn3sv3v.js → chunk-11ra3sbc.js} +3 -3
- package/dist/{chunk-e83j8xe9.js → chunk-12b8akfg.js} +4 -4
- package/dist/{chunk-68rq2fqt.js → chunk-1336h4sv.js} +1 -1
- package/dist/chunk-18awnp9d.js +2 -0
- package/dist/{chunk-hm2k9a04.js → chunk-20tdz0zs.js} +7 -7
- package/dist/{chunk-mj9yv1vb.js → chunk-21a7p956.js} +1 -1
- package/dist/{chunk-5fwy3xap.js → chunk-2ewa2sg5.js} +3 -3
- package/dist/chunk-2hswgxpb.js +2 -0
- package/dist/{chunk-g947brd0.js → chunk-2tfe2g58.js} +6 -6
- package/dist/{chunk-0xgf3xgy.js → chunk-32y3767j.js} +7 -7
- package/dist/{chunk-3wmxb126.js → chunk-34gy5zjm.js} +2 -2
- package/dist/{chunk-hg3tyzn5.js → chunk-3kmhv1kf.js} +11 -11
- package/dist/{chunk-yrbzsrde.js → chunk-3ynkg5dz.js} +2 -2
- package/dist/chunk-3zye6eh1.js +2 -0
- package/dist/chunk-4488r5j1.js +2 -0
- package/dist/chunk-4amznxaq.js +2 -0
- package/dist/{chunk-vepc9rbt.js → chunk-4e101kjp.js} +2 -2
- package/dist/{chunk-psmdbcbc.js → chunk-4mew0ae3.js} +3 -3
- package/dist/{chunk-865xvpp2.js → chunk-4n6c5rp5.js} +2 -2
- package/dist/chunk-5akd7qsb.js +2 -0
- package/dist/chunk-5eqd40k0.js +2 -0
- package/dist/{chunk-dw961rvn.js → chunk-5vfyxxrp.js} +2 -2
- package/dist/{chunk-7q1yy18q.js → chunk-62r4fa4q.js} +2 -2
- package/dist/{chunk-76japd6k.js → chunk-66k7yxnr.js} +4 -4
- package/dist/{chunk-jgsgd6rt.js → chunk-6aqcgrhw.js} +5 -5
- package/dist/chunk-6r9y4p81.js +2 -0
- package/dist/{chunk-bk5ndwv3.js → chunk-757ec865.js} +2 -2
- package/dist/chunk-75zcwcrt.js +2 -0
- package/dist/{chunk-xwkdv585.js → chunk-802pr252.js} +2 -2
- package/dist/chunk-89e1d0rz.js +4 -0
- package/dist/{chunk-ev8bhsc0.js → chunk-8drvzsk1.js} +2 -2
- package/dist/{chunk-y9t55tv7.js → chunk-8j8k27xb.js} +6 -6
- package/dist/{chunk-q8swb7na.js → chunk-8jqy69td.js} +3 -3
- package/dist/chunk-8nsqac4z.js +2 -0
- package/dist/chunk-8ttvazck.js +2 -0
- package/dist/{chunk-sjjc670z.js → chunk-8vq0qjq9.js} +9 -9
- package/dist/chunk-8y4bqsxz.js +2 -0
- package/dist/{chunk-v15g9jjh.js → chunk-a4r19yxm.js} +6 -6
- package/dist/chunk-ac033b93.js +2 -0
- package/dist/chunk-aj43359g.js +2 -0
- package/dist/chunk-aj8yq228.js +2 -0
- package/dist/{chunk-vyfg2qd2.js → chunk-ap6fehea.js} +5 -5
- package/dist/chunk-as72dvvm.js +2 -0
- package/dist/{chunk-ka8x4sw6.js → chunk-awtrcb5m.js} +5 -5
- package/dist/chunk-ax58cds3.js +5 -0
- package/dist/{chunk-qmzwhtr2.js → chunk-aync8qmk.js} +2 -2
- package/dist/chunk-b01jqb5f.js +2 -0
- package/dist/{chunk-3aqe7wy7.js → chunk-b1fg9vg7.js} +2 -2
- package/dist/chunk-b7z2yegr.js +2 -0
- package/dist/chunk-bfvaxrq0.js +2 -0
- package/dist/{chunk-jfjym18d.js → chunk-bh4x090w.js} +3 -3
- package/dist/chunk-bkaw7sgz.js +2 -0
- package/dist/chunk-bmk0s261.js +2 -0
- package/dist/chunk-bvbank3z.js +2 -0
- package/dist/{chunk-bt11a8z4.js → chunk-csjw5esc.js} +3 -3
- package/dist/chunk-cvzkbsds.js +2 -0
- package/dist/{chunk-d6h9rpm4.js → chunk-cw6j75ck.js} +5 -5
- package/dist/chunk-d2c5727w.js +2 -0
- package/dist/chunk-d5amzers.js +2 -0
- package/dist/{chunk-kds79hq3.js → chunk-debz86rr.js} +10 -10
- package/dist/chunk-dfchrqw5.js +2 -0
- package/dist/{chunk-47h689h6.js → chunk-dhxbjw6k.js} +2 -2
- package/dist/chunk-dscsvkfa.js +2 -0
- package/dist/chunk-eav0pt6d.js +2 -0
- package/dist/{chunk-9yt899e7.js → chunk-ep5jnqdb.js} +6 -6
- package/dist/{chunk-e2m674vf.js → chunk-g1fxmp9z.js} +4 -4
- package/dist/{chunk-h8f18cc5.js → chunk-h1h6xe1k.js} +5 -5
- package/dist/chunk-hahzjyxc.js +2 -0
- package/dist/chunk-hgqcqg1h.js +2 -0
- package/dist/chunk-hjdwf9gp.js +2 -0
- package/dist/{chunk-94ky725r.js → chunk-hjp990p8.js} +2 -2
- package/dist/{chunk-d0ynfema.js → chunk-hy9e3ny6.js} +1 -1
- package/dist/{chunk-9bq4w4d6.js → chunk-hyak4dzg.js} +3 -3
- package/dist/chunk-j9aberz0.js +2 -0
- package/dist/chunk-jjm0ekw8.js +2 -0
- package/dist/chunk-jjnfj9nf.js +3 -0
- package/dist/chunk-jjtzm6dn.js +3 -0
- package/dist/chunk-k1am0dyg.js +2 -0
- package/dist/{chunk-c8p4v1rd.js → chunk-k31fwm2w.js} +5 -5
- package/dist/{chunk-5vzamjf6.js → chunk-kea18wnc.js} +3 -3
- package/dist/{chunk-pb0fgdvn.js → chunk-kjkwycce.js} +4 -4
- package/dist/{chunk-85bm5xrm.js → chunk-krr2vb0s.js} +3 -3
- package/dist/{chunk-3f5td68v.js → chunk-m16h8ea0.js} +2 -2
- package/dist/chunk-m2jphkdv.js +2 -0
- package/dist/{chunk-25n4gmek.js → chunk-mg13q1kd.js} +2 -2
- package/dist/chunk-mk7b3qdz.js +2 -0
- package/dist/chunk-ncvfjcr2.js +2 -0
- package/dist/chunk-p083sckk.js +2 -0
- package/dist/chunk-p7b17yr0.js +2 -0
- package/dist/chunk-pc178389.js +2 -0
- package/dist/{chunk-gfm7g98y.js → chunk-pzngjk81.js} +39 -39
- package/dist/chunk-q1v0jwr4.js +2 -0
- package/dist/{chunk-fr8jq2ys.js → chunk-qby6wxat.js} +2 -2
- package/dist/{chunk-dym1eteb.js → chunk-qx3js9tk.js} +1 -1
- package/dist/{chunk-ayd5r3se.js → chunk-qxre7vw6.js} +2 -2
- package/dist/chunk-r5gjb55x.js +2 -0
- package/dist/{chunk-vfdwvt23.js → chunk-r8wze9ym.js} +2 -2
- package/dist/{chunk-1680nbq4.js → chunk-rj3hyqff.js} +302 -301
- package/dist/chunk-rj8rdd8n.js +2 -0
- package/dist/{chunk-wgzxmh7w.js → chunk-rsxvbnp4.js} +3 -3
- package/dist/chunk-s0pmn48x.js +2 -0
- package/dist/chunk-s58yz9q0.js +2 -0
- package/dist/chunk-srdzwtsq.js +2 -0
- package/dist/{chunk-vdqa5gt7.js → chunk-tafebmtg.js} +2 -2
- package/dist/chunk-tf44jyrh.js +2 -0
- package/dist/chunk-tfypkw4y.js +3 -0
- package/dist/{chunk-hkxxfzfd.js → chunk-th9s15es.js} +2 -2
- package/dist/{chunk-xt6d3zws.js → chunk-tqnysw0k.js} +4 -4
- package/dist/{chunk-5f3k2mke.js → chunk-tspmynvh.js} +1 -1
- package/dist/chunk-vwxasbtx.js +2 -0
- package/dist/{chunk-08p07eq7.js → chunk-wg1ttvs5.js} +2 -2
- package/dist/chunk-wynvh7dc.js +2 -0
- package/dist/{chunk-fxhvkenf.js → chunk-x5ks23vx.js} +2 -2
- package/dist/chunk-x8rckpyz.js +2 -0
- package/dist/{chunk-9af8qbwb.js → chunk-xvzxrt9a.js} +5 -5
- package/dist/chunk-y4xs4m7p.js +2 -0
- package/dist/chunk-y8rpk1b9.js +2 -0
- package/dist/chunk-y9m93qkk.js +2 -0
- package/dist/chunk-ya9c8nec.js +2 -0
- package/dist/chunk-yvq1f313.js +2 -0
- package/dist/chunk-yy3dgwfm.js +2 -0
- package/dist/{chunk-mj6fme15.js → chunk-z0ck9t6j.js} +5 -5
- package/dist/{chunk-072mzamc.js → chunk-z521cyfv.js} +5 -5
- package/dist/chunk-zpcz2kh6.js +2 -0
- package/dist/{chunk-kkj5x9rp.js → chunk-zvh2nnzr.js} +1 -1
- package/dist/cli.js +21 -21
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/ts-css.js +2 -2
- package/dist/head-keys.d.ts +41 -0
- package/dist/head-keys.js +78 -0
- package/dist/head.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/process.js +2 -1
- package/dist/production-builder.js +2 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +15 -15
- package/dist/ts-css-config.d.ts +21 -0
- package/dist/ts-css-config.js +12 -4
- package/dist/variable-extractor.js +2 -1
- package/package.json +5 -5
- package/dist/chunk-072f6hnz.js +0 -2
- package/dist/chunk-0x076wz1.js +0 -2
- package/dist/chunk-2gfj59pt.js +0 -2
- package/dist/chunk-2gntnw7e.js +0 -2
- package/dist/chunk-2hvvwhmv.js +0 -2
- package/dist/chunk-31a8eh0j.js +0 -5
- package/dist/chunk-4bhertga.js +0 -2
- package/dist/chunk-4s9dypby.js +0 -2
- package/dist/chunk-5z56g0n4.js +0 -2
- package/dist/chunk-6ad0nseq.js +0 -2
- package/dist/chunk-7eazcxzf.js +0 -2
- package/dist/chunk-7hy29tcy.js +0 -2
- package/dist/chunk-8fyqbq14.js +0 -2
- package/dist/chunk-92xzpt6p.js +0 -2
- package/dist/chunk-9kmmafp4.js +0 -2
- package/dist/chunk-atgwc7r7.js +0 -2
- package/dist/chunk-bs6y5wy2.js +0 -2
- package/dist/chunk-ccg6xjr1.js +0 -2
- package/dist/chunk-ckv4aty5.js +0 -2
- package/dist/chunk-dbh7h0kt.js +0 -2
- package/dist/chunk-dhqkg0ph.js +0 -2
- package/dist/chunk-ettat5ah.js +0 -2
- package/dist/chunk-f4ws0qcd.js +0 -2
- package/dist/chunk-f97v10zr.js +0 -2
- package/dist/chunk-fe5st320.js +0 -2
- package/dist/chunk-fet3hce8.js +0 -2
- package/dist/chunk-fq7128p1.js +0 -2
- package/dist/chunk-fwy2h1ms.js +0 -2
- package/dist/chunk-gtkhykc4.js +0 -2
- package/dist/chunk-h8pkm7c5.js +0 -2
- package/dist/chunk-hneg0155.js +0 -2
- package/dist/chunk-hs90en70.js +0 -2
- package/dist/chunk-jn3njpxs.js +0 -2
- package/dist/chunk-mcqn70v8.js +0 -3
- package/dist/chunk-mcs7p3fy.js +0 -2
- package/dist/chunk-mmtg0jxd.js +0 -2
- package/dist/chunk-mrsxwd0h.js +0 -2
- package/dist/chunk-mscky0ww.js +0 -2
- package/dist/chunk-mtphm33a.js +0 -2
- package/dist/chunk-p2jbc71s.js +0 -2
- package/dist/chunk-pvd9k3kx.js +0 -2
- package/dist/chunk-pz1jc3db.js +0 -2
- package/dist/chunk-qvr6e2ve.js +0 -3
- package/dist/chunk-ra0pkkvd.js +0 -2
- package/dist/chunk-rcbtd4w3.js +0 -2
- package/dist/chunk-rd2r9jvn.js +0 -2
- package/dist/chunk-s8srb8bg.js +0 -2
- package/dist/chunk-snf2b68p.js +0 -2
- package/dist/chunk-t2bfwr9v.js +0 -2
- package/dist/chunk-tbmwdahm.js +0 -2
- package/dist/chunk-vpv896zx.js +0 -2
- package/dist/chunk-w6h63b48.js +0 -2
- package/dist/chunk-wrk3gkgg.js +0 -2
- package/dist/chunk-wtd71jsa.js +0 -2
- package/dist/chunk-wymf1ek6.js +0 -2
- package/dist/chunk-wz8hyh8h.js +0 -4
- package/dist/chunk-x32wpjs0.js +0 -2
- package/dist/chunk-x4q2eyt0.js +0 -2
- package/dist/chunk-x95ejws0.js +0 -2
- package/dist/chunk-xket8ejt.js +0 -2
- package/dist/chunk-ypfzy1mq.js +0 -2
- package/dist/chunk-zg68pwy8.js +0 -2
- package/dist/chunk-zs58fnme.js +0 -2
- package/dist/chunk-zy3p0vmx.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{pn,m,ho,Tt,Ts,yo,bo,wo,vo}from"./chunk-757ec865.js";import{R}from"./chunk-tafebmtg.js";import{t,K,er,o,te,Cs,_,$t,un,$s,c,p,P,ve,Je,l,tr}from"./chunk-09hhrjk9.js";import{gn,mn,ir,Se}from"./chunk-66k7yxnr.js";import{w,Ss,Xe,cn,Zn,de,ks,pe,Qn}from"./chunk-ax58cds3.js";import{bs,ws,vs,xs,Xn,Gn}from"./chunk-32y3767j.js";import{po,ms,Wn,qn}from"./chunk-g1fxmp9z.js";import{le,Ct,Kn,ys,S,qe}from"./chunk-62r4fa4q.js";import{on}from"./chunk-4e101kjp.js";import{Ps}from"./chunk-4n6c5rp5.js";import{so,io,ao,co}from"./chunk-11ra3sbc.js";import{We}from"./chunk-802pr252.js";import{s,be}from"./chunk-12b8akfg.js";import{kt,go,rn,a,sn}from"./chunk-tfypkw4y.js";import{u}from"./chunk-cg8hg6cs.js";import{fe,D,dn}from"./chunk-jjnfj9nf.js";import{or}from"./chunk-dhxbjw6k.js";import Ar from"path";import ui from"fs";var Wm=new Set(["touchstart","touchmove","wheel","mousewheel"]);function da(x,v){if(v.passive)return!0;if(v.prevent||v.nonpassive)return!1;return Wm.has(x.toLowerCase())}var Zl=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"]),Gl={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"},Vm=new Set(["ctrl","alt","shift","meta"]),Ql={left:0,middle:1,right:2};function Jl(x){let v={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 x){let E=k.toLowerCase();if(E==="prevent")v.prevent=!0;else if(E==="stop")v.stop=!0;else if(E==="once")v.once=!0;else if(E==="capture")v.capture=!0;else if(E==="self")v.self=!0;else if(E==="passive")v.passive=!0;else if(E==="nonpassive")v.nonpassive=!0;else if(Vm.has(E))v.systemKeys.push(E);else if(E in Ql)v.mouse=E;else if(E in Gl||/^[a-z]$/.test(E))v.keys.push(Gl[E]||E.toUpperCase());else if(E.startsWith("debounce")){let C=E.match(/debounce(?:\.(\d+))?/);v.debounce=C?.[1]?Number.parseInt(C[1],10):300}else if(E.startsWith("throttle")){let C=E.match(/throttle(?:\.(\d+))?/);v.throttle=C?.[1]?Number.parseInt(C[1],10):300}}return v}function eu(x,v=""){let k=[],E=0,C=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,j;while((j=C.exec(x))!==null){let[L,B,z]=j,F=j.index,X=F+L.length,G=`__stx_evt_${v}${E++}`,J=[],ne=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,re;while((re=ne.exec(z))!==null){let[,oe,ie]=re,ge=oe.split("."),ue=ge[0];if(!Zl.has(ue))continue;J.push({attribute:`@${oe}`,event:ue,handler:ie,modifiers:Jl(ge.slice(1)),elementId:G})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(z))!==null){let[,oe,ie]=re,ge=oe.split("."),ue=ge[0];if(!Zl.has(ue))continue;J.push({attribute:`@${oe}`,event:ue,handler:ie,modifiers:Jl(ge.slice(1)),elementId:G})}if(J.length>0)k.push({originalTag:L,elementId:G,events:J,startIndex:F,endIndex:X})}return k}function Um(x){let v=[],{modifiers:k}=x;if(k.self)v.push("if ($event.target !== $el) return");for(let E of k.systemKeys)v.push(`if (!$event.${E}Key) return`);if(k.keys.length>0){let E=k.keys.map((C)=>`$event.key === '${C}'`).join(" || ");v.push(`if (!(${E})) return`)}if(k.mouse!==null){let E=Ql[k.mouse];v.push(`if ($event.button !== ${E}) return`)}if(k.prevent)v.push("$event.preventDefault()");if(k.stop)v.push("$event.stopPropagation()");return v.join("; ")}function Hm(x,v){let k=x;if(v.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${v.debounce})`;else if(v.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${v.throttle})`;return k}function fa(x){let v=x.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(v))return x;return`if (typeof ${v} === 'function' && !${v}._isSignal) ${v}($event);`}function qm(x){let{modifiers:v}=x,k=x.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=Um(x),C=Hm(fa(x.handler),v),j=[];if(v.once)j.push("once: true");if(v.capture)j.push("capture: true");if(da(x.event,v))j.push("passive: true");let L=j.length>0?`, { ${j.join(", ")} }`:"",B=C.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(x.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${k}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -53,7 +53,7 @@ else {
|
|
|
53
53
|
__stx_runHandler('${B}', $event, $el);
|
|
54
54
|
}
|
|
55
55
|
}${L});
|
|
56
|
-
})();`}function
|
|
56
|
+
})();`}function pa(x){if(x.length===0)return"";return`
|
|
57
57
|
<script data-stx-events>
|
|
58
58
|
(function() {
|
|
59
59
|
'use strict';
|
|
@@ -108,20 +108,20 @@ else {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Event listeners
|
|
111
|
-
${x.map(
|
|
111
|
+
${x.map(qm).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function
|
|
115
|
-
`+C.slice(L);else C+=j;return C}function
|
|
114
|
+
</script>`}function Km(x,v=""){let k=eu(x,v);if(k.length===0)return{template:x,bindings:[]};let E=x,C=[];for(let j=k.length-1;j>=0;j--){let L=k[j],B=L.originalTag;if(!B.includes(" id="))B=B.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${L.elementId}"`);else{let z=B.match(/id=["']([^"']+)["']/);if(z)for(let F of L.events)F.elementId=z[1]}for(let z of L.events){let F=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`\\s*${F}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${F}\\s*=\\s*'[^']*'`,"g");B=B.replace(X,""),B=B.replace(G,"")}E=E.slice(0,L.startIndex)+B+E.slice(L.endIndex),C.push(...L.events)}return{template:E,bindings:C}}function Yl(x){let v=x.$uid;return typeof v==="string"&&v?`${v}_`:""}function tu(x,v,k){if(yo(x))return x;if(v.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(x))return x;let{template:B,bindings:z}=Km(x,Yl(v)),F=v.__stx_event_bindings||[];return v.__stx_event_bindings=[...F,...z],B}let E=eu(x,Yl(v));if(E.length===0)return x;let C=x;for(let B=E.length-1;B>=0;B--){let z=E[B],F=z.originalTag;if(!F.includes(" id="))F=F.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let X=F.match(/id=["']([^"']+)["']/);if(X)for(let G of z.events)G.elementId=X[1]}for(let X of z.events){let G=X.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ne=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");F=F.replace(J,""),F=F.replace(ne,"")}C=C.slice(0,z.startIndex)+F+C.slice(z.endIndex)}let j=pa(E.flatMap((B)=>B.events)),L=C.lastIndexOf("</body>");if(L!==-1)C=C.slice(0,L)+j+`
|
|
115
|
+
`+C.slice(L);else C+=j;return C}function nu(x,v){let k=new Set;for(let E of x.split(",")){let C=E.trim().replace(/^\.\.\./,"").trim();if(!C)continue;if(v){let j=C.lastIndexOf(":");if(j!==-1)C=C.slice(j+1).trim()}if(C=C.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(C))k.add(C)}return k}function hi(x,v){let k=s(x),{depths:E,balanced:C}=be(k),j=(B)=>!C||E[B]===0,L=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${v}\\b)`,"g");for(let B of k.matchAll(L)){let z=(B.index??0)+B[0].length-B[1].length;if(j(z))return!0}for(let B of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(B.index??0)&&nu(B[1],!0).has(v))return!0;for(let B of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(B.index??0)&&nu(B[1],!1).has(v))return!0;return!1}import Om from"fs";import Qe from"path";import{createHash as Xm}from"crypto";var yi="__stx_component_client_factories";function xi(x){let v=x[yi];return v instanceof Map?v:null}function su(x){x[yi]=new Map}function ga(x,v){let k=xi(x);if(!k)return null;let E=Xm("sha256").update(v).digest("hex").slice(0,16),C=k.get(E);if(C)C.instances++;else k.set(E,{body:v,instances:1});return E}function iu(x,v){let k=xi(v);if(!k?.size)return x;let E=new Map;for(let[X,G]of k)if(G.instances===1)E.set(X,G.body);let C=[];if(E.size>0){let X=[...E.keys()].map((ne)=>JSON.stringify(ne).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${X})\\]\\(("[^"]+")\\);`,"g"),J=G.exec(x);while(J!==null){let ne=E.get(JSON.parse(J[1]));if(ne!==void 0)C.push({start:J.index,end:J.index+J[0].length,replacement:`(${ne})(${J[2]});`});J=G.exec(x)}}let j=[...k].filter(([,X])=>X.instances>1);if(j.length===0)return ru(x,C);let B=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
116
|
(function() {
|
|
117
117
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
|
-
${j.map(([
|
|
119
|
-
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(
|
|
118
|
+
${j.map(([X,G])=>` try { factories[${JSON.stringify(X)}] = factories[${JSON.stringify(X)}] || ${G.body}; }
|
|
119
|
+
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(X)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
120
120
|
`)}
|
|
121
121
|
})();
|
|
122
122
|
</script>`,z=x.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),F=z<0?0:z;return C.push({start:F,end:F,replacement:`${B}
|
|
123
|
-
`}),eu(x,C)}function eu(x,v){if(v.length===0)return x;v.sort((j,L)=>j.start-L.start||j.end-L.end);let k=Array(v.length*2+1),E=0,C=0;for(let j of v)k[C++]=x.slice(E,j.start),k[C++]=j.replacement,E=j.end;return k[C]=x.slice(E),k.join("")}function ru(x){let v=mi(x),k=new Map;if(v)for(let[E,C]of v)k.set(E,C.instances);return k}function su(x,v){let k=mi(x);if(!k)return[];let E=[];for(let[C,j]of k){let L=j.instances-(v.get(C)??0);if(L>0)E.push({body:j.body,count:L})}return E}function iu(x,v){for(let{body:k,count:E}of v)for(let C=0;C<E;C++)da(x,k)}import Nu from"fs";var ou=0,fa=new Map;function Ai(){ou=0,fa.clear()}function hi(x,v){let k=ou++,E=`<!--__STX_${x.toUpperCase()}_${k}__-->`;return fa.set(E,{type:x,expression:v}),E}function Pi(){let x={};for(let[v,k]of fa)x[v]={type:k.type,expression:k.expression};return x}function Ii(x,v){let k=x;for(let[E,C]of v)k=k.split(E).join(C);return k}function Hr(x){return x.includes("<!--__STX_")}var Hm=/@(?=[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 qm(x){return Array.from({length:x},()=>"{").join("⁠")}function au(x){return x.replace(/\{{2,}/g,(v)=>qm(v.length)).replace(/\{(?=!)/g,"{⁠").replace(Hm,"@")}var Km=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Xm=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Zm=/^data:(?:text\/html|application\/xhtml\+xml)/,Gm=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Jm(x){return x.replace(Gm,"").toLowerCase()}function Ym(x){let v=x.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(v))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(v))return"fetched";return null}function cu(x,v="navigable"){let k=Jm(x);if(Km.test(k))return!0;return v==="navigable"?Xm.test(k):Zm.test(k)}function Ms(x,v="navigable"){return cu(x,v)?"unsafe:"+x:x}function Qm(x){let v=x.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!v)return null;if(v[3].trim()!=="")return null;return Ym(v[1])}function pa(x,v,k=256){if(v<=k)return x.slice(0,v);let E=x.slice(v-k,v),C=E.search(/[\s"'`/]/);return C===-1?"":E.slice(C)}function ga(x,v,k=v){let E=Qm(x);return E&&cu(v,E)?"unsafe:"+k:k}var yi=/<script\b[^>]*>/iy,xa=/<\/script\s*>/ig,xi=/<style\b[^>]*>/iy,ba=/<\/style\s*>/ig;function lu(x,v,k,E){k.lastIndex=v;let C=k.exec(x);if(!C||C.index!==v)return-1;E.lastIndex=k.lastIndex;let j=E.exec(x);if(!j)return-1;return j.index+j[0].length}function Y(x,v){return lu(x,v,yi,xa)}function Ar(x,v){return lu(x,v,xi,ba)}function Me(x,v){if(!x.startsWith("<!--",v))return-1;let k=x.indexOf("-->",v+4);if(k===-1)return-1;return k+3}function Mu(x,v){if(x.startsWith("<!--",v)){let C=Me(x,v);return C===-1?x.length:C}if(yi.lastIndex=v,yi.exec(x)?.index===v){xa.lastIndex=yi.lastIndex;let C=xa.exec(x);return C?C.index+C[0].length:x.length}if(xi.lastIndex=v,xi.exec(x)?.index===v){ba.lastIndex=xi.lastIndex;let C=ba.exec(x);return C?C.index+C[0].length:x.length}return-1}function Ir(x,v){let k=[],E=0,C=x.length,j=!1,L=null;while(E<C){let B=x[E];if(j){if(L){if(B===L)L=null}else if(B==='"'||B==="'")L=B;else if(B===">")j=!1;E++;continue}if(B!=="<"){let G=x.indexOf("<",E+1);if(G===-1)break;E=G;continue}let z=v(x,E);if(z>E){k.push({start:E,end:z,token:x.slice(E,z)}),E=z;continue}let F=Mu(x,E);if(F>E){E=F;continue}let K=x.charCodeAt(E+1);if(K>=65&&K<=90||K>=97&&K<=122)j=!0;E++}return k}function Ou(x){let v=0,k=0,E=0,C=!1,j=null;while(E<x.length){if(C){let G=x[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")C=!1;E++;continue}let L=x.indexOf("<",E),B=L===-1?x.length:L;while(E<B){let G=x[E++];if(G==="{")v++;else if(G==="}")k++;if(v>=2&&k>=2)return!0}if(L===-1)break;let z=Mu(x,L);if(z>L){E=z;continue}let F=x.charCodeAt(L+1),K=F===47?x.charCodeAt(L+2):F;if(K>=65&&K<=90||K>=97&&K<=122)C=!0;E=L+1}return!1}function bi(x,v){while(x.size>=v){let k=x.keys().next();if(k.done)return;x.delete(k.value)}}var eh=65536,th=12,ma=new Map;function $n(x,v,k,E){let C=E!==void 0&&x.length>=eh,j=C?`${E}\x00${x}`:"";if(C){let K=ma.get(j);if(K)return{output:K.output,tokens:K.tokens.slice()}}let L=Ir(x,v);if(L.length===0)return{output:x,tokens:[]};let B=L.map((K)=>K.token),z="",F=0;for(let K=0;K<L.length;K++){let G=L[K];z+=x.slice(F,G.start),z+=k(G.token,K),F=G.end}if(z+=x.slice(F),C)return bi(ma,th),ma.set(j,{output:z,tokens:B}),{output:z,tokens:B.slice()};return{output:z,tokens:B}}var nh=65536,rh=4,ha=new Map;function ya(x,v,k){return{output:v,scripts:k,restore:(E)=>E===v?x:Pr(E,k)}}function yn(x){let v=x.length>=nh;if(v){let C=ha.get(x);if(C)return ya(x,C.output,C.scripts.slice())}let{output:k,tokens:E}=$n(x,Y,(C,j)=>`\x00STX_SCRIPT_${j}\x00`);if(v)return bi(ha,rh),ha.set(x,{output:k,scripts:E}),ya(x,k,E.slice());return ya(x,k,E)}function Pr(x,v){if(v.length===0)return x;return x.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>v[+E]??"")}var Ns={},ju=new Map;function sh(x){let v=ju.get(x);if(!v){let k=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");v=new RegExp(`:${k}(?!\\w)`,"g"),ju.set(x,v)}return v.lastIndex=0,v}var An={uppercase:(x,v)=>x!==void 0&&x!==null?String(x).toUpperCase():"",lowercase:(x,v)=>x!==void 0&&x!==null?String(x).toLowerCase():"",capitalize:(x,v)=>{if(x===void 0||x===null)return"";let k=String(x);return k.charAt(0).toUpperCase()+k.slice(1)},number:(x,v,k=0)=>{if(x===void 0||x===null)return"";try{let E=Number(x);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(x,v,k="en-US")=>{if(x===void 0||x===null)return"";try{let E=Number(x);if(Number.isNaN(E))return String(x);return E.toLocaleString(k)}catch{return String(x)}},join:(x,v,k=",")=>{if(!Array.isArray(x))return"";return x.join(String(k))},escape:(x,v)=>{if(x===void 0||x===null)return"";return yt(String(x))},translate:(x,v,k={})=>{if(!v||!v.__translations)return x;let E=v.__translations,C=v.__i18nConfig?.fallbackToKey??!0,j=String(x).split("."),L=E;for(let z of j){if(L===void 0||L===null)break;L=L[z]}if(L===void 0||L===null)return C?x:"";let B=String(L);return Object.entries(k).forEach(([z,F])=>{B=B.replace(sh(z),String(F))}),B},t:(x,v,k={})=>An.translate(x,v,k),truncate:(x,v,k=50,E="...")=>{if(x===void 0||x===null)return"";let C=String(x);if(C.length<=k)return C;if(k<=E.length)return E.substring(0,k);return C.substring(0,k-E.length)+E},date:(x,v,k="short",E="en-US")=>{if(x===void 0||x===null)return"";try{let C=x instanceof Date?x:new Date(x);if(Number.isNaN(C.getTime()))return String(x);let j={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 C.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(C)}catch{return String(x)}},currency:(x,v,k="USD",E="en-US")=>{if(x===void 0||x===null)return"";try{let C=Number(x);if(Number.isNaN(C))return String(x);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(C)}catch{return String(x)}},pluralize:(x,v,k,E)=>{let C=Number(x);if(Number.isNaN(C))return k;let j=E||`${k}s`;return C===1?k:j},first:(x,v)=>{if(x===void 0||x===null)return"";if(Array.isArray(x))return x.length===0?"":x[0];return String(x).charAt(0)},last:(x,v)=>{if(x===void 0||x===null)return"";if(Array.isArray(x))return x.length===0?"":x[x.length-1];let k=String(x);return k.charAt(k.length-1)},length:(x,v)=>{if(x===void 0||x===null)return 0;if(Array.isArray(x)||typeof x==="string")return x.length;if(x instanceof Map||x instanceof Set)return x.size;if(typeof x==="object")return Object.keys(x).length;return 0},json:(x,v,k=!1)=>{if(x===void 0)return"undefined";if(x===null)return"null";try{return k?JSON.stringify(x,null,2):JSON.stringify(x)}catch{return String(x)}},default:(x,v,k="")=>x===void 0||x===null||x===""?k:x,reverse:(x,v)=>{if(x===void 0||x===null)return"";if(Array.isArray(x))return[...x].reverse();return String(x).split("").reverse().join("")},slice:(x,v,k=0,E)=>{if(x===void 0||x===null)return"";if(Array.isArray(x)||typeof x==="string")return x.slice(k,E);return x},replace:(x,v,k,E="")=>{if(x===void 0||x===null)return"";let C=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(x).replace(new RegExp(C,"g"),()=>E)},stripTags:(x,v)=>{if(x===void 0||x===null)return"";return String(x).replace(/<[^>]*>/g,"")},urlencode:(x,v)=>{if(x===void 0||x===null)return"";return encodeURIComponent(String(x))},abs:(x,v)=>{let k=Number(x);return Number.isNaN(k)?0:Math.abs(k)},round:(x,v,k=0)=>{let E=Number(x);if(Number.isNaN(E))return 0;let C=10**k;return Math.round(E*C)/C}};function Oa(x,v){if(x in An)console.warn(`Filter "${x}" already exists as a built-in filter. Custom filter will take precedence.`);Ns[x]=v}function du(x){for(let[v,k]of Object.entries(x))Oa(v,k)}function Ma(){return{...An,...Ns}}function pu(){for(let x of Object.keys(Ns))delete Ns[x]}function Na(x,v,k=2){let E=0,C=null;for(let j=v+k;j<x.length;j++){let L=x[j];if(C){if(L==="\\"){j++;continue}if(L===C)C=null;continue}if(L==='"'||L==="'"||L==="`"){C=L;continue}if(L==="{"){E++;continue}if(L==="}"){if(E>0){E--;continue}let B=0;while(x[j+B]==="}")B++;if(B>=k)return j}}return-1}function Pn(x,v,k=2){let E="{".repeat(k);if(!x.includes(E))return x;let C="",j=0;for(;;){let L=x.indexOf(E,j);if(L===-1)break;let B=Na(x,L,k);if(B===-1)break;C+=x.slice(j,L)+v(x.slice(L,B+k),x.slice(L+k,B),L),j=B+k}return j===0?x:C+x.slice(j)}function h(x){return x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function yt(x){return au(h(x))}function me(x,v){let{scripts:k}=yn(x);for(let E of k){let C=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!C||/\bserver\b|\bsrc\s*=/.test(C[1]))continue;let j=C[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(un(j,v))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(x))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(x))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(x))return!0;return!1}function La(x){let v=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(x);E;E=k.exec(x)){let C=E[1].toLowerCase(),j=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(E[3]);if(!j)continue;let L=new Set([j[1],...j[2]?[j[2]]:[]]),B=E.index+E[0].length;if(E[0].endsWith("/>")){v.push({start:E.index,end:B,names:L});continue}let z=new RegExp(`<(/?)${C}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let F=1,K=x.length;for(let G=z.exec(x);G;G=z.exec(x)){if(G[2]==="/")continue;if(F+=G[1]==="/"?-1:1,F===0){K=G.index+G[0].length;break}}v.push({start:E.index,end:K,names:L})}return v}function ih(x,v,k){let E=s(k);for(let C of x){if(v<C.start||v>=C.end)continue;for(let j of C.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function Lu(x,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"],E=x.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),C="",j=!1,L=0;for(let F=0;F<E.length;F++){let K=E[F];if(!j&&K==="`"){j=!0,L=0;continue}if(j){if(K==="`"&&L===0){j=!1;continue}if(K==="$"&&E[F+1]==="{"){L++,F++,C+=" ";continue}if(K==="}"&&L>0){L--;continue}if(L>0){C+=K;continue}continue}C+=K}E=C;let B=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,z;while((z=B.exec(E))!==null){let F=z[1];if(!E.substring(0,z.index).trimEnd().endsWith(".")){if(!k.includes(F)&&!(F in v))return!1}}return!0}function oh(x,v){let k=v.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(x);for(let C of k)if(new RegExp(`(?<![.#\\w$])${C}(?![\\w$])`).test(E))return!0;return!1}var Bu=new Set;function zu(x){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(x.trim())}function Fu(x,v){let k=`${v??"<unknown>"}\x00${x}`;if(process.env.STX_DEBUG||!Bu.has(k))Bu.add(k),console.warn(`[stx] {{ ${x} }} in a <script> in ${v??"<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 Vr(x,v,k){let E=x;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(C,j)=>{try{let L=b(j,v);if(L===void 0)return zu(j)?Fu(j.trim(),k):C;return L===null?"":String(L)}catch{return C}}),E=Pn(E,(C,j,L)=>{let B=j.trim();if(/^__[A-Z_]+__$/.test(B))return C;try{let z=b(j,v);if(z===void 0)return zu(B)?Fu(B,k):C;return JSON.stringify(z).replace(/</g,"\\u003c")}catch{return C}}),E}function ja(x,v){if(!x.includes("{"))return x;let k=x;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,C)=>{try{let j=b(C,v);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Pn(k,(E,C,j)=>{let L=C.trim();if(/^__[A-Z_]+__$/.test(L))return E;try{let B=b(C,v);if(B===void 0)return E;if(B===null)return"";let z=String(B);return ga(pa(k,j),z,yt(z))}catch{return E}}),k}function fu(x,v,k={}){let{output:E,scripts:C}=yn(x),j=C.map((L)=>{let B=L.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),z=L.match(/^<script\b[^>]*>/i),F=L.search(/<\/script\s*>$/i);if(!B||!z||F===-1)return L;let K=B[1],G=B[2];if(/\bdata-raw\b/.test(K))return L;if(k.skipServer&&/\bserver\b/.test(K))return L;let ne=`<script${ja(K,v)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return ne+G+L.slice(F);return ne+Vr(G,v)+L.slice(F)});return Pr(E,j)}function W(x,v,k){let E=x,C=(J,ne)=>{let re=Ar(J,ne);if(re===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(ne,re))?-1:re},j=(J,ne,re,se)=>{let oe=re.length,{output:ie,tokens:fe}=$n(J,ne,(ue,be)=>se(oe+be));return re.push(...fe),ie},L=[];E=j(E,C,L,(J)=>`<!--__STX_STYLE_${J}__-->`);let B=[];E=j(E,Y,B,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let z=v?.__stx_signals_gate===!0||me(x),F=new Set(Array.isArray(v?.__stx_client_signal_names)?v.__stx_client_signal_names:[]),K=new Set(Array.isArray(v?.__stx_preserved_client_expressions)?v.__stx_preserved_client_expressions:[]);E=Pn(E,(J,ne,re)=>{try{let se=b(ne,v,!1,(oe)=>va(oe,J,k,x));return se!==void 0&&se!==null?String(se):""}catch(se){let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${ne.trim()}}}}: ${oe}`,k,x,re,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,ne,re)=>{try{let se=b(ne,v,!1,(oe)=>va(oe,J,k,x));if(se===void 0&&v.__stx_buildMode==="compile")return hi("raw",ne.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(v.__stx_buildMode==="compile")return hi("raw",ne.trim());let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${ne.trim()} !!}: ${oe}`,k,x,re,J)}}),E=j(E,Y,B,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,C,L,(J)=>`<!--__STX_STYLE_${J}__-->`);let G=z?La(E):[];if(E=Pn(E,(J,ne,re)=>{let se=ne.trim();if(G.length>0&&ih(G,re,se))return J;if(K.has(se))return J;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ie=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ue=se.match(ie)?.[1],be=ue&&((ue in v)||oe.includes(ue)),we=Boolean(ue&&F.has(ue)),Se=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,$e=se.match(Se),Ee=$e&&!oe.includes($e[1])&&!($e[1]in v);if(/^__[A-Z_]+__$/.test(se))return"";let ke;try{let Re=b(ne,v,!1,(_e)=>{ke=_e});if(we)return J;if(z&&!Lu(se,v))return J;if(ke)va(ke,J,k,x);if(v.__stx_buildMode==="compile"&&!z&&(Re===void 0||oh(se,v)))return hi("expr",se);if(Re===void 0||Re===null)return"";let Ce=String(Re);return ga(pa(E,re),Ce,yt(Ce))}catch(Re){if(we)return J;if(z&&!Lu(se,v))return J;if(Ee)return J;let Ce=Re instanceof Error?Re.message:String(Re);return g("Expression",`Error evaluating: {{ ${se} }}: ${Ce}`,k,x,re,J)}}),B.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,ne)=>B[Number(ne)]??J);if(L.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,ne)=>L[Number(ne)]??J);return E}function Ba(x,v,k){if(!v.trim())return x;let E=x,C=v.trim();while(C.length>0){let j=C.match(/^(\w+)/);if(!j)break;let L=j[1];C=C.substring(L.length).trim();let B=Ns[L]||An[L];if(!B)throw Error(`Filter not found: ${L}. Available filters: ${Object.keys(Ma()).join(", ")}`);let z=[];if(C.startsWith(":")){let F=C.match(/^:([^|\s]+)/);if(F){let K=F[1].trim();try{let G=Number(K);z=[Number.isNaN(G)?K:G]}catch{z=[K]}C=C.substring(F[0].length).trim()}}else if(C.startsWith("(")){let F=1,K=1;while(F>0&&K<C.length){if(C[K]==="(")F++;if(C[K]===")")F--;K++}if(F===0){let G=C.substring(1,K-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))z=[b(`(${G})`,k,!0)];else{let J=[],ne="",re=null,se=0,oe=0,ie=0,fe=!1;for(let ue=0;ue<G.length;ue++){let be=G[ue];if(fe){ne+=be,fe=!1;continue}if(be==="\\"){ne+=be,fe=!0;continue}if(re){if(ne+=be,be===re)re=null;continue}if(be==='"'||be==="'"||be==="`"){re=be,ne+=be;continue}if(be==="(")se++;else if(be===")")se--;else if(be==="[")oe++;else if(be==="]")oe--;else if(be==="{")ie++;else if(be==="}")ie--;if(be===","&&se===0&&oe===0&&ie===0){J.push(ne),ne="";continue}ne+=be}if(ne)J.push(ne);z=J.map((ue)=>{let be=ue.trim();return b(be,k,!0)})}}catch{z=[G]}C=C.substring(K).trim()}}try{E=B(E,k,...z)}catch(F){let K=F instanceof Error?F.message:String(F);throw Error(`Error applying filter '${L}': ${K}`)}if(C.startsWith("|"))C=C.substring(1).trim();else break}return E}function ah(x){let v=!1,k="",E=0,C=0,j=0,L=!1;for(let B=0;B<x.length;B++){let z=x[B],F=x[B+1];if(v&&L){L=!1;continue}if(v&&z==="\\"){L=!0;continue}if(L=!1,(z==='"'||z==="'"||z==="`")&&!L){if(!v)v=!0,k=z;else if(z===k)v=!1,k="";continue}if(v&&k==="`"&&z==="$"&&F==="{"){let K=1;B+=2;while(B<x.length&&K>0){if(x[B]==="{")K++;else if(x[B]==="}")K--;if(K>0)B++}continue}if(v)continue;if(z==="(")E++;else if(z===")")E--;else if(z==="[")C++;else if(z==="]")C--;else if(z==="{")j++;else if(z==="}")j--;if(z==="|"&&E===0&&C===0&&j===0){if(F==="|"){B++;continue}if(F==="="){B++;continue}return B}}return-1}var Os=new Set,ch=1000;function gu(){Os.clear()}function va(x,v,k,E){if(!D())return;let C=`${k}\x00${x.expression}`;if(Os.has(C))return;if(Os.size>=ch)Os.clear();Os.add(C);let j=k,L=E;try{if(k&&Nu.existsSync(k))L=Nu.readFileSync(k,"utf8")}catch{}let B=L.indexOf(v);if(B>=0)j=`${k}:${L.slice(0,B).split(`
|
|
124
|
-
`).length}`;console.warn(`${j}: stx warning: ${v} rendered as an empty string. The safe evaluator rejected \`${x.expression}\` (${x.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function b(x,v,k=!1,E){try{let C=x.trim(),j=
|
|
123
|
+
`}),ru(x,C)}function ru(x,v){if(v.length===0)return x;v.sort((j,L)=>j.start-L.start||j.end-L.end);let k=Array(v.length*2+1),E=0,C=0;for(let j of v)k[C++]=x.slice(E,j.start),k[C++]=j.replacement,E=j.end;return k[C]=x.slice(E),k.join("")}function ou(x){let v=xi(x),k=new Map;if(v)for(let[E,C]of v)k.set(E,C.instances);return k}function au(x,v){let k=xi(x);if(!k)return[];let E=[];for(let[C,j]of k){let L=j.instances-(v.get(C)??0);if(L>0)E.push({body:j.body,count:L})}return E}function cu(x,v){for(let{body:k,count:E}of v)for(let C=0;C<E;C++)ga(x,k)}import Bu from"fs";var lu=0,ma=new Map;function Di(){lu=0,ma.clear()}function bi(x,v){let k=lu++,E=`<!--__STX_${x.toUpperCase()}_${k}__-->`;return ma.set(E,{type:x,expression:v}),E}function Oi(){let x={};for(let[v,k]of ma)x[v]={type:k.type,expression:k.expression};return x}function Mi(x,v){let k=x;for(let[E,C]of v)k=k.split(E).join(C);return k}function Wr(x){return x.includes("<!--__STX_")}var Zm=/@(?=[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 Gm(x){return Array.from({length:x},()=>"{").join("⁠")}function uu(x){return x.replace(/\{{2,}/g,(v)=>Gm(v.length)).replace(/\{(?=!)/g,"{⁠").replace(Zm,"@")}var Jm=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Ym=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Qm=/^data:(?:text\/html|application\/xhtml\+xml)/,eh=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function th(x){return x.replace(eh,"").toLowerCase()}function nh(x){let v=x.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(v))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(v))return"fetched";return null}function du(x,v="navigable"){let k=th(x);if(Jm.test(k))return!0;return v==="navigable"?Ym.test(k):Qm.test(k)}function js(x,v="navigable"){return du(x,v)?"unsafe:"+x:x}function rh(x){let v=x.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!v)return null;if(v[3].trim()!=="")return null;return nh(v[1])}function ha(x,v,k=256){if(v<=k)return x.slice(0,v);let E=x.slice(v-k,v),C=E.search(/[\s"'`/]/);return C===-1?"":E.slice(C)}function ya(x,v,k=v){let E=rh(x);return E&&du(v,E)?"unsafe:"+k:k}var vi=/<script\b[^>]*>/iy,wa=/<\/script\s*>/ig,wi=/<style\b[^>]*>/iy,Sa=/<\/style\s*>/ig;function pu(x,v,k,E){k.lastIndex=v;let C=k.exec(x);if(!C||C.index!==v)return-1;E.lastIndex=k.lastIndex;let j=E.exec(x);if(!j)return-1;return j.index+j[0].length}function Y(x,v){return pu(x,v,vi,wa)}function Dr(x,v){return pu(x,v,wi,Sa)}function Ne(x,v){if(!x.startsWith("<!--",v))return-1;let k=x.indexOf("-->",v+4);if(k===-1)return-1;return k+3}function ju(x,v){if(x.startsWith("<!--",v)){let C=Ne(x,v);return C===-1?x.length:C}if(vi.lastIndex=v,vi.exec(x)?.index===v){wa.lastIndex=vi.lastIndex;let C=wa.exec(x);return C?C.index+C[0].length:x.length}if(wi.lastIndex=v,wi.exec(x)?.index===v){Sa.lastIndex=wi.lastIndex;let C=Sa.exec(x);return C?C.index+C[0].length:x.length}return-1}function Mr(x,v){let k=[],E=0,C=x.length,j=!1,L=null;while(E<C){let B=x[E];if(j){if(L){if(B===L)L=null}else if(B==='"'||B==="'")L=B;else if(B===">")j=!1;E++;continue}if(B!=="<"){let G=x.indexOf("<",E+1);if(G===-1)break;E=G;continue}let z=v(x,E);if(z>E){k.push({start:E,end:z,token:x.slice(E,z)}),E=z;continue}let F=ju(x,E);if(F>E){E=F;continue}let X=x.charCodeAt(E+1);if(X>=65&&X<=90||X>=97&&X<=122)j=!0;E++}return k}function Lu(x){let v=0,k=0,E=0,C=!1,j=null;while(E<x.length){if(C){let G=x[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")C=!1;E++;continue}let L=x.indexOf("<",E),B=L===-1?x.length:L;while(E<B){let G=x[E++];if(G==="{")v++;else if(G==="}")k++;if(v>=2&&k>=2)return!0}if(L===-1)break;let z=ju(x,L);if(z>L){E=z;continue}let F=x.charCodeAt(L+1),X=F===47?x.charCodeAt(L+2):F;if(X>=65&&X<=90||X>=97&&X<=122)C=!0;E=L+1}return!1}function Si(x,v){while(x.size>=v){let k=x.keys().next();if(k.done)return;x.delete(k.value)}}var sh=65536,ih=12,xa=new Map;function kn(x,v,k,E){let C=E!==void 0&&x.length>=sh,j=C?`${E}\x00${x}`:"";if(C){let X=xa.get(j);if(X)return{output:X.output,tokens:X.tokens.slice()}}let L=Mr(x,v);if(L.length===0)return{output:x,tokens:[]};let B=L.map((X)=>X.token),z="",F=0;for(let X=0;X<L.length;X++){let G=L[X];z+=x.slice(F,G.start),z+=k(G.token,X),F=G.end}if(z+=x.slice(F),C)return Si(xa,ih),xa.set(j,{output:z,tokens:B}),{output:z,tokens:B.slice()};return{output:z,tokens:B}}var oh=65536,ah=4,ba=new Map;function va(x,v,k){return{output:v,scripts:k,restore:(E)=>E===v?x:Or(E,k)}}function bn(x){let v=x.length>=oh;if(v){let C=ba.get(x);if(C)return va(x,C.output,C.scripts.slice())}let{output:k,tokens:E}=kn(x,Y,(C,j)=>`\x00STX_SCRIPT_${j}\x00`);if(v)return Si(ba,ah),ba.set(x,{output:k,scripts:E}),va(x,k,E.slice());return va(x,k,E)}function Or(x,v){if(v.length===0)return x;return x.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>v[+E]??"")}var Bs={},zu=new Map;function ch(x){let v=zu.get(x);if(!v){let k=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");v=new RegExp(`:${k}(?!\\w)`,"g"),zu.set(x,v)}return v.lastIndex=0,v}var In={uppercase:(x,v)=>x!==void 0&&x!==null?String(x).toUpperCase():"",lowercase:(x,v)=>x!==void 0&&x!==null?String(x).toLowerCase():"",capitalize:(x,v)=>{if(x===void 0||x===null)return"";let k=String(x);return k.charAt(0).toUpperCase()+k.slice(1)},number:(x,v,k=0)=>{if(x===void 0||x===null)return"";try{let E=Number(x);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(x,v,k="en-US")=>{if(x===void 0||x===null)return"";try{let E=Number(x);if(Number.isNaN(E))return String(x);return E.toLocaleString(k)}catch{return String(x)}},join:(x,v,k=",")=>{if(!Array.isArray(x))return"";return x.join(String(k))},escape:(x,v)=>{if(x===void 0||x===null)return"";return bt(String(x))},translate:(x,v,k={})=>{if(!v||!v.__translations)return x;let E=v.__translations,C=v.__i18nConfig?.fallbackToKey??!0,j=String(x).split("."),L=E;for(let z of j){if(L===void 0||L===null)break;L=L[z]}if(L===void 0||L===null)return C?x:"";let B=String(L);return Object.entries(k).forEach(([z,F])=>{B=B.replace(ch(z),String(F))}),B},t:(x,v,k={})=>In.translate(x,v,k),truncate:(x,v,k=50,E="...")=>{if(x===void 0||x===null)return"";let C=String(x);if(C.length<=k)return C;if(k<=E.length)return E.substring(0,k);return C.substring(0,k-E.length)+E},date:(x,v,k="short",E="en-US")=>{if(x===void 0||x===null)return"";try{let C=x instanceof Date?x:new Date(x);if(Number.isNaN(C.getTime()))return String(x);let j={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 C.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(C)}catch{return String(x)}},currency:(x,v,k="USD",E="en-US")=>{if(x===void 0||x===null)return"";try{let C=Number(x);if(Number.isNaN(C))return String(x);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(C)}catch{return String(x)}},pluralize:(x,v,k,E)=>{let C=Number(x);if(Number.isNaN(C))return k;let j=E||`${k}s`;return C===1?k:j},first:(x,v)=>{if(x===void 0||x===null)return"";if(Array.isArray(x))return x.length===0?"":x[0];return String(x).charAt(0)},last:(x,v)=>{if(x===void 0||x===null)return"";if(Array.isArray(x))return x.length===0?"":x[x.length-1];let k=String(x);return k.charAt(k.length-1)},length:(x,v)=>{if(x===void 0||x===null)return 0;if(Array.isArray(x)||typeof x==="string")return x.length;if(x instanceof Map||x instanceof Set)return x.size;if(typeof x==="object")return Object.keys(x).length;return 0},json:(x,v,k=!1)=>{if(x===void 0)return"undefined";if(x===null)return"null";try{return k?JSON.stringify(x,null,2):JSON.stringify(x)}catch{return String(x)}},default:(x,v,k="")=>x===void 0||x===null||x===""?k:x,reverse:(x,v)=>{if(x===void 0||x===null)return"";if(Array.isArray(x))return[...x].reverse();return String(x).split("").reverse().join("")},slice:(x,v,k=0,E)=>{if(x===void 0||x===null)return"";if(Array.isArray(x)||typeof x==="string")return x.slice(k,E);return x},replace:(x,v,k,E="")=>{if(x===void 0||x===null)return"";let C=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(x).replace(new RegExp(C,"g"),()=>E)},stripTags:(x,v)=>{if(x===void 0||x===null)return"";return String(x).replace(/<[^>]*>/g,"")},urlencode:(x,v)=>{if(x===void 0||x===null)return"";return encodeURIComponent(String(x))},abs:(x,v)=>{let k=Number(x);return Number.isNaN(k)?0:Math.abs(k)},round:(x,v,k=0)=>{let E=Number(x);if(Number.isNaN(E))return 0;let C=10**k;return Math.round(E*C)/C}};function La(x,v){if(x in In)console.warn(`Filter "${x}" already exists as a built-in filter. Custom filter will take precedence.`);Bs[x]=v}function gu(x){for(let[v,k]of Object.entries(x))La(v,k)}function ja(){return{...In,...Bs}}function mu(){for(let x of Object.keys(Bs))delete Bs[x]}function Ba(x,v,k=2){let E=0,C=null;for(let j=v+k;j<x.length;j++){let L=x[j];if(C){if(L==="\\"){j++;continue}if(L===C)C=null;continue}if(L==='"'||L==="'"||L==="`"){C=L;continue}if(L==="{"){E++;continue}if(L==="}"){if(E>0){E--;continue}let B=0;while(x[j+B]==="}")B++;if(B>=k)return j}}return-1}function Dn(x,v,k=2){let E="{".repeat(k);if(!x.includes(E))return x;let C="",j=0;for(;;){let L=x.indexOf(E,j);if(L===-1)break;let B=Ba(x,L,k);if(B===-1)break;C+=x.slice(j,L)+v(x.slice(L,B+k),x.slice(L+k,B),L),j=B+k}return j===0?x:C+x.slice(j)}function h(x){return x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function bt(x){return uu(h(x))}function he(x,v){let{scripts:k}=bn(x);for(let E of k){let C=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!C||/\bserver\b|\bsrc\s*=/.test(C[1]))continue;let j=C[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(pn(j,v))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(x))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(x))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(x))return!0;return!1}function Fa(x){let v=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(x);E;E=k.exec(x)){let C=E[1].toLowerCase(),j=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(E[3]);if(!j)continue;let L=new Set([j[1],...j[2]?[j[2]]:[]]),B=E.index+E[0].length;if(E[0].endsWith("/>")){v.push({start:E.index,end:B,names:L});continue}let z=new RegExp(`<(/?)${C}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let F=1,X=x.length;for(let G=z.exec(x);G;G=z.exec(x)){if(G[2]==="/")continue;if(F+=G[1]==="/"?-1:1,F===0){X=G.index+G[0].length;break}}v.push({start:E.index,end:X,names:L})}return v}function lh(x,v,k){let E=s(k);for(let C of x){if(v<C.start||v>=C.end)continue;for(let j of C.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function Fu(x,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"],E=x.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),C="",j=!1,L=0;for(let F=0;F<E.length;F++){let X=E[F];if(!j&&X==="`"){j=!0,L=0;continue}if(j){if(X==="`"&&L===0){j=!1;continue}if(X==="$"&&E[F+1]==="{"){L++,F++,C+=" ";continue}if(X==="}"&&L>0){L--;continue}if(L>0){C+=X;continue}continue}C+=X}E=C;let B=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,z;while((z=B.exec(E))!==null){let F=z[1];if(!E.substring(0,z.index).trimEnd().endsWith(".")){if(!k.includes(F)&&!(F in v))return!1}}return!0}function uh(x,v){let k=v.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(x);for(let C of k)if(new RegExp(`(?<![.#\\w$])${C}(?![\\w$])`).test(E))return!0;return!1}var Wu=new Set;function Vu(x){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(x.trim())}function Uu(x,v){let k=`${v??"<unknown>"}\x00${x}`;if(process.env.STX_DEBUG||!Wu.has(k))Wu.add(k),console.warn(`[stx] {{ ${x} }} in a <script> in ${v??"<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 qr(x,v,k){let E=x;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(C,j)=>{try{let L=b(j,v);if(L===void 0)return Vu(j)?Uu(j.trim(),k):C;return L===null?"":String(L)}catch{return C}}),E=Dn(E,(C,j,L)=>{let B=j.trim();if(/^__[A-Z_]+__$/.test(B))return C;try{let z=b(j,v);if(z===void 0)return Vu(B)?Uu(B,k):C;return JSON.stringify(z).replace(/</g,"\\u003c")}catch{return C}}),E}function za(x,v){if(!x.includes("{"))return x;let k=x;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,C)=>{try{let j=b(C,v);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Dn(k,(E,C,j)=>{let L=C.trim();if(/^__[A-Z_]+__$/.test(L))return E;try{let B=b(C,v);if(B===void 0)return E;if(B===null)return"";let z=String(B);return ya(ha(k,j),z,bt(z))}catch{return E}}),k}function hu(x,v,k={}){let{output:E,scripts:C}=bn(x),j=C.map((L)=>{let B=L.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),z=L.match(/^<script\b[^>]*>/i),F=L.search(/<\/script\s*>$/i);if(!B||!z||F===-1)return L;let X=B[1],G=B[2];if(/\bdata-raw\b/.test(X))return L;if(k.skipServer&&/\bserver\b/.test(X))return L;let ne=`<script${za(X,v)}>`;if(/\bsrc\s*=/.test(X)||/\btype\s*=\s*["']application\/json["']/.test(X))return ne+G+L.slice(F);return ne+qr(G,v)+L.slice(F)});return Or(E,j)}function W(x,v,k){let E=x,C=(J,ne)=>{let re=Dr(J,ne);if(re===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(ne,re))?-1:re},j=(J,ne,re,se)=>{let oe=re.length,{output:ie,tokens:ge}=kn(J,ne,(ue,xe)=>se(oe+xe));return re.push(...ge),ie},L=[];E=j(E,C,L,(J)=>`<!--__STX_STYLE_${J}__-->`);let B=[];E=j(E,Y,B,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let z=v?.__stx_signals_gate===!0||he(x),F=new Set(Array.isArray(v?.__stx_client_signal_names)?v.__stx_client_signal_names:[]),X=new Set(Array.isArray(v?.__stx_preserved_client_expressions)?v.__stx_preserved_client_expressions:[]);E=Dn(E,(J,ne,re)=>{try{let se=b(ne,v,!1,(oe)=>$a(oe,J,k,x));return se!==void 0&&se!==null?String(se):""}catch(se){let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${ne.trim()}}}}: ${oe}`,k,x,re,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,ne,re)=>{try{let se=b(ne,v,!1,(oe)=>$a(oe,J,k,x));if(se===void 0&&v.__stx_buildMode==="compile")return bi("raw",ne.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(v.__stx_buildMode==="compile")return bi("raw",ne.trim());let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${ne.trim()} !!}: ${oe}`,k,x,re,J)}}),E=j(E,Y,B,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,C,L,(J)=>`<!--__STX_STYLE_${J}__-->`);let G=z?Fa(E):[];if(E=Dn(E,(J,ne,re)=>{let se=ne.trim();if(G.length>0&&lh(G,re,se))return J;if(X.has(se))return J;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ie=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ue=se.match(ie)?.[1],xe=ue&&((ue in v)||oe.includes(ue)),we=Boolean(ue&&F.has(ue)),$e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,_e=se.match($e),Ce=_e&&!oe.includes(_e[1])&&!(_e[1]in v);if(/^__[A-Z_]+__$/.test(se))return"";let Ee;try{let Te=b(ne,v,!1,(ke)=>{Ee=ke});if(we)return J;if(z&&!Fu(se,v))return J;if(Ee)$a(Ee,J,k,x);if(v.__stx_buildMode==="compile"&&!z&&(Te===void 0||uh(se,v)))return bi("expr",se);if(Te===void 0||Te===null)return"";let Re=String(Te);return ya(ha(E,re),Re,bt(Re))}catch(Te){if(we)return J;if(z&&!Fu(se,v))return J;if(Ce)return J;let Re=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${se} }}: ${Re}`,k,x,re,J)}}),B.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,ne)=>B[Number(ne)]??J);if(L.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,ne)=>L[Number(ne)]??J);return E}function Ha(x,v,k){if(!v.trim())return x;let E=x,C=v.trim();while(C.length>0){let j=C.match(/^(\w+)/);if(!j)break;let L=j[1];C=C.substring(L.length).trim();let B=Bs[L]||In[L];if(!B)throw Error(`Filter not found: ${L}. Available filters: ${Object.keys(ja()).join(", ")}`);let z=[];if(C.startsWith(":")){let F=C.match(/^:([^|\s]+)/);if(F){let X=F[1].trim();try{let G=Number(X);z=[Number.isNaN(G)?X:G]}catch{z=[X]}C=C.substring(F[0].length).trim()}}else if(C.startsWith("(")){let F=1,X=1;while(F>0&&X<C.length){if(C[X]==="(")F++;if(C[X]===")")F--;X++}if(F===0){let G=C.substring(1,X-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))z=[b(`(${G})`,k,!0)];else{let J=[],ne="",re=null,se=0,oe=0,ie=0,ge=!1;for(let ue=0;ue<G.length;ue++){let xe=G[ue];if(ge){ne+=xe,ge=!1;continue}if(xe==="\\"){ne+=xe,ge=!0;continue}if(re){if(ne+=xe,xe===re)re=null;continue}if(xe==='"'||xe==="'"||xe==="`"){re=xe,ne+=xe;continue}if(xe==="(")se++;else if(xe===")")se--;else if(xe==="[")oe++;else if(xe==="]")oe--;else if(xe==="{")ie++;else if(xe==="}")ie--;if(xe===","&&se===0&&oe===0&&ie===0){J.push(ne),ne="";continue}ne+=xe}if(ne)J.push(ne);z=J.map((ue)=>{let xe=ue.trim();return b(xe,k,!0)})}}catch{z=[G]}C=C.substring(X).trim()}}try{E=B(E,k,...z)}catch(F){let X=F instanceof Error?F.message:String(F);throw Error(`Error applying filter '${L}': ${X}`)}if(C.startsWith("|"))C=C.substring(1).trim();else break}return E}function dh(x){let v=!1,k="",E=0,C=0,j=0,L=!1;for(let B=0;B<x.length;B++){let z=x[B],F=x[B+1];if(v&&L){L=!1;continue}if(v&&z==="\\"){L=!0;continue}if(L=!1,(z==='"'||z==="'"||z==="`")&&!L){if(!v)v=!0,k=z;else if(z===k)v=!1,k="";continue}if(v&&k==="`"&&z==="$"&&F==="{"){let X=1;B+=2;while(B<x.length&&X>0){if(x[B]==="{")X++;else if(x[B]==="}")X--;if(X>0)B++}continue}if(v)continue;if(z==="(")E++;else if(z===")")E--;else if(z==="[")C++;else if(z==="]")C--;else if(z==="{")j++;else if(z==="}")j--;if(z==="|"&&E===0&&C===0&&j===0){if(F==="|"){B++;continue}if(F==="="){B++;continue}return B}}return-1}var Ls=new Set,fh=1000;function yu(){Ls.clear()}function $a(x,v,k,E){if(!D())return;let C=`${k}\x00${x.expression}`;if(Ls.has(C))return;if(Ls.size>=fh)Ls.clear();Ls.add(C);let j=k,L=E;try{if(k&&Bu.existsSync(k))L=Bu.readFileSync(k,"utf8")}catch{}let B=L.indexOf(v);if(B>=0)j=`${k}:${L.slice(0,B).split(`
|
|
124
|
+
`).length}`;console.warn(`${j}: stx warning: ${v} rendered as an empty string. The safe evaluator rejected \`${x.expression}\` (${x.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function b(x,v,k=!1,E){try{let C=x.trim(),j=dh(C);if(j>0){let B=C.substring(0,j).trim(),z=C.substring(j+1).trim(),F=b(B,v,!0,E);return Ha(F,z,v)}let L=un(C);if(L!==null){E?.({expression:C,rule:L});return}try{let B=Object.keys(v),z=Object.values(v);return l(C,B)(...z)}catch{return c(C,v)}}catch(C){if(C instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(C.message);if(j){let L=j[1],B=ph(L,Object.keys(v));if(B&&B!==L)C.message=`${C.message} \u2014 did you mean '${B}'?`}}if(!k)console.error(`Error evaluating expression: ${x}`,C);throw C}}function ph(x,v){let k=null;for(let C of v){if(C===x)continue;let j=gh(x,C);if(k===null||j<k.dist)k={key:C,dist:j}}if(!k)return null;let E=Math.max(x.length,k.key.length);if(k.dist<=2||k.dist/E<=0.35)return k.key;return null}function gh(x,v){if(x===v)return 0;if(x.length===0)return v.length;if(v.length===0)return x.length;let[k,E]=x.length<v.length?[x,v]:[v,x],C=Array(k.length+1),j=Array(k.length+1);for(let L=0;L<=k.length;L++)C[L]=L;for(let L=1;L<=E.length;L++){j[0]=L;for(let B=1;B<=k.length;B++){let z=k[B-1]===E[L-1]?0:1;j[B]=Math.min(j[B-1]+1,C[B]+1,C[B-1]+z)}for(let B=0;B<=k.length;B++)C[B]=j[B]}return C[k.length]}function bu(x){if(!x)return"";return x.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Ku from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(x=100,v){this.maxSize=x,this.options=v??null,this.sizes=v?new Map:null}get byteSize(){return this.bytes}setMaxBytes(x){if(!this.options)return;this.options={...this.options,maxBytes:x};while(this.bytes>x&&this.cache.size>0){let v=this.cache.keys().next().value;if(v===void 0)break;this.delete(v)}}get(x){if(!this.cache.has(x))return;let v=this.cache.get(x);return this.cache.delete(x),this.cache.set(x,v),v}set(x,v){if(this.cache.has(x))this.delete(x);let k=this.options?this.options.sizeOf(v):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 E=this.cache.keys().next().value;if(E===void 0)break;this.delete(E)}if(this.cache.set(x,v),this.sizes)this.sizes.set(x,k),this.bytes+=k}has(x){return this.cache.has(x)}delete(x){if(this.sizes){let v=this.sizes.get(x);if(v!==void 0)this.bytes-=v,this.sizes.delete(x)}return this.cache.delete(x)}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 Nr=new Map,mh=500;function xr(x,v){if(v?.includes("g"))return new RegExp(x,v);let k=`${x}:${v||""}`;if(!Nr.has(k)){if(Nr.size>=mh){let E=Nr.keys().next().value;if(E)Nr.delete(E)}Nr.set(k,new RegExp(x,v))}return Nr.get(k)}class Hu{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(x){let v=Array.from(new Set(x)),k=v.sort().join(","),E=this.pool.find((B)=>B.context.join(",")===k);if(E)return E.func;let C=this.fnCache,j=this.fnCacheMaxSize,L=(...B)=>(z)=>{try{let F=`${k}:${z}`,X=C.get(F);if(!X){if(C.size>=j){let G=C.keys().next().value;if(G)C.delete(G)}X=Function(...v,`
|
|
125
125
|
'use strict';
|
|
126
126
|
try {
|
|
127
127
|
return ${z};
|
|
@@ -132,27 +132,28 @@ catch (e) {
|
|
|
132
132
|
}
|
|
133
133
|
throw e;
|
|
134
134
|
}
|
|
135
|
-
`),C.set(F,K)}return K(...B)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:L,context:v.slice()});return L}clear(){this.pool.length=0,this.fnCache.clear()}}var d0=new Wu;class Vu{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(x){this.enabled=x}isEnabled(){return this.enabled}setBudget(x,v){this.budgets.set(x,{warnThreshold:0.8,action:"warn",...v})}setBudgets(x){for(let[v,k]of Object.entries(x))this.setBudget(v,k)}removeBudget(x){this.budgets.delete(x)}getBudgets(){let x={};for(let[v,k]of this.budgets.entries())x[v]=k;return x}onViolation(x){this.violationHandlers.push(x)}offViolation(x){let v=this.violationHandlers.indexOf(x);if(v!==-1)this.violationHandlers.splice(v,1)}time(x,v){if(!this.enabled)return v();let k=performance.now(),E=v(),C=performance.now()-k;return this.recordTime(x,C),this.checkBudget(x,C),E}async timeAsync(x,v){if(!this.enabled)return v();let k=performance.now(),E=await v(),C=performance.now()-k;return this.recordTime(x,C),this.checkBudget(x,C),E}checkBudget(x,v){let k=this.budgets.get(x);if(!k)return;let E=v/k.maxTime*100,C=k.warnThreshold!==void 0?v>=k.maxTime*k.warnThreshold&&v<k.maxTime:!1,j=v>=k.maxTime;if(!C&&!j)return;let L={label:x,actualTime:v,budgetTime:k.maxTime,exceedancePercent:E,timestamp:new Date,isWarning:C};this.violations.push(L);while(this.violations.length>this.maxViolations)this.violations.shift();for(let z of this.violationHandlers)try{z(L)}catch{}let B=C?`[Performance Warning] "${x}" took ${v.toFixed(2)}ms (${E.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${x}" took ${v.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(E-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(B);break;case"warn":console.warn(B);break;case"error":console.error(B);break;case"throw":if(j)throw Error(B);else console.warn(B);break}}recordTime(x,v){let k=this.metrics.get(x);if(k)k.count++,k.totalTime+=v,k.maxTime=Math.max(k.maxTime,v),k.minTime=Math.min(k.minTime,v);else this.metrics.set(x,{count:1,totalTime:v,maxTime:v,minTime:v})}getStats(x){if(x){let k=this.metrics.get(x);if(!k)return{};let E=this.budgets.get(x);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:E?.maxTime,budgetUtilization:E?k.totalTime/k.count/E.maxTime*100:void 0}}let v={};for(let[k,E]of this.metrics.entries()){let C=this.budgets.get(k);v[k]={count:E.count,avgTime:E.totalTime/E.count,totalTime:E.totalTime,maxTime:E.maxTime,minTime:E.minTime,budget:C?.maxTime,budgetUtilization:C?E.totalTime/E.count/C.maxTime*100:void 0}}return v}getViolations(x){if(x)return this.violations.filter((v)=>v.label===x);return[...this.violations]}getViolationStats(){let x={},v=0,k=0;for(let E of this.violations)if(x[E.label]=(x[E.label]||0)+1,E.isWarning)v++;else k++;return{total:this.violations.length,byLabel:x,warnings:v,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 wa=null;function fh(){if(!wa)wa=new Vu;return wa}var U=new Proxy({},{get(x,v){return fh()[v]}});var Hu=[];function I(x){let v=new V(x);return Hu.push(v),v}function qu(){for(let x of Hu)x.clear()}function O(x,...v){return`${v.map((k)=>String(k??"")).join("\x00")}\x00${x.length}\x00${Bun.hash(x)}`}function Ku(x){let v=[];for(let k of new Set(x))try{v.push({path:k,mtimeMs:Uu.statSync(k).mtimeMs})}catch{}return v}function Gt(x){for(let v of x)try{if(Uu.statSync(v.path).mtimeMs!==v.mtimeMs)return!1}catch{return!1}return!0}import bw from"fs";import on from"path";import At from"path";import{hasLocalConfig as md}from"bunfig";import _n from"fs";import yr from"path";import Sa from"fs";import Xu from"path";import{fileURLToPath as ph}from"url";var $a;function De(){if($a)return $a;let x="unknown";try{x=String(JSON.parse(Sa.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let v=Xu.dirname(ph(import.meta.url)),k=0;for(let E of Sa.readdirSync(v,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,Sa.statSync(Xu.join(E.parentPath,E.name)).mtimeMs);x+=`+src.${Math.trunc(k)}`}catch{}return $a=x,x}var Fa=new Map,xr=new Map;async function hu(x){let k;for(let E=0;E<3;E++)try{let j=(await _n.promises.stat(x)).mtime.getTime(),L=xr.get(x);if(L&&L.mtime===j)return L.content;let B=await Bun.file(x).text(),F=(await _n.promises.stat(x)).mtime.getTime();if(F!==j)continue;return xr.set(x,{content:B,mtime:F}),B}catch(C){k=C;break}throw xr.delete(x),Error(`File not found: ${x}${k?` (${k.message})`:""}`)}function yu(x){xr.delete(x)}function bu(x){for(let v of xr.keys())if(v.startsWith(x))xr.delete(v)}var vi=null,gh=null,Gu=null;function vu(x){Gu=x}async function za(x=!1){let v=Gu??await import("./chunk-ccg6xjr1.js");if(x)return v.generateSignalsRuntimeDev();if(vi===null)vi=v.generateSignalsRuntime();return vi}var wi=null;async function Ha(){if(wi===null){let{getRouterScript:x}=await import("./chunk-mmtg0jxd.js");wi=x()}return wi}var Zu={};async function wu(x,v=!1){let k=x==="runtime"?await za(v):await Ha(),E=x==="runtime"&&v?"runtime-debug":x,C=Zu[E];if(!C||C.content!==k)C={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Zu[E]=C;return{content:k,hash:C.hash,url:`/_stx/${x}.${C.hash}.js`}}var mh=500,hr=new Map;function Ju(x){return a(process.cwd(),"module-bundles",`${x}.js`)}function xu(x){let v=Bun.hash(x).toString(16).padStart(16,"0").slice(0,16),k=hr.has(v);if(k)hr.delete(v);hr.set(v,x);while(hr.size>mh)hr.delete(hr.keys().next().value);if(!k)try{let E=Ju(v);if(!_n.existsSync(E))_n.mkdirSync(yr.dirname(E),{recursive:!0}),_n.writeFileSync(E,x)}catch{}return`/_stx/modules.${v}.js`}function Di(x){if(!/^[0-9a-f]{16}$/.test(x))return;let v=hr.get(x);if(v!==void 0)return v;try{return _n.readFileSync(Ju(x),"utf8")}catch{return}}function Su(){xr.clear(),ee(),qu(),vi=null,gh=null,wi=null}function Yu(x){let v={debug:x.debug===!0,middleware:(x.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(x.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(v)).digest("hex")}async function Jt(x,v){try{if(!v.cachePath)return null;let k=yr.resolve(v.cachePath),E=yr.join(k,`${In(x)}.html`),C=yr.join(k,`${In(x)}.meta.json`);if(!await n(E)||!await n(C))return null;let j=await Bun.file(C).text(),L=JSON.parse(j);if(L.cacheVersion!==v.cacheVersion)return null;if(L.engine!==De())return null;if(L.optionsSignature!==Yu(v))return null;if((await _n.promises.stat(x)).mtime.getTime()>L.mtime)return null;for(let z of L.dependencies)if(await n(z)){if((await _n.promises.stat(z)).mtime.getTime()>L.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${x}:`,k),null}}async function Yt(x,v,k,E){try{if(!E.cachePath)return;let C=yr.resolve(E.cachePath);await _n.promises.mkdir(C,{recursive:!0});let j=yr.join(C,`${In(x)}.html`),L=yr.join(C,`${In(x)}.meta.json`),B=await _n.promises.stat(x);await Bun.write(j,v);let z={sourcePath:x,mtime:B.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:De(),optionsSignature:Yu(E),generatedAt:Date.now()};await Bun.write(L,JSON.stringify(z,null,2)),Fa.set(x,{output:v,mtime:B.mtime.getTime(),dependencies:k})}catch(C){console.warn(`Failed to cache template ${x}:`,C)}}var hh=16;function In(x){return new Bun.CryptoHasher("sha1").update(x).digest("hex").substring(0,hh)}var Qu={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 _a(x){return`--stx-${x}`}function ka(x,v){let k=v.lastIndexOf("-");if(k===-1)return typeof x[v]==="string"?x[v]:void 0;let E=x[v.slice(0,k)];if(!E||typeof E!=="object")return;let C=E[v.slice(k+1)];return typeof C==="string"?C:void 0}function ed(x){let v={};for(let[k,E]of Object.entries(Qu)){let C=ka(x,E.light);if(C===void 0)continue;v[k]=`var(${_a(k)}, ${C})`}return v}function td(x){let v=[],k=[];for(let[E,C]of Object.entries(Qu)){let j=ka(x,C.light),L=ka(x,C.dark);if(j===void 0)continue;if(v.push(` ${_a(E)}: ${j};`),L!==void 0)k.push(` ${_a(E)}: ${L};`)}if(v.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...v,"}",".dark {",...k,"}",""].join(`
|
|
136
|
-
`)}var
|
|
137
|
-
`)}function
|
|
135
|
+
`),C.set(F,X)}return X(...B)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:L,context:v.slice()});return L}clear(){this.pool.length=0,this.fnCache.clear()}}var m0=new Hu;class qu{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(x){this.enabled=x}isEnabled(){return this.enabled}setBudget(x,v){this.budgets.set(x,{warnThreshold:0.8,action:"warn",...v})}setBudgets(x){for(let[v,k]of Object.entries(x))this.setBudget(v,k)}removeBudget(x){this.budgets.delete(x)}getBudgets(){let x={};for(let[v,k]of this.budgets.entries())x[v]=k;return x}onViolation(x){this.violationHandlers.push(x)}offViolation(x){let v=this.violationHandlers.indexOf(x);if(v!==-1)this.violationHandlers.splice(v,1)}time(x,v){if(!this.enabled)return v();let k=performance.now(),E=v(),C=performance.now()-k;return this.recordTime(x,C),this.checkBudget(x,C),E}async timeAsync(x,v){if(!this.enabled)return v();let k=performance.now(),E=await v(),C=performance.now()-k;return this.recordTime(x,C),this.checkBudget(x,C),E}checkBudget(x,v){let k=this.budgets.get(x);if(!k)return;let E=v/k.maxTime*100,C=k.warnThreshold!==void 0?v>=k.maxTime*k.warnThreshold&&v<k.maxTime:!1,j=v>=k.maxTime;if(!C&&!j)return;let L={label:x,actualTime:v,budgetTime:k.maxTime,exceedancePercent:E,timestamp:new Date,isWarning:C};this.violations.push(L);while(this.violations.length>this.maxViolations)this.violations.shift();for(let z of this.violationHandlers)try{z(L)}catch{}let B=C?`[Performance Warning] "${x}" took ${v.toFixed(2)}ms (${E.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${x}" took ${v.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(E-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(B);break;case"warn":console.warn(B);break;case"error":console.error(B);break;case"throw":if(j)throw Error(B);else console.warn(B);break}}recordTime(x,v){let k=this.metrics.get(x);if(k)k.count++,k.totalTime+=v,k.maxTime=Math.max(k.maxTime,v),k.minTime=Math.min(k.minTime,v);else this.metrics.set(x,{count:1,totalTime:v,maxTime:v,minTime:v})}getStats(x){if(x){let k=this.metrics.get(x);if(!k)return{};let E=this.budgets.get(x);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:E?.maxTime,budgetUtilization:E?k.totalTime/k.count/E.maxTime*100:void 0}}let v={};for(let[k,E]of this.metrics.entries()){let C=this.budgets.get(k);v[k]={count:E.count,avgTime:E.totalTime/E.count,totalTime:E.totalTime,maxTime:E.maxTime,minTime:E.minTime,budget:C?.maxTime,budgetUtilization:C?E.totalTime/E.count/C.maxTime*100:void 0}}return v}getViolations(x){if(x)return this.violations.filter((v)=>v.label===x);return[...this.violations]}getViolationStats(){let x={},v=0,k=0;for(let E of this.violations)if(x[E.label]=(x[E.label]||0)+1,E.isWarning)v++;else k++;return{total:this.violations.length,byLabel:x,warnings:v,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 _a=null;function hh(){if(!_a)_a=new qu;return _a}var V=new Proxy({},{get(x,v){return hh()[v]}});var Xu=[];function I(x){let v=new U(x);return Xu.push(v),v}function Zu(){for(let x of Xu)x.clear()}function O(x,...v){return`${v.map((k)=>String(k??"")).join("\x00")}\x00${x.length}\x00${Bun.hash(x)}`}function Gu(x){let v=[];for(let k of new Set(x))try{v.push({path:k,mtimeMs:Ku.statSync(k).mtimeMs})}catch{}return v}function Jt(x){for(let v of x)try{if(Ku.statSync(v.path).mtimeMs!==v.mtimeMs)return!1}catch{return!1}return!0}import $w from"fs";import an from"path";import It from"path";import{hasLocalConfig as bd}from"bunfig";import En from"fs";import vr from"path";import ka from"fs";import Ju from"path";import{fileURLToPath as yh}from"url";var Ea;function Oe(){if(Ea)return Ea;let x="unknown";try{x=String(JSON.parse(ka.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let v=Ju.dirname(yh(import.meta.url)),k=0;for(let E of ka.readdirSync(v,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,ka.statSync(Ju.join(E.parentPath,E.name)).mtimeMs);x+=`+src.${Math.trunc(k)}`}catch{}return Ea=x,x}var Ua=new Map,wr=new Map;async function wu(x){let k;for(let E=0;E<3;E++)try{let j=(await En.promises.stat(x)).mtime.getTime(),L=wr.get(x);if(L&&L.mtime===j)return L.content;let B=await Bun.file(x).text(),F=(await En.promises.stat(x)).mtime.getTime();if(F!==j)continue;return wr.set(x,{content:B,mtime:F}),B}catch(C){k=C;break}throw wr.delete(x),Error(`File not found: ${x}${k?` (${k.message})`:""}`)}function vu(x){wr.delete(x)}function xu(x){for(let v of wr.keys())if(v.startsWith(x))wr.delete(v)}var $i=null,xh=null,Qu=null;function Su(x){Qu=x}async function Va(x=!1){let v=Qu??await import("./chunk-4amznxaq.js");if(x)return v.generateSignalsRuntimeDev();if($i===null)$i=v.generateSignalsRuntime();return $i}var _i=null;async function Wa(){if(_i===null){let{getRouterScript:x}=await import("./chunk-ac033b93.js");_i=x()}return _i}var Yu={};async function ku(x,v=!1){let k=x==="runtime"?await Va(v):await Wa(),E=x==="runtime"&&v?"runtime-debug":x,C=Yu[E];if(!C||C.content!==k)C={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Yu[E]=C;return{content:k,hash:C.hash,url:`/_stx/${x}.${C.hash}.js`}}var bh=500,br=new Map;function ed(x){return a(process.cwd(),"module-bundles",`${x}.js`)}function Cu(x){let v=Bun.hash(x).toString(16).padStart(16,"0").slice(0,16),k=br.has(v);if(k)br.delete(v);br.set(v,x);while(br.size>bh)br.delete(br.keys().next().value);if(!k)try{let E=ed(v);if(!En.existsSync(E))En.mkdirSync(vr.dirname(E),{recursive:!0}),En.writeFileSync(E,x)}catch{}return`/_stx/modules.${v}.js`}function Ni(x){if(!/^[0-9a-f]{16}$/.test(x))return;let v=br.get(x);if(v!==void 0)return v;try{return En.readFileSync(ed(x),"utf8")}catch{return}}function $u(){wr.clear(),ee(),Zu(),$i=null,xh=null,_i=null}function td(x){let v={debug:x.debug===!0,middleware:(x.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(x.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(v)).digest("hex")}async function Yt(x,v){try{if(!v.cachePath)return null;let k=vr.resolve(v.cachePath),E=vr.join(k,`${On(x)}.html`),C=vr.join(k,`${On(x)}.meta.json`);if(!await n(E)||!await n(C))return null;let j=await Bun.file(C).text(),L=JSON.parse(j);if(L.cacheVersion!==v.cacheVersion)return null;if(L.engine!==Oe())return null;if(L.optionsSignature!==td(v))return null;if((await En.promises.stat(x)).mtime.getTime()>L.mtime)return null;for(let z of L.dependencies)if(await n(z)){if((await En.promises.stat(z)).mtime.getTime()>L.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${x}:`,k),null}}async function Zt(x,v,k,E){try{if(!E.cachePath)return;let C=vr.resolve(E.cachePath);await En.promises.mkdir(C,{recursive:!0});let j=vr.join(C,`${On(x)}.html`),L=vr.join(C,`${On(x)}.meta.json`),B=await En.promises.stat(x);await Bun.write(j,v);let z={sourcePath:x,mtime:B.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Oe(),optionsSignature:td(E),generatedAt:Date.now()};await Bun.write(L,JSON.stringify(z,null,2)),Ua.set(x,{output:v,mtime:B.mtime.getTime(),dependencies:k})}catch(C){console.warn(`Failed to cache template ${x}:`,C)}}var vh=16;function On(x){return new Bun.CryptoHasher("sha1").update(x).digest("hex").substring(0,vh)}var nd={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 Ca(x){return`--stx-${x}`}function Ra(x,v){let k=v.lastIndexOf("-");if(k===-1)return typeof x[v]==="string"?x[v]:void 0;let E=x[v.slice(0,k)];if(!E||typeof E!=="object")return;let C=E[v.slice(k+1)];return typeof C==="string"?C:void 0}function rd(x){let v={};for(let[k,E]of Object.entries(nd)){let C=Ra(x,E.light);if(C===void 0)continue;v[k]=`var(${Ca(k)}, ${C})`}return v}function sd(x){let v=[],k=[];for(let[E,C]of Object.entries(nd)){let j=Ra(x,C.light),L=Ra(x,C.dark);if(j===void 0)continue;if(v.push(` ${Ca(E)}: ${j};`),L!==void 0)k.push(` ${Ca(E)}: ${L};`)}if(v.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...v,"}",".dark {",...k,"}",""].join(`
|
|
136
|
+
`)}var id={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 od(x){return`--stx-radius-${x}`}function ad(){let x={};for(let[v,k]of Object.entries(id))x[v]=`var(${od(v)}, ${k.value})`;return x}function cd(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(id).map(([x,v])=>` ${od(x)}: ${v.value};`),"}",""].join(`
|
|
137
|
+
`)}function ld(x){return typeof x==="object"&&x!==null&&!Array.isArray(x)}function Ta(x,v){let k={...x};for(let[E,C]of Object.entries(v))k[E]=ld(C)&&ld(k[E])?Ta(k[E],C):C;return k}function ud(x,v){if(!v.fonts)return"";let k=new x({...v.config,fonts:v.fonts,cssVariables:!1}).toCSS(!1,v.minify);return k&&!v.minify?`${k}
|
|
138
|
+
`:k}function dd(x={},v={}){let k=x.theme||{},E=v.theme||{},{extend:C,...j}=E,{extend:L,...B}=k,z=B.colors||{};B.colors={...z,...rd(z)};let F=B.borderRadius||{};B.borderRadius={...F,...ad()};let X=Ta(B,j),G=Ta(L||{},C||{});if(Object.keys(G).length>0)X.extend=G;let J=[...x.safelist||[],...v.safelist||[]],ne={...x.shortcuts||{},...v.shortcuts||{}},re=[...x.preflights||[],...v.preflights||[]],{fonts:se,...oe}=x,{fonts:ie,...ge}=v,ue=ie??se;return{config:{...oe,...ge,theme:X,safelist:J,shortcuts:ne,...re.length>0?{preflights:re}:{},content:[],output:""},safelist:J,shortcuts:ne,includePreflight:v.preflight!==!1,minify:v.minify===!0,tokenCSS:sd(z)+cd(),...ue?{fonts:ue}:{}}}function fd(x,v=""){let k=`${x}${v}`,E=0;for(let C=0;C<k.length;C++){let j=k.charCodeAt(C);E=(E<<5)-E+j,E=E&E}return`stx-${Math.abs(E).toString(36)}`}function pd(x,v,k={}){let{prefix:E="",preserveHost:C=!0,scopeKeyframes:j=!0,scopeCustomProperties:L=!1}=k;if(!x.trim())return"";let B=Aa(x),z=[],F=new Map;if(j)for(let X of B){let G=X.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let J=G[1],ne=`${v}_${J}`;F.set(J,ne)}}for(let X of B){let G=gd(X,v,E,C,F,L);z.push(G)}return z.join(`
|
|
138
139
|
|
|
139
|
-
`)}function
|
|
140
|
-
`)})}else v.push({selector:`@${
|
|
140
|
+
`)}function Aa(x){let v=[],k=x.replace(/\/\*[\s\S]*?\*\//g,""),E=0,C="",j=!1,L="";for(let B=0;B<k.length;B++){let z=k[B];if(z==="@"&&E===0)j=!0;if(z==="{")E++;else if(z==="}"){if(E--,E===0){if(j){L+=z;let F=L.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(F){let[,X,G,J]=F;if(X==="keyframes")v.push({selector:`@keyframes ${G.trim()}`,declarations:J.trim()});else if(X==="media"||X==="supports"||X==="container"){let ne=Aa(J);v.push({selector:`@${X} ${G.trim()}`,declarations:ne.map((re)=>`${re.selector} { ${re.declarations} }`).join(`
|
|
141
|
+
`)})}else v.push({selector:`@${X} ${G.trim()}`,declarations:J.trim()})}L="",j=!1}else if(C.trim()){C+=z;let F=C.match(/([^{]+)\{([^}]*)\}/);if(F)v.push({selector:F[1].trim(),declarations:F[2].trim()});C=""}continue}}if(j)L+=z;else C+=z}return v}function gd(x,v,k,E,C,j){let{selector:L,declarations:B}=x;if(L.startsWith("@")){if(L.startsWith("@keyframes")){let X=L.replace("@keyframes ","").trim();return`@keyframes ${C.get(X)||X} { ${B} }`}if(L.startsWith("@media")||L.startsWith("@supports")||L.startsWith("@container")){let G=Aa(`x { ${B} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((J)=>gd(J,v,k,E,C,j)).join(`
|
|
141
142
|
`);return`${L} {
|
|
142
143
|
${G}
|
|
143
|
-
}`}return`${L} { ${B} }`}let z=
|
|
144
|
+
}`}return`${L} { ${B} }`}let z=wh(L,v,k,E),F=B;for(let[X,G]of C)F=F.replace(new RegExp(`\\b${X}\\b`,"g"),G);if(j)F=F.replace(/--([a-z-]+)/gi,`--${v}-$1`);return`${z} { ${F} }`}function wh(x,v,k,E){let C=x.split(",").map((L)=>L.trim()),j=[];for(let L of C){if(L.startsWith(":host")){if(E)j.push(L);else{let F=L.replace(/:host(\([^)]*\))?/,`.${v}$1`);j.push(F)}continue}if(L.includes("::slotted")){j.push(L);continue}if(L===":root"){j.push(`:root .${v}`);continue}let B=k?`${k} .${v}`:`.${v}`;j.push(`${B} ${L}`);let z=Sh(L,v);if(z)j.push(k?`${k} ${z}`:z)}return j.join(", ")}function Sh(x,v){let k=0,E=x.length;for(let z=0;z<x.length;z++){let F=x[z];if(F==="["||F==="(")k++;else if(F==="]"||F===")")k--;else if(k===0&&(F===" "||F===">"||F==="+"||F==="~")){E=z;break}}let C=x.slice(0,E),j=x.slice(E);if(!C)return"";let L=C.length,B=0;for(let z=0;z<C.length;z++){let F=C[z];if(F==="["||F==="(")B++;else if(F==="]"||F===")")B--;else if(k===0&&B===0&&F===":"){L=z;break}}return`${C.slice(0,L)}.${v}${C.slice(L)}${j}`}var yd=String.raw`(?<![\w-])scoped(?![\w-])`,Ia=/<style\s+([^>]*)>/gi,md=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,xd=new RegExp(yd,"i"),$h=new RegExp(yd,"gi"),Pa=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function _h(x){Ia.lastIndex=0;let v=Ia.exec(x);while(v!==null){if(xd.test(v[1]))return!0;v=Ia.exec(x)}return!1}function Da(x){let v=new Set,k=[];Pa.lastIndex=0;let E=Pa.exec(x);while(E!==null){let C=E[0].trim();if(v.has(C))k.push({start:E.index,end:E.index+E[0].length});else v.add(C);E=Pa.exec(x)}return k}function zs(x){let v=Da(x);if(v.length===0)return x;let k=Array(v.length+1),E=0;for(let C=0;C<v.length;C++){let j=v[C];k[C]=x.slice(E,j.start),E=j.end}return k[v.length]=x.slice(E),k.join("")}function ki(x,v){if(!_h(x))return{html:x,hasScoped:!1};let k=fd(v),E=`data-v-${k}`,C=x,j=!1;if(md.lastIndex=0,C=C.replace(md,(L,B,z)=>{if(!xd.test(B))return L;j=!0;let F=kh(z,E),X=B.replace($h,"").trim(),G=X?` ${X}`:"";return`<style data-stx-scoped="${k}"${G}>${F}</style>`}),!j)return{html:x,hasScoped:!1};return C=Ch(C,E),{html:C,hasScoped:!0}}function kh(x,v){return pd(x,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${v}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${v}]`)}var Eh=(x)=>`\x00stx-scope-mask-${x}\x00`,hd=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ch(x,v){let k=kn(x,(C,j)=>{let L=Y(C,j);return L>j?L:Dr(C,j)},(C,j)=>Eh(j)),E=Rh(k.output,v);return hd.lastIndex=0,E.replace(hd,(C,j)=>k.tokens[Number(j)])}function Rh(x,v){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return x.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(E,C,j)=>{if(k.has(C.toLowerCase()))return E;if(E.includes(v))return E;if(C.toLowerCase()==="style"||C.toLowerCase()==="script")return E;if(j)return E.replace(`<${C}${j}`,`<${C} ${v}${j}`);if(E.endsWith("/>"))return`<${C} ${v} />`;return`<${C} ${v}>`})}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 Cn=null,Oa=!1,Sr=null,Fs="",jr=!1,Sd=256,ur=new Map,Rn=new Map,Ei=null,$d=null,Ci=new Map;function Ri(x){return Bun.hash(x).toString(16).padStart(16,"0").slice(0,16)}function Ma(x,v){if(ur.has(x))ur.delete(x);else if(ur.size>=Sd)ur.delete(ur.keys().next().value);ur.set(x,v)}function Th(x){let v=Ri(x);if(Rn.has(v))Rn.delete(v);else if(Rn.size>=Sd)Rn.delete(Rn.keys().next().value);return Rn.set(v,x),v}function Eu(x){let v=Rn.get(x);if(v===void 0)return;return Rn.delete(x),Rn.set(x,v),v}async function Ah(x,v=Ei){if(!v)return null;try{let k=Bun.file(It.join(v,`cw-${Ri(x)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Ih(x,v,k=Ei){if(!k)return;try{if(!fs.existsSync(k))fs.mkdirSync(k,{recursive:!0});await Bun.write(It.join(k,`cw-${Ri(x)}.css`),v)}catch{}}async function vd(x){try{let v=await import(x);if(v&&v.CSSGenerator)return{CSSGenerator:v.CSSGenerator,config:v.config,build:v.build,defaultConfig:v.defaultConfig,extractClasses:v.extractClasses}}catch{}return null}var Ph=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Dh=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Mh(){let x=[],v=process.cwd();while(v!==It.dirname(v)){for(let k of["node_modules","pantry"])for(let E of Ph)x.push(It.join(v,k,...E));v=It.dirname(v)}return x}function Oh(){let x=[],v=process.env.HOME||process.env.USERPROFILE||"",k=[v&&It.join(v,"Code","Tools","ts-css"),v&&It.join(v,"Code","Tools","crosswind"),v&&It.join(v,"repos","stacks-org","ts-css"),v&&It.join(v,"repos","stacks-org","crosswind"),It.join(process.cwd(),"..","ts-css"),It.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)x.push(It.join(E,"packages","toolkit","dist","engine","index.js")),x.push(It.join(E,"packages","toolkit","src","engine","index.ts"));if(v)x.push(It.join(v,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return x}async function Li(){if(Oa)return Cn;Oa=!0;try{let x=async(C)=>{for(let j of C){if(!await Bun.file(j).exists())continue;let L=await vd(j);if(L){if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${It.dirname(It.dirname(j))}`);return L}}return null};if(process.env.CROSSWIND_SRC){let C=It.resolve(process.env.CROSSWIND_SRC),j=await x([C]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${C}`);return Cn=j,Cn}let v=await x(Mh());if(v)return Cn=v,Cn;let k=Dh;for(let C of k){let j=await vd(C);if(j){if(Cn=j,!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Cn}}let E=await x(Oh());if(E)return Cn=E,Cn;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 Tu(){xc.clear(),Cn=null,Oa=!1,Sr=null,Fs="",ur.clear(),Rn.clear(),$d=null,Ci.clear()}var wd=!1;async function ji(x){try{let v=bd({name:"css",cwd:x})?"css":bd({name:"crosswind",cwd:x})?"crosswind":null;if(!v)return null;if(v==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!wd)wd=!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"),E=await k({name:v,cwd:x,defaultConfig:{},checkEnv:!1,verbose:!1});if(!E?.path||!E.config||Object.keys(E.config).length===0)return null;let C=It.relative(x,E.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${C||E.path}`);return E.config}catch(v){if(v instanceof Error&&v.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,v instanceof Error?v.message:v),null}}async function qa(x){let v=null;try{let{loadStxConfig:k}=await import("./chunk-ncvfjcr2.js"),E=await k(x);if(E.css)if(typeof E.css==="string"){let C=It.isAbsolute(E.css)?E.css:It.resolve(x,E.css);if(await Bun.file(C).exists()){let j=await import(C);v=j.default||j,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${E.css}`)}}else{if(v={...E.css,content:E.css.content||[],preflight:E.css.preflight??!0,minify:E.css.minify??!1},E.css.config){let C=It.isAbsolute(E.css.config)?E.css.config:It.resolve(x,E.css.config);if(await Bun.file(C).exists()){let j=await import(C);v={...j.default||j,...v}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return v||await ji(x)}function Ka(x){try{let v=new WeakSet;return Ri(JSON.stringify(x??{},(k,E)=>{if(typeof E==="function")return`[fn]${String(E)}`;if(typeof E==="object"&&E!==null){if(v.has(E))return"[circular]";v.add(E)}return E})??"")}catch{return"unhashable"}}async function wt(x){if(jr)return Fs;jr=!0;try{let v=await Li();if(!v||!v.build)return jr=!1,"";if(!Sr)Sr=await ji(x);if(!Sr)return jr=!1,"";let k=v.defaultConfig?.theme||{},E=Sr.theme||{},C={...v.defaultConfig,...Sr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),L=await v.build(C),B=performance.now()-j;if(Fs=L.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${L.classes.size} classes in ${B.toFixed(1)}ms`),C.output){let z=It.isAbsolute(C.output)?C.output:It.join(x,C.output),F=It.dirname(z);if(!fs.existsSync(F))fs.mkdirSync(F,{recursive:!0});await Bun.write(z,L.css)}return jr=!1,L.css}catch(v){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,v),jr=!1,Fs}}async function Qt(x){Sr=null,await wt(x)}function _u(){return Fs}function Xa(x){let v=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,E=k.exec(x);while(E!==null){for(let L of E[1].split(/\s+/))if(L.trim())v.add(L.trim());E=k.exec(x)}let C=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=C.exec(x);while(j!==null){let L=j[1].match(/'([^']+)'/g);if(L){for(let B of L)for(let z of B.slice(1,-1).split(/\s+/))if(z.trim())v.add(z.trim())}j=C.exec(x)}return v}var xc=I(64);async function Ga(x,v){let k=()=>Ci.get(v?It.resolve(v):process.cwd())?.fingerprint??null,E=xc.get(O(x,v,k()));if(E!==void 0)return E;let C=await Nh(x,v);if(C)xc.set(O(x,v,k()),C);return C}function Ja(x){let v=[];for(let k of x.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Ni(k[1]);if(E)v.push(E)}return v.length?`${x}
|
|
144
145
|
${v.join(`
|
|
145
|
-
`)}`:x}async function
|
|
146
|
-
`))
|
|
147
|
-
`}let
|
|
146
|
+
`)}`:x}async function Nh(x,v){try{let k=await Li();if(!k)return"";let E=Ja(x),C=typeof k.extractClasses==="function"?k.extractClasses(E):Xa(E);if(C.size===0)return"";let j=v?It.resolve(v):process.cwd(),L=a(j,"cache");if(!Ei)Ei=L;let B=Ci.get(j);if(!B){let Ee=await qa(j);B={config:Ee,fingerprint:Ka(Ee)},Ci.set(j,B),$d=B.fingerprint}let z=[...C].sort().join(" "),F=`${B.fingerprint||"default"}::${z}`,X=ur.get(F);if(X!==void 0)return Ma(F,X),X;let G=await Ah(F,L);if(G!==null)return Ma(F,G),G;let J=k.defaultConfig||k.config,ne=B.config||{},re=dd(J,ne),{safelist:se,includePreflight:oe,minify:ie,tokenCSS:ge}=re,ue=re.config,xe=new k.CSSGenerator(ue),we=ue.shortcuts||ne.shortcuts||{},$e=Object.keys(we).filter((Ee)=>C.has(Ee)||se.includes(Ee));for(let Ee of se)if(!we[Ee])xe.generate(Ee);for(let Ee of C)if(!we[Ee])xe.generate(Ee);let _e="";if($e.length>0){let Ee=new k.CSSGenerator(ue);for(let Te of $e)Ee.generate(Te);if(_e=Ee.toCSS(!1,ie),_e&&!_e.endsWith(`
|
|
147
|
+
`))_e+=`
|
|
148
|
+
`}let Ce=_e+xe.toCSS(oe,ie);return Ce=ud(k.CSSGenerator,re)+ge+Ce,Ma(F,Ce),Ih(F,Ce,L),Ce}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(x,v,k=!1,E=!1){let C=await Ga(x,v);if(!C)return E?zs(x):x;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Th(C)}.css">`:`<style data-css="generated">
|
|
148
149
|
${C}
|
|
149
|
-
</style>`;if(E)return
|
|
150
|
+
</style>`;if(E)return jh(x,j);let L=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(L.test(x)){let B=!1;return x.replace(L,()=>{if(B)return"";return B=!0,j})}if(x.includes("</head>"))return x.replace("</head>",`${j}
|
|
150
151
|
</head>`);if(x.includes("<body"))return x.replace(/<body([^>]*)>/,`<body$1>
|
|
151
|
-
${j}`);return j+x}function
|
|
152
|
+
${j}`);return j+x}function jh(x,v){let k=Da(x).map((z)=>({...z,replacement:""})),E=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,C=E.exec(x);if(C!==null){let z=!0;while(C!==null)k.push({start:C.index,end:C.index+C[0].length,replacement:z?v:""}),z=!1,C=E.exec(x)}else{let z=x.indexOf("</head>");if(z!==-1)k.push({start:z,end:z,replacement:`${v}
|
|
152
153
|
`});else{let F=x.match(/<body([^>]*)>/);if(F?.index!==void 0)k.push({start:F.index,end:F.index+F[0].length,replacement:`${F[0]}
|
|
153
|
-
${v}`});else k.push({start:0,end:0,replacement:v})}}k.sort((z,F)=>z.start-F.start||z.end-F.end);for(let z=1;z<k.length;z++)if(k[z].start<k[z-1].end)return
|
|
154
|
+
${v}`});else k.push({start:0,end:0,replacement:v})}}k.sort((z,F)=>z.start-F.start||z.end-F.end);for(let z=1;z<k.length;z++)if(k[z].start<k[z-1].end)return Lh(zs(x),v);let j=Array(k.length*2+1),L=0,B=0;for(let z of k)j[B++]=x.slice(L,z.start),j[B++]=z.replacement,L=z.end;return j[B]=x.slice(L),j.join("")}function Lh(x,v){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(x)){let E=!1;return x.replace(k,()=>{if(E)return"";return E=!0,v})}if(x.includes("</head>"))return x.replace("</head>",`${v}
|
|
154
155
|
</head>`);if(x.includes("<body"))return x.replace(/<body([^>]*)>/,`<body$1>
|
|
155
|
-
${v}`);return v+x}var
|
|
156
|
+
${v}`);return v+x}var Sc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],_d=/<body\b([^>]*)>/gi;function Tn(x){let v=0,k,E=Sc.map(()=>{return});while(v<x.length){if(k===void 0||k!==null&&k.index<v)_d.lastIndex=v,k=_d.exec(x);if(!k)return null;let C=k.index,j=-1,L=null;for(let z=0;z<Sc.length;z++){let F=Sc[z],X=E[z];if(X===void 0||X!==null&&X.index<v)F.open.lastIndex=v,X=F.open.exec(x),E[z]=X;if(!X)continue;if(X.index<C&&(j===-1||X.index<j))j=X.index,L=F.close}if(j===-1||!L)return{index:C,tag:k[0],attrs:k[1]??""};L.lastIndex=j;let B=L.exec(x);if(!B)return null;v=B.index+B[0].length}return null}function Lr(x,v){let k=Tn(x);if(!k)return x;return x.slice(0,k.index)+v(k.tag,k.attrs)+x.slice(k.index+k.tag.length)}var kd=/<style\b[^>]*>/iy,Ed=/<\/style>/gi,Cd=/<script\b[^>]*>/iy,Rd=/<template(?=[\s>/])[^>]*>/iy,Td=/<\/template\s*>/iy;function Ws(x){let v=0,k=0,E=-1;while(v<x.length){let C=x.indexOf("<",v);if(C===-1)return-1;if(x.startsWith("<!--",C)){let z=x.indexOf("-->",C+4);v=z===-1?x.length:z+3;continue}kd.lastIndex=C;let j=kd.exec(x);if(j){Ed.lastIndex=C+j[0].length;let z=Ed.exec(x);v=z===null?x.length:z.index+8;continue}Rd.lastIndex=C;let L=Rd.exec(x);if(L){if(k===0)E=C;k++,v=C+L[0].length;continue}Td.lastIndex=C;let B=Td.exec(x);if(B){if(k>0)k--;v=C+B[0].length;continue}if(Cd.lastIndex=C,Cd.test(x))return k>0?E:C;v=C+1}return-1}function Ad(){return`
|
|
156
157
|
// STX Lifecycle Runtime
|
|
157
158
|
(function() {
|
|
158
159
|
if (typeof window === 'undefined') return;
|
|
@@ -500,7 +501,7 @@ else {
|
|
|
500
501
|
|
|
501
502
|
console.log('[stx] Lifecycle runtime initialized');
|
|
502
503
|
})();
|
|
503
|
-
`}function
|
|
504
|
+
`}function $c(x){return Symbol(x)}var J0=$c("theme"),Y0=$c("router"),Q0=$c("i18n");import*as Pd from"crypto";function Id(x){let v=/\$(\w+)\./g,k=[],E;while((E=v.exec(x))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function Bh(){return`stx-${Pd.randomBytes(4).toString("hex")}`}function zh(x){return/\$\w+\./.test(x)}function Fh(x){if(!x.includes("{{")||!/\$\w+\./.test(x))return{html:x,bindings:[],stores:new Set};let v=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,C=x;return C=C.replace(E,(j,L,B,z)=>{if(["script","style","template"].includes(L.toLowerCase()))return j;let F=[],X=!1,G=B,J=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ne=[...B.matchAll(J)];for(let oe of ne){let ie=oe[0],ge=oe[1],ue=oe[2];if(zh(ue)){X=!0;let xe=ue.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(xe){let we=xe[1];if(F.push({attr:ge,expr:we,fullMatch:ie,originalAttr:ge}),Id(we).forEach((_e)=>k.add(_e)),ge==="text")G=G.replace(ie,"");else if(ge==="class")G=G.replace(ie,'class=""');else if(ge==="disabled"||ge==="hidden")G=G.replace(ie,"");else G=G.replace(ie,`${ge}=""`)}}}if(!X)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=Bh(),G=` id="${se}"${G}`;for(let oe of F)v.push({elementId:se,attribute:oe.attr,expression:oe.expr,stores:Id(oe.expr)});return`<${L}${G}${z}`}),{html:C,bindings:v,stores:k}}function Wh(x,v){if(x.length===0)return"";let k=Array.from(v),E=`
|
|
504
505
|
<script>
|
|
505
506
|
(function() {
|
|
506
507
|
'use strict';
|
|
@@ -658,10 +659,10 @@ else {
|
|
|
658
659
|
}
|
|
659
660
|
})();
|
|
660
661
|
</script>
|
|
661
|
-
`,E}function
|
|
662
|
+
`,E}function Dd(x){let{html:v,bindings:k,stores:E}=Fh(x);if(k.length===0)return x;let C=Wh(k,E),j=v.lastIndexOf("</body>");if(j!==-1)return v.slice(0,j)+C+v.slice(j);return v+C}function Vh(x){let v=x.analytics;if(!v?.enabled)return"";switch(v.driver){case"fathom":return Uh(v);case"google-analytics":return Hh(v);case"plausible":return qh(v);case"self-hosted":return Kh(v);case"custom":return Xh(v);default:return""}}function Uh(x){let v=x.fathom;if(!v?.siteId)return"";let k=v.scriptUrl||"https://cdn.usefathom.com/script.js",E=v.defer!==!1?" defer":"",C=[`data-site="${yn(v.siteId)}"`];if(v.honorDnt)C.push('data-honor-dnt="true"');if(v.spa)C.push('data-spa="auto"');if(v.canonical)C.push(`data-canonical="${yn(v.canonical)}"`);if(v.auto===!1)C.push('data-auto="false"');return`
|
|
662
663
|
<!-- Fathom Analytics -->
|
|
663
|
-
<script src="${
|
|
664
|
-
`}function
|
|
664
|
+
<script src="${yn(k)}" ${C.join(" ")}${E}></script>
|
|
665
|
+
`}function Hh(x){let v=x.googleAnalytics;if(!v?.measurementId)return"";let k=yn(v.measurementId),E=v.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
|
|
665
666
|
<!-- Google Analytics -->
|
|
666
667
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
|
|
667
668
|
<script>
|
|
@@ -671,10 +672,10 @@ else {
|
|
|
671
672
|
gtag('config', '${k}');
|
|
672
673
|
${E}
|
|
673
674
|
</script>
|
|
674
|
-
`}function
|
|
675
|
+
`}function qh(x){let v=x.plausible;if(!v?.domain)return"";let k=v.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${yn(v.domain)}"`],C=k,j=[];if(v.trackLocalhost)j.push("local");if(v.hashMode)j.push("hash");if(j.length>0&&k==="https://plausible.io/js/script.js")C=`https://plausible.io/js/script.${j.join(".")}.js`;return`
|
|
675
676
|
<!-- Plausible Analytics -->
|
|
676
|
-
<script defer data-domain="${
|
|
677
|
-
`}function
|
|
677
|
+
<script defer data-domain="${yn(v.domain)}" src="${yn(C)}"></script>
|
|
678
|
+
`}function Kh(x){let v=x.selfHosted;if(!v?.siteId||!v?.apiEndpoint)return"";let k=yn(v.siteId),E=yn(v.apiEndpoint),C=v.honorDnt?'if(n.doNotTrack==="1")return;':"",j=v.trackHashChanges?"w.addEventListener('hashchange',pv);":"",L=v.trackOutboundLinks?`
|
|
678
679
|
d.addEventListener('click',function(e){
|
|
679
680
|
var a=e.target.closest('a');
|
|
680
681
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -707,15 +708,15 @@ else {
|
|
|
707
708
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
708
709
|
})();
|
|
709
710
|
</script>
|
|
710
|
-
`}function
|
|
711
|
+
`}function Xh(x){let v=x.custom;if(!v)return"";if(v.inlineScript)return`
|
|
711
712
|
<!-- Custom Analytics -->
|
|
712
713
|
<script>
|
|
713
714
|
${v.inlineScript}
|
|
714
715
|
</script>
|
|
715
|
-
`;if(!v.scriptUrl)return"";let k=[];if(v.scriptId)k.push(`id="${
|
|
716
|
+
`;if(!v.scriptUrl)return"";let k=[];if(v.scriptId)k.push(`id="${yn(v.scriptId)}"`);if(v.attributes)for(let[C,j]of Object.entries(v.attributes))k.push(`${yn(C)}="${yn(j)}"`);return`
|
|
716
717
|
<!-- Custom Analytics -->
|
|
717
|
-
<script${k.length>0?` ${k.join(" ")}`:""} src="${
|
|
718
|
-
`}function
|
|
718
|
+
<script${k.length>0?` ${k.join(" ")}`:""} src="${yn(v.scriptUrl)}" defer></script>
|
|
719
|
+
`}function Md(x,v){let k=Vh(v);if(!k)return x;if(!x.includes("</head>")){let E=x.lastIndexOf("</body>");if(E!==-1)return x.slice(0,E)+k+x.slice(E);return x+k}return x.replace("</head>",`${k}</head>`)}function yn(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Zh={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Od(x){let v=x.heatmap;if(!v?.enabled)return"";let k={...Zh,...v};return`
|
|
719
720
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
720
721
|
<script>
|
|
721
722
|
(function() {
|
|
@@ -1098,7 +1099,7 @@ else {
|
|
|
1098
1099
|
};
|
|
1099
1100
|
})();
|
|
1100
1101
|
</script>
|
|
1101
|
-
`}function
|
|
1102
|
+
`}function Nd(x,v){let k=Od(v);if(!k)return x;let E=x.lastIndexOf("</body>");if(E!==-1)return x.slice(0,E)+k+x.slice(E);return x+k}var jd={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(x,v,k,E)=>{let C=k.__stx_config||{};if(v.length>0){let j=Gh(v.join(" "));C.heatmap={...C.heatmap,...j,enabled:!0}}return Od(C)}};function Gh(x){let v={},k=x.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let E of k){let[C,j]=E.split("="),L=j?.replace(/["']/g,"");switch(C){case"endpoint":v.endpoint=L;break;case"samplingRate":v.samplingRate=Number.parseInt(L,10);break;case"batchSize":v.batchSize=Number.parseInt(L,10);break;case"trackMouse":v.trackMouse=L==="true";break;case"trackClicks":v.trackClicks=L==="true";break;case"trackScroll":v.trackScroll=L==="true";break;case"honorDnt":v.honorDnt=L==="true";break;case"debugOverlay":v.debugOverlay=L==="true";break}}return v}var rr={duration:300,delay:0,ease:"ease",direction:"both"};function Jh(x,v={}){let{duration:k,delay:E,ease:C,direction:j,custom:L}={...rr,...v};if(x==="custom"&&L)return L;switch(x){case"fade":return`${j==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1102
1103
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1103
1104
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${j==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1104
1105
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1108,7 +1109,7 @@ else {
|
|
|
1108
1109
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1109
1110
|
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${j==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1110
1111
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1111
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
1112
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function Yh(){return`
|
|
1112
1113
|
<script data-stx-scoped data-stx-run="once">
|
|
1113
1114
|
// Motion preferences handling
|
|
1114
1115
|
(function() {
|
|
@@ -1136,7 +1137,7 @@ else {
|
|
|
1136
1137
|
});
|
|
1137
1138
|
})();
|
|
1138
1139
|
</script>
|
|
1139
|
-
`}function
|
|
1140
|
+
`}function Qh(x){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((k)=>k.test(x))}function ey(x=0.1,v="0px"){return`
|
|
1140
1141
|
<script data-stx-scoped data-stx-run="always">
|
|
1141
1142
|
// Intersection Observer for scroll animations
|
|
1142
1143
|
(function() {
|
|
@@ -1179,7 +1180,7 @@ else {
|
|
|
1179
1180
|
}
|
|
1180
1181
|
})();
|
|
1181
1182
|
</script>
|
|
1182
|
-
`}function
|
|
1183
|
+
`}function ty(){return`
|
|
1183
1184
|
<style id="stx-animation-base">
|
|
1184
1185
|
:root {
|
|
1185
1186
|
--stx-transition-duration: 300ms;
|
|
@@ -1294,7 +1295,7 @@ else {
|
|
|
1294
1295
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1295
1296
|
}
|
|
1296
1297
|
</style>
|
|
1297
|
-
`}function
|
|
1298
|
+
`}function ny(x,v,k={}){let{staggerDelay:E=50,sequence:C=!1}=k;return`
|
|
1298
1299
|
<script data-stx-scoped data-stx-run="always">
|
|
1299
1300
|
// Animation Group: ${x}
|
|
1300
1301
|
(function() {
|
|
@@ -1331,11 +1332,11 @@ else {
|
|
|
1331
1332
|
}
|
|
1332
1333
|
})();
|
|
1333
1334
|
</script>
|
|
1334
|
-
`}var
|
|
1335
|
-
style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${L}; --stx-transition-delay: ${B}ms;">${x}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},
|
|
1336
|
-
${z}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},
|
|
1337
|
-
</head>`)}if(C.includes("stx-observe")){if(!C.includes("Intersection Observer for scroll animations")){let z=
|
|
1338
|
-
`+C.slice(F)}}return C}function
|
|
1335
|
+
`}var Ld={name:"transition",handler:(x,v,k,E)=>{if(v.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${x}`;let C=v[0],j=v.length>1?Number.parseInt(v[1],10)||rr.duration:rr.duration,L=v.length>2?v[2]||rr.ease:rr.ease,B=v.length>3?Number.parseInt(v[3],10)||rr.delay:rr.delay,z=v.length>4?v[4]||rr.direction:rr.direction,F=`stx-transition-${Math.random().toString(36).substr(2,9)}`,X=Jh(C,{duration:j,delay:B,ease:L,direction:z}),G="stx-transition",J="";if(C==="fade")J="stx-fade";else if(C==="slide")J="stx-slide";else if(C==="scale")J="stx-scale";else if(C==="flip")J="stx-flip";else if(C==="rotate")J="stx-rotate";return`<div id="${F}" class="${G} ${J} ${z==="out"?"stx-out":""}"
|
|
1336
|
+
style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${L}; --stx-transition-delay: ${B}ms;">${x}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Bd={name:"scrollAnimate",handler:(x,v,k,E)=>{if(v.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${x}`;let C=v[0],j=v.length>1?Number.parseInt(v[1],10)||300:300,L=v.length>2?v[2]||"ease":"ease",B=v.length>3?Number.parseFloat(v[3])||0.2:0.2,z=v.length>4?Number.parseInt(v[4],10)||0:0,F=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,X=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${L}; --stx-transition-delay: ${z}ms; will-change: opacity, transform;`,G="stx-transition stx-observe stx-out";if(C==="fade")G+=" stx-fade";else if(C==="slide-up"||C==="slide")G+=" stx-from-bottom";else if(C==="slide-down")G+=" stx-from-top";else if(C==="slide-left")G+=" stx-from-right";else if(C==="slide-right")G+=" stx-from-left";else if(C==="scale")G+=" stx-scale";else if(C.includes("-"))G+=` stx-${C}`;else G+=` stx-${C}`;return`<div id="${F}" class="${G}" style="${X}" data-threshold="${B}">${x}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},zd={name:"animationGroup",handler:(x,v,k,E)=>{if(v.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${x}`;let C=v[0],j=v.slice(1).map((F)=>F.startsWith("#")||F.startsWith(".")?F:`#${F}`),L=k.staggerDelay||50,B=k.sequence||!0,z=ny(C,j,{staggerDelay:L,sequence:B});return`${x}
|
|
1337
|
+
${z}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Fd={name:"motion",handler:(x,v,k,E)=>{let C=v.length>0?v[0].toLowerCase()==="true":!0,j=Yh();return`<div data-animate="${C?"auto":"true"}">${x}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Wd(x,v,k,E){let C=x;if(E.animation?.enabled===!1)return C;let j=k.includes("test")&&k.includes("animation");if(!Qh(C)&&!j)return C;if(!C.includes('<style id="stx-animation-base">')){let B=ty();C=C.replace("</head>",`${B}
|
|
1338
|
+
</head>`)}if(C.includes("stx-observe")){if(!C.includes("Intersection Observer for scroll animations")){let z=ey(),F=C.lastIndexOf("</body>");if(F!==-1)C=C.slice(0,F)+z+`
|
|
1339
|
+
`+C.slice(F)}}return C}function Le(x){let v=x.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!v)return null;try{return Function(`return ${v[1]}`)()}catch{return null}}function Vd(x){let v=x?.layout;if(v===!1)return!1;return typeof v==="string"&&v.trim()?v.trim():void 0}var ry=100,sy=599,kc="__stxResponseStatus",Vs="__stxResponseHeaders";function Ti(x){return typeof x==="number"&&Number.isInteger(x)&&x>=ry&&x<=sy}function vt(x){for(let v of x.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=v[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let E=Number(k[1]);if(Ti(E))return E}return}function _c(x,v){if(!x||typeof x!=="object")return!1;let k=typeof v==="string"&&/^\d+$/.test(v.trim())?Number(v.trim()):v;if(!Ti(k))return!1;return x[kc]=k,!0}function iy(x,v,k){if(!x||typeof x!=="object")return;let E=String(v??"").trim();if(!E)return;x[Vs]={...x[Vs],[E]:String(k)}}function je(x){let v=x?.[kc];return Ti(v)?v:void 0}function Be(x){let v=x?.[Vs];if(!v||typeof v!=="object")return;let k=Object.entries(v).map(([E,C])=>[E,String(C)]);return k.length>0?Object.fromEntries(k):void 0}function Bi(x,v){if(!x||!v||x===v||typeof v!=="object")return;let k=je(x);if(k!==void 0)v[kc]=k;let E=Be(x);if(E)v[Vs]={...v[Vs],...E}}function Mn(x){return{setResponseStatus:(v)=>{_c(x,v)},notFound:(v=404)=>{let k=Ti(v)&&v>=400?v:404;_c(x,k)},setResponseHeader:(v,k)=>{iy(x,v,k)}}}function Ud(x,v,k={}){if(!x.includes("@status"))return x;let{filePath:E,buildMode:C}=k,j=C==="compile",L="",B=0,z=/@status\s*\(/g,F;while((F=z.exec(x))!==null){let X=oy(x,F.index+F[0].length-1);if(X<0)break;let G=x.slice(F.index+F[0].length,X).trim(),J=/^\d+$/.test(G)?Number(G):c(G,v),ne=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${G})${ne} 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(${G}) from <script server> instead \u2014 that runs per request.`);else if(!_c(v,J))console.warn(`[stx] @status(${G})${ne} is not an HTTP status (100-599) \u2014 ignoring it.`);L+=x.slice(B,F.index),B=X+1+(x.slice(X+1).match(/^[^\S\n]*\n?/)?.[0].length??0),z.lastIndex=B}return B===0?x:L+x.slice(B)}function oy(x,v){let k=1,E=null,C=!1;for(let j=v+1;j<x.length;j++){let L=x[j];if(C){C=!1;continue}if(E){if(L==="\\")C=!0;else if(L===E)E=null;continue}if(L==='"'||L==="'"||L==="`"){E=L;continue}if(L==="(")k++;else if(L===")"&&--k===0)return j}return-1}var ay=0,cy=0;function Hd(x,v){let k=x.match(new RegExp(`${v}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let E=x.match(new RegExp(`${v}\\s*=\\s*'([^']*)'`,"i"));if(E)return E[1];return null}function ly(x){let v=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,E;while((E=k.exec(x))!==null){let[C,j,L]=E,B=E.index,z=Hd(L,"x-data");if(!z)continue;let F=`__stx_scope_${ay++}`,X=Hd(L,"x-init"),G=uy(x,j,B+C.length),J=x.slice(B,G.endIndex),ne=dy(J);v.push({id:F,selector:`[data-stx-scope="${F}"]`,stateExpr:z,initExpr:X,bindings:[],refs:ne})}return v}function uy(x,v,k){let E=1,C=k,j=new RegExp(`<${v}(?:\\s|>)`,"gi"),L=new RegExp(`</${v}>`,"gi"),B=new RegExp(`<${v}[^>]*/\\s*>`,"gi");while(E>0&&C<x.length){j.lastIndex=C,L.lastIndex=C,B.lastIndex=C;let z=j.exec(x),F=L.exec(x),X=B.exec(x);if(X&&X.index<(z?.index??1/0)){C=X.index+X[0].length;continue}if(!F)return{endIndex:x.length};if(z&&z.index<F.index)E++,C=z.index+z[0].length;else{if(E--,E===0)return{endIndex:F.index+F[0].length};C=F.index+F[0].length}}return{endIndex:x.length}}function dy(x){let v=new Map,k=x.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),E=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,C;while((C=E.exec(k))!==null){let[,j,L]=C,B=fy(j);v.set(L,B)}return v}function fy(x){let v=x.match(/\bid\s*=\s*["']([^"']*)["']/);if(v)return v[1];return`__stx_el_${cy++}`}function py(){return`
|
|
1339
1340
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1340
1341
|
(function() {
|
|
1341
1342
|
var style = document.createElement('style');
|
|
@@ -1588,7 +1589,7 @@ window.__stx_reactive = (function() {
|
|
|
1588
1589
|
|
|
1589
1590
|
return { initScope: initScope, reactive: reactive };
|
|
1590
1591
|
})();
|
|
1591
|
-
`}function
|
|
1592
|
+
`}function qd(x,v){let k=x.replace(/\{!!([\s\S]*?)!!\}/g,(B,z)=>{try{let F=b(z,v,!0);if(F===void 0)return B;return String(F)}catch{return B}}),E="",C=0,j=null;while(C<k.length){let B=k[C];if(j&&B==="\\"){E+=B+(k[C+1]??""),C+=2;continue}if(B==="{"&&k[C+1]==="{"){let z=k.indexOf("}}",C+2);if(z!==-1){let F=k.slice(C,z+2);E+=L(k.slice(C+2,z),F,j),C=z+2;continue}}if(j){if(B===j)j=null}else if(B==="'"||B==='"'||B==="`")j=B;E+=B,C++}return E;function L(B,z,F){let X;try{X=b(B,v,!0)}catch{return z}if(X===void 0)return z;if(F){let G=String(X).replace(/\\/g,"\\\\").replace(new RegExp(F==="`"?"`":F,"g"),`\\${F}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return F==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof X==="string"){let G=X.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(X)}}function gy(x,v){if(x.length===0)return"";let k=x.map((E)=>{let C=JSON.stringify(Object.fromEntries(E.refs)),j=qd(E.stateExpr,v),L=E.initExpr?qd(E.initExpr,v):null,B=JSON.stringify(j),z=L?JSON.stringify(L):"null";return`
|
|
1592
1593
|
(function() {
|
|
1593
1594
|
var scopeEl = document.querySelector('${E.selector}');
|
|
1594
1595
|
if (!scopeEl) return;
|
|
@@ -1597,13 +1598,13 @@ window.__stx_reactive = (function() {
|
|
|
1597
1598
|
})();`}).join(`
|
|
1598
1599
|
`);return`
|
|
1599
1600
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1600
|
-
${
|
|
1601
|
+
${py()}
|
|
1601
1602
|
${k}
|
|
1602
|
-
</script>`}function
|
|
1603
|
-
`+C.slice(L);else C+=j;return C}function
|
|
1604
|
-
`)){let B=L.trim();if(!B||B.startsWith("#"))continue;let z=B.indexOf(":");if(z===-1)continue;let F=B.slice(0,z).trim(),
|
|
1605
|
-
`),C=C.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),C=C.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),C=C.replace(/<\/ul>\n<ul>/g,""),C=C.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),C=C.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),C=C.replace(/<\/ol>\n<ol>/g,""),C=C.replace(/<li data-ul>/g,"<li>"),C=C.replace(/<li data-ol>/g,"<li>"),k)C=C.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(
|
|
1606
|
-
`).map((oe)=>`<tr>${oe.split("|").map((
|
|
1603
|
+
</script>`}function Kd(x,v,k){if(!hy(x))return x;let E=ly(x);if(E.length===0)return x;let C=my(x,E),j=gy(E,v),L=C.lastIndexOf("</body>");if(L!==-1)C=C.slice(0,L)+j+`
|
|
1604
|
+
`+C.slice(L);else C+=j;return C}function my(x,v){let k=0,E=x.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(C,j,L)=>{let B=v[k++];if(!B)return C;let z=/data-stx-scope="([^"]*)"/.exec(L);if(z)return B.id=z[1],B.selector=`[data-stx-scope="${B.id}"]`,C;return`<${j} data-stx-scope="${B.id}"${L}>`});return E=E.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),E=E.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),E=E.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),E=E.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),E}function hy(x){return/x-data\s*=\s*["']/.test(x)}import ex from"fs";import Lc from"path";import{createHighlighter as tx}from"ts-syntax-highlighter";import xo from"fs";import ln from"path";import{loadConfigWithResult as Xy}from"bunfig";async function yy(x,v,k,E){let C=v[0]?.replace(/['"]/g,"")||"main",j=Se();if(C!=="main")j=j.replace("container:'main'",`container:'${C}'`);return`<script data-stx-router>${j}</script>`}var Xd={name:"stxRouter",handler:yy,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function dr(x){return x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Zd(x){let v=x.trim().toLowerCase();return!v.startsWith("javascript:")&&!v.startsWith("vbscript:")&&!v.startsWith("data:text/html")}function Pn(x){let v=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=x.match(v);if(!k)return{data:{},content:x.trim()};let E=k[1],C=x.slice(k[0].length),j={};for(let L of E.split(`
|
|
1605
|
+
`)){let B=L.trim();if(!B||B.startsWith("#"))continue;let z=B.indexOf(":");if(z===-1)continue;let F=B.slice(0,z).trim(),X=B.slice(z+1).trim();if(typeof X==="string"){if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))X=X.slice(1,-1);else if(X.startsWith("[")&&X.endsWith("]"))try{X=JSON.parse(X)}catch{}else if(X==="true")X=!0;else if(X==="false")X=!1;else if(/^-?\d+(?:\.\d+)?$/.test(X))X=Number(X)}j[F]=X}return{data:j,content:C.trim()}}function De(x,v={}){let{gfm:k=!0,breaks:E=!1}=v,C=x,j=[];if(C=C.replace(/```(\w*)\n([\s\S]*?)```/g,(X,G,J)=>{let ne=j.length,re=G?` class="language-${dr(G)}"`:"";return j.push(`<pre><code${re}>${dr(J.trim())}</code></pre>`),`\x00CODEBLOCK${ne}\x00`}),C=C.replace(/`([^`]*)`/g,(X,G)=>`<code>${dr(G)}</code>`),C=C.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),C=C.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),C=C.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),C=C.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),C=C.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),C=C.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),C=C.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),C=C.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),C=C.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),C=C.replace(/__(.+?)__/g,"<strong>$1</strong>"),C=C.replace(/\*(.+?)\*/g,"<em>$1</em>"),C=C.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)C=C.replace(/~~(.+?)~~/g,"<del>$1</del>");if(C=C.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(X,G,J)=>`<img src="${Zd(J)?dr(J):""}" alt="${dr(G)}" />`),C=C.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(X,G,J)=>`<a href="${Zd(J)?dr(J):""}">${G}</a>`),C=C.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),C=C.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),C=C.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1606
|
+
`),C=C.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),C=C.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),C=C.replace(/<\/ul>\n<ul>/g,""),C=C.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),C=C.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),C=C.replace(/<\/ol>\n<ol>/g,""),C=C.replace(/<li data-ul>/g,"<li>"),C=C.replace(/<li data-ol>/g,"<li>"),k)C=C.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(X,G,J)=>{let re=`<tr>${G.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${dr(oe)}</th>`).join("")}</tr>`,se=J.trim().split(`
|
|
1607
|
+
`).map((oe)=>`<tr>${oe.split("|").map((ge)=>ge.trim()).filter(Boolean).map((ge)=>`<td>${dr(ge)}</td>`).join("")}</tr>`).join(`
|
|
1607
1608
|
`);return`<table>
|
|
1608
1609
|
<thead>
|
|
1609
1610
|
${re}
|
|
@@ -1612,14 +1613,14 @@ ${re}
|
|
|
1612
1613
|
${se}
|
|
1613
1614
|
</tbody>
|
|
1614
1615
|
</table>`});if(k)C=C.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),C=C.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let L=C.split(`
|
|
1615
|
-
`),B=[],z=!1,F=[];for(let
|
|
1616
|
+
`),B=[],z=!1,F=[];for(let X of L){let G=X.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(G)||/^\0CODEBLOCK\d+\0$/.test(G)||G===""){if(z&&F.length>0)B.push(`<p>${F.join(E?`<br />
|
|
1616
1617
|
`:`
|
|
1617
|
-
`)}</p>`),F=[],z=!1;B.push(
|
|
1618
|
+
`)}</p>`),F=[],z=!1;B.push(X)}else z=!0,F.push(G)}if(z&&F.length>0)B.push(`<p>${F.join(E?`<br />
|
|
1618
1619
|
`:`
|
|
1619
1620
|
`)}</p>`);if(C=B.join(`
|
|
1620
1621
|
`),E)C=C.replace(/\n/g,`<br />
|
|
1621
|
-
`);for(let
|
|
1622
|
-
`||
|
|
1622
|
+
`);for(let X=0;X<j.length;X++)C=C.replace(`\x00CODEBLOCK${X}\x00`,j[X]);return C=C.replace(/<p>\s*<\/p>/g,""),C.trim()}async function Gd(x,v,k=""){let E=x,C=[],j=/@markdown(?:\([^)]*\))?/g,L;while((L=j.exec(x))!==null){let B=L.index,z=L[0].match(/@markdown\(([^)]*)\)/),F=z?z[1]:"",X=B+L[0].length,G=1,J=X,ne=-1;while(G>0&&J<x.length){let oe=x.indexOf("@markdown",J),ie=x.indexOf("@endmarkdown",J);if(ie===-1)break;if(oe!==-1&&oe<ie&&oe!==B){let ge=x[oe+9];if(ge==="("||ge===`
|
|
1623
|
+
`||ge==="\r"||ge===" "||ge===void 0)G++;J=oe+9}else{if(G--,G===0){ne=ie;break}J=ie+12}}if(ne===-1)continue;let re=x.slice(X,ne),se=x.slice(B,ne+12);C.push({fullMatch:se,options:F,content:re,index:B}),j.lastIndex=ne+12}for(let{fullMatch:B,options:z,content:F,index:X}of C)try{let G={};if(z)z.split(",").forEach((re)=>{let se=re.trim();if(se)G[se]=!0});let J={gfm:G.gfm??!0,breaks:G.breaks??!1},ne=De(F.trim(),J);E=E.split(B).join(ne)}catch(G){let J=G instanceof Error?G.message:String(G),ne=g("Markdown Directive",`Error processing markdown: ${J}`,k,x,X,B);E=E.split(B).join(ne)}return E}async function Jd(x,v,k,E){let C={gfm:!0,breaks:!1};return v.forEach((j)=>{let L=j.trim().replace(/['"]/g,"");if(L==="breaks")C.breaks=!0;if(L==="no-gfm")C.gfm=!1}),De(x.trim(),C)}var Br=[320,480,640,768,1024,1280,1536,1920,2560],xy=[1,1.5,2,3],Us=["avif","webp","jpeg"],by={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function Ec(x,v=Br,k={},E){return v.sort((C,j)=>C-j).map((C)=>`${Hs(x,{...k,w:C,fm:E})} ${C}w`).join(", ")}function Yd(x,v,k=xy,E={},C){return k.sort((j,L)=>j-L).map((j)=>{let L=Math.round(v*j);return`${Hs(x,{...E,w:L,dpr:j,fm:C})} ${j}x`}).join(", ")}function Cc(x,v="100vw"){if(!x||Object.keys(x).length===0)return v;let E=Object.entries(x).map(([C,j])=>{let L=/^\d+$/.test(C)?`${C}px`:C;return{bp:L,size:j,numericBp:Number.parseInt(L)||0}}).sort((C,j)=>C.numericBp-j.numericBp).map(({bp:C,size:j})=>`(max-width: ${C}) ${j}`);return E.push(v),E.join(", ")}function Hs(x,v={}){let k=Object.entries(v).filter(([,j])=>j!==void 0&&j!==null).map(([j,L])=>{if(Array.isArray(L))return[j,L.join(",")];return[j,String(L)]});if(k.length===0)return x;let E=k.map(([j,L])=>`${j}=${encodeURIComponent(L)}`).join("&"),C=x.includes("?")?"&":"?";return`${x}${C}${E}`}function Rc(x){return by[x]||"application/octet-stream"}var vy={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Ac=`
|
|
1623
1624
|
.stx-img-placeholder {
|
|
1624
1625
|
position: relative;
|
|
1625
1626
|
overflow: hidden;
|
|
@@ -1648,7 +1649,7 @@ ${se}
|
|
|
1648
1649
|
filter: blur(0);
|
|
1649
1650
|
transform: scale(1);
|
|
1650
1651
|
}
|
|
1651
|
-
`.trim();async function
|
|
1652
|
+
`.trim();async function wy(){try{return await import("ts-images")}catch{return null}}async function Sy(x,v={}){let k={...vy,...v},E=await wy();if(E)try{return await $y(x,k,E)}catch(C){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${C}`)}return _y(x,k)}async function $y(x,v,k){let{generatePlaceholder:E,generateThumbHash:C}=k,L={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[v.strategy]||"blur";if(v.strategy==="thumbhash")return{dataURL:(await C(x)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let B=await E(x,{width:v.width,height:v.height,quality:v.quality,blurLevel:v.blurLevel,strategy:L,base64Encode:!0});return{dataURL:B.dataURL,width:B.width,height:B.height,aspectRatio:B.aspectRatio,originalWidth:B.originalWidth,originalHeight:B.originalHeight,strategy:v.strategy,dominantColor:B.dominantColor,css:B.css}}function _y(x,v){let k=v.width||20,E=v.height||k,C="#e5e7eb",j=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${E}" viewBox="0 0 ${k} ${E}"><rect fill="#e5e7eb" width="${k}" height="${E}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(j)}`,width:k,height:E,aspectRatio:k/E,originalWidth:0,originalHeight:0,strategy:v.strategy,dominantColor:"#e5e7eb"}}function Qd(x,v,k={}){let E=k.transitionDuration||300,C=k.easing||"ease-out";return`
|
|
1652
1653
|
#${x} {
|
|
1653
1654
|
--stx-img-transition-duration: ${E}ms;
|
|
1654
1655
|
--stx-img-transition-easing: ${C};
|
|
@@ -1665,20 +1666,20 @@ ${se}
|
|
|
1665
1666
|
#${x}.stx-img-loaded img {
|
|
1666
1667
|
opacity: 1;
|
|
1667
1668
|
}
|
|
1668
|
-
`.trim()}var
|
|
1669
|
-
`):void 0,script:
|
|
1669
|
+
`.trim()}var Tc=new Map;async function ef(x,v={}){let k=`${x}:${JSON.stringify(v)}`;if(Tc.has(k))return Tc.get(k);let E=await Sy(x,v);return Tc.set(k,E),E}async function ky(){try{return await import("./chunk-r5gjb55x.js")}catch(x){if(!tf)console.warn("[stx-media] Image processor not available, some features disabled:",x),tf=!0;return null}}var tf=!1,Ic=80,lo="async",uo="lazy",nf=!1;async function oo(x,v={}){let k=v,E=x;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Ty(E,k)}if(k.processedResult?.processed)return Mc(x,k.processedResult,v);if(k.responsiveVariants)return of(x,k.responsiveVariants,v);let{src:C,alt:j,width:L,height:B,sizes:z,widths:F=Br,dpr:X,formats:G=Us,quality:J=Ic,params:ne={},placeholder:re="none",placeholderOptions:se={},lazy:oe=!0,priority:ie=!1,loading:ge=ie?"eager":uo,decoding:ue=lo,fetchpriority:xe,objectFit:we,objectPosition:$e,crossorigin:_e,referrerpolicy:Ce}=x,{class:Ee,style:Te,id:Re}=x,ke=x.data||{},{isDev:Ae=!1,baseUrl:Ze=""}=v;if(Ae&&!v.optimize)return Ry(x);let Pe,Ie,Ge=Re||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!ie)try{Pe=await ef(C,{strategy:re,...se}),Ie=Qd(Ge,Pe,se)}catch{}let nt=X!==void 0&&L!==void 0,at;if(nt)at=Cy(x,Ge,Pe,v);else at=await Ey(x,Ge,Pe,v);let rt;if(ie){let _t=G.includes("webp")?"webp":G[0],ct=Ec(C,F,{...ne,q:J},_t),Pt=typeof z==="object"?Cc(z):z||"100vw";rt=`<link rel="preload" as="image" imagesrcset="${ct}" imagesizes="${Pt}" />`}let Et=[];if(!nf&&re!=="none")Et.push(Ac),nf=!0;if(Ie)Et.push(Ie);let ft=oe?sf(Ge):void 0;return{html:at,preloadLink:rt,css:Et.length>0?Et.join(`
|
|
1670
|
+
`):void 0,script:ft}}async function Ey(x,v,k,E){let{src:C,alt:j,width:L,height:B,sizes:z,widths:F=Br,formats:X=Us,quality:G=Ic,params:J={},lazy:ne=!0,priority:re=!1,loading:se=re?"eager":uo,decoding:oe=lo,fetchpriority:ie,objectFit:ge,objectPosition:ue,crossorigin:xe,referrerpolicy:we}=x,{class:$e,style:_e}=x,Ce=x.data||{},Ee=typeof z==="object"?Cc(z):z||"100vw",Te=[];for(let Ae of X){let Ze=Ec(C,F,{...J,q:G},Ae),Pe=Rc(Ae);if(ne&&!re)Te.push(` <source type="${Pe}" data-srcset="${Ze}" data-sizes="${Ee}" />`);else Te.push(` <source type="${Pe}" srcset="${Ze}" sizes="${Ee}" />`)}let Re=Pc({src:Hs(C,{...J,q:G}),alt:j,width:L,height:B,loading:re?void 0:se,decoding:oe,fetchpriority:re?"high":ie,objectFit:ge,objectPosition:ue,crossorigin:xe,referrerpolicy:we,className:rf($e,k),style:Dc(_e,ge,ue,k),lazy:ne&&!re,data:Ce}),ke;if(k){let Ae=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;ke=`<div id="${v}" class="stx-img-placeholder" style="${Ae}">
|
|
1670
1671
|
<picture>
|
|
1671
|
-
${
|
|
1672
|
+
${Te.join(`
|
|
1672
1673
|
`)}
|
|
1673
|
-
<img ${
|
|
1674
|
+
<img ${Re} />
|
|
1674
1675
|
</picture>
|
|
1675
|
-
</div>`}else
|
|
1676
|
-
${
|
|
1676
|
+
</div>`}else ke=`<picture${v?` id="${v}"`:""}>
|
|
1677
|
+
${Te.join(`
|
|
1677
1678
|
`)}
|
|
1678
|
-
<img ${
|
|
1679
|
-
</picture>`;return
|
|
1680
|
-
<img ${
|
|
1681
|
-
</div>`}return`<img ${v?`id="${v}" `:""}${
|
|
1679
|
+
<img ${Re} />
|
|
1680
|
+
</picture>`;return ke}function Cy(x,v,k,E){let{src:C,alt:j,width:L,height:B,dpr:z=[1,2,3],quality:F=Ic,params:X={},lazy:G=!0,priority:J=!1,loading:ne=J?"eager":uo,decoding:re=lo,fetchpriority:se,objectFit:oe,objectPosition:ie,crossorigin:ge,referrerpolicy:ue}=x,{class:xe,style:we}=x,$e=x.data||{},_e=typeof L==="number"?L:Number.parseInt(String(L),10),Ce=Yd(C,_e,z,{...X,q:F}),Ee=Pc({src:Hs(C,{...X,w:_e,q:F}),alt:j,width:L,height:B,loading:J?void 0:ne,decoding:re,fetchpriority:J?"high":se,objectFit:oe,objectPosition:ie,crossorigin:ge,referrerpolicy:ue,className:rf(xe,k),style:Dc(we,oe,ie,k),lazy:G&&!J,data:$e}),Te=G&&!J?`data-srcset="${Ce}"`:`srcset="${Ce}"`;if(k){let Re=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${v}" class="stx-img-placeholder" style="${Re}">
|
|
1681
|
+
<img ${Ee} ${Te} />
|
|
1682
|
+
</div>`}return`<img ${v?`id="${v}" `:""}${Ee} ${Te} />`}function Ry(x){let{src:v,alt:k,width:E,height:C,loading:j=uo,decoding:L=lo,fetchpriority:B,objectFit:z,objectPosition:F,crossorigin:X,referrerpolicy:G,priority:J=!1}=x,{class:ne,style:re,id:se}=x,oe=x.data||{};return{html:`<img ${Pc({src:v,alt:k,width:E,height:C,loading:J?"eager":j,decoding:L,fetchpriority:J?"high":B,objectFit:z,objectPosition:F,crossorigin:X,referrerpolicy:G,className:ne,style:Dc(re,z,F),id:se,data:oe})} />`}}function Pc(x){let v=[];if(x.lazy)v.push(`data-src="${_n(x.src)}"`),v.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else v.push(`src="${_n(x.src)}"`);if(v.push(`alt="${_n(x.alt)}"`),x.width)v.push(`width="${x.width}"`);if(x.height)v.push(`height="${x.height}"`);if(x.loading)v.push(`loading="${x.loading}"`);if(x.decoding)v.push(`decoding="${x.decoding}"`);if(x.fetchpriority)v.push(`fetchpriority="${x.fetchpriority}"`);if(x.crossorigin)v.push(`crossorigin="${x.crossorigin}"`);if(x.referrerpolicy)v.push(`referrerpolicy="${x.referrerpolicy}"`);if(x.className)v.push(`class="${_n(x.className)}"`);if(x.style)v.push(`style="${_n(x.style)}"`);if(x.id)v.push(`id="${_n(x.id)}"`);if(x.data)for(let[k,E]of Object.entries(x.data))v.push(`data-${k}="${_n(E)}"`);if(x.lazy)v.push("data-stx-lazy");return v.join(" ")}function rf(x,v){let k=[];if(x)k.push(x);if(v)k.push("stx-img-blur");return k.join(" ")||""}function Dc(x,v,k,E){let C=[];if(v)C.push(`object-fit: ${v}`);if(k)C.push(`object-position: ${k}`);if(E)C.push("opacity: 0; transition: opacity 300ms ease-out");if(x)C.push(x);return C.join("; ")}function _n(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function sf(x){return`
|
|
1682
1683
|
(function() {
|
|
1683
1684
|
const container = document.getElementById('${x}');
|
|
1684
1685
|
if (!container) return;
|
|
@@ -1715,27 +1716,27 @@ ${Re.join(`
|
|
|
1715
1716
|
|
|
1716
1717
|
observer.observe(container);
|
|
1717
1718
|
})();
|
|
1718
|
-
`.trim()}async function
|
|
1719
|
+
`.trim()}async function Ty(x,v){let k=await ky();if(!k)return oo({...x,process:!1},v);let E=v.tsImagesConfig;if(x.responsiveWidths&&x.responsiveWidths.length>0||x.widths&&x.widths.length>0||!x.width&&!x.dpr){let j=await k.generateResponsiveVariants(x.src,x,E);if(j)return of(x,j,v)}else{let j=await k.processImage(x.src,x,E);if(j.processed)return Mc(x,j,v)}return oo({...x,process:!1},v)}async function Mc(x,v,k){let{alt:E,width:C,height:j,lazy:L=!0,priority:B=!1,objectFit:z,objectPosition:F,crossorigin:X,referrerpolicy:G}=x,{class:J,style:ne}=x,re=x.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=x.data||{},oe=v.variants||[],ie=oe.find((Ie)=>Ie.format==="jpeg")||oe.find((Ie)=>Ie.format==="webp")||oe[0],ge=ie?.url||x.src,ue=oe.filter((Ie)=>Ie.format===(ie?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),xe=new Map;for(let Ie of oe){if(!xe.has(Ie.format))xe.set(Ie.format,[]);xe.get(Ie.format).push(Ie)}let we=[],$e=["avif","webp","jpeg","png"];for(let Ie of $e){let Ge=xe.get(Ie);if(Ge&&Ge.length>0){let nt=Ge.map((rt)=>`${rt.url} ${rt.width}w`).join(", "),at=Rc(Ie);if(L&&!B)we.push(` <source type="${at}" data-srcset="${nt}" />`);else we.push(` <source type="${at}" srcset="${nt}" />`)}}let _e=[];if(L&&!B){if(_e.push(`data-src="${_n(ge)}"`),_e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ue)_e.push(`data-srcset="${ue}"`)}else if(_e.push(`src="${_n(ge)}"`),ue)_e.push(`srcset="${ue}"`);_e.push(`alt="${_n(E)}"`);let Ce=C||v.originalWidth,Ee=j||v.originalHeight;if(Ce)_e.push(`width="${Ce}"`);if(Ee)_e.push(`height="${Ee}"`);if(!B)_e.push(`loading="${L?"lazy":"eager"}"`);if(_e.push('decoding="async"'),B)_e.push('fetchpriority="high"');if(X)_e.push(`crossorigin="${X}"`);if(G)_e.push(`referrerpolicy="${G}"`);let Te=[];if(z)Te.push(`object-fit: ${z}`);if(F)Te.push(`object-position: ${F}`);if(v.placeholder&&L)Te.push("opacity: 0; transition: opacity 300ms ease-out");if(ne)Te.push(ne);if(Te.length>0)_e.push(`style="${Te.join("; ")}"`);let Re=[];if(J)Re.push(J);if(v.placeholder)Re.push("stx-img-blur");if(Re.length>0)_e.push(`class="${Re.join(" ")}"`);if(L&&!B)_e.push("data-stx-lazy");for(let[Ie,Ge]of Object.entries(se))_e.push(`data-${Ie}="${_n(Ge)}"`);let ke;if(v.placeholder||v.dominantColor&&x.useDominantColor){let Ie=v.placeholder?`background-image: url('${v.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${v.dominantColor};`;ke=`<div id="${re}" class="stx-img-placeholder" style="${Ie}">
|
|
1719
1720
|
<picture>
|
|
1720
1721
|
${we.join(`
|
|
1721
1722
|
`)}
|
|
1722
|
-
<img ${
|
|
1723
|
+
<img ${_e.join(" ")} />
|
|
1723
1724
|
</picture>
|
|
1724
|
-
</div>`}else
|
|
1725
|
+
</div>`}else ke=`<picture${re?` id="${re}"`:""}>
|
|
1725
1726
|
${we.join(`
|
|
1726
1727
|
`)}
|
|
1727
|
-
<img ${
|
|
1728
|
-
</picture>`;let
|
|
1729
|
-
`):void 0,script:
|
|
1730
|
-
`+
|
|
1731
|
-
<style>${F.css}</style>`;if(F.script)
|
|
1732
|
-
<script>${F.script}</script>`;return
|
|
1733
|
-
`),
|
|
1734
|
-
${
|
|
1728
|
+
<img ${_e.join(" ")} />
|
|
1729
|
+
</picture>`;let Ae=[];if(v.placeholder)Ae.push(Ac);let Ze=L?sf(re):void 0,Pe;if(B&&ue)Pe=`<link rel="preload" as="image" imagesrcset="${ue}" />`;return{html:ke,preloadLink:Pe,css:Ae.length>0?Ae.join(`
|
|
1730
|
+
`):void 0,script:Ze}}async function of(x,v,k){let E={src:v.src,processed:!0,variants:[],placeholder:v.placeholder?.dataURL,originalWidth:v.placeholder?.width,originalHeight:v.placeholder?.height};for(let[C,j]of Object.entries(v.byFormat))if(j)E.variants.push(...j);return Mc(x,E,k)}function Ay(){return We({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(x,v,k,E)=>{let{src:C,alt:j,options:L}=Iy(x,v,k);if(!C)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let B={src:C,alt:j||"",widths:L.widths||Br,formats:L.formats||Us,quality:L.quality,sizes:L.sizes,dpr:L.dpr,params:L.params,placeholder:L.placeholder,placeholderOptions:L.placeholderOptions,lazy:L.lazy!==!1,priority:L.priority||!1,loading:L.loading,decoding:L.decoding,fetchpriority:L.fetchpriority,objectFit:L.objectFit,objectPosition:L.objectPosition,class:L.class,style:L.style,id:L.id,width:L.width,height:L.height},z=k.__isDev||!1,F=await oo(B,{isDev:z}),X=F.html;if(F.preloadLink)X=F.preloadLink+`
|
|
1731
|
+
`+X;if(F.css)X+=`
|
|
1732
|
+
<style>${F.css}</style>`;if(F.script)X+=`
|
|
1733
|
+
<script>${F.script}</script>`;return X},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Iy(x,v,k){if(v.src)return{src:String(v.src),alt:String(v.alt||""),options:v.options||{}};let E=x.trim();if(E.startsWith("@img(")||E.startsWith("("))E=E.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let C=Py(E),j=Oc(C[0],k)||"",L=Oc(C[1],k)||"",B={};if(C[2]){let z=Oc(C[2],k);if(typeof z==="object"&&z!==null)B=z;else if(typeof C[2]==="string")try{B=JSON.parse(C[2])}catch{}}return{src:j,alt:L,options:B}}function Py(x){let v=[],k="",E=!1,C="",j=0,L=0;for(let B=0;B<x.length;B++){let z=x[B],F=B>0?x[B-1]:"";if((z==='"'||z==="'"||z==="`")&&F!=="\\"){if(!E)E=!0,C=z;else if(z===C)E=!1,C="";else k+=z;continue}if(!E){if(z==="{")j++;if(z==="}")j--;if(z==="[")L++;if(z==="]")L--;if(z===","&&j===0&&L===0){v.push(k.trim()),k="";continue}}k+=z}if(k.trim())v.push(k.trim());return v}function Oc(x,v){if(typeof x!=="string")return x;let k=x.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 E=v[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var af=Ay();async function lf(){try{return await import("./chunk-18awnp9d.js")}catch(x){if(!cf)console.warn("[stx-media] Video processor not available, some features disabled:",x),cf=!0;return null}}var cf=!1,uf=!0,df="metadata",Dy="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function fo(x,v={}){let k=v,E=x;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Ly(E,k)}if(k.processedResult?.processed)return pf(x,k.processedResult,v);let C;if(E.generatePoster&&E.src&&!x.poster)C=await By(E,k);let{src:j,sources:L=[],poster:B,posterPlaceholder:z,controls:F=uf,autoplay:X=!1,muted:G=!1,loop:J=!1,preload:ne=df,playsinline:re=!0,lazy:se=!0,player:oe="native",type:ie,width:ge,height:ue,crossorigin:xe,disablePictureInPicture:we=!1,disableRemotePlayback:$e=!1}=x,_e=C||B,{class:Ce,style:Ee}=x,Te=x.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return Oy(x,v);if(ie&&ie!=="video")return My(j||"",ie,x);let Re=L.length>0?L:j?[{src:j,type:ff(j)}]:[],ke=[`id="${Te}"`];if(F)ke.push("controls");if(X)ke.push("autoplay");if(G)ke.push("muted");if(J)ke.push("loop");if(re)ke.push("playsinline");if(we)ke.push("disablepictureinpicture");if($e)ke.push("disableremoteplayback");if(xe)ke.push(`crossorigin="${xe}"`);if(se){if(ke.push(`data-preload="${ne}"`),ke.push('preload="none"'),_e)ke.push(`data-poster="${Ut(_e)}"`);ke.push("data-stx-lazy")}else if(ke.push(`preload="${ne}"`),_e)ke.push(`poster="${Ut(_e)}"`);if(ge)ke.push(`width="${ge}"`);if(ue)ke.push(`height="${ue}"`);if(Ce)ke.push(`class="${Ut(Ce)}"`);if(Ee)ke.push(`style="${Ut(Ee)}"`);let Ae=Re.map((Ie)=>` <source ${se?`data-src="${Ut(Ie.src)}"`:`src="${Ut(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
|
|
1734
|
+
`),Ze=`<video ${ke.join(" ")}>
|
|
1735
|
+
${Ae}
|
|
1735
1736
|
Your browser does not support the video tag.
|
|
1736
1737
|
</video>`,Pe;if(se)Pe=`
|
|
1737
1738
|
(function() {
|
|
1738
|
-
var video = document.getElementById('${
|
|
1739
|
+
var video = document.getElementById('${Te}');
|
|
1739
1740
|
if (!video) return;
|
|
1740
1741
|
|
|
1741
1742
|
var observer = new IntersectionObserver(function(entries) {
|
|
@@ -1768,20 +1769,20 @@ ${Te}
|
|
|
1768
1769
|
|
|
1769
1770
|
observer.observe(video);
|
|
1770
1771
|
})();
|
|
1771
|
-
`.trim();return{html:
|
|
1772
|
-
<iframe ${
|
|
1773
|
-
</div>`}}function
|
|
1772
|
+
`.trim();return{html:Ze,script:Pe}}function My(x,v,k){let{width:E=640,height:C=360}=k,{class:j,style:L}=k,B=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,z,F=null;switch(v){case"youtube":F=Ny(x),z=F?`https://www.youtube-nocookie.com/embed/${F}`:x;break;case"vimeo":F=jy(x),z=F?`https://player.vimeo.com/video/${F}`:x;break;case"dailymotion":F=x.split("/").pop()||"",z=`https://www.dailymotion.com/embed/video/${F}`;break;case"twitch":F=x.split("/").pop()||"",z=`https://player.twitch.tv/?video=${F}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:z=x}let X=[`id="${B}"`,`src="${Ut(z)}"`,`width="${E}"`,`height="${C}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)X.push(`class="${Ut(j)}"`);if(L)X.push(`style="${Ut(L)}"`);if(k.lazy)X.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1773
|
+
<iframe ${X.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1774
|
+
</div>`}}function Oy(x,v={}){let{src:k,sources:E=[],poster:C,controls:j=!0,autoplay:L=!1,muted:B=!1,loop:z=!1,preload:F="metadata",playsinline:X=!0,lazy:G=!0,width:J,height:ne}=x,{class:re,style:se}=x,oe=x.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ie={src:E.length>0?E:k,autoplay:L,loop:z,muted:B,playsinline:X,preload:F,poster:C,controls:j,title:x.title},ge=["position: relative",J?`width: ${typeof J==="number"?J+"px":J}`:"width: 100%",ne?`height: ${typeof ne==="number"?ne+"px":ne}`:"",se||""].filter(Boolean).join("; "),ue=`
|
|
1774
1775
|
<div
|
|
1775
1776
|
id="${oe}"
|
|
1776
|
-
class="ts-video-player${re?" "+
|
|
1777
|
-
style="${
|
|
1777
|
+
class="ts-video-player${re?" "+Ut(re):""}"
|
|
1778
|
+
style="${ge}"
|
|
1778
1779
|
data-ts-video-player
|
|
1779
1780
|
data-config='${JSON.stringify(ie)}'
|
|
1780
1781
|
${G?"data-lazy":""}
|
|
1781
1782
|
>
|
|
1782
1783
|
<div class="ts-video-player__container">
|
|
1783
1784
|
${C?`
|
|
1784
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${
|
|
1785
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${Ut(C)}');">
|
|
1785
1786
|
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1786
1787
|
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1787
1788
|
<path d="M8 5v14l11-7z"/>
|
|
@@ -1791,7 +1792,7 @@ ${Te}
|
|
|
1791
1792
|
`:""}
|
|
1792
1793
|
</div>
|
|
1793
1794
|
</div>
|
|
1794
|
-
`.trim(),
|
|
1795
|
+
`.trim(),xe=`
|
|
1795
1796
|
(function() {
|
|
1796
1797
|
var container = document.getElementById('${oe}');
|
|
1797
1798
|
if (!container) return;
|
|
@@ -1807,7 +1808,7 @@ ${Te}
|
|
|
1807
1808
|
|
|
1808
1809
|
// Load ts-video-player from CDN
|
|
1809
1810
|
var script = document.createElement('script');
|
|
1810
|
-
script.src = '${
|
|
1811
|
+
script.src = '${Dy}';
|
|
1811
1812
|
script.onload = initPlayer;
|
|
1812
1813
|
script.onerror = function() {
|
|
1813
1814
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -1937,12 +1938,12 @@ else {
|
|
|
1937
1938
|
.ts-video-player__play-button svg {
|
|
1938
1939
|
margin-left: 4px;
|
|
1939
1940
|
}
|
|
1940
|
-
`.trim();return{html:ue,script:
|
|
1941
|
-
${
|
|
1941
|
+
`.trim();return{html:ue,script:xe,css:we}}function ff(x){switch(x.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 Ny(x){let v=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of v){let E=x.match(k);if(E)return E[1]}return null}function jy(x){let v=x.match(/vimeo\.com\/(\d+)/);return v?v[1]:null}function Ut(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function Ly(x,v){let k=await lf();if(!k)return fo({...x,process:!1},v);let E=v.tsVideosConfig,C=await k.processVideo(x.src,x,E,x.onProcessProgress);if(C.processed)return pf(x,C,v);return fo({...x,process:!1},v)}async function By(x,v){let k=await lf();if(!k||!x.src)return;let E=typeof x.generatePoster==="object"?x.generatePoster:{timestamp:0},C=v.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(x.src,E,C.outputDir,C.baseUrl||"/videos"))?.url}function pf(x,v,k){let{controls:E=uf,autoplay:C=!1,muted:j=!1,loop:L=!1,preload:B=df,playsinline:z=!0,lazy:F=!0,width:X,height:G,crossorigin:J,disablePictureInPicture:ne=!1,disableRemotePlayback:re=!1}=x,{class:se,style:oe}=x,ie=x.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ge=x.src,ue=ff(ge);if(v.transcoded)ge=v.transcoded.url,ue="video/mp4";let xe=v.streaming?.hls||v.streaming?.dash;if(xe){if(v.streaming?.hls)ge=v.streaming.hls.manifestUrl,ue="application/x-mpegURL";else if(v.streaming?.dash)ge=v.streaming.dash.manifestUrl,ue="application/dash+xml"}let we=v.poster?.url||x.poster,$e=[`id="${ie}"`];if(E)$e.push("controls");if(C)$e.push("autoplay");if(j)$e.push("muted");if(L)$e.push("loop");if(z)$e.push("playsinline");if(ne)$e.push("disablepictureinpicture");if(re)$e.push("disableremoteplayback");if(J)$e.push(`crossorigin="${J}"`);if(F){if($e.push(`data-preload="${B}"`),$e.push('preload="none"'),we)$e.push(`data-poster="${Ut(we)}"`);$e.push("data-stx-lazy")}else if($e.push(`preload="${B}"`),we)$e.push(`poster="${Ut(we)}"`);let _e=X||v.metadata?.width,Ce=G||v.metadata?.height;if(_e)$e.push(`width="${_e}"`);if(Ce)$e.push(`height="${Ce}"`);if(se)$e.push(`class="${Ut(se)}"`);if(oe)$e.push(`style="${Ut(oe)}"`);let Te=` <source ${F?`data-src="${Ut(ge)}"`:`src="${Ut(ge)}"`} type="${ue}" />`,Re=`<video ${$e.join(" ")}>
|
|
1942
|
+
${Te}
|
|
1942
1943
|
Your browser does not support the video tag.
|
|
1943
|
-
</video>`;if(v.spriteSheet)
|
|
1944
|
-
${
|
|
1945
|
-
</div>`;let
|
|
1944
|
+
</video>`;if(v.spriteSheet)Re=`<div class="stx-video-wrapper" data-sprite-sheet="${Ut(v.spriteSheet.url)}" data-sprite-cols="${v.spriteSheet.columns}" data-sprite-interval="${v.spriteSheet.interval}">
|
|
1945
|
+
${Re}
|
|
1946
|
+
</div>`;let ke;if(F)ke=`
|
|
1946
1947
|
(function() {
|
|
1947
1948
|
var video = document.getElementById('${ie}');
|
|
1948
1949
|
if (!video) return;
|
|
@@ -1977,7 +1978,7 @@ ${Ce}
|
|
|
1977
1978
|
|
|
1978
1979
|
observer.observe(video);
|
|
1979
1980
|
})();
|
|
1980
|
-
`.trim();let
|
|
1981
|
+
`.trim();let Ae;if(xe)Ae=`
|
|
1981
1982
|
.stx-video-wrapper {
|
|
1982
1983
|
position: relative;
|
|
1983
1984
|
width: 100%;
|
|
@@ -1986,9 +1987,9 @@ ${Ce}
|
|
|
1986
1987
|
width: 100%;
|
|
1987
1988
|
height: auto;
|
|
1988
1989
|
}
|
|
1989
|
-
`.trim();return{html:
|
|
1990
|
-
<style>${F.css}</style>`;if(F.script)
|
|
1991
|
-
<script>${F.script}</script>`;return
|
|
1990
|
+
`.trim();return{html:Re,script:ke,css:Ae}}function gf(){return We({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(x,v,k,E)=>{let{src:C,options:j}=zy(x,v,k);if(!C)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let L={src:C,poster:j.poster,controls:j.controls!==!1,autoplay:j.autoplay||!1,muted:j.muted||!1,loop:j.loop||!1,preload:j.preload||"metadata",playsinline:j.playsinline!==!1,lazy:j.lazy!==!1,player:j.player||"native",type:j.type,width:j.width,height:j.height,class:j.class,style:j.style,id:j.id,crossorigin:j.crossorigin,disablePictureInPicture:j.disablePictureInPicture,disableRemotePlayback:j.disableRemotePlayback,title:j.title,quality:j.quality,platform:j.platform,process:j.process,generatePoster:j.generatePoster,streaming:j.streaming,transcode:j.transcode,spriteSheet:j.spriteSheet,waveform:j.waveform},z={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},F=await fo(L,z),X=F.html;if(F.css)X+=`
|
|
1991
|
+
<style>${F.css}</style>`;if(F.script)X+=`
|
|
1992
|
+
<script>${F.script}</script>`;return X},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function zy(x,v,k){if(v.src)return{src:String(v.src),options:v.options||{}};let E=x.trim();if(E.startsWith("@video(")||E.startsWith("("))E=E.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let C=Fy(E),j=mf(C[0],k)||"",L={};if(C[1]){let B=mf(C[1],k);if(typeof B==="object"&&B!==null)L=B;else if(typeof C[1]==="string")try{L=JSON.parse(C[1])}catch{}}return{src:j,options:L}}function Fy(x){let v=[],k="",E=!1,C="",j=0,L=0;for(let B=0;B<x.length;B++){let z=x[B],F=B>0?x[B-1]:"";if((z==='"'||z==="'"||z==="`")&&F!=="\\"){if(!E)E=!0,C=z;else if(z===C)E=!1,C="";else k+=z;continue}if(!E){if(z==="{")j++;if(z==="}")j--;if(z==="[")L++;if(z==="]")L--;if(z===","&&j===0&&L===0){v.push(k.trim()),k="";continue}}k+=z}if(k.trim())v.push(k.trim());return v}function mf(x,v){if(typeof x!=="string")return x;let k=x.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 E=v[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var Nc=gf();import Wy from"fs";import vn from"path";async function Vn(x,v){if(!x.webComponents?.enabled)return[];let k=x.webComponents.components||[],E=[];if(k.length>0){if(x.debug)console.log(`Building ${k.length} web components...`);for(let C of k)try{let j=await Vy(C,x,v);if(j)E.push(j)}catch(j){if(console.error(`Error building web component ${C.name}:`,j),x.debug)throw j}}return E}async function Vy(x,v,k){let{name:E,file:C,tag:j,extends:L}=x;if(!E||!C||!j)return console.error("Invalid web component configuration, missing required fields:",x),null;let B=null;if(vn.isAbsolute(C)&&await n(C))B=C;else if(v.componentsDir){let se=vn.join(v.componentsDir,C);if(await n(se))B=se}if(!B)B=await Un(C,process.cwd(),v,k);if(!B)return console.error(`Web component source file not found: ${C}`),null;let z=await Bun.file(B).text();k.add(B);let X=(x.outputFormat||"js")==="ts",G=X?Hy({name:E,tag:j,baseElement:L,source:z,shadowDOM:x.shadowDOM??!0,template:x.template??!0,styleSource:x.styleSource,attributes:x.attributes||[],attributeTypes:x.attributeTypes||{}}):Uy({name:E,tag:j,baseElement:L,source:z,shadowDOM:x.shadowDOM??!0,template:x.template??!0,styleSource:x.styleSource,attributes:x.attributes||[]}),J=v.webComponents?.outputDir||"dist/web-components";await Wy.promises.mkdir(J,{recursive:!0});let ne=X?"ts":"js",re=vn.join(J,`${j}.${ne}`);if(await Bun.write(re,G),v.debug)console.log(`Built web component ${E} -> ${re}`);return re}function Uy(x){let{name:v,tag:k,baseElement:E="HTMLElement",source:C,shadowDOM:j,template:L,styleSource:B,attributes:z=[]}=x,F=C.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)F=F.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),F=F.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),F=F.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),F=F.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let X="";if(B)X=`<link rel="stylesheet" href="${B}">`;return`/**
|
|
1992
1993
|
* ${v} Web Component
|
|
1993
1994
|
* Auto-generated from stx component
|
|
1994
1995
|
*/
|
|
@@ -2003,13 +2004,13 @@ class ${v.replace(/\W/g,"")} extends ${E} {
|
|
|
2003
2004
|
${L?`
|
|
2004
2005
|
_createTemplate() {
|
|
2005
2006
|
const template = document.createElement('template')
|
|
2006
|
-
template.innerHTML = \`${
|
|
2007
|
+
template.innerHTML = \`${X}${F}\`
|
|
2007
2008
|
${j?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2008
2009
|
this._processSlots()
|
|
2009
2010
|
}
|
|
2010
2011
|
`:`
|
|
2011
2012
|
_render() {
|
|
2012
|
-
${j?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${
|
|
2013
|
+
${j?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${X}${F}\`
|
|
2013
2014
|
this._processSlots()
|
|
2014
2015
|
}
|
|
2015
2016
|
`}
|
|
@@ -2080,14 +2081,14 @@ class ${v.replace(/\W/g,"")} extends ${E} {
|
|
|
2080
2081
|
|
|
2081
2082
|
// Register the web component
|
|
2082
2083
|
customElements.define('${k}', ${v.replace(/\W/g,"")})
|
|
2083
|
-
`}function
|
|
2084
|
-
`),oe=z.map((we)=>{let
|
|
2085
|
-
get ${
|
|
2086
|
-
return this._${
|
|
2084
|
+
`}function Hy(x){let{name:v,tag:k,baseElement:E="HTMLElement",source:C,shadowDOM:j,template:L,styleSource:B,attributes:z=[],attributeTypes:F={}}=x,X=v.replace(/\W/g,""),G=C.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let J=B?`<link rel="stylesheet" href="${B}">`:"",ne=(we)=>{switch(F[we]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(we)=>we.replace(/-([a-z])/g,($e,_e)=>_e.toUpperCase()),se=z.map((we)=>` private _${re(we)}: ${ne(we)} | null = null;`).join(`
|
|
2085
|
+
`),oe=z.map((we)=>{let $e=ne(we),_e=re(we);return`
|
|
2086
|
+
get ${_e}(): ${$e} | null {
|
|
2087
|
+
return this._${_e};
|
|
2087
2088
|
}
|
|
2088
2089
|
|
|
2089
|
-
set ${
|
|
2090
|
-
this._${
|
|
2090
|
+
set ${_e}(value: ${$e} | null) {
|
|
2091
|
+
this._${_e} = value;
|
|
2091
2092
|
if (value !== null) {
|
|
2092
2093
|
this.setAttribute('${we}', String(value));
|
|
2093
2094
|
}
|
|
@@ -2098,11 +2099,11 @@ else {
|
|
|
2098
2099
|
`),ie=z.length>0?`/**
|
|
2099
2100
|
* Props interface for ${v}
|
|
2100
2101
|
*/
|
|
2101
|
-
export interface ${
|
|
2102
|
-
${z.map((we)=>{let
|
|
2102
|
+
export interface ${X}Props {
|
|
2103
|
+
${z.map((we)=>{let $e=ne(we);return` ${re(we)}?: ${$e};`}).join(`
|
|
2103
2104
|
`)}
|
|
2104
2105
|
}
|
|
2105
|
-
`:"",
|
|
2106
|
+
`:"",ge=z.length>0?`
|
|
2106
2107
|
static get observedAttributes(): string[] {
|
|
2107
2108
|
return [${z.map((we)=>`'${we}'`).join(", ")}];
|
|
2108
2109
|
}
|
|
@@ -2160,7 +2161,7 @@ ${ie}
|
|
|
2160
2161
|
* ${v} custom element class
|
|
2161
2162
|
* @customElement ${k}
|
|
2162
2163
|
*/
|
|
2163
|
-
export class ${
|
|
2164
|
+
export class ${X} extends ${E} {
|
|
2164
2165
|
${se}
|
|
2165
2166
|
private _initialized = false;
|
|
2166
2167
|
${j?"":"private _slotContent: Node[] = [];"}
|
|
@@ -2207,7 +2208,7 @@ ${j?`
|
|
|
2207
2208
|
}
|
|
2208
2209
|
}
|
|
2209
2210
|
}`}
|
|
2210
|
-
${
|
|
2211
|
+
${ge}
|
|
2211
2212
|
${oe}
|
|
2212
2213
|
|
|
2213
2214
|
connectedCallback(): void {
|
|
@@ -2229,13 +2230,13 @@ ${oe}
|
|
|
2229
2230
|
// Type augmentation for HTMLElementTagNameMap
|
|
2230
2231
|
declare global {
|
|
2231
2232
|
interface HTMLElementTagNameMap {
|
|
2232
|
-
'${k}': ${
|
|
2233
|
+
'${k}': ${X};
|
|
2233
2234
|
}
|
|
2234
2235
|
}
|
|
2235
2236
|
|
|
2236
2237
|
// Register the web component
|
|
2237
|
-
customElements.define('${k}', ${
|
|
2238
|
-
`}function
|
|
2238
|
+
customElements.define('${k}', ${X});
|
|
2239
|
+
`}function qy(x,v){let k=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),E=k?k[1].trim():"",C=v,j=[],L=!0;if(E){let G=E.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let J=G[1],ne=J.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ne)C=ne[1];let re=J.match(/props\s*:\s*\[([\s\S]*?)\]/);if(re)j=re[1].split(",").map((oe)=>oe.trim().replace(/['"`]/g,"")).filter((oe)=>oe.length>0);let se=J.match(/shadowDOM\s*:\s*(true|false)/);if(se)L=se[1]==="true"}catch{}}let B=x.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),z=B?B[1].trim():"",F=x.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),X=F?F[1].trim():"";return{tag:C,props:j,template:z,styles:X,script:E,shadowDOM:L}}function Ky(x){let{tag:v,props:k,template:E,styles:C,shadowDOM:j}=x,L=v.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),B=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),z=C.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),F=k.map((G)=>`'${G}'`).join(", "),X=k.map((G)=>`
|
|
2239
2240
|
get ${G}() {
|
|
2240
2241
|
return this.getAttribute('${G}') || '';
|
|
2241
2242
|
}
|
|
@@ -2267,7 +2268,7 @@ class ${L} extends HTMLElement {
|
|
|
2267
2268
|
this._render();
|
|
2268
2269
|
}
|
|
2269
2270
|
}
|
|
2270
|
-
${
|
|
2271
|
+
${X}
|
|
2271
2272
|
|
|
2272
2273
|
_render() {
|
|
2273
2274
|
const template = \`${z?`<style>${z}</style>`:""}${B}\`;
|
|
@@ -2286,24 +2287,24 @@ ${K}
|
|
|
2286
2287
|
}
|
|
2287
2288
|
|
|
2288
2289
|
customElements.define('${v}', ${L});
|
|
2289
|
-
`}async function
|
|
2290
|
-
${
|
|
2291
|
-
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:St,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:Kd,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:ff,hasEndTag:!1,description:"Include a web component in the template"},so,io,qn,Xn,Md,Nd,jd,Od,Ud,Dd,nf,Dc,...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 Hy(x,v,k){let E=v||"pages";if(x)return{root:x,pagesDir:E};let C=k||process.cwd(),j=an.join(C,"resources","views"),L=an.join(C,"resources","layouts");if(xo.existsSync(j)&&xo.existsSync(L))return{root:"resources",pagesDir:"views"};let B=an.join(C,"resources","views","pages");if(xo.existsSync(B))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var pf=new Set,bo=["partialsDir","componentsDir","layoutsDir"],Mc=new WeakMap;function qy(x,v){let k=v.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=x.replace(/\\/g,"/"),C=k.replace(/\\/g,"/");return E===C||E.startsWith(`${C}/`)}function yc(x,v){let k=!x.root,E=Hy(x.root,x.pagesDir,v);if(x.root=E.root,x.pagesDir=E.pagesDir,k&&E.root!=="."){let C=`${v}::${E.root}`;if(!pf.has(C))pf.add(C),console.warn(`[stx] No "root" in config \u2014 inferred "${E.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Mc.has(x)){let C={};for(let j of bo){let L=x[j];if(typeof L==="string"&&L)C[j]=L}Mc.set(x,C)}if(x.root&&x.root!=="."){let C=x.root;for(let j of bo){let L=x[j];if(typeof L!=="string"||!L)continue;if(an.isAbsolute(L)||qy(L,C))continue;x[j]=an.join(C,L)}}for(let C of bo){let j=x[C];if(typeof j!=="string"||!j||an.isAbsolute(j))continue;x[C]=an.resolve(v,j)}return x}function Ky(x,v){let k=Mc.get(x);for(let E of bo){let C=x[E];if(typeof C!=="string"||!C)continue;let j=an.isAbsolute(C)?C:an.join(v,C);if(xo.existsSync(j))continue;let L=k?.[E]??C,B=x.root,z=!!B&&B!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${L}"`+(z?`, resolved under root "${B}".`:"."))}}function Xy(x){if(x.customDirectives)x.customDirectives=[...x.customDirectives];if(x.middleware)x.middleware=[...x.middleware];if(x.apiRoutes)x.apiRoutes={...x.apiRoutes}}function Zy(x){if(uo(x.stateDir),x.stateDir=nn(),x.cachePath=rn(x.cachePath),x.build)x.build.cacheDir=rn(x.build.cacheDir);if(x.media?.cache)x.media.cache.directory=rn(x.media.cache.directory);if(x.story)x.story.outDir=rn(x.story.outDir)}var lr=null,vr=new Map,po=new Map,Vs=null;async function i(x){let v=x?an.resolve(x):process.cwd(),k=po.get(v);if(k&&k.signature!==Vn(k.graph)){let j=vr.get(v);if(vr.delete(v),po.delete(v),!x)lr=null,Vs=null;let{clearComponentCache:L}=await import("./chunk-ra0pkkvd.js"),{partialsCache:B}=await import("./chunk-ettat5ah.js");if(L(),B.clear(),j&&k.configSignature===Un(k.graph)){let z=j.then(async(F)=>{let K={...k.graph};await ds(K,v),po.set(v,{graph:K,signature:Vn(K),configSignature:Un(K)});let G={...F,_layerGraph:K};if(!x)lr=G;return G});return vr.set(v,z),z}}if(!x){if(lr)return lr;if(Vs)return Vs}let E=vr.get(v);if(E)return E;let C=(async()=>{let L=(await Uy({name:"stx",alias:"ui",cwd:v,defaultConfig:A,verbose:!1})).config;if(L.extends!==void 0||k){let K=await co(v,A);L=K.config,po.set(v,{graph:K.graph,signature:Vn(K.graph),configSignature:Un(K.graph)})}if(L.runtimeConfig){let{resolveRuntimeConfig:K}=await import("./chunk-bs6y5wy2.js");K(L.runtimeConfig,{});let{generateRuntimeConfigTypes:G}=await import("./chunk-4s9dypby.js");await G(v,L.runtimeConfig)}Xy(L),Zy(L),yc(L,v),Ky(L,v);let B=[],z=new Set((L.plugins??[]).map((K)=>typeof K==="string"?K:K[0]));for(let K of L.componentPackages??["@stacksjs/components"]){let G=`${K}/stx-plugin`;if(z.has(G)||z.has(K))continue;try{u.resolve(G,{paths:[v]}),B.push(G)}catch{}}let F=[...L.plugins??[],...B];if(F.length>0){let{pluginManager:K}=await import("./chunk-f4ws0qcd.js"),G=[],J=[];for(let ne of F){let re=typeof ne==="string"?ne:ne[0],se=typeof ne==="string"?{}:ne[1]||{};try{let oe,ie;try{let ue=u.resolve(re,{paths:[v]});oe=await import(ue),ie=an.dirname(ue)}catch{let ue=an.resolve(v,re);oe=await import(ue),ie=an.dirname(ue)}let fe=oe.default||oe;if(!K.has(fe.name))await K.register(fe,L);if(fe.components){let ue=Array.isArray(fe.components)?fe.components:[fe.components];for(let be of ue)G.push(an.resolve(ie,be))}if(fe.pages){let ue=an.resolve(ie,fe.pages),be=se.path||"/";J.push({dir:ue,prefix:be})}if(fe.setup){let ue={addDirective:(be)=>{L.customDirectives=L.customDirectives||[],L.customDirectives.push(be)},addRoute:(be,we)=>{L.apiRoutes=L.apiRoutes||{},L.apiRoutes[be]=we},addMiddleware:(be)=>{L.middleware=L.middleware||[],L.middleware.push(be)},pluginDir:ie,config:L};await fe.setup(se,ue)}console.log(`[stx] Plugin loaded: ${fe.name||re}`)}catch(oe){console.warn(`[stx] Failed to load plugin ${re}:`,oe.message)}}L._pluginComponentDirs=G,L._pluginPageDirs=J}return L})();if(vr.set(v,C),C.catch(()=>{if(vr.get(v)===C)vr.delete(v)}),!x)Vs=C,C.then((j)=>{lr=j}).catch(()=>{});return C}var T=new Proxy(A,{get(x,v){if(lr&&v in lr)return lr[v];if(!Vs)i().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return x[v]}});function Iu(x){return x}function Du(x){let v=[],k=[];if(x.partialsDir!==void 0&&typeof x.partialsDir!=="string")v.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(x.componentsDir!==void 0&&typeof x.componentsDir!=="string")v.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(x.cache!==void 0&&typeof x.cache!=="boolean")v.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(x.debug!==void 0&&typeof x.debug!=="boolean")v.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(x.streaming){if(x.streaming.bufferSize!==void 0){if(typeof x.streaming.bufferSize!=="number"||x.streaming.bufferSize<=0)v.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(x.streaming.timeout!==void 0){if(typeof x.streaming.timeout!=="number"||x.streaming.timeout<=0)v.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(x.streaming.strategy!==void 0){let E=["auto","manual","sections"];if(!E.includes(x.streaming.strategy))v.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.i18n){if(x.i18n.format!==void 0){let E=["json","yaml","yml","js"];if(!E.includes(x.i18n.format))v.push({path:"i18n.format",message:`i18n.format must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.animation){if(x.animation.defaultDuration!==void 0){if(typeof x.animation.defaultDuration!=="number"||x.animation.defaultDuration<0)v.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(x.animation.staggerDelay!==void 0){if(typeof x.animation.staggerDelay!=="number"||x.animation.staggerDelay<0)v.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(x.a11y){if(x.a11y.level!==void 0){let E=["AA","AAA"];if(!E.includes(x.a11y.level))v.push({path:"a11y.level",message:`a11y.level must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.hydration){if(x.hydration.mode!==void 0){let E=["progressive","islands"];if(!E.includes(x.hydration.mode))v.push({path:"hydration.mode",message:`hydration.mode must be one of: ${E.join(", ")}`,severity:"error"})}if(x.hydration.preload!==void 0){let E=["none","eager","lazy"];if(!E.includes(x.hydration.preload))v.push({path:"hydration.preload",message:`hydration.preload must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.customDirectives)if(!Array.isArray(x.customDirectives))v.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else x.customDirectives.forEach((E,C)=>{if(!E.name||typeof E.name!=="string")v.push({path:`customDirectives[${C}].name`,message:"Custom directive must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")v.push({path:`customDirectives[${C}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(x.middleware)if(!Array.isArray(x.middleware))v.push({path:"middleware",message:"middleware must be an array",severity:"error"});else x.middleware.forEach((E,C)=>{if(!E.name||typeof E.name!=="string")v.push({path:`middleware[${C}].name`,message:"Middleware must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")v.push({path:`middleware[${C}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!E.timing||!["before","after"].includes(E.timing))v.push({path:`middleware[${C}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(x.debug===!0&&x.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(x.seo?.enabled===!0&&!x.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(x.pwa){if(x.pwa.enabled===!0&&!x.pwa.manifest?.name)v.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(x.pwa.manifest?.display!==void 0){let E=["fullscreen","standalone","minimal-ui","browser"];if(!E.includes(x.pwa.manifest.display))v.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${E.join(", ")}`,severity:"error"})}if(x.pwa.manifest?.orientation!==void 0){let E=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!E.includes(x.pwa.manifest.orientation))v.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${E.join(", ")}`,severity:"error"})}if(x.pwa.routes){let E=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];x.pwa.routes.forEach((C,j)=>{if(!C.pattern||typeof C.pattern!=="string")v.push({path:`pwa.routes[${j}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!E.includes(C.strategy))v.push({path:`pwa.routes[${j}].strategy`,message:`PWA route strategy must be one of: ${E.join(", ")}`,severity:"error"});if(C.maxAgeSeconds!==void 0&&(typeof C.maxAgeSeconds!=="number"||C.maxAgeSeconds<0))v.push({path:`pwa.routes[${j}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(C.maxEntries!==void 0&&(typeof C.maxEntries!=="number"||C.maxEntries<1))v.push({path:`pwa.routes[${j}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(x.pwa.icons?.sizes){if(!Array.isArray(x.pwa.icons.sizes))v.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(x.pwa.icons.sizes.filter((C)=>typeof C!=="number"||C<16||C>1024).length>0)v.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(x.pwa.icons?.purpose){let E=["any","maskable","monochrome"];if(x.pwa.icons.purpose.filter((j)=>!E.includes(j)).length>0)v.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${E.join(", ")}`,severity:"error"})}if(x.pwa.enabled===!0&&!x.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(x.pwa.enabled===!0&&!x.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:v.length===0,errors:v,warnings:k}}var Nc=new Map;async function ce(x,v={}){try{if(!await n(x))throw Error(`Markdown file not found: ${x}`);let E=(await Gy.promises.stat(x)).mtime.getTime();if(v.cache&&Nc.has(x)){let G=Nc.get(x);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let C=await Bun.file(x).text(),{data:j,content:L}=Rn(C),B=v.markdown||T.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},F=Ie(L,{gfm:!0});if(B.syntaxHighlighting?.enabled&&B.syntaxHighlighting?.serverSide)F=await Yy(F,B.syntaxHighlighting?.defaultTheme||"github-dark",B.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:F,data:j||{}};if(v.cache)Nc.set(x,{...K,updatedAt:E});return K}catch(k){if(v.debug)console.error(`Error reading/parsing markdown file ${x}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,x,"",0,""),data:{}}}}var vo=null;async function Yy(x,v,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!vo)try{vo=await Jy({theme:v||"github-dark",cache:!0})}catch(B){return console.error("Failed to initialize ts-syntax-highlighter:",B),x}let C=async(B,z,F,K)=>{let G=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),J=F||(k?"text":"");if(!J)return B;try{if(!vo.getSupportedLanguages().includes(J))return B;return(await vo.highlight(G,J,{theme:v})).html}catch(ne){console.error(`Error highlighting code block with language ${F}:`,ne)}return B},j=x,L=x.matchAll(E);for(let B of L){let[z,F,K,G]=B,J=await C(z,F,K,G);j=j.replace(z,J)}return j}async function gf(x,v,k="",E={}){return await Qy(x,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(L,B,z,F)=>{try{let K=B;if(!Oc.isAbsolute(B))K=Oc.resolve(Oc.dirname(k),B);let G={};if(z)try{try{G=JSON.parse(z)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let fe=z.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ue of fe){let be=ue.indexOf(":");if(be>0){let we=ue.substring(0,be).trim(),Se=ue.substring(be+1).trim(),$e=Se.startsWith('"')&&Se.endsWith('"'),Ee=Se.startsWith("'")&&Se.endsWith("'");if($e||Ee)Se=Se.substring(1,Se.length-1);G[we]=Se}}}}catch(ie){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ie)}let{content:J,data:ne}=await ce(K,E),re={...v,...ne,...G},se=J,oe=/\{\{([^}]+)\}\}/g;return se=se.replace(oe,(ie,fe)=>{let ue=fe.trim();return re[ue]!==void 0?String(re[ue]):ie}),se}catch(K){let G=K instanceof Error?K.message:String(K);return g("Markdown File",`Error including markdown file: ${G}`,k,x,F,L)}})}async function Qy(x,v,k){let E=[],C;while((C=v.exec(x))!==null){let B=C[0],z=C.index,F=C;E.push(k(...F).then((K)=>({match:B,replacement:K,index:z})))}let j=await Promise.all(E);j.sort((B,z)=>z.index-B.index);let L=x;for(let{match:B,replacement:z}of j)L=L.replace(B,()=>z);return L}function ur(x,v){try{let k=x.trim();if(p(k))return l(k,Object.keys(v))(...Object.values(v));else return c(k,v)}catch{return!1}}function dr(x,v){let k=ex(x,v);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function ex(x,v){let k=v;while(k<x.length&&/\s/.test(x[k]))k++;if(x[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=w(x,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:x.slice(k+1,E),endPos:E+1}}function tx(x,v){let k=x.lastIndexOf("<",v);if(k===-1)return!1;return k>x.lastIndexOf(">",v)}function wr(x,v,k,E){let C=1,j=E,L=new RegExp(`@${v}\\s*\\(`,"g"),B=new RegExp(`@${k}(?![a-z])`,"g");while(j<x.length&&C>0){L.lastIndex=j,B.lastIndex=j;let z=L.exec(x),F=B.exec(x),K=z?z.index:1/0,G=F?F.index:1/0;if(K<G)C++,j=K+z[0].length;else if(G<1/0){if(C--,C===0)return G;j=G+F[0].length}else break}return-1}function mf(x,v){let k=x.slice(v).match(/^@if\s*/);if(!k)return null;let E=v+k[0].length,C=dr(x,E);if(!C)return null;let j=C.endPos,L=wr(x,"if","endif",j);if(L===-1)return null;let B=x.slice(j,L),z=[],F=0,K="if",G=C.expression,J=0,ne=0;while(F<B.length){let re=B.indexOf("@",F);if(re===-1)break;F=re;let se=B.substring(re);if(tx(B,re)){F++;continue}if(/^@if\s*\(/.test(se)){ne++,F++;continue}if(/^@endif(?![a-z])/.test(se)){ne--,F+=6;continue}if(ne===0){let oe=se.match(/^@elseif\s*/);if(oe){z.push({type:K,condition:G,content:B.substring(J,F),start:j+J,end:j+F});let ie=F+oe[0].length,fe=dr(B,ie);if(!fe){F++;continue}K="elseif",G=fe.expression,F=fe.endPos,J=F;continue}else if(/^@else(?![a-z])/.test(se)){z.push({type:K,condition:G,content:B.substring(J,F),start:j+J,end:j+F}),K="else",G=void 0,F+=5,J=F;continue}}F++}return z.push({type:K,condition:G,content:B.slice(J),start:j+J,end:j+B.length}),{fullMatch:x.slice(v,L+6),branches:z,start:v,end:L+6}}function Us(x){let v=[],k=/@if\s*\(/g,E=k.exec(x);while(E!==null){if(v.some((L)=>E.index>L.start&&E.index<L.end)){E=k.exec(x);continue}let j=mf(x,E.index);if(j)v.push(j),k.lastIndex=j.end;E=k.exec(x)}return v}function wo(x,v,k){let E=[],C=new RegExp(`@${v}\\s*\\(`,"g"),j=C.exec(x);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=C.exec(x);continue}let B=j.index,z=B+j[0].length-1,F=w(x,"(",")",z);if(F===-1){j=C.exec(x);continue}let K=x.slice(z+1,F),G=F+1,J=wr(x,v,k,G);if(J===-1){j=C.exec(x);continue}let ne=x.slice(G,J),re=J+`@${k}`.length;E.push({fullMatch:x.slice(B,re),name:v,params:K,content:ne,start:B,end:re}),C.lastIndex=re,j=C.exec(x)}return E}function jc(x,v){let k=x.slice(v).match(/^@switch\s*/);if(!k)return null;let E=v+k[0].length,C=dr(x,E);if(!C)return null;let j=C.endPos,L=wr(x,"switch","endswitch",j);if(L===-1)return null;let B=x.slice(j,L),z=[],F=0,K=null,G=0;while(F<B.length){let J=B.slice(F),ne=J.match(/^@switch\s*\(/),re=J.match(/^@endswitch(?![a-z])/);if(ne){if(G++,K)K.content+=ne[0];F+=ne[0].length;continue}if(re){if(G--,K)K.content+=re[0];F+=re[0].length;continue}if(G>0){if(K)K.content+=B[F];F++;continue}let se=J.match(/^@case\s*/),oe=J.match(/^@default(?![a-z])/),ie=J.match(/^@break(?![a-z])/);if(se&&J.startsWith("@case")){if(K)z.push(K);let fe=F+se[0].length,ue=dr(B,fe);if(!ue){F++;continue}K={type:"case",value:ue.expression,content:""},F=ue.endPos}else if(oe&&J.startsWith("@default")){if(K)z.push(K);K={type:"default",content:""},F+=oe[0].length}else if(ie&&J.startsWith("@break"))F+=ie[0].length;else{if(K)K.content+=B[F];F++}}if(K)z.push(K);return{fullMatch:x.slice(v,L+10),expression:C.expression,cases:z,start:v,end:L+10}}function ix(x,v,k){let E=x,C=!0;while(C){C=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let L=j.index,B=jc(E,L);if(!B)break;try{let z;if(p(B.expression))z=l(B.expression,Object.keys(v))(...Object.values(v));else z=c(B.expression,v);let F="",K=!1;for(let G of B.cases)if(G.type==="default"){if(!K)F=G.content.trim()}else try{let J;if(G.value&&p(G.value))J=l(G.value,Object.keys(v))(...Object.values(v));else if(G.value)J=c(G.value,v);if(z===J){F=G.content.trim(),K=!0;break}}catch{continue}E=E.substring(0,L)+F+E.substring(B.end),C=!0}catch(z){let F=z instanceof Error?z.message:String(z),K=o("Switch",`Error evaluating @switch expression: ${F}`,t.EVALUATION_ERROR);E=E.substring(0,L)+K+E.substring(B.end);break}}return E}function ox(x){let v=[];return{masked:x.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(v.push(E),`\x00stx-script-${v.length-1}\x00`)),scripts:v}}function ax(x,v){if(v.length===0)return x;return x.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>v[Number(E)]??k)}function tr(x,v,k){let{masked:E,scripts:C}=ox(x);return ax(cx(E,v,k),C)}function cx(x,v,k){let E=x;E=ix(E,v,k);{let j=!0;while(j){j=!1;let L=E.match(/@unless\s*\(/);if(!L||L.index===void 0)break;let B=L.index,z=dr(E,B+7);if(!z)break;let F=z.endPos,K=wr(E,"unless","endunless",F);if(K===-1){console.warn(`[stx] @unless directive at position ${B} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(F,K),J=z.expression,ne=-1;{let se=0,oe=/@(?:if|unless)\s*\(/g,ie=/@(?:endif|endunless)(?![a-z])/g,fe=/@else(?![a-z])/g,ue=[],be;while((be=oe.exec(G))!==null)ue.push({pos:be.index,type:"open"});while((be=ie.exec(G))!==null)ue.push({pos:be.index,type:"close"});while((be=fe.exec(G))!==null)ue.push({pos:be.index,type:"else"});ue.sort((we,Se)=>we.pos-Se.pos);for(let we of ue)if(we.type==="open")se++;else if(we.type==="close")se--;else if(we.type==="else"&&se===0){ne=we.pos;break}}let re;if(ne!==-1){let se=G.slice(0,ne),oe=G.slice(ne+5);re=`@if (${J})${oe}@else ${se}@endif`}else re=`@if (!(${J}))${G}@endif`;E=E.substring(0,B)+re+E.substring(K+10),j=!0}}E=Bc(E,v,k),E=zc(E,v,k),E=Lc(E,v);let C=()=>{let j=Us(E);if(j.length===0)return!1;let L=Array(j.length);for(let F=j.length-1;F>=0;F--){let K=j[F];try{let G="",J=!1;for(let ne of K.branches){if(J)break;if(ne.type==="else")G=ne.content,J=!0;else try{let re;if(ne.condition&&p(ne.condition))re=l(ne.condition,Object.keys(v))(...Object.values(v));else if(ne.condition)re=c(ne.condition,v);if(re)G=ne.content,J=!0}catch(re){G=o(ne.type==="if"?"If":"Elseif",`Error in @${ne.type}(${ne.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),J=!0}}L[F]=G}catch(G){let J=G instanceof Error?G.message:String(G);L[F]=o("If",`Error processing @if block: ${J}`,t.EVALUATION_ERROR)}}let B=Array(j.length*2+1),z=0;for(let F=0;F<j.length;F++){let K=j[F];B[F*2]=E.slice(z,K.start),B[F*2+1]=L[F],z=K.end}return B[j.length*2]=E.slice(z),E=B.join(""),!0};while(!0){let j=E;if(!C())break;if(E===j)break}return E}function hf(x){let v=0;while(v<x.length&&/\s/.test(x[v]))v++;if(x[v]!=="(")return null;v++;while(v<x.length&&/\s/.test(x[v]))v++;let k=x[v];if(k!=="'"&&k!=='"')return null;v++;let E=[];while(v<x.length){let C=x[v];if(C==="\\"&&v+1<x.length){E.push(x[v+1]),v+=2;continue}if(C===k){v++;break}E.push(C),v++}while(v<x.length&&/\s/.test(x[v]))v++;if(x[v]!==")")return null;return v++,{value:E.join(""),consumed:v}}function Lc(x,v){let k=x;function E(B,z,F,K){let G=1,J=K,ne=new RegExp(`@${z}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${F}(?![a-z])`,"g");while(J<B.length&&G>0){ne.lastIndex=J,re.lastIndex=J;let se=ne.exec(B),oe=re.exec(B),ie=se?se.index:1/0,fe=oe?oe.index:1/0;if(ie<fe)G++,J=ie+se[0].length;else if(fe<1/0){if(G--,G===0)return fe;J=fe+oe[0].length}else break}return-1}function C(B,z,F){let K=0,G=new RegExp(`@${z}(?:\\s*\\(|\\s|$)`,"g"),J=new RegExp(`@${F}(?![a-z])`,"g"),ne=/@else(?![a-z])/g,re=[],se;while((se=G.exec(B))!==null)re.push({pos:se.index,type:"open"});while((se=J.exec(B))!==null)re.push({pos:se.index,type:"close"});while((se=ne.exec(B))!==null)re.push({pos:se.index,type:"else"});re.sort((oe,ie)=>oe.pos-ie.pos);for(let oe of re)if(oe.type==="open")K++;else if(oe.type==="close")K--;else if(oe.type==="else"&&K===0)return oe.pos;return-1}{let B=!0;while(B){B=!1;let z=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!z||z.index===void 0)break;let F=z.index,K,G,J=k.slice(F+5),ne=hf(J);if(ne)K=ne.value,G=F+5+ne.consumed;else G=F+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${F} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),oe=C(se,"auth","endauth"),ie;if(!v.auth)ie=!1;else ie=K?ur(`auth?.check && auth?.user?.[${K}]`,v):ur("auth?.check",v);let fe;if(oe!==-1){let ue=se.slice(0,oe),be=se.slice(oe+5);fe=ie?ue:be}else fe=ie?se:"";k=k.substring(0,F)+fe+k.substring(re+8),B=!0}}{let B=!0;while(B){B=!1;let z=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!z||z.index===void 0)break;let F=z.index,K,G,J=k.slice(F+6),ne=hf(J);if(ne)K=ne.value,G=F+6+ne.consumed;else G=F+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${F} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),oe=C(se,"guest","endguest"),ie;if(!v.auth)ie=!0;else ie=K?ur(`!auth?.check || !auth?.user?.[${K}]`,v):ur("!auth?.check",v);let fe;if(oe!==-1){let ue=se.slice(0,oe),be=se.slice(oe+5);fe=ie?ue:be}else fe=ie?se:"";k=k.substring(0,F)+fe+k.substring(re+9),B=!0}}function j(B,z,F){if(v.userCan&&typeof v.userCan[B]==="boolean")return v.userCan[B];if(v.permissions?.check&&typeof v.permissions.check==="function")try{let K=[B];if(z)K.push(z);if(F){let G=ur(F,v);K.push(G)}return v.permissions.check(...K)}catch{return!1}return!1}function L(B){let z=B.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!z)return null;return{ability:z[1],type:z[2],id:z[3]?.trim(),paramsEnd:z[0].length}}for(let B of["can","cannot"]){let z=`end${B}`,F=B==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let G=k.match(new RegExp(`@${B}\\s*\\(`));if(!G||G.index===void 0)break;let J=G.index,ne=k.slice(J+`@${B}`.length),re=L(ne);if(!re)break;let se=J+`@${B}`.length+re.paramsEnd,oe=E(k,B,z,se);if(oe===-1){console.warn(`[stx] @${B} directive at position ${J} has no matching @${z} \u2014 the block was skipped.`);break}let ie=k.slice(se,oe),fe=[],ue=0,be=new RegExp(`@${B}\\s*\\(`,"g"),we=new RegExp(`@${z}(?![a-z])`,"g"),Se=new RegExp(`@${F}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Ee=[],ke;while((ke=be.exec(ie))!==null)Ee.push({pos:ke.index,type:"open"});while((ke=we.exec(ie))!==null)Ee.push({pos:ke.index,type:"close"});while((ke=Se.exec(ie))!==null)Ee.push({pos:ke.index,type:"elseDirective"});while((ke=$e.exec(ie))!==null)Ee.push({pos:ke.index,type:"else"});Ee.sort((Pe,Ae)=>Pe.pos-Ae.pos);for(let Pe of Ee){if(Pe.type==="open"){ue++;continue}if(Pe.type==="close"){ue--;continue}if(ue===0)fe.push(Pe)}let Re=[],Ce=0;for(let Pe=0;Pe<fe.length;Pe++){let Ae=fe[Pe];if(Re.push({content:ie.slice(Ce,Ae.pos),ability:void 0}),Ae.type==="elseDirective"){let Ze=ie.slice(Ae.pos+`@${F}`.length),tt=L(Ze);if(tt){Re[Re.length-1]={content:ie.slice(Ce,Ae.pos)},Ce=Ae.pos+`@${F}`.length+tt.paramsEnd,Re.push({content:"",ability:tt.ability,type:tt.type,id:tt.id}),Re.pop();let ot=fe[Pe+1],nt=ot?ot.pos:ie.length;Re.push({content:ie.slice(Ce,nt),ability:tt.ability,type:tt.type,id:tt.id}),Ce=nt}}else Ce=Ae.pos+5}if(Ce<ie.length){let Pe=Re[Re.length-1];if(fe.length>0&&fe[fe.length-1].type==="else")Re.push({content:ie.slice(Ce),isFinalElse:!0});else if(Re.length===0)Re.push({content:ie.slice(Ce)})}let _e=j(re.ability,re.type,re.id),Te=B==="can"?_e:!_e,Ke="";if(Te)Ke=Re[0]?.content||"";else{let Pe=!1;for(let Ae=1;Ae<Re.length;Ae++){let Ze=Re[Ae];if(Ze.isFinalElse){Ke=Ze.content,Pe=!0;break}if(Ze.ability){let tt=j(Ze.ability,Ze.type,Ze.id);if(B==="can"?tt:!tt){Ke=Ze.content,Pe=!0;break}}}if(!Pe&&Re.length>0){let Ae=Re[Re.length-1];if(Ae.isFinalElse)Ke=Ae.content}}k=k.substring(0,J)+Ke+k.substring(oe+`@${z}`.length),K=!0}}return k}function Bc(x,v,k){let E=x;function C(j,L,B,z,F){let K=!0;while(K){K=!1;let G=new RegExp(`@${L}\\s*\\(`),J=j.match(G);if(!J||J.index===void 0)break;let ne=J.index,re=dr(j,ne+`@${L}`.length);if(!re)break;let se=re.endPos,oe=wr(j,L,B,se);if(oe===-1){console.warn(`[stx] @${L} directive at position ${ne} has no matching @${B} \u2014 the block was skipped.`);break}let ie=j.slice(se,oe),fe=re.expression,ue=-1,be=0,we=0;while(we<ie.length){let Se=ie.indexOf("@",we);if(Se===-1)break;let $e=ie.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){be++,we=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){be--,we=Se+1;continue}if(be===0&&/^@else(?![a-z])/.test($e)){ue=Se;break}we=Se+1}try{let Se=z(fe.trim()),$e;if(ue!==-1){let Ee=ie.slice(0,ue),ke=ie.slice(ue+5);$e=Se?Ee:ke}else $e=Se?ie:"";j=j.substring(0,ne)+$e+j.substring(oe+`@${B}`.length),K=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Ee=o(F,`Error processing @${L} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,ne)+Ee+j.substring(oe+`@${B}`.length);break}}return j}return E=C(E,"isset","endisset",(j)=>{let L=ur(j,v);return L!==void 0&&L!==null},"Isset"),E=C(E,"empty","endempty",(j)=>{let L=ur(j,v);return L===void 0||L===null||L===""||L===0||L===!1||Array.isArray(L)&&L.length===0||typeof L==="object"&&L!==null&&Object.keys(L).length===0},"Empty"),E}function zc(x,v,k){let E=x,C="development";function j(L,B,z,F){let K=new RegExp(`@${B}(?![a-z])`,"g"),G=new RegExp(`@${z}(?![a-z])`,"g"),J=new RegExp(`^@${B}(?![a-z])`),ne=new RegExp(`^@${z}(?![a-z])`),re=L,se=!0;while(se){se=!1,K.lastIndex=0;let oe=K.exec(re);if(!oe)break;let ie=oe.index,fe=ie+oe[0].length;if(B==="env"){let _e=re.substring(fe).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;fe+=_e[0].length,F=C===_e[2]}let ue=1,be=fe,we=-1;while(ue>0&&be<re.length){K.lastIndex=be,G.lastIndex=be;let _e=K.exec(re),Te=G.exec(re),Ke=_e?_e.index:1/0,Pe=Te?Te.index:1/0;if(Ke<Pe)ue++,be=Ke+_e[0].length;else if(Pe<1/0){if(ue--,ue===0){we=Pe;break}be=Pe+Te[0].length}else break}if(we===-1){console.warn(`[stx] @${B} directive at position ${ie} has no matching @${z} \u2014 the block was skipped.`);break}let Se=re.substring(fe,we),$e=-1,Ee=0,ke=0;while(ke<Se.length){let _e=Se.indexOf("@",ke);if(_e===-1)break;let Te=Se.substring(_e);if(J.test(Te)){Ee++,ke=_e+1;continue}if(ne.test(Te)){Ee--,ke=_e+1;continue}if(Ee===0&&/^@else(?![a-z])/.test(Te)){$e=_e;break}ke=_e+1}let Re;if($e!==-1){let _e=Se.slice(0,$e),Te=Se.slice($e+5);Re=F?_e:Te}else Re=F?Se:"";let Ce=`@${z}`.length;re=re.substring(0,ie)+Re+re.substring(we+Ce),se=!0}return re}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",C==="production"),E=j(E,"development","enddevelopment",C==="development"),E=j(E,"staging","endstaging",C==="staging"),E=j(E,"testing","endtesting",C==="testing"),E}var yf=new WeakMap;function xf(x=16){let v=new Uint8Array(x);return crypto.getRandomValues(v),btoa(String.fromCharCode(...v))}function So(x,v){if(!x)return v?.nonceGenerator?.()??xf();let k=yf.get(x);if(!k)k=v?.nonceGenerator?.()??xf(),yf.set(x,k);return k}function lx(x,v){let k=[];for(let[E,C]of Object.entries(x)){if(C===void 0||C===null)continue;if(typeof C==="boolean"){if(C)k.push(E);continue}if(Array.isArray(C)){let j=[...C];if(v&&(E==="script-src"||E==="style-src"))j=j.filter((L)=>!L.startsWith("'nonce-")),j.push(`'nonce-${v}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function bf(x,v){return`<meta http-equiv="Content-Security-Policy" content="${lx(x,v).replace(/&/g,"&").replace(/"/g,""")}">`}function vf(x,v,k){if(!v.enabled||!v.addMetaTag)return x;if(x.includes('http-equiv="Content-Security-Policy"'))return x;if(!x.includes("<head>")&&!x.includes("<head "))return x;let E=v.useNonce?So(k,v):void 0,C=bf(v.directives,E);return x.replace(/<head([^>]*)>/,`<head$1>
|
|
2292
|
-
${C}`)}function wf(x,v){let k=x;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(E,C)=>{if(C.includes("nonce="))return E;return`<script nonce="${v}"${C}>`}),k=k.replace(/<style([^>]*)>/gi,(E,C)=>{if(C.includes("nonce="))return E;return`<style nonce="${v}"${C}>`}),k}function Sf(x,v,k,E){let C=x,j=E.csp;if(C=C.replace(/@csp\b/g,()=>{if(!j?.enabled||!j.directives)return"<!-- CSP not configured -->";let L=j.useNonce?So(v,j):void 0;return bf(j.directives,L)}),C=C.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return So(v,j)}),j?.enabled&&j.useNonce)v.cspNonce=So(v,j);return C}import ux from"crypto";var dx=40,$f="_token",Fc=null;function fx(x=dx){let v=ux.randomBytes(Math.ceil(x/2)).toString("hex").slice(0,x);return Fc=v,v}function px(){if(!Fc)fx();return Fc}function gx(x=$f){let v=px();return`<input type="hidden" name="${x}" value="${v}">`}function _f(x){return x.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(v,k,E)=>gx(E||$f))}async function kf(x,v,k,E){if(!E.customDirectives||E.customDirectives.length===0)return x;let C=x;for(let j of E.customDirectives){if(!j.name||typeof j.handler!=="function"){if(E.debug)console.warn("Invalid custom directive:",j);continue}if(j.hasEndTag)C=await mx(C,j,v,k,E);else C=await hx(C,j,v,k,E)}return C}async function mx(x,v,k,E,C){let{name:j,handler:L}=v,B=`@${j}`,z=`@end${j}`,F=x,K=mr(`${B}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${z}`,"g"),G=[],J=K.exec(F);while(J!==null){let[ne,re="",se=""]=J,oe=J.index||0;try{let ie=re?Ef(v,re):[],fe=se.trim(),ue=await L(fe,ie,k,E);G.push({original:ne,processed:ue,startIndex:oe})}catch(ie){let fe=ie instanceof Error?ie.message:String(ie);if(C.debug)console.error(`Error processing custom directive @${j}:`,ie);G.push({original:ne,processed:o("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${fe}`,t.EVALUATION_ERROR),startIndex:oe})}J=K.exec(F)}for(let ne=G.length-1;ne>=0;ne--){let{original:re,processed:se}=G[ne];F=F.replace(re,se)}return F}async function hx(x,v,k,E,C){let{name:j,handler:L}=v,B=x,z=[],F=[];if(v.rawParams){for(let J of vs(B,mr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(J.end!==-1)F.push({fullMatch:J.call,paramString:J.args,startIndex:J.start})}else{let J=mr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");J.lastIndex=0;let ne=J.exec(B);while(ne!==null)F.push({fullMatch:ne[0],paramString:ne[1]??"",startIndex:ne.index||0}),ne=J.exec(B)}for(let{fullMatch:J,paramString:ne,startIndex:re}of F)try{let se=Ef(v,ne),oe=await L("",se,k,E);z.push({original:J,processed:oe,startIndex:re})}catch(se){let oe=se instanceof Error?se.message:String(se);if(C.debug)console.error(`Error processing custom directive @${j}:`,se);z.push({original:J,processed:o("CustomDirective",`Error in @${j}(${ne}): ${oe}`,t.EVALUATION_ERROR),startIndex:re})}let K=mr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=K.exec(B);while(G!==null){let[J]=G,ne=G.index||0;try{let re=await L("",[],k,E);z.push({original:J,processed:re,startIndex:ne})}catch(re){let se=re instanceof Error?re.message:String(re);if(C.debug)console.error(`Error processing custom directive @${j}:`,re);z.push({original:J,processed:o("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:ne})}G=K.exec(B)}for(let J=z.length-1;J>=0;J--){let{original:ne,processed:re}=z[J];B=B.replace(ne,re)}return B}function Ef(x,v){return x.rawParams?Xe(v):yx(v)}function yx(x){if(!x.trim())return[];let v=[],k="",E=!1,C="";for(let j=0;j<x.length;j++){let L=x[j];if((L==='"'||L==="'")&&(j===0||x[j-1]!=="\\"))if(!E)E=!0,C=L;else if(L===C)E=!1;else k+=L;else if(L===","&&!E)v.push(k.trim()),k="";else k+=L}if(k.trim())v.push(k.trim());return v.map((j)=>{let L=j.trim();if(L.startsWith('"')&&L.endsWith('"')||L.startsWith("'")&&L.endsWith("'"))return L.substring(1,L.length-1);return L})}var Cf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Rf=/^[A-Za-z_$][\w$]*$/,xx=new Set(["light","dark","system"]);function Sr(x,v){if(typeof x!=="string"||x.length===0)throw Error(`@appearanceBootstrap ${v} must be a non-empty string`)}function bx(x){if(!x||typeof x!=="object"||Array.isArray(x))throw Error("@appearanceBootstrap expects an options object");let v=x,{appearance:k,colorMode:E}=v;if(Sr(v.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!E||typeof E!=="object"||Array.isArray(E))throw Error("@appearanceBootstrap colorMode must be an object");if(Sr(E.key,"colorMode.key"),Sr(E.attribute,"colorMode.attribute"),Sr(E.default,"colorMode.default"),!Rf.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Cf.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!xx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let C=null;if(k){if(Sr(k.key,"appearance.key"),Sr(k.attribute,"appearance.attribute"),Sr(k.default,"appearance.default"),!Rf.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Cf.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((j)=>typeof j!=="string"||j.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");C={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:v.storageKey,appearance:C,colorMode:{key:E.key,attribute:E.attribute,default:E.default},respectExisting:v.respectExisting===!0}}function vx(x){return JSON.stringify(x).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function wx(x){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${vx(x)};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 Sx(x,v){let k=1,E=null,C=!1;for(let j=v+1;j<x.length;j++){let L=x[j];if(C){C=!1;continue}if(E){if(L==="\\")C=!0;else if(L===E)E=null;continue}if(L==='"'||L==="'"||L==="`"){E=L;continue}if(L==="(")k++;else if(L===")"&&--k===0)return j}return-1}function Tf(x,v){let k=x,E=/@appearanceBootstrap\s*\(/g,C;while((C=E.exec(k))!==null){let j=C.index+C[0].length-1,L=Sx(k,j);if(L===-1)throw Error("@appearanceBootstrap has an unclosed options object");let B=k.slice(j+1,L).trim(),z=c(`(${B})`,v),F=wx(bx(z));k=k.slice(0,C.index)+F+k.slice(L+1),E.lastIndex=C.index+F.length}return k}import $x from"crypto";function zt(x){return String(x??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var If={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function $o(x,v,k,E){let C=x||v;return k?`${C} ${E}`:C}function bn(x){return String(x).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function jr(x,v){if(/\bid\s*=/i.test(x))return"";return` id="${zt(v)}"`}function Wc(x,v,k){if(!v)return"";let E="";if(!/\baria-invalid\s*=/i.test(k))E+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))E+=` aria-describedby="${zt(`${bn(x)}-error`)}"`;return E}function _x(){return $x.randomUUID()}function _o(x,v){let k=x;return k=k.replace(/@csrf/g,()=>{if(!v.csrf||typeof v.csrf!=="object"){let E=_x();v.csrf={token:E}}if(v.csrf.field)return v.csrf.field;if(v.csrf.token)return`<input type="hidden" name="_token" value="${zt(v.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(E,C)=>{let j=C.toUpperCase();if(C&&!["GET","POST"].includes(j))return`<input type="hidden" name="_method" value="${zt(j)}">`;return E}),k}function Pf(x,v,k=If){let E=x;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(C,j,L,B,z,F="")=>{let K=j||L||"POST",G=B||z||"",J=fr(F),ne=K.toUpperCase(),re=["GET","POST"].includes(ne)?ne:"POST",se=`<form method="${zt(re)}" action="${zt(G)}"${J?` ${J}`:""}>`;if(se+=`
|
|
2293
|
-
${
|
|
2294
|
-
${_o(`@method('${ne}')`,v)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(C,j,L,B,z,F="")=>{let K=j||L||"",G=B||z||"",J=fr(F),ne=Hs(K,v),re=ne!==void 0&&ne!==null?ne:G||"",se=J.match(/type=['"]([^'"]+)['"]/i),oe=se?se[1]:"text",ie=qs(K,v),fe=J.match(/class=['"]([^'"]+)['"]/i),ue=$o(fe?fe[1]:"",k.input,ie,k.inputError),be=J.replace(/class=['"][^'"]+['"]/i,"");return be=be.replace(/type=['"][^'"]+['"]/i,""),`<input type="${zt(oe)}" name="${zt(K)}"${jr(J,bn(K))} value="${zt(re)}" class="${ue}"${Wc(K,ie,J)}${be?` ${be}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(C,j,L="",B="")=>{let z=fr(L),F=Hs(j,v)||B.trim(),K=qs(j,v),G=z.match(/class=['"]([^'"]+)['"]/i),J=$o(G?G[1]:"",k.input,K,k.inputError),ne=z.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${zt(j)}"${jr(z,bn(j))} class="${J}"${Wc(j,K,z)}${ne?` ${ne}`:""}>${zt(F)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(C,j,L="",B)=>{let z=fr(L),F=Hs(j,v),K=qs(j,v),G=z.match(/class=['"]([^'"]+)['"]/i),J=$o(G?G[1]:"",k.input,K,k.inputError),ne=z.replace(/class=['"][^'"]+['"]/i,""),re=B;if(F!==void 0)re=B.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,oe,ie)=>{if((Array.isArray(F)?F.some((ue)=>String(ue)===ie):String(F)===ie)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return se});return`<select name="${zt(j)}"${jr(z,bn(j))} class="${J}"${Wc(j,K,z)}${ne?` ${ne}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(C,j,L,B="")=>{let z=L===void 0?"1":L,F=L===void 0?bn(j):`${bn(j)}-${bn(z)}`,K=fr(B),G=Hs(j,v),J=G!==void 0&&(Array.isArray(G)?G.some((oe)=>String(oe)===z):G===!0||String(G)===z),ne=K.match(/class=['"]([^'"]+)['"]/i),re=ne?ne[1]:k.checkInput,se=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${zt(j)}"${jr(K,F)} value="${zt(z)}" class="${re}"${J?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(C,j,L,B="")=>{let z=fr(B),F=Hs(j,v),K=F!==void 0&&F===L,G=z.match(/class=['"]([^'"]+)['"]/i),J=G?G[1]:k.checkInput,ne=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${zt(j)}"${jr(z,`${bn(j)}-${bn(L)}`)} value="${zt(L)}" class="${J}"${K?" checked":""}${ne?` ${ne}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(C,j,L="")=>{let B=fr(L),z=B.match(/accept=['"]([^'"]+)['"]/i),F=z?z[1]:"",K=B.includes("multiple"),G=qs(j,v),J=B.match(/class=['"]([^'"]+)['"]/i),ne=$o(J?J[1]:"",k.input,G,k.inputError),re=B.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${zt(j)}"${jr(B,bn(j))}`,`class="${ne}"`];if(F)se.push(`accept="${zt(F)}"`);if(K)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(C,j,L="",B)=>{let z=fr(L),F=z.match(/class=['"]([^'"]+)['"]/i),K=F?F[1]:k.label,G=z.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${zt(bn(j))}" class="${K}"${G?` ${G}`:""}>${B}</label>`}),E}function Df(x,v,k=If){return x.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,C,j)=>{try{if(qs(C,v)){let L=j.replace(/\{\{([^}]+)\}\}/g,(B,z)=>{try{if(z.trim()==="$message"||z.trim()==="message")return Af(C,v);if(z.trim().includes("errors.first")||z.trim().includes("$errors.first")){if(typeof v.errors?.first==="function")return v.errors.first(C);return Af(C,v)}let F=z.trim();if(p(F)){let K=c(F,v);return K!==void 0?String(K):F}return F}catch{return z}});return`<div id="${zt(`${bn(C)}-error`)}" role="alert">${L}</div>`}return""}catch(L){return console.error("Error processing @error directive:",L),E}})}function qs(x,v){if(!v.errors)return!1;if(typeof v.errors.has==="function")return v.errors.has(x);if(typeof v.errors==="object")return Object.prototype.hasOwnProperty.call(v.errors,x);return!1}function Af(x,v){if(!v.errors)return"";if(typeof v.errors.get==="function")return v.errors.get(x);if(typeof v.errors==="object"&&Object.prototype.hasOwnProperty.call(v.errors,x)){let k=v.errors[x];return Array.isArray(k)?k[0]:String(k)}return""}function Hs(x,v){let k;if(v.old&&typeof v.old==="function")return v.old(x);if(v.old&&typeof v.old==="object")return v.old[x];if(x.endsWith("[]")){let E=x.slice(0,-2);if(k=v[E],k!==void 0)return k}return v[x]}function fr(x){if(!x.trim())return"";let v=[],k=x.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,C;while((C=E.exec(k))!==null){let[,j,,L]=C;v.push(`${j}="${L.trim()}"`)}return v.join(" ")}var Ks=/<\/?template\b[^>]*>/gi,kx=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Ex(x){let v=x.replace(/^<template\b/i,"").replace(/>$/,"");return kx.test(v)}function Z(x){Ks.lastIndex=0;let v;while((v=Ks.exec(x))!==null){if(v[0].startsWith("</")||Ex(v[0]))continue;let k=v.index,E=Ks.lastIndex,C=1,j;while((j=Ks.exec(x))!==null)if(j[0].startsWith("</")){if(C--,C===0){let L=j.index;return{start:k,openEnd:E,closeStart:L,end:Ks.lastIndex,content:x.slice(E,L)}}}else C++;return null}return null}import Mt from"path";import{existsSync as $b}from"fs";import ko from"fs";import jt from"path";var Mf=new Map;function Eo(x,v=!0){let k=Mf.get(x);if(v&&k)return k;let E=new Map,C=[jt.join(x,"src"),jt.join(x,"dist"),x];function j(L,B){if(B>6)return;let z;try{z=ko.readdirSync(L,{withFileTypes:!0})}catch{return}for(let F of z){let K=jt.join(L,F.name);if(F.isDirectory()){if(F.name==="node_modules"||F.name.startsWith("."))continue;j(K,B+1)}else if(F.isFile()&&F.name.endsWith(".stx")){let G=F.name.slice(0,-4);if(!E.has(G))E.set(G,K);let J=G.toLowerCase();if(!E.has(J))E.set(J,K);let ne=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(ne))E.set(ne,K)}}}for(let L of C)if(j(L,0),E.size>0)break;if(v)Mf.set(x,E);return E}function Co(x,v){if(x.startsWith(".")||x.startsWith("/"))return null;let k=v;while(!0){let E=jt.join(k,"node_modules",x);try{if(ko.statSync(E).isDirectory())return E}catch{}let C=jt.dirname(k);if(C===k)return null;k=C}}function Ro(x,v,k={}){return[jt.resolve(jt.dirname(v),`${x}.stx`),jt.resolve(jt.dirname(v),x),jt.resolve(k.componentsDir||"components",`${x}.stx`),jt.resolve(k.componentsDir||"components",x),x.endsWith(".stx")?x:`${x}.stx`]}function Of(x){let v=x.endsWith(".stx")?x.slice(0,-4):x,k=v.split("-").map((C)=>C.charAt(0).toUpperCase()+C.slice(1)).join(""),E=v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[v,k,E]}function Vc(x,v){let[k,E,C]=Of(x);for(let j of[k,k.toLowerCase(),E,C]){let L=v?.__importedComponents?.get(j);if(L!==void 0)return L}}function*Uc(x,v,k={},E){let C=Of(x);if(C[0].startsWith("./")||C[0].startsWith("../")){yield jt.resolve(jt.dirname(v),`${C[0]}.stx`);return}let j=[...new Set(C.map((z)=>`${z}.stx`))],L=k.projectRoot||process.cwd(),B=[...E?.__originalFilePath?[jt.join(jt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],jt.join(jt.dirname(v),"components"),jt.resolve(L,"src/components"),jt.resolve(L,"components"),...import.meta.dir?[jt.resolve(import.meta.dir,"components")]:[]];for(let z of new Set(B)){for(let F of j)yield jt.join(z,F);try{for(let F of ko.readdirSync(z,{withFileTypes:!0}))if(F.isDirectory())for(let K of j)yield jt.join(z,F.name,K)}catch{}}}function Nf(x,v,k={},E){let C=Vc(x,E);if(C!==void 0)return C;for(let j of Uc(x,v,k,E))try{if(ko.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class jf{builtins=new Map;registerBuiltin(x){this.builtins.set(x.name.toLowerCase(),x);for(let v of x.aliases)this.builtins.set(v.toLowerCase(),x)}isBuiltin(x){return this.builtins.has(x.toLowerCase())}getBuiltin(x){return this.builtins.get(x.toLowerCase())??null}async resolveFile(x,v,k,E){let C=Vc(x,E);if(C!==void 0)return C;for(let j of Uc(x,v,k,E))if(await n(j))return j;return null}}var Lr=new jf;function Wt(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var $r="\x00stx-boolean-attribute";function Hc(x){return x.indexOf("\x00")===-1?x:x.replace(/\0/g,"")}function us(x,v){let k=[];for(let[E,C]of Object.entries(x.static)){if(v.has(E))continue;let j=x.staticNames?.[E]??E;if(typeof C==="boolean"){if(C)k.push(Wt(j));continue}if(C===$r){k.push(Wt(j));continue}k.push(`${Wt(j)}="${Wt(Hc(String(C)))}"`)}return k}function ps(x,v){let k=[];for(let[E,C]of Object.entries(x.serverDynamic??{})){if(v.has(E))continue;if(C===null||C===void 0||C===!1)continue;let j=x.serverDynamicNames?.[E]??E;if(C===!0){k.push(Wt(j));continue}if(typeof C==="object")continue;k.push(`${Wt(j)}="${Wt(Hc(String(C)))}"`)}return k}function $s(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cx(x){if(x.clientReactive.to)return{value:x.clientReactive.to,reactive:!0};if(x.serverDynamic.to!==void 0)return{value:String(x.serverDynamic.to),reactive:!1};if(typeof x.static.to==="string")return{value:x.static.to,reactive:!1};return{value:"#",reactive:!1}}var qc={name:"StxLink",aliases:["stx-link"],render(x,v,k){let E=Cx(x),C=(typeof x.static.class==="string"?x.static.class:"")||(typeof x.static.className==="string"?x.static.className:""),j=typeof x.static.activeClass==="string"?x.static.activeClass:"active",L=typeof x.static.exactActiveClass==="string"?x.static.exactActiveClass:"exact-active",B=x.static.prefetch===!0||x.static.prefetch==="true"||x.serverDynamic.prefetch===!0,z=[];if(E.reactive)z.push(`:href="${$s(E.value)}"`);else z.push(`href="${$s(Ms(E.value,"navigable"))}"`);if(C)z.push(`class="${$s(C)}"`);if(z.push("data-stx-link"),z.push(`data-stx-active-class="${$s(j)}"`),z.push(`data-stx-exact-active-class="${$s(L)}"`),B)z.push("data-stx-prefetch");let F=typeof x.static.activeMatch==="string"?x.static.activeMatch.trim():"";if(F)z.push(`data-stx-active-match="${$s(F)}"`);let K=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return z.push(...us(x,K)),z.push(...ps(x,K)),`<a ${z.join(" ")}>${v}</a>`}};import{createHash as Zf}from"crypto";import dn from"fs";import Ut from"path";import{decode as Ox,generateThumbHash as Nx}from"ts-images";import{createImageDeliveryCatalog as Vf}from"ts-images/delivery";import Kc from"fs";function To(x,v,k){let E=Buffer.alloc(k),C=Kc.readSync(x,E,0,k,v);return E.subarray(0,C)}function Xc(x){if(x.length<25)return!1;let v=(E,C)=>String.fromCharCode(...x.subarray(E,C));if(v(0,4)!=="RIFF"||v(8,12)!=="WEBP")return!1;let k=v(12,16);if(k==="VP8X")return(x[20]&16)!==0;if(k==="VP8L")return((x[21]|x[22]<<8|x[23]<<16|x[24]<<24)>>>28&1)===1;return!1}function Zc(x){let v;try{v=Kc.openSync(x,"r");let k=To(v,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 E=k[25];if(E===4||E===6)return"possible";let C=8;for(let j=0;j<64;j++){let L=To(v,C,8);if(L.length<8)return"unknown";let B=L.toString("latin1",4,8);if(B==="tRNS")return"possible";if(B==="IDAT"||B==="IEND")return"none";C+=12+L.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Xc(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(v!==void 0)Kc.closeSync(v)}}import Rx from"fs";import Ao from"os";import{join as Lf}from"path";import{fileURLToPath as Bf}from"url";import{Worker as zf}from"worker_threads";var Po=Symbol("stx.image-worker.unavailable");function Tx(x=typeof Ao.availableParallelism==="function"?Ao.availableParallelism():Ao.cpus().length){return Math.max(1,Math.min(2,x-1))}var Io=0,Wf=[];async function Ax(){if(Io<Tx()){Io++;return}await new Promise((x)=>Wf.push(x)),Io++}function Ix(){Io--,Wf.shift()?.()}var Px="@stacksjs/stx/builtins/image-warmup-worker";function Dx(x=process.cwd()){let v=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${v}`,import.meta.url);if(k.protocol==="file:"&&Rx.existsSync(Bf(k)))return Bf(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Px,x):void 0;return k&&Mx(k)?k:void 0}catch{return}}function Mx(x,v=process.env){let k=x.replace(/\\/g,"/");if(k.split("/").some((C)=>/@\d[^/]*@@@\d+$/.test(C)))return!1;return![v.BUN_INSTALL_CACHE_DIR,Lf(v.BUN_INSTALL||Lf(Ao.homedir(),".bun"),"install","cache")].filter((C)=>!!C).map((C)=>`${C.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((C)=>k.startsWith(C))}var Ff=!1;function Xs(x){if(!Ff)Ff=!0,console.warn(`[stx] image worker unavailable (${x}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Po}function Gc(x){return x instanceof Error?x.message:String(x)}async function Jc(x,v){if(typeof zf!=="function")return Xs("node:worker_threads has no Worker in this runtime");let k=Dx();if(!k)return Xs("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Ax();try{return await new Promise((E,C)=>{let j;try{j=new zf(k)}catch(F){E(Xs(`could not start ${k}: ${Gc(F)}`));return}let L=!1,B=!1,z=(F)=>{if(B)return;B=!0,F(),j.terminate()};j.on("message",(F)=>{if(F.type==="ready"){L=!0,j.postMessage({task:x,args:v});return}if(F.type==="result"){z(()=>E(F.value));return}let K=Error(F.error?.message??"image worker failed");if(F.error?.name)K.name=F.error.name;if(F.error?.stack)K.stack=F.error.stack;z(()=>C(K))}),j.on("error",(F)=>{z(()=>L?C(F instanceof Error?F:Error(Gc(F)||"image worker crashed")):E(Xs(`the worker failed before it was ready: ${Gc(F)}`)))}),j.on("exit",(F)=>{z(()=>L?C(Error("image worker exited before it finished")):E(Xs(`the worker exited with code ${F} before it was ready`)))})})}finally{Ix()}}var jx=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Lx=[320,640,960,1280,1920],Mo="/_stx/images",Bx=`stx:${Mo}:alpha-1`,zx=["@stacksjs/ts-webp","@stacksjs/ts-avif"],Do;function Fx(x,v){let k=Ut.dirname(Bun.resolveSync(x,v));while(k!==Ut.dirname(k)){let E=Ut.join(k,"package.json");if(dn.existsSync(E)){let C=JSON.parse(dn.readFileSync(E,"utf8"));if(C.name===x)return C.version}k=Ut.dirname(k)}return}function Wx(){if(Do!==void 0)return Do;let x;try{x=Ut.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Do=zx.map((v)=>{let k;try{k=x?Fx(v,x):void 0}catch{}return`${v.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Do}var Uf=Symbol.for("stx.image-delivery");function Zs(){let x=globalThis;return x[Uf]??={catalog:new Map,transparent:new Set},x[Uf]}var Hf=new Set;function Vx(x){return`/${x.split(Ut.sep).map(encodeURIComponent).join("/")}`}function Ux(x){let v=Ut.extname(x),k=x.slice(0,-v.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=Zf("sha256").update(x).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function qf(x,v=`stx:${Mo}`){let k=(E)=>`${Mo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:v,async stat(E){let C=Ut.join(x,E);try{let j=await dn.promises.stat(C);return j.size>0?{bytes:j.size,path:C,url:k(E)}:null}catch{return null}},async write(E,C){let j=Ut.join(x,E);await dn.promises.mkdir(Ut.dirname(j),{recursive:!0});let L=`${j}.${process.pid}.tmp`;return await dn.promises.writeFile(L,C),await dn.promises.rename(L,j),{bytes:C.byteLength,path:j,url:k(E)}},url:k}}async function Gf(x,v=x){let k=await dn.promises.readdir(v,{withFileTypes:!0});k.sort((C,j)=>C.name.localeCompare(j.name));let E=[];for(let C of k){let j=Ut.join(v,C.name);if(C.isDirectory()){E.push(...await Gf(x,j));continue}if(!C.isFile()||!jx.has(Ut.extname(C.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ut.relative(x,j)})}return E}function Kf(x,v){return x.map((k)=>({key:Vx(k.relativePath),input:k.absolutePath,name:Ux(k.relativePath),...Hx(k.absolutePath)?{options:{storage:v}}:{}}))}function Hx(x){return Zc(x)==="possible"}function qx(x){for(let v=3;v<x.length;v+=4)if(x[v]!==255)return!0;return!1}async function Kx(x){let v=Object.entries(x).filter(([,C])=>C.fallback.format==="png"),k=new Set,E=8;for(let C=0;C<v.length;C+=8)await Promise.all(v.slice(C,C+8).map(async([j,L])=>{let B=L.variants.filter((z)=>z.format==="png").sort((z,F)=>z.width-F.width)[0];try{let z=await Ox(new Uint8Array(await dn.promises.readFile(B?.path??L.fallback.path)));if(qx(z.data))k.add(j)}catch{k.add(j)}}));return k}function Xx(x,v){let k=[];for(let E of v){let C=x[E],j=C?.variants.filter((B)=>B.format==="webp")??[];if(!C||j.length===0)continue;if(!j.some((B)=>{let z;try{return z=dn.openSync(B.path,"r"),!Xc(To(z,0,32))}catch{return!0}finally{if(z!==void 0)dn.closeSync(z)}}))continue;if(C.variants=C.variants.filter((B)=>B.format!=="webp"),delete C.sources.webp,k.push(E),!Hf.has(E))Hf.add(E),console.warn(`[stx-images] ${E} 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 Zx(x){let v=[],k=8;for(let E=0;E<x.length;E+=8){let C=x.slice(E,E+8),j=await Promise.all(C.map(async(L)=>{try{return await Nx(L.absolutePath),L}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${L.relativePath}`),null}}));v.push(...j.filter((L)=>L!==null))}return v}function Yc(x){return Ut.join(x,"undecodable.json")}function Gx(x){try{let v=dn.readFileSync(Yc(x),"utf-8"),k=JSON.parse(v);return k&&typeof k==="object"?k:{}}catch{return{}}}function Jx(x,v){try{dn.mkdirSync(Ut.dirname(Yc(x)),{recursive:!0}),dn.writeFileSync(Yc(x),JSON.stringify(v))}catch{}}function Xf(x){try{let v=dn.statSync(x);return{mtimeMs:v.mtimeMs,size:v.size}}catch{return}}function Jf(x){if(!x||x.startsWith("data:")||x.startsWith("blob:")||/^https?:\/\//i.test(x)||x.startsWith("//"))return;let v=x.split(/[?#]/,1)[0];if(!v)return;try{return`/${v.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Ur(x){let v=Jf(x);return v?Zs().catalog.get(v):void 0}function Wr(x){let v=Jf(x);return v?Zs().transparent.has(v):!1}function qr(x){let v=(E)=>x.variants.filter((C)=>C.format===E).reduce((C,j)=>C+j.bytes,0),k=v(x.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:x.sources[E]||"",bytes:v(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,C)=>E.bytes-C.bytes).map(({format:E,srcset:C})=>({format:E,srcset:C}))}function Eu(x){let v=Ur(x);if(!v)return;return{src:v.fallback.url,srcset:v.sources[v.fallback.format]||"",sources:qr(v).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:v.source.width,height:v.source.height,placeholder:Wr(x)?void 0:v.placeholder?.dataUrl}}function On(){let x=Zs();x.catalog=new Map,x.transparent=new Set}function Yx(x){let v=Zs();v.catalog=new Map(x.entries),v.transparent=new Set(x.transparent)}async function Tu(x,v,k={}){if(!x||!dn.existsSync(x))return On(),{count:0,fingerprint:""};if(k.offThread){let re=await Jc("delivery",{publicDir:x,outputDir:v});if(re!==Po)return Yx(re.state),re.result}let E=await Gf(x);if(E.length===0)return On(),{count:0,fingerprint:""};let C=Gx(v),j=E.filter((re)=>{let se=C[re.relativePath];if(!se)return!0;let oe=Xf(re.absolutePath);return!oe||oe.mtimeMs!==se.mtimeMs||oe.size!==se.size});if(j.length===0)return On(),{count:0,fingerprint:""};let L=qf(Ut.join(v,"_stx","images"),`${Bx}:${Wx()}`),B={outDir:Ut.join(v,"_stx","images"),storage:qf(Ut.join(v,"_stx","images")),baseUrl:Mo,widths:Lx,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},z=j,F;try{F=await Vf({...B,entries:Kf(j,L)})}catch(re){if(z=await Zx(j),z.length===j.length)throw re;let se=new Set(z.map((ie)=>ie.relativePath)),oe=!1;for(let ie of j){if(se.has(ie.relativePath))continue;let fe=Xf(ie.absolutePath);if(!fe)continue;C[ie.relativePath]=fe,oe=!0}if(oe)Jx(v,C);if(z.length===0)return On(),{count:0,fingerprint:""};F=await Vf({...B,entries:Kf(z,L)})}let K=await Kx(F.entries),G=Xx(F.entries,K),J=Zs();J.catalog=new Map(Object.entries(F.entries)),J.transparent=K;let ne=K.size===0&&G.length===0?F.fingerprint:Zf("sha256").update(F.fingerprint).update(JSON.stringify({transparent:[...K].sort(),droppedWebp:G.sort()})).digest("hex");return{count:z.length,fingerprint:ne}}var Qx=new Map;function Qc(x){if(!x)return;let v=x.split("?")[0].split("#")[0];return Qx.get(v)}var eb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},el=[320,640,768,1024,1280,1536,1920];function Lt(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Kt(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}function Oo(x,v,k=!1){let E=x.serverDynamic[v];if(E!==void 0)return E!==!1&&E!=="false";let C=x.static[v];if(C!==void 0)return C!=="false"&&C!==!1;return k}function tl(x){if(x.includes("(")||x.includes(","))return x;let v=x.trim().split(/\s+/),k=[];for(let E of v)if(E.includes(":")){let[C,j]=E.split(":"),L=eb[C];if(L)k.push(`(max-width: ${L}px) ${j}`);else{let B=Number.parseInt(C);if(!Number.isNaN(B))k.push(`(max-width: ${B}px) ${j}`)}}else k.push(E);return k.join(", ")}function nl(x,v,k,E){return v.map((C)=>`${Gs(x,C,void 0,k,E)} ${C}w`).join(", ")}function tb(x,v,k,E,C){return v.map((j)=>{let L=k?k*j:void 0;return`${Gs(x,L,void 0,E,C)} ${j}x`}).join(", ")}function Gs(x,v,k,E,C){if(!E||E==="local"||E==="static")return x;if(E==="cloudinary"){let j=[];if(v)j.push(`w_${v}`);if(k)j.push(`h_${k}`);if(C)j.push(`f_${C}`);j.push("q_auto");let L=j.join(",");return x.replace("/upload/",`/upload/${L}/`)}if(E==="imgix"){let j=new URLSearchParams;if(v)j.set("w",String(v));if(k)j.set("h",String(k));if(C)j.set("fm",C);j.set("auto","format");let L=x.includes("?")?"&":"?";return`${x}${L}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(v)j.set("width",String(v));if(k)j.set("height",String(k));if(C)j.set("format",C);let L=x.includes("?")?"&":"?";return`${x}${L}${j.toString()}`}return x}function nb(x){return`var s=this.style;${x.map((v)=>`s.${v}=''`).join(";")}`}function rb(x,v,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${x}" height="${v}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var rl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(x,v,k){let E=Kt(x,"src")||"",C=Ur(E),j=Kt(x,"alt")||"",L=Kt(x,"width")||(C?String(C.source.width):void 0),B=Kt(x,"height")||(C?String(C.source.height):void 0),z=Kt(x,"sizes"),F=Kt(x,"srcset"),K=Kt(x,"densities"),G=Kt(x,"format"),J=Wr(E)||Qc(E)?.transparent===!0,ne=Kt(x,"placeholder")||(C&&!J?"thumbhash":void 0),re=Kt(x,"placeholderColor")||"#e5e7eb",se=Kt(x,"provider"),oe=Kt(x,"class")||Kt(x,"className")||"",ie=Kt(x,"style")||"",fe=Kt(x,"quality"),ue=Oo(x,"lazy",!0),be=Oo(x,"preload",!1),we=Oo(x,"priority",!1),Se=Kt(x,"loading"),$e=Kt(x,"decoding")||"async",Ee=!!C||Oo(x,"picture",!1)||!!G,ke=L?Number.parseInt(L):void 0,Re=B?Number.parseInt(B):void 0,Ce=F||"",_e="";if(C)Ce=C.sources[C.fallback.format]||"",_e=z?tl(z):"100vw";else if(!Ce&&z&&se&&se!=="local"&&se!=="static")Ce=nl(E,el,se,G),_e=tl(z);else if(!Ce&&K){let dt=K.split(/\s+/).map(($t)=>Number.parseFloat($t.replace("x","")));Ce=tb(E,dt,ke,se,G)}else if(z)_e=tl(z);let Te=[];if(ie)Te.push(ie);if(ke&&Re)Te.push(`aspect-ratio:${ke}/${Re}`);let Ke=[],Pe=ne==="blur"||ne==="color"||ne==="thumbhash";if(Pe&&!J){let dt=C?.placeholder?{dataUrl:C.placeholder.dataUrl,color:re}:Qc(E);if(dt&&ne==="color")Te.push(`background-color:${dt.color}`),Ke.push("backgroundColor");else if(dt)Te.push(`background-color:${dt.color}`),Te.push(`background-image:url(${dt.dataUrl})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Ke.push("backgroundColor","backgroundImage");else{let $t=rb(ke||16,Re||9,re);Te.push(`background-image:url(${$t})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Ke.push("backgroundImage")}}else if(!Pe&&ne&&ne!=="empty"&&ne!=="none")Te.push(`background-image:url(${Lt(ne)})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Ke.push("backgroundImage");let Ae=C?.fallback.url||Gs(E,ke,Re,se,G),Ze=[];if(Ze.push(`src="${Lt(Ms(Ae,"fetched"))}"`),Ze.push(`alt="${Lt(j)}"`),L)Ze.push(`width="${Lt(L)}"`);if(B)Ze.push(`height="${Lt(B)}"`);let tt=Se||(we||be?"eager":ue?"lazy":"");if(tt)Ze.push(`loading="${Lt(tt)}"`);if(we)Ze.push('fetchpriority="high"');if(Ze.push(`decoding="${Lt($e)}"`),oe)Ze.push(`class="${Lt(oe)}"`);if(Te.length>0)Ze.push(`style="${Lt(Te.join(";"))}"`);if(Ce)Ze.push(`srcset="${Lt(Ms(Ce,"fetched"))}"`);if(_e)Ze.push(`sizes="${Lt(_e)}"`);let ot=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ke.length>0){let dt=typeof x.static.onload==="string"?x.static.onload:"",$t=nb(Ke)+(dt?`;${dt}`:"");Ze.push(`onload="${Lt($t)}"`),ot.add("onload")}Ze.push(...us(x,ot)),Ze.push(...ps(x,ot));let nt=`<img ${Ze.join(" ")} />`,_t="";if(be){let $t=G==="webp"?"image/webp":G==="avif"?"image/avif":"";_t=`<link rel="preload" as="image" href="${Lt(Ae)}"${$t?` type="${$t}"`:""}${Ce?` imagesrcset="${Lt(Ce)}"`:""}${_e?` imagesizes="${Lt(_e)}"`:""} />
|
|
2295
|
-
`}if(
|
|
2296
|
-
${
|
|
2290
|
+
`}async function hf(x,v,k,E){if(v.length<1)return o("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let C=v[0].replace(/['"]/g,""),L=(k.__stx_options||{}).componentsDir||"components",B=vn.isAbsolute(L)?[vn.join(L,`${C}.stx`),vn.join(vn.dirname(E),`${C}.stx`)]:[vn.join(vn.dirname(E),L,`${C}.stx`),vn.join(process.cwd(),L,`${C}.stx`),vn.join(vn.dirname(E),`${C}.stx`)],z=null;for(let G of B)if(await n(G)){z=await Bun.file(G).text();break}if(!z)return o("WebComponent",`Component file not found: ${C}.stx`,t.FILE_NOT_FOUND);let F=qy(z,C);return`<script type="module">
|
|
2291
|
+
${Ky(F)}
|
|
2292
|
+
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:kt,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:Jd,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:hf,hasEndTag:!1,description:"Include a web component in the template"},ao,co,Xn,Gn,Ld,zd,Fd,Bd,Xd,jd,af,Nc,...or],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 Zy(x,v,k){let E=v||"pages";if(x)return{root:x,pagesDir:E};let C=k||process.cwd(),j=ln.join(C,"resources","views"),L=ln.join(C,"resources","layouts");if(xo.existsSync(j)&&xo.existsSync(L))return{root:"resources",pagesDir:"views"};let B=ln.join(C,"resources","views","pages");if(xo.existsSync(B))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var yf=new Set,So=["partialsDir","componentsDir","layoutsDir"],jc=new WeakMap;function Gy(x,v){let k=v.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=x.replace(/\\/g,"/"),C=k.replace(/\\/g,"/");return E===C||E.startsWith(`${C}/`)}function vc(x,v){let k=!x.root,E=Zy(x.root,x.pagesDir,v);if(x.root=E.root,x.pagesDir=E.pagesDir,k&&E.root!=="."){let C=`${v}::${E.root}`;if(!yf.has(C))yf.add(C),console.warn(`[stx] No "root" in config \u2014 inferred "${E.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!jc.has(x)){let C={};for(let j of So){let L=x[j];if(typeof L==="string"&&L)C[j]=L}jc.set(x,C)}if(x.root&&x.root!=="."){let C=x.root;for(let j of So){let L=x[j];if(typeof L!=="string"||!L)continue;if(ln.isAbsolute(L)||Gy(L,C))continue;x[j]=ln.join(C,L)}}for(let C of So){let j=x[C];if(typeof j!=="string"||!j||ln.isAbsolute(j))continue;x[C]=ln.resolve(v,j)}return x}function Jy(x,v){let k=jc.get(x);for(let E of So){let C=x[E];if(typeof C!=="string"||!C)continue;let j=ln.isAbsolute(C)?C:ln.join(v,C);if(xo.existsSync(j))continue;let L=k?.[E]??C,B=x.root,z=!!B&&B!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${L}"`+(z?`, resolved under root "${B}".`:"."))}}function Yy(x){if(x.customDirectives)x.customDirectives=[...x.customDirectives];if(x.middleware)x.middleware=[...x.middleware];if(x.apiRoutes)x.apiRoutes={...x.apiRoutes}}function Qy(x){if(go(x.stateDir),x.stateDir=rn(),x.cachePath=sn(x.cachePath),x.build)x.build.cacheDir=sn(x.build.cacheDir);if(x.media?.cache)x.media.cache.directory=sn(x.media.cache.directory);if(x.story)x.story.outDir=sn(x.story.outDir)}var fr=null,$r=new Map,mo=new Map,qs=null;async function i(x){let v=x?ln.resolve(x):process.cwd(),k=mo.get(v);if(k&&k.signature!==Wn(k.graph)){let j=$r.get(v);if($r.delete(v),mo.delete(v),!x)fr=null,qs=null;let{clearComponentCache:L}=await import("./chunk-s0pmn48x.js"),{partialsCache:B}=await import("./chunk-yvq1f313.js");if(L(),B.clear(),j&&k.configSignature===qn(k.graph)){let z=j.then(async(F)=>{let X={...k.graph};await ms(X,v),mo.set(v,{graph:X,signature:Wn(X),configSignature:qn(X)});let G={...F,_layerGraph:X};if(!x)fr=G;return G});return $r.set(v,z),z}}if(!x){if(fr)return fr;if(qs)return qs}let E=$r.get(v);if(E)return E;let C=(async()=>{let L=(await Xy({name:"stx",alias:"ui",cwd:v,defaultConfig:A,verbose:!1})).config;if(L.extends!==void 0||k){let X=await po(v,A);L=X.config,mo.set(v,{graph:X.graph,signature:Wn(X.graph),configSignature:qn(X.graph)})}if(L.runtimeConfig){let{resolveRuntimeConfig:X}=await import("./chunk-zpcz2kh6.js");X(L.runtimeConfig,{});let{generateRuntimeConfigTypes:G}=await import("./chunk-y8rpk1b9.js");await G(v,L.runtimeConfig)}Yy(L),Qy(L),vc(L,v),Jy(L,v);let B=[],z=new Set((L.plugins??[]).map((X)=>typeof X==="string"?X:X[0]));for(let X of L.componentPackages??["@stacksjs/components"]){let G=`${X}/stx-plugin`;if(z.has(G)||z.has(X))continue;try{u.resolve(G,{paths:[v]}),B.push(G)}catch{}}let F=[...L.plugins??[],...B];if(F.length>0){let{pluginManager:X}=await import("./chunk-x8rckpyz.js"),G=[],J=[];for(let ne of F){let re=typeof ne==="string"?ne:ne[0],se=typeof ne==="string"?{}:ne[1]||{};try{let oe,ie;try{let ue=u.resolve(re,{paths:[v]});oe=await import(ue),ie=ln.dirname(ue)}catch{let ue=ln.resolve(v,re);oe=await import(ue),ie=ln.dirname(ue)}let ge=oe.default||oe;if(!X.has(ge.name))await X.register(ge,L);if(ge.components){let ue=Array.isArray(ge.components)?ge.components:[ge.components];for(let xe of ue)G.push(ln.resolve(ie,xe))}if(ge.pages){let ue=ln.resolve(ie,ge.pages),xe=se.path||"/";J.push({dir:ue,prefix:xe})}if(ge.setup){let ue={addDirective:(xe)=>{L.customDirectives=L.customDirectives||[],L.customDirectives.push(xe)},addRoute:(xe,we)=>{L.apiRoutes=L.apiRoutes||{},L.apiRoutes[xe]=we},addMiddleware:(xe)=>{L.middleware=L.middleware||[],L.middleware.push(xe)},pluginDir:ie,config:L};await ge.setup(se,ue)}console.log(`[stx] Plugin loaded: ${ge.name||re}`)}catch(oe){console.warn(`[stx] Failed to load plugin ${re}:`,oe.message)}}L._pluginComponentDirs=G,L._pluginPageDirs=J}return L})();if($r.set(v,C),C.catch(()=>{if($r.get(v)===C)$r.delete(v)}),!x)qs=C,C.then((j)=>{fr=j}).catch(()=>{});return C}var T=new Proxy(A,{get(x,v){if(fr&&v in fr)return fr[v];if(!qs)i().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return x[v]}});function Mu(x){return x}function Nu(x){let v=[],k=[];if(x.partialsDir!==void 0&&typeof x.partialsDir!=="string")v.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(x.componentsDir!==void 0&&typeof x.componentsDir!=="string")v.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(x.cache!==void 0&&typeof x.cache!=="boolean")v.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(x.debug!==void 0&&typeof x.debug!=="boolean")v.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(x.streaming){if(x.streaming.bufferSize!==void 0){if(typeof x.streaming.bufferSize!=="number"||x.streaming.bufferSize<=0)v.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(x.streaming.timeout!==void 0){if(typeof x.streaming.timeout!=="number"||x.streaming.timeout<=0)v.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(x.streaming.strategy!==void 0){let E=["auto","manual","sections"];if(!E.includes(x.streaming.strategy))v.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.i18n){if(x.i18n.format!==void 0){let E=["json","yaml","yml","js"];if(!E.includes(x.i18n.format))v.push({path:"i18n.format",message:`i18n.format must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.animation){if(x.animation.defaultDuration!==void 0){if(typeof x.animation.defaultDuration!=="number"||x.animation.defaultDuration<0)v.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(x.animation.staggerDelay!==void 0){if(typeof x.animation.staggerDelay!=="number"||x.animation.staggerDelay<0)v.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(x.a11y){if(x.a11y.level!==void 0){let E=["AA","AAA"];if(!E.includes(x.a11y.level))v.push({path:"a11y.level",message:`a11y.level must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.hydration){if(x.hydration.mode!==void 0){let E=["progressive","islands"];if(!E.includes(x.hydration.mode))v.push({path:"hydration.mode",message:`hydration.mode must be one of: ${E.join(", ")}`,severity:"error"})}if(x.hydration.preload!==void 0){let E=["none","eager","lazy"];if(!E.includes(x.hydration.preload))v.push({path:"hydration.preload",message:`hydration.preload must be one of: ${E.join(", ")}`,severity:"error"})}}if(x.customDirectives)if(!Array.isArray(x.customDirectives))v.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else x.customDirectives.forEach((E,C)=>{if(!E.name||typeof E.name!=="string")v.push({path:`customDirectives[${C}].name`,message:"Custom directive must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")v.push({path:`customDirectives[${C}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(x.middleware)if(!Array.isArray(x.middleware))v.push({path:"middleware",message:"middleware must be an array",severity:"error"});else x.middleware.forEach((E,C)=>{if(!E.name||typeof E.name!=="string")v.push({path:`middleware[${C}].name`,message:"Middleware must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")v.push({path:`middleware[${C}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!E.timing||!["before","after"].includes(E.timing))v.push({path:`middleware[${C}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(x.debug===!0&&x.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(x.seo?.enabled===!0&&!x.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(x.pwa){if(x.pwa.enabled===!0&&!x.pwa.manifest?.name)v.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(x.pwa.manifest?.display!==void 0){let E=["fullscreen","standalone","minimal-ui","browser"];if(!E.includes(x.pwa.manifest.display))v.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${E.join(", ")}`,severity:"error"})}if(x.pwa.manifest?.orientation!==void 0){let E=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!E.includes(x.pwa.manifest.orientation))v.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${E.join(", ")}`,severity:"error"})}if(x.pwa.routes){let E=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];x.pwa.routes.forEach((C,j)=>{if(!C.pattern||typeof C.pattern!=="string")v.push({path:`pwa.routes[${j}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!E.includes(C.strategy))v.push({path:`pwa.routes[${j}].strategy`,message:`PWA route strategy must be one of: ${E.join(", ")}`,severity:"error"});if(C.maxAgeSeconds!==void 0&&(typeof C.maxAgeSeconds!=="number"||C.maxAgeSeconds<0))v.push({path:`pwa.routes[${j}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(C.maxEntries!==void 0&&(typeof C.maxEntries!=="number"||C.maxEntries<1))v.push({path:`pwa.routes[${j}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(x.pwa.icons?.sizes){if(!Array.isArray(x.pwa.icons.sizes))v.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(x.pwa.icons.sizes.filter((C)=>typeof C!=="number"||C<16||C>1024).length>0)v.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(x.pwa.icons?.purpose){let E=["any","maskable","monochrome"];if(x.pwa.icons.purpose.filter((j)=>!E.includes(j)).length>0)v.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${E.join(", ")}`,severity:"error"})}if(x.pwa.enabled===!0&&!x.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(x.pwa.enabled===!0&&!x.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:v.length===0,errors:v,warnings:k}}var Bc=new Map;async function ce(x,v={}){try{if(!await n(x))throw Error(`Markdown file not found: ${x}`);let E=(await ex.promises.stat(x)).mtime.getTime();if(v.cache&&Bc.has(x)){let G=Bc.get(x);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let C=await Bun.file(x).text(),{data:j,content:L}=Pn(C),B=v.markdown||T.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},F=De(L,{gfm:!0});if(B.syntaxHighlighting?.enabled&&B.syntaxHighlighting?.serverSide)F=await nx(F,B.syntaxHighlighting?.defaultTheme||"github-dark",B.syntaxHighlighting?.highlightUnknownLanguages||!1);let X={content:F,data:j||{}};if(v.cache)Bc.set(x,{...X,updatedAt:E});return X}catch(k){if(v.debug)console.error(`Error reading/parsing markdown file ${x}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,x,"",0,""),data:{}}}}var $o=null;async function nx(x,v,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$o)try{$o=await tx({theme:v||"github-dark",cache:!0})}catch(B){return console.error("Failed to initialize ts-syntax-highlighter:",B),x}let C=async(B,z,F,X)=>{let G=X.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),J=F||(k?"text":"");if(!J)return B;try{if(!$o.getSupportedLanguages().includes(J))return B;return(await $o.highlight(G,J,{theme:v})).html}catch(ne){console.error(`Error highlighting code block with language ${F}:`,ne)}return B},j=x,L=x.matchAll(E);for(let B of L){let[z,F,X,G]=B,J=await C(z,F,X,G);j=j.replace(z,J)}return j}async function xf(x,v,k="",E={}){return await rx(x,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(L,B,z,F)=>{try{let X=B;if(!Lc.isAbsolute(B))X=Lc.resolve(Lc.dirname(k),B);let G={};if(z)try{try{G=JSON.parse(z)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let ge=z.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ue of ge){let xe=ue.indexOf(":");if(xe>0){let we=ue.substring(0,xe).trim(),$e=ue.substring(xe+1).trim(),_e=$e.startsWith('"')&&$e.endsWith('"'),Ce=$e.startsWith("'")&&$e.endsWith("'");if(_e||Ce)$e=$e.substring(1,$e.length-1);G[we]=$e}}}}catch(ie){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ie)}let{content:J,data:ne}=await ce(X,E),re={...v,...ne,...G},se=J,oe=/\{\{([^}]+)\}\}/g;return se=se.replace(oe,(ie,ge)=>{let ue=ge.trim();return re[ue]!==void 0?String(re[ue]):ie}),se}catch(X){let G=X instanceof Error?X.message:String(X);return g("Markdown File",`Error including markdown file: ${G}`,k,x,F,L)}})}async function rx(x,v,k){let E=[],C;while((C=v.exec(x))!==null){let B=C[0],z=C.index,F=C;E.push(k(...F).then((X)=>({match:B,replacement:X,index:z})))}let j=await Promise.all(E);j.sort((B,z)=>z.index-B.index);let L=x;for(let{match:B,replacement:z}of j)L=L.replace(B,()=>z);return L}function pr(x,v){try{let k=x.trim();if(p(k))return l(k,Object.keys(v))(...Object.values(v));else return c(k,v)}catch{return!1}}function gr(x,v){let k=sx(x,v);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function sx(x,v){let k=v;while(k<x.length&&/\s/.test(x[k]))k++;if(x[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=w(x,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:x.slice(k+1,E),endPos:E+1}}function ix(x,v){let k=x.lastIndexOf("<",v);if(k===-1)return!1;return k>x.lastIndexOf(">",v)}function _r(x,v,k,E){let C=1,j=E,L=new RegExp(`@${v}\\s*\\(`,"g"),B=new RegExp(`@${k}(?![a-z])`,"g");while(j<x.length&&C>0){L.lastIndex=j,B.lastIndex=j;let z=L.exec(x),F=B.exec(x),X=z?z.index:1/0,G=F?F.index:1/0;if(X<G)C++,j=X+z[0].length;else if(G<1/0){if(C--,C===0)return G;j=G+F[0].length}else break}return-1}function bf(x,v){let k=x.slice(v).match(/^@if\s*/);if(!k)return null;let E=v+k[0].length,C=gr(x,E);if(!C)return null;let j=C.endPos,L=_r(x,"if","endif",j);if(L===-1)return null;let B=x.slice(j,L),z=[],F=0,X="if",G=C.expression,J=0,ne=0;while(F<B.length){let re=B.indexOf("@",F);if(re===-1)break;F=re;let se=B.substring(re);if(ix(B,re)){F++;continue}if(/^@if\s*\(/.test(se)){ne++,F++;continue}if(/^@endif(?![a-z])/.test(se)){ne--,F+=6;continue}if(ne===0){let oe=se.match(/^@elseif\s*/);if(oe){z.push({type:X,condition:G,content:B.substring(J,F),start:j+J,end:j+F});let ie=F+oe[0].length,ge=gr(B,ie);if(!ge){F++;continue}X="elseif",G=ge.expression,F=ge.endPos,J=F;continue}else if(/^@else(?![a-z])/.test(se)){z.push({type:X,condition:G,content:B.substring(J,F),start:j+J,end:j+F}),X="else",G=void 0,F+=5,J=F;continue}}F++}return z.push({type:X,condition:G,content:B.slice(J),start:j+J,end:j+B.length}),{fullMatch:x.slice(v,L+6),branches:z,start:v,end:L+6}}function Ks(x){let v=[],k=/@if\s*\(/g,E=k.exec(x);while(E!==null){if(v.some((L)=>E.index>L.start&&E.index<L.end)){E=k.exec(x);continue}let j=bf(x,E.index);if(j)v.push(j),k.lastIndex=j.end;E=k.exec(x)}return v}function _o(x,v,k){let E=[],C=new RegExp(`@${v}\\s*\\(`,"g"),j=C.exec(x);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=C.exec(x);continue}let B=j.index,z=B+j[0].length-1,F=w(x,"(",")",z);if(F===-1){j=C.exec(x);continue}let X=x.slice(z+1,F),G=F+1,J=_r(x,v,k,G);if(J===-1){j=C.exec(x);continue}let ne=x.slice(G,J),re=J+`@${k}`.length;E.push({fullMatch:x.slice(B,re),name:v,params:X,content:ne,start:B,end:re}),C.lastIndex=re,j=C.exec(x)}return E}function zc(x,v){let k=x.slice(v).match(/^@switch\s*/);if(!k)return null;let E=v+k[0].length,C=gr(x,E);if(!C)return null;let j=C.endPos,L=_r(x,"switch","endswitch",j);if(L===-1)return null;let B=x.slice(j,L),z=[],F=0,X=null,G=0;while(F<B.length){let J=B.slice(F),ne=J.match(/^@switch\s*\(/),re=J.match(/^@endswitch(?![a-z])/);if(ne){if(G++,X)X.content+=ne[0];F+=ne[0].length;continue}if(re){if(G--,X)X.content+=re[0];F+=re[0].length;continue}if(G>0){if(X)X.content+=B[F];F++;continue}let se=J.match(/^@case\s*/),oe=J.match(/^@default(?![a-z])/),ie=J.match(/^@break(?![a-z])/);if(se&&J.startsWith("@case")){if(X)z.push(X);let ge=F+se[0].length,ue=gr(B,ge);if(!ue){F++;continue}X={type:"case",value:ue.expression,content:""},F=ue.endPos}else if(oe&&J.startsWith("@default")){if(X)z.push(X);X={type:"default",content:""},F+=oe[0].length}else if(ie&&J.startsWith("@break"))F+=ie[0].length;else{if(X)X.content+=B[F];F++}}if(X)z.push(X);return{fullMatch:x.slice(v,L+10),expression:C.expression,cases:z,start:v,end:L+10}}function lx(x,v,k){let E=x,C=!0;while(C){C=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let L=j.index,B=zc(E,L);if(!B)break;try{let z;if(p(B.expression))z=l(B.expression,Object.keys(v))(...Object.values(v));else z=c(B.expression,v);let F="",X=!1;for(let G of B.cases)if(G.type==="default"){if(!X)F=G.content.trim()}else try{let J;if(G.value&&p(G.value))J=l(G.value,Object.keys(v))(...Object.values(v));else if(G.value)J=c(G.value,v);if(z===J){F=G.content.trim(),X=!0;break}}catch{continue}E=E.substring(0,L)+F+E.substring(B.end),C=!0}catch(z){let F=z instanceof Error?z.message:String(z),X=o("Switch",`Error evaluating @switch expression: ${F}`,t.EVALUATION_ERROR);E=E.substring(0,L)+X+E.substring(B.end);break}}return E}function ux(x){let v=[];return{masked:x.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(v.push(E),`\x00stx-script-${v.length-1}\x00`)),scripts:v}}function dx(x,v){if(v.length===0)return x;return x.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>v[Number(E)]??k)}function sr(x,v,k){let{masked:E,scripts:C}=ux(x);return dx(fx(E,v,k),C)}function fx(x,v,k){let E=x;E=lx(E,v,k);{let j=!0;while(j){j=!1;let L=E.match(/@unless\s*\(/);if(!L||L.index===void 0)break;let B=L.index,z=gr(E,B+7);if(!z)break;let F=z.endPos,X=_r(E,"unless","endunless",F);if(X===-1){console.warn(`[stx] @unless directive at position ${B} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(F,X),J=z.expression,ne=-1;{let se=0,oe=/@(?:if|unless)\s*\(/g,ie=/@(?:endif|endunless)(?![a-z])/g,ge=/@else(?![a-z])/g,ue=[],xe;while((xe=oe.exec(G))!==null)ue.push({pos:xe.index,type:"open"});while((xe=ie.exec(G))!==null)ue.push({pos:xe.index,type:"close"});while((xe=ge.exec(G))!==null)ue.push({pos:xe.index,type:"else"});ue.sort((we,$e)=>we.pos-$e.pos);for(let we of ue)if(we.type==="open")se++;else if(we.type==="close")se--;else if(we.type==="else"&&se===0){ne=we.pos;break}}let re;if(ne!==-1){let se=G.slice(0,ne),oe=G.slice(ne+5);re=`@if (${J})${oe}@else ${se}@endif`}else re=`@if (!(${J}))${G}@endif`;E=E.substring(0,B)+re+E.substring(X+10),j=!0}}E=Wc(E,v,k),E=Vc(E,v,k),E=Fc(E,v);let C=()=>{let j=Ks(E);if(j.length===0)return!1;let L=Array(j.length);for(let F=j.length-1;F>=0;F--){let X=j[F];try{let G="",J=!1;for(let ne of X.branches){if(J)break;if(ne.type==="else")G=ne.content,J=!0;else try{let re;if(ne.condition&&p(ne.condition))re=l(ne.condition,Object.keys(v))(...Object.values(v));else if(ne.condition)re=c(ne.condition,v);if(re)G=ne.content,J=!0}catch(re){G=o(ne.type==="if"?"If":"Elseif",`Error in @${ne.type}(${ne.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),J=!0}}L[F]=G}catch(G){let J=G instanceof Error?G.message:String(G);L[F]=o("If",`Error processing @if block: ${J}`,t.EVALUATION_ERROR)}}let B=Array(j.length*2+1),z=0;for(let F=0;F<j.length;F++){let X=j[F];B[F*2]=E.slice(z,X.start),B[F*2+1]=L[F],z=X.end}return B[j.length*2]=E.slice(z),E=B.join(""),!0};while(!0){let j=E;if(!C())break;if(E===j)break}return E}function vf(x){let v=0;while(v<x.length&&/\s/.test(x[v]))v++;if(x[v]!=="(")return null;v++;while(v<x.length&&/\s/.test(x[v]))v++;let k=x[v];if(k!=="'"&&k!=='"')return null;v++;let E=[];while(v<x.length){let C=x[v];if(C==="\\"&&v+1<x.length){E.push(x[v+1]),v+=2;continue}if(C===k){v++;break}E.push(C),v++}while(v<x.length&&/\s/.test(x[v]))v++;if(x[v]!==")")return null;return v++,{value:E.join(""),consumed:v}}function Fc(x,v){let k=x;function E(B,z,F,X){let G=1,J=X,ne=new RegExp(`@${z}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${F}(?![a-z])`,"g");while(J<B.length&&G>0){ne.lastIndex=J,re.lastIndex=J;let se=ne.exec(B),oe=re.exec(B),ie=se?se.index:1/0,ge=oe?oe.index:1/0;if(ie<ge)G++,J=ie+se[0].length;else if(ge<1/0){if(G--,G===0)return ge;J=ge+oe[0].length}else break}return-1}function C(B,z,F){let X=0,G=new RegExp(`@${z}(?:\\s*\\(|\\s|$)`,"g"),J=new RegExp(`@${F}(?![a-z])`,"g"),ne=/@else(?![a-z])/g,re=[],se;while((se=G.exec(B))!==null)re.push({pos:se.index,type:"open"});while((se=J.exec(B))!==null)re.push({pos:se.index,type:"close"});while((se=ne.exec(B))!==null)re.push({pos:se.index,type:"else"});re.sort((oe,ie)=>oe.pos-ie.pos);for(let oe of re)if(oe.type==="open")X++;else if(oe.type==="close")X--;else if(oe.type==="else"&&X===0)return oe.pos;return-1}{let B=!0;while(B){B=!1;let z=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!z||z.index===void 0)break;let F=z.index,X,G,J=k.slice(F+5),ne=vf(J);if(ne)X=ne.value,G=F+5+ne.consumed;else G=F+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${F} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),oe=C(se,"auth","endauth"),ie;if(!v.auth)ie=!1;else ie=X?pr(`auth?.check && auth?.user?.[${X}]`,v):pr("auth?.check",v);let ge;if(oe!==-1){let ue=se.slice(0,oe),xe=se.slice(oe+5);ge=ie?ue:xe}else ge=ie?se:"";k=k.substring(0,F)+ge+k.substring(re+8),B=!0}}{let B=!0;while(B){B=!1;let z=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!z||z.index===void 0)break;let F=z.index,X,G,J=k.slice(F+6),ne=vf(J);if(ne)X=ne.value,G=F+6+ne.consumed;else G=F+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${F} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),oe=C(se,"guest","endguest"),ie;if(!v.auth)ie=!0;else ie=X?pr(`!auth?.check || !auth?.user?.[${X}]`,v):pr("!auth?.check",v);let ge;if(oe!==-1){let ue=se.slice(0,oe),xe=se.slice(oe+5);ge=ie?ue:xe}else ge=ie?se:"";k=k.substring(0,F)+ge+k.substring(re+9),B=!0}}function j(B,z,F){if(v.userCan&&typeof v.userCan[B]==="boolean")return v.userCan[B];if(v.permissions?.check&&typeof v.permissions.check==="function")try{let X=[B];if(z)X.push(z);if(F){let G=pr(F,v);X.push(G)}return v.permissions.check(...X)}catch{return!1}return!1}function L(B){let z=B.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!z)return null;return{ability:z[1],type:z[2],id:z[3]?.trim(),paramsEnd:z[0].length}}for(let B of["can","cannot"]){let z=`end${B}`,F=B==="can"?"elsecan":"elsecannot",X=!0;while(X){X=!1;let G=k.match(new RegExp(`@${B}\\s*\\(`));if(!G||G.index===void 0)break;let J=G.index,ne=k.slice(J+`@${B}`.length),re=L(ne);if(!re)break;let se=J+`@${B}`.length+re.paramsEnd,oe=E(k,B,z,se);if(oe===-1){console.warn(`[stx] @${B} directive at position ${J} has no matching @${z} \u2014 the block was skipped.`);break}let ie=k.slice(se,oe),ge=[],ue=0,xe=new RegExp(`@${B}\\s*\\(`,"g"),we=new RegExp(`@${z}(?![a-z])`,"g"),$e=new RegExp(`@${F}\\s*\\(`,"g"),_e=/@else(?![a-z])/g,Ce=[],Ee;while((Ee=xe.exec(ie))!==null)Ce.push({pos:Ee.index,type:"open"});while((Ee=we.exec(ie))!==null)Ce.push({pos:Ee.index,type:"close"});while((Ee=$e.exec(ie))!==null)Ce.push({pos:Ee.index,type:"elseDirective"});while((Ee=_e.exec(ie))!==null)Ce.push({pos:Ee.index,type:"else"});Ce.sort((Pe,Ie)=>Pe.pos-Ie.pos);for(let Pe of Ce){if(Pe.type==="open"){ue++;continue}if(Pe.type==="close"){ue--;continue}if(ue===0)ge.push(Pe)}let Te=[],Re=0;for(let Pe=0;Pe<ge.length;Pe++){let Ie=ge[Pe];if(Te.push({content:ie.slice(Re,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ge=ie.slice(Ie.pos+`@${F}`.length),nt=L(Ge);if(nt){Te[Te.length-1]={content:ie.slice(Re,Ie.pos)},Re=Ie.pos+`@${F}`.length+nt.paramsEnd,Te.push({content:"",ability:nt.ability,type:nt.type,id:nt.id}),Te.pop();let at=ge[Pe+1],rt=at?at.pos:ie.length;Te.push({content:ie.slice(Re,rt),ability:nt.ability,type:nt.type,id:nt.id}),Re=rt}}else Re=Ie.pos+5}if(Re<ie.length){let Pe=Te[Te.length-1];if(ge.length>0&&ge[ge.length-1].type==="else")Te.push({content:ie.slice(Re),isFinalElse:!0});else if(Te.length===0)Te.push({content:ie.slice(Re)})}let ke=j(re.ability,re.type,re.id),Ae=B==="can"?ke:!ke,Ze="";if(Ae)Ze=Te[0]?.content||"";else{let Pe=!1;for(let Ie=1;Ie<Te.length;Ie++){let Ge=Te[Ie];if(Ge.isFinalElse){Ze=Ge.content,Pe=!0;break}if(Ge.ability){let nt=j(Ge.ability,Ge.type,Ge.id);if(B==="can"?nt:!nt){Ze=Ge.content,Pe=!0;break}}}if(!Pe&&Te.length>0){let Ie=Te[Te.length-1];if(Ie.isFinalElse)Ze=Ie.content}}k=k.substring(0,J)+Ze+k.substring(oe+`@${z}`.length),X=!0}}return k}function Wc(x,v,k){let E=x;function C(j,L,B,z,F){let X=!0;while(X){X=!1;let G=new RegExp(`@${L}\\s*\\(`),J=j.match(G);if(!J||J.index===void 0)break;let ne=J.index,re=gr(j,ne+`@${L}`.length);if(!re)break;let se=re.endPos,oe=_r(j,L,B,se);if(oe===-1){console.warn(`[stx] @${L} directive at position ${ne} has no matching @${B} \u2014 the block was skipped.`);break}let ie=j.slice(se,oe),ge=re.expression,ue=-1,xe=0,we=0;while(we<ie.length){let $e=ie.indexOf("@",we);if($e===-1)break;let _e=ie.substring($e);if(/^@(?:if|unless|isset|empty)\s*\(/.test(_e)){xe++,we=$e+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(_e)){xe--,we=$e+1;continue}if(xe===0&&/^@else(?![a-z])/.test(_e)){ue=$e;break}we=$e+1}try{let $e=z(ge.trim()),_e;if(ue!==-1){let Ce=ie.slice(0,ue),Ee=ie.slice(ue+5);_e=$e?Ce:Ee}else _e=$e?ie:"";j=j.substring(0,ne)+_e+j.substring(oe+`@${B}`.length),X=!0}catch($e){let _e=$e instanceof Error?$e.message:String($e),Ce=o(F,`Error processing @${L} directive: ${_e}`,t.EVALUATION_ERROR);j=j.substring(0,ne)+Ce+j.substring(oe+`@${B}`.length);break}}return j}return E=C(E,"isset","endisset",(j)=>{let L=pr(j,v);return L!==void 0&&L!==null},"Isset"),E=C(E,"empty","endempty",(j)=>{let L=pr(j,v);return L===void 0||L===null||L===""||L===0||L===!1||Array.isArray(L)&&L.length===0||typeof L==="object"&&L!==null&&Object.keys(L).length===0},"Empty"),E}function Vc(x,v,k){let E=x,C="development";function j(L,B,z,F){let X=new RegExp(`@${B}(?![a-z])`,"g"),G=new RegExp(`@${z}(?![a-z])`,"g"),J=new RegExp(`^@${B}(?![a-z])`),ne=new RegExp(`^@${z}(?![a-z])`),re=L,se=!0;while(se){se=!1,X.lastIndex=0;let oe=X.exec(re);if(!oe)break;let ie=oe.index,ge=ie+oe[0].length;if(B==="env"){let ke=re.substring(ge).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!ke)break;ge+=ke[0].length,F=C===ke[2]}let ue=1,xe=ge,we=-1;while(ue>0&&xe<re.length){X.lastIndex=xe,G.lastIndex=xe;let ke=X.exec(re),Ae=G.exec(re),Ze=ke?ke.index:1/0,Pe=Ae?Ae.index:1/0;if(Ze<Pe)ue++,xe=Ze+ke[0].length;else if(Pe<1/0){if(ue--,ue===0){we=Pe;break}xe=Pe+Ae[0].length}else break}if(we===-1){console.warn(`[stx] @${B} directive at position ${ie} has no matching @${z} \u2014 the block was skipped.`);break}let $e=re.substring(ge,we),_e=-1,Ce=0,Ee=0;while(Ee<$e.length){let ke=$e.indexOf("@",Ee);if(ke===-1)break;let Ae=$e.substring(ke);if(J.test(Ae)){Ce++,Ee=ke+1;continue}if(ne.test(Ae)){Ce--,Ee=ke+1;continue}if(Ce===0&&/^@else(?![a-z])/.test(Ae)){_e=ke;break}Ee=ke+1}let Te;if(_e!==-1){let ke=$e.slice(0,_e),Ae=$e.slice(_e+5);Te=F?ke:Ae}else Te=F?$e:"";let Re=`@${z}`.length;re=re.substring(0,ie)+Te+re.substring(we+Re),se=!0}return re}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",C==="production"),E=j(E,"development","enddevelopment",C==="development"),E=j(E,"staging","endstaging",C==="staging"),E=j(E,"testing","endtesting",C==="testing"),E}var wf=new WeakMap;function Sf(x=16){let v=new Uint8Array(x);return crypto.getRandomValues(v),btoa(String.fromCharCode(...v))}function ko(x,v){if(!x)return v?.nonceGenerator?.()??Sf();let k=wf.get(x);if(!k)k=v?.nonceGenerator?.()??Sf(),wf.set(x,k);return k}function px(x,v){let k=[];for(let[E,C]of Object.entries(x)){if(C===void 0||C===null)continue;if(typeof C==="boolean"){if(C)k.push(E);continue}if(Array.isArray(C)){let j=[...C];if(v&&(E==="script-src"||E==="style-src"))j=j.filter((L)=>!L.startsWith("'nonce-")),j.push(`'nonce-${v}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function $f(x,v){return`<meta http-equiv="Content-Security-Policy" content="${px(x,v).replace(/&/g,"&").replace(/"/g,""")}">`}function _f(x,v,k){if(!v.enabled||!v.addMetaTag)return x;if(x.includes('http-equiv="Content-Security-Policy"'))return x;if(!x.includes("<head>")&&!x.includes("<head "))return x;let E=v.useNonce?ko(k,v):void 0,C=$f(v.directives,E);return x.replace(/<head([^>]*)>/,`<head$1>
|
|
2293
|
+
${C}`)}function kf(x,v){let k=x;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(E,C)=>{if(C.includes("nonce="))return E;return`<script nonce="${v}"${C}>`}),k=k.replace(/<style([^>]*)>/gi,(E,C)=>{if(C.includes("nonce="))return E;return`<style nonce="${v}"${C}>`}),k}function Ef(x,v,k,E){let C=x,j=E.csp;if(C=C.replace(/@csp\b/g,()=>{if(!j?.enabled||!j.directives)return"<!-- CSP not configured -->";let L=j.useNonce?ko(v,j):void 0;return $f(j.directives,L)}),C=C.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return ko(v,j)}),j?.enabled&&j.useNonce)v.cspNonce=ko(v,j);return C}import gx from"crypto";var mx=40,Cf="_token",Uc=null;function hx(x=mx){let v=gx.randomBytes(Math.ceil(x/2)).toString("hex").slice(0,x);return Uc=v,v}function yx(){if(!Uc)hx();return Uc}function xx(x=Cf){let v=yx();return`<input type="hidden" name="${x}" value="${v}">`}function Rf(x){return x.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(v,k,E)=>xx(E||Cf))}async function Tf(x,v,k,E){if(!E.customDirectives||E.customDirectives.length===0)return x;let C=x;for(let j of E.customDirectives){if(!j.name||typeof j.handler!=="function"){if(E.debug)console.warn("Invalid custom directive:",j);continue}if(j.hasEndTag)C=await bx(C,j,v,k,E);else C=await vx(C,j,v,k,E)}return C}async function bx(x,v,k,E,C){let{name:j,handler:L}=v,B=`@${j}`,z=`@end${j}`,F=x,X=xr(`${B}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${z}`,"g"),G=[],J=X.exec(F);while(J!==null){let[ne,re="",se=""]=J,oe=J.index||0;try{let ie=re?Af(v,re):[],ge=se.trim(),ue=await L(ge,ie,k,E);G.push({original:ne,processed:ue,startIndex:oe})}catch(ie){let ge=ie instanceof Error?ie.message:String(ie);if(C.debug)console.error(`Error processing custom directive @${j}:`,ie);G.push({original:ne,processed:o("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${ge}`,t.EVALUATION_ERROR),startIndex:oe})}J=X.exec(F)}for(let ne=G.length-1;ne>=0;ne--){let{original:re,processed:se}=G[ne];F=F.replace(re,se)}return F}async function vx(x,v,k,E,C){let{name:j,handler:L}=v,B=x,z=[],F=[];if(v.rawParams){for(let J of Ss(B,xr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(J.end!==-1)F.push({fullMatch:J.call,paramString:J.args,startIndex:J.start})}else{let J=xr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");J.lastIndex=0;let ne=J.exec(B);while(ne!==null)F.push({fullMatch:ne[0],paramString:ne[1]??"",startIndex:ne.index||0}),ne=J.exec(B)}for(let{fullMatch:J,paramString:ne,startIndex:re}of F)try{let se=Af(v,ne),oe=await L("",se,k,E);z.push({original:J,processed:oe,startIndex:re})}catch(se){let oe=se instanceof Error?se.message:String(se);if(C.debug)console.error(`Error processing custom directive @${j}:`,se);z.push({original:J,processed:o("CustomDirective",`Error in @${j}(${ne}): ${oe}`,t.EVALUATION_ERROR),startIndex:re})}let X=xr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=X.exec(B);while(G!==null){let[J]=G,ne=G.index||0;try{let re=await L("",[],k,E);z.push({original:J,processed:re,startIndex:ne})}catch(re){let se=re instanceof Error?re.message:String(re);if(C.debug)console.error(`Error processing custom directive @${j}:`,re);z.push({original:J,processed:o("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:ne})}G=X.exec(B)}for(let J=z.length-1;J>=0;J--){let{original:ne,processed:re}=z[J];B=B.replace(ne,re)}return B}function Af(x,v){return x.rawParams?Xe(v):wx(v)}function wx(x){if(!x.trim())return[];let v=[],k="",E=!1,C="";for(let j=0;j<x.length;j++){let L=x[j];if((L==='"'||L==="'")&&(j===0||x[j-1]!=="\\"))if(!E)E=!0,C=L;else if(L===C)E=!1;else k+=L;else if(L===","&&!E)v.push(k.trim()),k="";else k+=L}if(k.trim())v.push(k.trim());return v.map((j)=>{let L=j.trim();if(L.startsWith('"')&&L.endsWith('"')||L.startsWith("'")&&L.endsWith("'"))return L.substring(1,L.length-1);return L})}var If=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Pf=/^[A-Za-z_$][\w$]*$/,Sx=new Set(["light","dark","system"]);function kr(x,v){if(typeof x!=="string"||x.length===0)throw Error(`@appearanceBootstrap ${v} must be a non-empty string`)}function $x(x){if(!x||typeof x!=="object"||Array.isArray(x))throw Error("@appearanceBootstrap expects an options object");let v=x,{appearance:k,colorMode:E}=v;if(kr(v.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!E||typeof E!=="object"||Array.isArray(E))throw Error("@appearanceBootstrap colorMode must be an object");if(kr(E.key,"colorMode.key"),kr(E.attribute,"colorMode.attribute"),kr(E.default,"colorMode.default"),!Pf.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!If.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Sx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let C=null;if(k){if(kr(k.key,"appearance.key"),kr(k.attribute,"appearance.attribute"),kr(k.default,"appearance.default"),!Pf.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!If.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((j)=>typeof j!=="string"||j.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");C={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:v.storageKey,appearance:C,colorMode:{key:E.key,attribute:E.attribute,default:E.default},respectExisting:v.respectExisting===!0}}function _x(x){return JSON.stringify(x).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function kx(x){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_x(x)};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 Ex(x,v){let k=1,E=null,C=!1;for(let j=v+1;j<x.length;j++){let L=x[j];if(C){C=!1;continue}if(E){if(L==="\\")C=!0;else if(L===E)E=null;continue}if(L==='"'||L==="'"||L==="`"){E=L;continue}if(L==="(")k++;else if(L===")"&&--k===0)return j}return-1}function Df(x,v){let k=x,E=/@appearanceBootstrap\s*\(/g,C;while((C=E.exec(k))!==null){let j=C.index+C[0].length-1,L=Ex(k,j);if(L===-1)throw Error("@appearanceBootstrap has an unclosed options object");let B=k.slice(j+1,L).trim(),z=c(`(${B})`,v),F=kx($x(z));k=k.slice(0,C.index)+F+k.slice(L+1),E.lastIndex=C.index+F.length}return k}import Cx from"crypto";function Ft(x){return String(x??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Of={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Eo(x,v,k,E){let C=x||v;return k?`${C} ${E}`:C}function wn(x){return String(x).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function zr(x,v){if(/\bid\s*=/i.test(x))return"";return` id="${Ft(v)}"`}function Hc(x,v,k){if(!v)return"";let E="";if(!/\baria-invalid\s*=/i.test(k))E+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))E+=` aria-describedby="${Ft(`${wn(x)}-error`)}"`;return E}function Rx(){return Cx.randomUUID()}function Co(x,v){let k=x;return k=k.replace(/@csrf/g,()=>{if(!v.csrf||typeof v.csrf!=="object"){let E=Rx();v.csrf={token:E}}if(v.csrf.field)return v.csrf.field;if(v.csrf.token)return`<input type="hidden" name="_token" value="${Ft(v.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(E,C)=>{let j=C.toUpperCase();if(C&&!["GET","POST"].includes(j))return`<input type="hidden" name="_method" value="${Ft(j)}">`;return E}),k}function Nf(x,v,k=Of){let E=x;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(C,j,L,B,z,F="")=>{let X=j||L||"POST",G=B||z||"",J=mr(F),ne=X.toUpperCase(),re=["GET","POST"].includes(ne)?ne:"POST",se=`<form method="${Ft(re)}" action="${Ft(G)}"${J?` ${J}`:""}>`;if(se+=`
|
|
2294
|
+
${Co("@csrf",v)}`,!["GET","POST"].includes(ne))se+=`
|
|
2295
|
+
${Co(`@method('${ne}')`,v)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(C,j,L,B,z,F="")=>{let X=j||L||"",G=B||z||"",J=mr(F),ne=Xs(X,v),re=ne!==void 0&&ne!==null?ne:G||"",se=J.match(/type=['"]([^'"]+)['"]/i),oe=se?se[1]:"text",ie=Zs(X,v),ge=J.match(/class=['"]([^'"]+)['"]/i),ue=Eo(ge?ge[1]:"",k.input,ie,k.inputError),xe=J.replace(/class=['"][^'"]+['"]/i,"");return xe=xe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Ft(oe)}" name="${Ft(X)}"${zr(J,wn(X))} value="${Ft(re)}" class="${ue}"${Hc(X,ie,J)}${xe?` ${xe}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(C,j,L="",B="")=>{let z=mr(L),F=Xs(j,v)||B.trim(),X=Zs(j,v),G=z.match(/class=['"]([^'"]+)['"]/i),J=Eo(G?G[1]:"",k.input,X,k.inputError),ne=z.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Ft(j)}"${zr(z,wn(j))} class="${J}"${Hc(j,X,z)}${ne?` ${ne}`:""}>${Ft(F)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(C,j,L="",B)=>{let z=mr(L),F=Xs(j,v),X=Zs(j,v),G=z.match(/class=['"]([^'"]+)['"]/i),J=Eo(G?G[1]:"",k.input,X,k.inputError),ne=z.replace(/class=['"][^'"]+['"]/i,""),re=B;if(F!==void 0)re=B.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,oe,ie)=>{if((Array.isArray(F)?F.some((ue)=>String(ue)===ie):String(F)===ie)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return se});return`<select name="${Ft(j)}"${zr(z,wn(j))} class="${J}"${Hc(j,X,z)}${ne?` ${ne}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(C,j,L,B="")=>{let z=L===void 0?"1":L,F=L===void 0?wn(j):`${wn(j)}-${wn(z)}`,X=mr(B),G=Xs(j,v),J=G!==void 0&&(Array.isArray(G)?G.some((oe)=>String(oe)===z):G===!0||String(G)===z),ne=X.match(/class=['"]([^'"]+)['"]/i),re=ne?ne[1]:k.checkInput,se=X.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Ft(j)}"${zr(X,F)} value="${Ft(z)}" class="${re}"${J?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(C,j,L,B="")=>{let z=mr(B),F=Xs(j,v),X=F!==void 0&&F===L,G=z.match(/class=['"]([^'"]+)['"]/i),J=G?G[1]:k.checkInput,ne=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Ft(j)}"${zr(z,`${wn(j)}-${wn(L)}`)} value="${Ft(L)}" class="${J}"${X?" checked":""}${ne?` ${ne}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(C,j,L="")=>{let B=mr(L),z=B.match(/accept=['"]([^'"]+)['"]/i),F=z?z[1]:"",X=B.includes("multiple"),G=Zs(j,v),J=B.match(/class=['"]([^'"]+)['"]/i),ne=Eo(J?J[1]:"",k.input,G,k.inputError),re=B.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Ft(j)}"${zr(B,wn(j))}`,`class="${ne}"`];if(F)se.push(`accept="${Ft(F)}"`);if(X)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(C,j,L="",B)=>{let z=mr(L),F=z.match(/class=['"]([^'"]+)['"]/i),X=F?F[1]:k.label,G=z.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Ft(wn(j))}" class="${X}"${G?` ${G}`:""}>${B}</label>`}),E}function jf(x,v,k=Of){return x.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,C,j)=>{try{if(Zs(C,v)){let L=j.replace(/\{\{([^}]+)\}\}/g,(B,z)=>{try{if(z.trim()==="$message"||z.trim()==="message")return Mf(C,v);if(z.trim().includes("errors.first")||z.trim().includes("$errors.first")){if(typeof v.errors?.first==="function")return v.errors.first(C);return Mf(C,v)}let F=z.trim();if(p(F)){let X=c(F,v);return X!==void 0?String(X):F}return F}catch{return z}});return`<div id="${Ft(`${wn(C)}-error`)}" role="alert">${L}</div>`}return""}catch(L){return console.error("Error processing @error directive:",L),E}})}function Zs(x,v){if(!v.errors)return!1;if(typeof v.errors.has==="function")return v.errors.has(x);if(typeof v.errors==="object")return Object.prototype.hasOwnProperty.call(v.errors,x);return!1}function Mf(x,v){if(!v.errors)return"";if(typeof v.errors.get==="function")return v.errors.get(x);if(typeof v.errors==="object"&&Object.prototype.hasOwnProperty.call(v.errors,x)){let k=v.errors[x];return Array.isArray(k)?k[0]:String(k)}return""}function Xs(x,v){let k;if(v.old&&typeof v.old==="function")return v.old(x);if(v.old&&typeof v.old==="object")return v.old[x];if(x.endsWith("[]")){let E=x.slice(0,-2);if(k=v[E],k!==void 0)return k}return v[x]}function mr(x){if(!x.trim())return"";let v=[],k=x.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,C;while((C=E.exec(k))!==null){let[,j,,L]=C;v.push(`${j}="${L.trim()}"`)}return v.join(" ")}var Gs=/<\/?template\b[^>]*>/gi,Tx=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Ax(x){let v=x.replace(/^<template\b/i,"").replace(/>$/,"");return Tx.test(v)}function Z(x){Gs.lastIndex=0;let v;while((v=Gs.exec(x))!==null){if(v[0].startsWith("</")||Ax(v[0]))continue;let k=v.index,E=Gs.lastIndex,C=1,j;while((j=Gs.exec(x))!==null)if(j[0].startsWith("</")){if(C--,C===0){let L=j.index;return{start:k,openEnd:E,closeStart:L,end:Gs.lastIndex,content:x.slice(E,L)}}}else C++;return null}return null}import Ot from"path";import{existsSync as Cb}from"fs";import Ro from"fs";import Lt from"path";var Lf=new Map;function To(x,v=!0){let k=Lf.get(x);if(v&&k)return k;let E=new Map,C=[Lt.join(x,"src"),Lt.join(x,"dist"),x];function j(L,B){if(B>6)return;let z;try{z=Ro.readdirSync(L,{withFileTypes:!0})}catch{return}for(let F of z){let X=Lt.join(L,F.name);if(F.isDirectory()){if(F.name==="node_modules"||F.name.startsWith("."))continue;j(X,B+1)}else if(F.isFile()&&F.name.endsWith(".stx")){let G=F.name.slice(0,-4);if(!E.has(G))E.set(G,X);let J=G.toLowerCase();if(!E.has(J))E.set(J,X);let ne=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(ne))E.set(ne,X)}}}for(let L of C)if(j(L,0),E.size>0)break;if(v)Lf.set(x,E);return E}function Ao(x,v){if(x.startsWith(".")||x.startsWith("/"))return null;let k=v;while(!0){let E=Lt.join(k,"node_modules",x);try{if(Ro.statSync(E).isDirectory())return E}catch{}let C=Lt.dirname(k);if(C===k)return null;k=C}}function Io(x,v,k={}){return[Lt.resolve(Lt.dirname(v),`${x}.stx`),Lt.resolve(Lt.dirname(v),x),Lt.resolve(k.componentsDir||"components",`${x}.stx`),Lt.resolve(k.componentsDir||"components",x),x.endsWith(".stx")?x:`${x}.stx`]}function Bf(x){let v=x.endsWith(".stx")?x.slice(0,-4):x,k=v.split("-").map((C)=>C.charAt(0).toUpperCase()+C.slice(1)).join(""),E=v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[v,k,E]}function qc(x,v){let[k,E,C]=Bf(x);for(let j of[k,k.toLowerCase(),E,C]){let L=v?.__importedComponents?.get(j);if(L!==void 0)return L}}function*Kc(x,v,k={},E){let C=Bf(x);if(C[0].startsWith("./")||C[0].startsWith("../")){yield Lt.resolve(Lt.dirname(v),`${C[0]}.stx`);return}let j=[...new Set(C.map((z)=>`${z}.stx`))],L=k.projectRoot||process.cwd(),B=[...E?.__originalFilePath?[Lt.join(Lt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Lt.join(Lt.dirname(v),"components"),Lt.resolve(L,"src/components"),Lt.resolve(L,"components"),...import.meta.dir?[Lt.resolve(import.meta.dir,"components")]:[]];for(let z of new Set(B)){for(let F of j)yield Lt.join(z,F);try{for(let F of Ro.readdirSync(z,{withFileTypes:!0}))if(F.isDirectory())for(let X of j)yield Lt.join(z,F.name,X)}catch{}}}function zf(x,v,k={},E){let C=qc(x,E);if(C!==void 0)return C;for(let j of Kc(x,v,k,E))try{if(Ro.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class Ff{builtins=new Map;registerBuiltin(x){this.builtins.set(x.name.toLowerCase(),x);for(let v of x.aliases)this.builtins.set(v.toLowerCase(),x)}isBuiltin(x){return this.builtins.has(x.toLowerCase())}getBuiltin(x){return this.builtins.get(x.toLowerCase())??null}async resolveFile(x,v,k,E){let C=qc(x,E);if(C!==void 0)return C;for(let j of Kc(x,v,k,E))if(await n(j))return j;return null}}var Fr=new Ff;function Vt(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Er="\x00stx-boolean-attribute";function Xc(x){return x.indexOf("\x00")===-1?x:x.replace(/\0/g,"")}function gs(x,v){let k=[];for(let[E,C]of Object.entries(x.static)){if(v.has(E))continue;let j=x.staticNames?.[E]??E;if(typeof C==="boolean"){if(C)k.push(Vt(j));continue}if(C===Er){k.push(Vt(j));continue}k.push(`${Vt(j)}="${Vt(Xc(String(C)))}"`)}return k}function hs(x,v){let k=[];for(let[E,C]of Object.entries(x.serverDynamic??{})){if(v.has(E))continue;if(C===null||C===void 0||C===!1)continue;let j=x.serverDynamicNames?.[E]??E;if(C===!0){k.push(Vt(j));continue}if(typeof C==="object")continue;k.push(`${Vt(j)}="${Vt(Xc(String(C)))}"`)}return k}function _s(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ix(x){if(x.clientReactive.to)return{value:x.clientReactive.to,reactive:!0};if(x.serverDynamic.to!==void 0)return{value:String(x.serverDynamic.to),reactive:!1};if(typeof x.static.to==="string")return{value:x.static.to,reactive:!1};return{value:"#",reactive:!1}}var Zc={name:"StxLink",aliases:["stx-link"],render(x,v,k){let E=Ix(x),C=(typeof x.static.class==="string"?x.static.class:"")||(typeof x.static.className==="string"?x.static.className:""),j=typeof x.static.activeClass==="string"?x.static.activeClass:"active",L=typeof x.static.exactActiveClass==="string"?x.static.exactActiveClass:"exact-active",B=x.static.prefetch===!0||x.static.prefetch==="true"||x.serverDynamic.prefetch===!0,z=[];if(E.reactive)z.push(`:href="${_s(E.value)}"`);else z.push(`href="${_s(js(E.value,"navigable"))}"`);if(C)z.push(`class="${_s(C)}"`);if(z.push("data-stx-link"),z.push(`data-stx-active-class="${_s(j)}"`),z.push(`data-stx-exact-active-class="${_s(L)}"`),B)z.push("data-stx-prefetch");let F=typeof x.static.activeMatch==="string"?x.static.activeMatch.trim():"";if(F)z.push(`data-stx-active-match="${_s(F)}"`);let X=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return z.push(...gs(x,X)),z.push(...hs(x,X)),`<a ${z.join(" ")}>${v}</a>`}};import{createHash as Qf}from"crypto";import fn from"fs";import Ht from"path";import{decode as Bx,generateThumbHash as zx}from"ts-images";import{createImageDeliveryCatalog as Kf}from"ts-images/delivery";import Gc from"fs";function Po(x,v,k){let E=Buffer.alloc(k),C=Gc.readSync(x,E,0,k,v);return E.subarray(0,C)}function Jc(x){if(x.length<25)return!1;let v=(E,C)=>String.fromCharCode(...x.subarray(E,C));if(v(0,4)!=="RIFF"||v(8,12)!=="WEBP")return!1;let k=v(12,16);if(k==="VP8X")return(x[20]&16)!==0;if(k==="VP8L")return((x[21]|x[22]<<8|x[23]<<16|x[24]<<24)>>>28&1)===1;return!1}function Yc(x){let v;try{v=Gc.openSync(x,"r");let k=Po(v,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 E=k[25];if(E===4||E===6)return"possible";let C=8;for(let j=0;j<64;j++){let L=Po(v,C,8);if(L.length<8)return"unknown";let B=L.toString("latin1",4,8);if(B==="tRNS")return"possible";if(B==="IDAT"||B==="IEND")return"none";C+=12+L.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Jc(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(v!==void 0)Gc.closeSync(v)}}import Px from"fs";import Do from"os";import{join as Wf}from"path";import{fileURLToPath as Vf}from"url";import{Worker as Uf}from"worker_threads";var Oo=Symbol("stx.image-worker.unavailable");function Dx(x=typeof Do.availableParallelism==="function"?Do.availableParallelism():Do.cpus().length){return Math.max(1,Math.min(2,x-1))}var Mo=0,qf=[];async function Mx(){if(Mo<Dx()){Mo++;return}await new Promise((x)=>qf.push(x)),Mo++}function Ox(){Mo--,qf.shift()?.()}var Nx="@stacksjs/stx/builtins/image-warmup-worker";function jx(x=process.cwd()){let v=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${v}`,import.meta.url);if(k.protocol==="file:"&&Px.existsSync(Vf(k)))return Vf(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Nx,x):void 0;return k&&Lx(k)?k:void 0}catch{return}}function Lx(x,v=process.env){let k=x.replace(/\\/g,"/");if(k.split("/").some((C)=>/@\d[^/]*@@@\d+$/.test(C)))return!1;return![v.BUN_INSTALL_CACHE_DIR,Wf(v.BUN_INSTALL||Wf(Do.homedir(),".bun"),"install","cache")].filter((C)=>!!C).map((C)=>`${C.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((C)=>k.startsWith(C))}var Hf=!1;function Js(x){if(!Hf)Hf=!0,console.warn(`[stx] image worker unavailable (${x}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Oo}function Qc(x){return x instanceof Error?x.message:String(x)}async function el(x,v){if(typeof Uf!=="function")return Js("node:worker_threads has no Worker in this runtime");let k=jx();if(!k)return Js("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Mx();try{return await new Promise((E,C)=>{let j;try{j=new Uf(k)}catch(F){E(Js(`could not start ${k}: ${Qc(F)}`));return}let L=!1,B=!1,z=(F)=>{if(B)return;B=!0,F(),j.terminate()};j.on("message",(F)=>{if(F.type==="ready"){L=!0,j.postMessage({task:x,args:v});return}if(F.type==="result"){z(()=>E(F.value));return}let X=Error(F.error?.message??"image worker failed");if(F.error?.name)X.name=F.error.name;if(F.error?.stack)X.stack=F.error.stack;z(()=>C(X))}),j.on("error",(F)=>{z(()=>L?C(F instanceof Error?F:Error(Qc(F)||"image worker crashed")):E(Js(`the worker failed before it was ready: ${Qc(F)}`)))}),j.on("exit",(F)=>{z(()=>L?C(Error("image worker exited before it finished")):E(Js(`the worker exited with code ${F} before it was ready`)))})})}finally{Ox()}}var Fx=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Wx=[320,640,960,1280,1920],jo="/_stx/images",Vx=`stx:${jo}:alpha-1`,Ux=["@stacksjs/ts-webp","@stacksjs/ts-avif"],No;function Hx(x,v){let k=Ht.dirname(Bun.resolveSync(x,v));while(k!==Ht.dirname(k)){let E=Ht.join(k,"package.json");if(fn.existsSync(E)){let C=JSON.parse(fn.readFileSync(E,"utf8"));if(C.name===x)return C.version}k=Ht.dirname(k)}return}function qx(){if(No!==void 0)return No;let x;try{x=Ht.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return No=Ux.map((v)=>{let k;try{k=x?Hx(v,x):void 0}catch{}return`${v.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),No}var Xf=Symbol.for("stx.image-delivery");function Ys(){let x=globalThis;return x[Xf]??={catalog:new Map,transparent:new Set},x[Xf]}var Zf=new Set;function Kx(x){return`/${x.split(Ht.sep).map(encodeURIComponent).join("/")}`}function Xx(x){let v=Ht.extname(x),k=x.slice(0,-v.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=Qf("sha256").update(x).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function Gf(x,v=`stx:${jo}`){let k=(E)=>`${jo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:v,async stat(E){let C=Ht.join(x,E);try{let j=await fn.promises.stat(C);return j.size>0?{bytes:j.size,path:C,url:k(E)}:null}catch{return null}},async write(E,C){let j=Ht.join(x,E);await fn.promises.mkdir(Ht.dirname(j),{recursive:!0});let L=`${j}.${process.pid}.tmp`;return await fn.promises.writeFile(L,C),await fn.promises.rename(L,j),{bytes:C.byteLength,path:j,url:k(E)}},url:k}}async function ep(x,v=x){let k=await fn.promises.readdir(v,{withFileTypes:!0});k.sort((C,j)=>C.name.localeCompare(j.name));let E=[];for(let C of k){let j=Ht.join(v,C.name);if(C.isDirectory()){E.push(...await ep(x,j));continue}if(!C.isFile()||!Fx.has(Ht.extname(C.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ht.relative(x,j)})}return E}function Jf(x,v){return x.map((k)=>({key:Kx(k.relativePath),input:k.absolutePath,name:Xx(k.relativePath),...Zx(k.absolutePath)?{options:{storage:v}}:{}}))}function Zx(x){return Yc(x)==="possible"}function Gx(x){for(let v=3;v<x.length;v+=4)if(x[v]!==255)return!0;return!1}async function Jx(x){let v=Object.entries(x).filter(([,C])=>C.fallback.format==="png"),k=new Set,E=8;for(let C=0;C<v.length;C+=8)await Promise.all(v.slice(C,C+8).map(async([j,L])=>{let B=L.variants.filter((z)=>z.format==="png").sort((z,F)=>z.width-F.width)[0];try{let z=await Bx(new Uint8Array(await fn.promises.readFile(B?.path??L.fallback.path)));if(Gx(z.data))k.add(j)}catch{k.add(j)}}));return k}function Yx(x,v){let k=[];for(let E of v){let C=x[E],j=C?.variants.filter((B)=>B.format==="webp")??[];if(!C||j.length===0)continue;if(!j.some((B)=>{let z;try{return z=fn.openSync(B.path,"r"),!Jc(Po(z,0,32))}catch{return!0}finally{if(z!==void 0)fn.closeSync(z)}}))continue;if(C.variants=C.variants.filter((B)=>B.format!=="webp"),delete C.sources.webp,k.push(E),!Zf.has(E))Zf.add(E),console.warn(`[stx-images] ${E} 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 Qx(x){let v=[],k=8;for(let E=0;E<x.length;E+=8){let C=x.slice(E,E+8),j=await Promise.all(C.map(async(L)=>{try{return await zx(L.absolutePath),L}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${L.relativePath}`),null}}));v.push(...j.filter((L)=>L!==null))}return v}function tl(x){return Ht.join(x,"undecodable.json")}function eb(x){try{let v=fn.readFileSync(tl(x),"utf-8"),k=JSON.parse(v);return k&&typeof k==="object"?k:{}}catch{return{}}}function tb(x,v){try{fn.mkdirSync(Ht.dirname(tl(x)),{recursive:!0}),fn.writeFileSync(tl(x),JSON.stringify(v))}catch{}}function Yf(x){try{let v=fn.statSync(x);return{mtimeMs:v.mtimeMs,size:v.size}}catch{return}}function tp(x){if(!x||x.startsWith("data:")||x.startsWith("blob:")||/^https?:\/\//i.test(x)||x.startsWith("//"))return;let v=x.split(/[?#]/,1)[0];if(!v)return;try{return`/${v.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Kr(x){let v=tp(x);return v?Ys().catalog.get(v):void 0}function Xr(x){let v=tp(x);return v?Ys().transparent.has(v):!1}function Gr(x){let v=(E)=>x.variants.filter((C)=>C.format===E).reduce((C,j)=>C+j.bytes,0),k=v(x.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:x.sources[E]||"",bytes:v(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,C)=>E.bytes-C.bytes).map(({format:E,srcset:C})=>({format:E,srcset:C}))}function Ru(x){let v=Kr(x);if(!v)return;return{src:v.fallback.url,srcset:v.sources[v.fallback.format]||"",sources:Gr(v).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:v.source.width,height:v.source.height,placeholder:Xr(x)?void 0:v.placeholder?.dataUrl}}function Nn(){let x=Ys();x.catalog=new Map,x.transparent=new Set}function nb(x){let v=Ys();v.catalog=new Map(x.entries),v.transparent=new Set(x.transparent)}async function Au(x,v,k={}){if(!x||!fn.existsSync(x))return Nn(),{count:0,fingerprint:""};if(k.offThread){let re=await el("delivery",{publicDir:x,outputDir:v});if(re!==Oo)return nb(re.state),re.result}let E=await ep(x);if(E.length===0)return Nn(),{count:0,fingerprint:""};let C=eb(v),j=E.filter((re)=>{let se=C[re.relativePath];if(!se)return!0;let oe=Yf(re.absolutePath);return!oe||oe.mtimeMs!==se.mtimeMs||oe.size!==se.size});if(j.length===0)return Nn(),{count:0,fingerprint:""};let L=Gf(Ht.join(v,"_stx","images"),`${Vx}:${qx()}`),B={outDir:Ht.join(v,"_stx","images"),storage:Gf(Ht.join(v,"_stx","images")),baseUrl:jo,widths:Wx,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},z=j,F;try{F=await Kf({...B,entries:Jf(j,L)})}catch(re){if(z=await Qx(j),z.length===j.length)throw re;let se=new Set(z.map((ie)=>ie.relativePath)),oe=!1;for(let ie of j){if(se.has(ie.relativePath))continue;let ge=Yf(ie.absolutePath);if(!ge)continue;C[ie.relativePath]=ge,oe=!0}if(oe)tb(v,C);if(z.length===0)return Nn(),{count:0,fingerprint:""};F=await Kf({...B,entries:Jf(z,L)})}let X=await Jx(F.entries),G=Yx(F.entries,X),J=Ys();J.catalog=new Map(Object.entries(F.entries)),J.transparent=X;let ne=X.size===0&&G.length===0?F.fingerprint:Qf("sha256").update(F.fingerprint).update(JSON.stringify({transparent:[...X].sort(),droppedWebp:G.sort()})).digest("hex");return{count:z.length,fingerprint:ne}}var rb=new Map;function nl(x){if(!x)return;let v=x.split("?")[0].split("#")[0];return rb.get(v)}var sb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},rl=[320,640,768,1024,1280,1536,1920];function Bt(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Xt(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}function Lo(x,v,k=!1){let E=x.serverDynamic[v];if(E!==void 0)return E!==!1&&E!=="false";let C=x.static[v];if(C!==void 0)return C!=="false"&&C!==!1;return k}function sl(x){if(x.includes("(")||x.includes(","))return x;let v=x.trim().split(/\s+/),k=[];for(let E of v)if(E.includes(":")){let[C,j]=E.split(":"),L=sb[C];if(L)k.push(`(max-width: ${L}px) ${j}`);else{let B=Number.parseInt(C);if(!Number.isNaN(B))k.push(`(max-width: ${B}px) ${j}`)}}else k.push(E);return k.join(", ")}function il(x,v,k,E){return v.map((C)=>`${Qs(x,C,void 0,k,E)} ${C}w`).join(", ")}function ib(x,v,k,E,C){return v.map((j)=>{let L=k?k*j:void 0;return`${Qs(x,L,void 0,E,C)} ${j}x`}).join(", ")}function Qs(x,v,k,E,C){if(!E||E==="local"||E==="static")return x;if(E==="cloudinary"){let j=[];if(v)j.push(`w_${v}`);if(k)j.push(`h_${k}`);if(C)j.push(`f_${C}`);j.push("q_auto");let L=j.join(",");return x.replace("/upload/",`/upload/${L}/`)}if(E==="imgix"){let j=new URLSearchParams;if(v)j.set("w",String(v));if(k)j.set("h",String(k));if(C)j.set("fm",C);j.set("auto","format");let L=x.includes("?")?"&":"?";return`${x}${L}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(v)j.set("width",String(v));if(k)j.set("height",String(k));if(C)j.set("format",C);let L=x.includes("?")?"&":"?";return`${x}${L}${j.toString()}`}return x}function ob(x){return`var s=this.style;${x.map((v)=>`s.${v}=''`).join(";")}`}function ab(x,v,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${x}" height="${v}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var ol={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(x,v,k){let E=Xt(x,"src")||"",C=Kr(E),j=Xt(x,"alt")||"",L=Xt(x,"width")||(C?String(C.source.width):void 0),B=Xt(x,"height")||(C?String(C.source.height):void 0),z=Xt(x,"sizes"),F=Xt(x,"srcset"),X=Xt(x,"densities"),G=Xt(x,"format"),J=Xr(E)||nl(E)?.transparent===!0,ne=Xt(x,"placeholder")||(C&&!J?"thumbhash":void 0),re=Xt(x,"placeholderColor")||"#e5e7eb",se=Xt(x,"provider"),oe=Xt(x,"class")||Xt(x,"className")||"",ie=Xt(x,"style")||"",ge=Xt(x,"quality"),ue=Lo(x,"lazy",!0),xe=Lo(x,"preload",!1),we=Lo(x,"priority",!1),$e=Xt(x,"loading"),_e=Xt(x,"decoding")||"async",Ce=!!C||Lo(x,"picture",!1)||!!G,Ee=L?Number.parseInt(L):void 0,Te=B?Number.parseInt(B):void 0,Re=F||"",ke="";if(C)Re=C.sources[C.fallback.format]||"",ke=z?sl(z):"100vw";else if(!Re&&z&&se&&se!=="local"&&se!=="static")Re=il(E,rl,se,G),ke=sl(z);else if(!Re&&X){let ft=X.split(/\s+/).map((_t)=>Number.parseFloat(_t.replace("x","")));Re=ib(E,ft,Ee,se,G)}else if(z)ke=sl(z);let Ae=[];if(ie)Ae.push(ie);if(Ee&&Te)Ae.push(`aspect-ratio:${Ee}/${Te}`);let Ze=[],Pe=ne==="blur"||ne==="color"||ne==="thumbhash";if(Pe&&!J){let ft=C?.placeholder?{dataUrl:C.placeholder.dataUrl,color:re}:nl(E);if(ft&&ne==="color")Ae.push(`background-color:${ft.color}`),Ze.push("backgroundColor");else if(ft)Ae.push(`background-color:${ft.color}`),Ae.push(`background-image:url(${ft.dataUrl})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Ze.push("backgroundColor","backgroundImage");else{let _t=ab(Ee||16,Te||9,re);Ae.push(`background-image:url(${_t})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Ze.push("backgroundImage")}}else if(!Pe&&ne&&ne!=="empty"&&ne!=="none")Ae.push(`background-image:url(${Bt(ne)})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Ze.push("backgroundImage");let Ie=C?.fallback.url||Qs(E,Ee,Te,se,G),Ge=[];if(Ge.push(`src="${Bt(js(Ie,"fetched"))}"`),Ge.push(`alt="${Bt(j)}"`),L)Ge.push(`width="${Bt(L)}"`);if(B)Ge.push(`height="${Bt(B)}"`);let nt=$e||(we||xe?"eager":ue?"lazy":"");if(nt)Ge.push(`loading="${Bt(nt)}"`);if(we)Ge.push('fetchpriority="high"');if(Ge.push(`decoding="${Bt(_e)}"`),oe)Ge.push(`class="${Bt(oe)}"`);if(Ae.length>0)Ge.push(`style="${Bt(Ae.join(";"))}"`);if(Re)Ge.push(`srcset="${Bt(js(Re,"fetched"))}"`);if(ke)Ge.push(`sizes="${Bt(ke)}"`);let at=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ze.length>0){let ft=typeof x.static.onload==="string"?x.static.onload:"",_t=ob(Ze)+(ft?`;${ft}`:"");Ge.push(`onload="${Bt(_t)}"`),at.add("onload")}Ge.push(...gs(x,at)),Ge.push(...hs(x,at));let rt=`<img ${Ge.join(" ")} />`,Et="";if(xe){let _t=G==="webp"?"image/webp":G==="avif"?"image/avif":"";Et=`<link rel="preload" as="image" href="${Bt(Ie)}"${_t?` type="${_t}"`:""}${Re?` imagesrcset="${Bt(Re)}"`:""}${ke?` imagesizes="${Bt(ke)}"`:""} />
|
|
2296
|
+
`}if(Ce){let ft=[];if(C)for(let _t of Gr(C))ft.push(`<source type="image/${_t.format}" srcset="${Bt(_t.srcset)}"${ke?` sizes="${Bt(ke)}"`:""} />`);if(!C&&(G==="avif"||G==="auto")){let _t=Qs(E,Ee,Te,se,"avif"),ct=Re?il(E,rl,se,"avif"):`${_t}`;ft.push(`<source type="image/avif" srcset="${Bt(ct)}"${ke?` sizes="${Bt(ke)}"`:""} />`)}if(!C&&(G==="webp"||G==="auto")){let _t=Qs(E,Ee,Te,se,"webp"),ct=Re?il(E,rl,se,"webp"):`${_t}`;ft.push(`<source type="image/webp" srcset="${Bt(ct)}"${ke?` sizes="${Bt(ke)}"`:""} />`)}return`${Et}<picture>
|
|
2297
|
+
${ft.join(`
|
|
2297
2298
|
`)}
|
|
2298
|
-
${
|
|
2299
|
-
</picture>`}return`${
|
|
2299
|
+
${rt}
|
|
2300
|
+
</picture>`}return`${Et}${rt}`}};var np="/images/safe-image-default.svg";function ei(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Es(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}var cb=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${np}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,al={name:"SafeImage",aliases:["safe-image","safe-img"],render(x,v,k){let E=Es(x,"src")||"",C=Es(x,"alt")||"",j=Es(x,"fallback")||np,L=Es(x,"class")||Es(x,"className")||"",B=Es(x,"fallbackClassName")||"",z=[];if(z.push(`src="${ei(E)}"`),z.push(`alt="${ei(C)}"`),L)z.push(`class="${ei(L)}"`);if(z.push(`data-fallback="${ei(j)}"`),B)z.push(`data-fallback-class="${ei(B)}"`);z.push('onerror="window.__stxSafeImageHandler(this)"');let F=new Set(["src","alt","fallback","class","className","fallbackClassName"]);z.push(...gs(x,F)),z.push(...hs(x,F));let X=`<img ${z.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${cb}${X}`;return X}};function cl(x){return x.replace(/[;{}()]/g,"").replace(/url/gi,"")}function ti(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}function Bo(x,v,k){let E=ti(x,v);if(E!==void 0){let C=Number.parseInt(E,10);if(!Number.isNaN(C))return C}return k}var ll={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(x,v,k){let E=cl(ti(x,"color")||"#6366f1"),C=cl(ti(x,"initialColor")||ti(x,"initial-color")||""),j=cl(ti(x,"height")||"3px"),L=Bo(x,"duration",2000),B=Bo(x,"throttle",200),z=Bo(x,"zIndex",999999)||Bo(x,"z-index",999999),F=C?`linear-gradient(to right, ${C}, ${E})`:E;return`
|
|
2300
2301
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${j};background:${F};z-index:${z};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
2301
2302
|
<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>
|
|
2302
2303
|
</div>
|
|
2303
2304
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
2304
2305
|
<script>
|
|
2305
2306
|
(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)},${B})},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()})})();
|
|
2306
|
-
</script>`}};function
|
|
2307
|
+
</script>`}};function sp(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}function lb(x,v,k){let E=sp(x,v);if(E!==void 0){let C=Number.parseInt(E,10);if(!Number.isNaN(C))return C}return k}var rp={"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%)"},ul={name:"StxToast",aliases:["stx-toast"],render(x,v,k){let E=Vt(sp(x,"position")||"top-right"),C=lb(x,"max",5),j=rp[E]||rp["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${E}" data-stx-toast-max="${C}" style="position:fixed;${j};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
2307
2308
|
<style>
|
|
2308
2309
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
2309
2310
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -2311,7 +2312,7 @@ ${nt}
|
|
|
2311
2312
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
2312
2313
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
2313
2314
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
2314
|
-
</style>`}};function
|
|
2315
|
+
</style>`}};function zo(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}var ip={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)"},dl={name:"StxModal",aliases:["stx-modal"],render(x,v,k){let E=zo(x,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let C=Vt(E),j=zo(x,"size")||"md",L=zo(x,"closeOnBackdrop")!=="false",B=zo(x,"closeOnEscape")!=="false",z=ip[j]||ip.md;return`<div id="stx-modal-${C}" class="stx-modal-backdrop" data-stx-modal="${C}" data-close-backdrop="${L}" data-close-escape="${B}" 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">
|
|
2315
2316
|
<div class="stx-modal-panel" style="${z};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)">
|
|
2316
2317
|
<div style="padding:1.5rem">${v}</div>
|
|
2317
2318
|
</div>
|
|
@@ -2320,8 +2321,8 @@ ${nt}
|
|
|
2320
2321
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2321
2322
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2322
2323
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2323
|
-
</style>`}};function
|
|
2324
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${J};width:${
|
|
2324
|
+
</style>`}};function Rs(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);let k=x.static[v];if(typeof k==="string")return k;return}var op={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},fl={name:"StxDrawer",aliases:["stx-drawer"],render(x,v,k){let E=Rs(x,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let C=Vt(E),j=Rs(x,"side")||"right",L=Rs(x,"size")||"md",B=Rs(x,"closeOnBackdrop")!=="false",z=Rs(x,"closeOnEscape")!=="false",F=Rs(x,"overlay")!=="false",X=op[L]||op.md,G=j==="left",J=G?"left:0":"right:0",ne=G?"translateX(-100%)":"translateX(100%)",re=G?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${C}" class="stx-drawer-backdrop" data-stx-drawer="${C}" data-close-backdrop="${B}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;${F?"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">
|
|
2325
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${J};width:${X};max-width:100vw;transform:${ne};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">
|
|
2325
2326
|
<div style="padding:1.5rem">${v}</div>
|
|
2326
2327
|
</div>
|
|
2327
2328
|
</div>
|
|
@@ -2329,7 +2330,7 @@ ${nt}
|
|
|
2329
2330
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2330
2331
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2331
2332
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2332
|
-
</style>`}};import{existsSync as
|
|
2333
|
+
</style>`}};import{existsSync as ub,readFileSync as db}from"fs";var Fo=new Map,ap=new Set;function fb(x){if(ap.has(x))return;ap.add(x),console.warn(`[stx] icon collection "${x}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${x}\`.`)}function pb(x){let v=process.cwd();for(let k of[`${v}/node_modules/@iconify-json/${x}/icons.json`,`${v}/pantry/@iconify-json/${x}/icons.json`,`${v}/node_modules/@iconify/json/json/${x}.json`,`${v}/pantry/@iconify/json/json/${x}.json`])if(ub(k))return k;for(let k of[`@iconify-json/${x}/icons.json`,`@iconify/json/json/${x}.json`])try{return u.resolve(k)}catch{}return null}function gb(x){if(Fo.has(x))return Fo.get(x);let v=pb(x);if(!v)return fb(x),null;try{let k=JSON.parse(db(v,"utf8"));return Fo.set(x,k.icons),k.icons}catch{return null}}function As(x,v){if(x.serverDynamic[v]!==void 0)return String(x.serverDynamic[v]);if(x.static[v]!==void 0)return String(x.static[v]);if(x.clientReactive[v]!==void 0)return x.clientReactive[v];return}var pl={name:"Icon",aliases:["icon","stx-icon"],render(x,v,k){let E=As(x,"name")??As(x,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let C="lucide",j=E;if(E.includes(":")){let ge=E.split(":");C=ge[0],j=ge[1]}let L=Vt(As(x,"size")||"24"),B=Vt(As(x,"color")||"currentColor"),z=Vt(As(x,"class")||""),F=Vt(As(x,"style")||""),X=Fo.get(C)??gb(C);if(!X)return`<!-- Icon: collection "${C}" not loaded -->`;let G=X[j];if(!G)return`<!-- Icon: "${j}" not found in ${C} -->`;let J=G.width||24,ne=G.height||24,re=`0 0 ${J} ${ne}`,se=G.body;if(B!=="currentColor")se=se.replace(/currentColor/g,B);let oe=z?` class="${z}"`:"",ie=F?` style="${F}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${L}" height="${L}" viewBox="${re}" fill="none"${oe}${ie}>${se}</svg>`}};function gl(){return`
|
|
2333
2334
|
(function(){
|
|
2334
2335
|
var tip=null,hideTimer=null,currentEl=null;
|
|
2335
2336
|
|
|
@@ -2432,18 +2433,18 @@ document.addEventListener("focusout",function(e){
|
|
|
2432
2433
|
if(el) hideTip();
|
|
2433
2434
|
});
|
|
2434
2435
|
})();
|
|
2435
|
-
`}function
|
|
2436
|
-
`||ke==="\t")fe++;ue=$e+oe.length}else{if(fe--,fe===0){be=Ee;break}ue=Ee+ie.length}}if(be===-1){C=ne;continue}let we=x.slice(ne,be),Se=be+ie.length;E.push({fullMatch:x.slice(L,Se),tagName:F,attributes:se,content:we,startIndex:L,endIndex:Se,isSelfClosing:!1}),C=Se}}return E}function dp(x){return x.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function fp(x,v){try{let k=Buffer.from(x,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=x.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(k)}catch(k){if(v?.debug)console.error("Error decoding __stx_ prop:",k);return x}}function gl(x,v){let k=0,E="",C=v;while(C<x.length){let j=x[C];if(E){if(j==="\\")C++;else if(j===E)E=""}else if(j==='"'||j==="'"||j==="`")E=j;else if(j==="{")k++;else if(j==="}"){if(k--,k===0)return x.slice(v,C+1)}C++}return x.slice(v)}function pp(x){let v=x.trim();if(!v.startsWith("{")||!v.endsWith("}"))return null;if(gl(v,0).length!==v.length)return null;return v.slice(1,-1).trim()}var fb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),pb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ml(x){let v=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(x))!==null){let C=E[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(C))continue;let j=E.index,L=j+E[0].length,B=E[1].toLowerCase();if(E[0].endsWith("/>")||pb.has(B)){v.push([j,L]);continue}let z=B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`<\\/?${z}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");F.lastIndex=L;let K=1,G=L,J;while((J=F.exec(x))!==null)if(J[0].startsWith("</")){if(K--,K===0){G=J.index+J[0].length;break}}else if(!J[0].endsWith("/>"))K++;v.push([j,G])}return v}function gp(x){if(typeof x==="string")return x;if(Array.isArray(x))return x.filter(Boolean).map((v)=>gp(v)).join(" ");if(x&&typeof x==="object")return Object.entries(x).filter(([,v])=>v).map(([v])=>v).join(" ");return x?String(x):""}function mp(x,v){if(!/:[\w-]+=/.test(x))return x;let k=x,E=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,C=[],j;while((j=E.exec(x))!==null)C.push([j.index,j.index+j[0].length]);C.push(...ml(x));function L(G){return C.some(([J,ne])=>G>=J&&G<ne)}let B=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,z=[],F=new Map,K=256;while((j=B.exec(k))!==null){if(L(j.index))continue;let G=j[0],J=j[2];if(!J||!J.includes(":"))continue;let ne=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,re,se=J,oe=!1;while((re=ne.exec(J))!==null){let ie=re[1],fe=re[2];if(ho(ie))continue;if(fe.includes("()")&&!fe.includes(".get(")||fe.includes("$store")||fe.includes("$ref"))continue;try{let ue=Object.keys(v),be=Object.values(v),we=fe.match(/^([a-zA-Z_$][\w$]*)/);if(we&&!ue.includes(we[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(we[1]))continue;let Se=JSON.stringify([ue,fe]),$e=F.get(Se);if(!$e){if($e=Function(...ue,`return (${fe})`),F.size>=K)F.clear();F.set(Se,$e)}let Ee=$e(...be);if(ie==="class"){let ke=gp(Ee);if(ke){let Re=se.match(/\sclass="([^"]*)"/);if(Re)se=se.replace(Re[0],` class="${Re[1]} ${ke}"`);else se=se.replace(re[0],` class="${ke}"`)}else se=se.replace(re[0],"");oe=!0;continue}if(fb.has(ie)){if(Ee)se=se.replace(re[0],` ${ie}`);else se=se.replace(re[0],"");oe=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)se=se.replace(re[0],"");else{let ke=String(Ee).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");se=se.replace(re[0],` ${ie}="${ke}"`)}oe=!0}catch{continue}}if(oe){let ie=j[3]?" /":"",ue=`<${j[1]}${se}${ie}>`;z.push({start:j.index,end:j.index+G.length,replacement:ue})}}if(z.length>0){let G=Array(z.length*2+1),J=0;for(let ne=0;ne<z.length;ne++){let{start:re,end:se,replacement:oe}=z[ne];G[ne*2]=k.slice(J,re),G[ne*2+1]=oe,J=se}G[z.length*2]=k.slice(J),k=G.join("")}return k}import hp from"fs";import yp from"path";var Qs=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 Qt(x){if(x.includes("-")||x==="component")return!1;if(/^[A-Z]/.test(x))return!/[a-z]/.test(x)&&[...Qs].some((v)=>v.toLowerCase()===x.toLowerCase());return Qs.has(x)||/[A-Z]/.test(x)}var xp=!1;function gb(x,v,k,E=!1){let C={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},j=new Set(Array.isArray(v.__stx_client_signal_names)?v.__stx_client_signal_names:[]),L=(K)=>{if(j.size===0)return!1;let G=s(K),J=G.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&j.has(J))return!0;for(let ne of j){let re=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${re}\\s*\\(`).test(G))return!0}return!1},B=new Set(yo),z=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(G,J)=>J.toUpperCase())},F=(K,G)=>{let J=z(K);if(C.static[J]=G,J!==K)C.staticNames[J]=K};for(let[K,G]of Object.entries(x)){let J=K.startsWith("x-")&&!B.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(J.startsWith("@")){C.events[J]=G;continue}if(J.startsWith("__stx_")){let ne=z(J.slice(6));C.serverDynamic[ne]=fp(G,k);continue}if(J.startsWith(":")){let ne=z(J.slice(1)),re=G===$r?ne:G;if(ne==="if"||ne==="for"||ne==="show"){C.clientReactive[ne]=re;continue}if(E){C.clientReactive[ne]=re;continue}if(L(re)){C.clientReactive[ne]=re;continue}try{if(!p(re)){if(k.debug)console.error(`Unsafe expression in :${ne} binding: ${re}`);C.clientReactive[ne]=re;continue}let se=Object.keys(v),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(ve(re).some((be)=>!oe.has(be)&&!se.includes(be)&&!(be in globalThis))){C.clientReactive[ne]=re;continue}let ue=l(re,se)(...Object.values(v));if(C.serverDynamic[ne]=ue,ne!==J.slice(1)&&C.serverDynamicNames)C.serverDynamicNames[ne]=J.slice(1)}catch{C.clientReactive[ne]=re}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let ne=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ne)try{let re=ne[1];if(p(re)){let oe=l(re,Object.keys(v))(...Object.values(v));F(J,oe!=null?String(oe):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${re}`);F(J,G)}}catch(re){if(k.debug)console.error(`Error evaluating expression for ${J}:`,re);F(J,G)}else{let re=G,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,oe;while((oe=se.exec(G))!==null)try{let ie=oe[1];if(!p(ie)){if(k.debug)console.error(`Unsafe expression in ${J}: ${ie}`);continue}let ue=l(ie,Object.keys(v))(...Object.values(v));re=re.replace(oe[0],String(ue??""))}catch(ie){if(k.debug)console.error(`Error evaluating expression in ${J}:`,ie)}F(J,re)}continue}F(J,G===$r?"true":dp(G))}return C}var mb=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function hb(x,v,k){if(!x.includes("@"))return x;if(!mb.some(([C,j])=>C.test(x)&&x.includes(j)))return x;try{return tr(x,v,k)}catch{return x}}function yb(x){let v={},k=0,E=x.length;while(k<E){while(k<E&&/\s/.test(x[k]))k++;if(k>=E)break;let C="";while(k<E&&!/[\s=]/.test(x[k]))C+=x[k],k++;if(!C)break;while(k<E&&/\s/.test(x[k]))k++;if(k<E&&x[k]==="="){k++;while(k<E&&/\s/.test(x[k]))k++;let j="";if(k<E&&(x[k]==='"'||x[k]==="'")){let L=x[k];k++;while(k<E){let B=x[k];if(B==="\\"&&k+1<E){k++,j+=x[k],k++;continue}if(B===L){k++;break}j+=B,k++}}else if(x[k]==="{"){j=gl(x,k),k+=j.length;let L=pp(j);if(L!==null){v[`:${C}`]=L;continue}}else while(k<E&&!/\s/.test(x[k]))j+=x[k],k++;v[C]=j}else v[C]=$r}return v}function bp(x){return Object.entries(x).map(([v,k])=>k===$r?v:`${v}="${xb(k)}"`).join(" ")}function xb(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function bb(x){let v=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(x))!==null){let C=E[1];if(Lr.isBuiltin(C))v.add(C)}return[...v].sort()}async function Ka(x,v,k,E,C){if(!/import\s/.test(x))return x;if(!v.__importedComponents)v.__importedComponents=new Map;let j=v.__importedComponents,L=yp.dirname(k),B=[],z=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of x.matchAll(z)){let[J,ne,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=re,ie,fe=[];while((ie=se.exec(re))!==null){let[ue,be,we,Se]=ie,$e=null,Ee=null;if(Se.startsWith(".")||Se.startsWith("/")){let Ce=yp.resolve(L,Se);if(Ce.endsWith(".stx"))Ee=Ce;else{let _e=`${Ce}.stx`;try{if(hp.statSync(_e).isFile())Ee=_e}catch{try{if(hp.statSync(Ce).isDirectory())$e=Ce}catch{}}}}else $e=Co(Se,L);if(!$e&&!Ee)continue;let ke=!1,Re=(Ce,_e)=>{j.set(Ce,_e),j.set(Ce.toLowerCase(),_e);let Te=Ce.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Te,_e),C.add(_e)};if(we&&Ee)Re(we,Ee),ke=!0;else if(be){let Ce=be.slice(1,-1).split(",").map((Te)=>Te.trim()).filter(Boolean).map((Te)=>{let Ke=Te.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ke)return{source:Ke[1],local:Ke[2]};return{source:Te,local:Te}}),_e=$e?Eo($e):null;for(let{source:Te,local:Ke}of Ce){let Pe=null;if(Ee)Pe=Ee;else if(_e)Pe=_e.get(Te)??_e.get(Te.toLowerCase())??_e.get(Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Pe)Re(Ke,Pe),ke=!0}}if(ke)fe.push({start:ie.index,end:ie.index+ue.length})}if(fe.length===0)continue;for(let ue=fe.length-1;ue>=0;ue--)oe=oe.slice(0,fe[ue].start)+oe.slice(fe[ue].end);B.push({start:G.index,end:G.index+J.length,value:`<script${ne}>${oe}</script>`})}if(B.length===0)return x;let F=[],K=0;for(let G of B)F.push(x.slice(K,G.start),G.value),K=G.end;return F.push(x.slice(K)),F.join("")}async function vb(x,v,k,E,C){let j=x;if(!v.__importedComponents)v.__importedComponents=new Map;let L=v.__importedComponents,B=/@import\s*\(\s*([^)]+)\s*\)/g,z;while((z=B.exec(j))!==null){let[F,K]=z,G=K.split(",").map((J)=>J.trim().replace(/^['"]|['"]$/g,"")).filter((J)=>J.length>0);for(let J of G){let ne=J.split("/"),se=ne[ne.length-1].replace(/\.stx$/,""),oe=se.includes("-")?se.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ie=null,fe=Ro(J,k,E);for(let ue of fe)try{if(await Bun.file(ue).exists()){ie=ue;break}}catch{}if(ie){L.set(oe,ie),L.set(se,ie),L.set(se.toLowerCase(),ie);let ue=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(L.set(ue,ie),C.add(ie),E.debug)console.log(`Imported component: ${oe} -> ${ie}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${J}`)}j=j.replace(F,""),B.lastIndex=0}return j}async function wb(x,v,k,E,C){let j=x,L=E.componentsDir||"components";if(!v.__processedComponents)v.__processedComponents=new Set;let B=v.__processedComponents,z=/@component\s*\(/g,F;while((F=z.exec(j))!==null){let K=F.index,G=K+F[0].length-1,J=1,ne=G+1;while(ne<j.length&&J>0){if(j[ne]==="(")J++;else if(j[ne]===")"){if(J--,J===0)break}ne++}if(J!==0)break;let re=j.substring(G+1,ne),se=ne+1,oe=re.match(/^\s*['"]([^'"]+)['"]/);if(!oe){z.lastIndex=0;continue}let ie=oe[1],fe,ue=re.slice(oe[0].length),be=ue.match(/^\s*,\s*/);if(be)fe=ue.slice(be[0].length).trim();let we={};if(fe)try{we=P(fe,v)}catch(Ce){let _e=Ce instanceof Error?Ce.message:String(Ce);j=j.replace(j.substring(K,se),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=se,ke=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(ke)Se=ke[1].trim(),$e=se+ke[0].length;let Re=await Ve(ie,we,Se,L,v,k,E,B,C);j=j.substring(0,K)+Re+j.substring($e),z.lastIndex=0}return j}async function Sb(x,v,k,E,C){if(!x)return x;let j=x,L=E.componentsDir||"components";if(!v.__processedComponents)v.__processedComponents=new Set;let B=v.__processedComponents,z=yn(j);j=z.output;let F=ml(j);return j=await ne(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await ne(j,/[A-Z][a-zA-Z0-9]*/,!0,lp(Qs)),j=await ne(j,/[a-z][a-z0-9]*/,!1,Qs),j=z.restore(j),j;async function ne(re,se,oe,ie){if(!re)return re;let fe=re,ue=up(fe,se,ie),be=new Map;for(let $e=ue.length-1;$e>=0;$e--){let Ee=ue[$e],ke=oe?zo(Ee.tagName):Ee.tagName,Re=yb(hb(Ee.attributes,v,k)),Ce=F.some(([tt,ot])=>Ee.startIndex>=tt&&Ee.startIndex<ot),_e=gb(Re,v,E,Ce),Te=Lr.getBuiltin(Ee.tagName),Ke=Te?await Fn(ke,L,v,k,E):!1;if(Te&&!Ke){let tt={context:v,filePath:k,options:E,dependencies:C},ot=Te.render(_e,Ee.content,tt);if(Object.keys(_e.events).length>0){let nt=bp(_e.events);ot=ot.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${nt}`)}if(Object.keys(_e.clientReactive).length>0)ot=vp(ot,_e.clientReactive);be.set($e,ot);continue}if(!oe&&Ee.tagName.includes("-")&&!await Fn(ke,L,v,k,E))continue;let Pe={};for(let[tt,ot]of Object.entries(_e.static))Pe[tt]=ot;for(let[tt,ot]of Object.entries(_e.serverDynamic))Pe[tt]=ot;let Ze=await Ve(ke,Pe,z.restore(Ee.content),L,v,k,E,B,C);if(Object.keys(_e.events).length>0){let tt=wp(Ze);if(tt){let ot=bp(_e.events),nt=Object.keys(_e.events).map((_t)=>_t.replace(/^@/,"").split(".")[0]).join(" ");Ze=Ze.substring(0,tt.insertPos)+` data-stx-parent-events="${nt}" ${ot}`+Ze.substring(tt.insertPos)}}if(Object.keys(_e.clientReactive).length>0)Ze=vp(Ze,_e.clientReactive);be.set($e,Ze)}if(be.size===0)return fe;let we="",Se=0;for(let $e=0;$e<ue.length;$e++){let Ee=be.get($e);if(Ee===void 0)continue;we+=fe.slice(Se,ue[$e].startIndex),we+=Ee,Se=ue[$e].endIndex}return we+=fe.slice(Se),we}}function vp(x,v){let k=new Set(["if","for"]),E=new Set(["show"]),C=Object.entries(v).filter(([K])=>!k.has(K)),j=C.filter(([K])=>!E.has(K)).map(([K])=>zo(K)).join(" "),L=x,B=C.length>0?wp(L):null;if(B){let K=C.map(([J,ne])=>`:${zo(J)}="${ne.replace(/"/g,""")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";L=L.substring(0,B.insertPos)+`${G} ${K}`+L.substring(B.insertPos)}let z=v.if;if(z)L=`<template :if="${z.replace(/"/g,""")}">${L}</template>`;let F=v.for;if(F)L=`<template :for="${F.replace(/"/g,""")}">${L}</template>`;return L}function wp(x){let v=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(x);if(v)return{insertPos:v.index+1+v[1].length};let k=0;while(k<x.length){let E=x.slice(k),C=E.match(/^\s+/);if(C){k+=C[0].length;continue}if(E.startsWith("<!--")){let B=x.indexOf("-->",k+4);if(B===-1)return null;k=B+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let B=`</${j[1].toLowerCase()}>`,z=x.toLowerCase().indexOf(B,k+j[0].length);if(z===-1)return null;k=z+B.length;continue}let L=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!L)return null;return{insertPos:k+1+L[1].length}}return null}async function Xr(x,v,k,E,C){if(!xp)op(Lr),xp=!0;let j=await Ka(x,v,k,E,C);j=await vb(j,v,k,E,C),j=await wb(j,v,k,E,C);let L=[];for(let B=0;B<3;B++){let z=L.length,F=$n(j,Me,(G,J)=>`\x00STX_COMPONENT_COMMENT_${z+J}\x00`,`STX_COMPONENT_COMMENT:${z}`);L.push(...F.tokens);let K=j;if(j=await Sb(F.output,v,k,E,C),j===K)break}if(L.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(B,z)=>L[Number(z)]??"");if(E.debug){let B=bb(j);if(B.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${B.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function hl(x,v){let k=0;for(let E=v;E<x.length;E++){let C=x[E];if(C==="("||C==="["||C==="{")k++;else if(C===")"||C==="]"||C==="}")k--;else if(C===","&&k===0)return E}return-1}function _b(x,v,k){let E=x,C=new RegExp(`${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=C.exec(E);while(j){let L=j.index,B=L+j[0].length-1,z=1,F=B+1;while(F<E.length&&z>0){if(E[F]==="(")z++;else if(E[F]===")")z--;F++}if(z!==0)break;let K=E.substring(B+1,F-1),G=`${k}(${K})`;E=E.substring(0,L)+G+E.substring(F),C.lastIndex=L+G.length,j=C.exec(E)}return E}function kb(x){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(x)}function kp(x){let v=x,k=[],E=new Set,C=0,j=0,L=v.length,B=(G)=>{j++;while(j<L){if(v[j]==="\\"){j+=2;continue}if(v[j]===G){j++;return}j++}},z=()=>{j++;while(j<L){if(v[j]==="\\"){j+=2;continue}if(v[j]==="`"){j++;return}if(v[j]==="$"&&v[j+1]==="{"){j+=2;let G=1;while(j<L&&G>0)if(v[j]==="{")G++,j++;else if(v[j]==="}")G--,j++;else if(v[j]==="'"||v[j]==='"')B(v[j]);else if(v[j]==="`")z();else j++;continue}j++}},F=()=>{if(v[j]==="/"&&v[j+1]==="/"){while(j<L&&v[j]!==`
|
|
2437
|
-
`)j++;return!0}if(v[j]==="/"&&v[j+1]==="*"){j+=2;while(j<L-1&&!(v[j]==="*"&&v[j+1]==="/"))j++;return j+=2,!0}return!1},
|
|
2436
|
+
`}function cp(x,...v){for(let k of v){if(x.serverDynamic[k]!==void 0)return String(x.serverDynamic[k]);let E=x.static[k];if(typeof E==="string")return E}return}function lp(x,v){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${v}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),E=x.match(k);if(!E)return{region:null,rest:x};return{region:E[2],rest:x.replace(E[0],"")}}var ml={name:"Suspense",aliases:["suspense"],render(x,v,k){let E=lp(v,"fallback"),C=E.rest,j=lp(C,"error"),L=j.rest,B=E.region??cp(x,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',z=j.region??cp(x,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${B}</div><div data-stx-suspense-error hidden>${z}</div><div data-stx-suspense-content hidden>${L}</div></div>`}};function Wo(x,...v){for(let k of v){if(x.serverDynamic[k]!==void 0)return String(x.serverDynamic[k]);let E=x.static[k];if(typeof E==="string")return E}return}var hl={name:"TransitionGroup",aliases:["transition-group"],render(x,v,k){let E=(Wo(x,"name")||"v").replace(/["'<>]/g,""),C=(Wo(x,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=Wo(x,"class"),L=Wo(x,"id"),B=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",L?`id="${L}"`:""].filter(Boolean).join(" ");return`<${C} ${B}>${v}</${C}>`}};function up(x=Fr){x.registerBuiltin(Zc),x.registerBuiltin(ol),x.registerBuiltin(al),x.registerBuiltin(ll),x.registerBuiltin(ul),x.registerBuiltin(dl),x.registerBuiltin(fl),x.registerBuiltin(pl),x.registerBuiltin(ml),x.registerBuiltin(hl)}function Vo(x){return x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var dp=new Map;function mb(x){let v=dp.get(x.source);if(!v)v=new RegExp(`(${x.source})(?![\\w.:-])`,"y"),dp.set(x.source,v);return v}var fp=new WeakMap;function pp(x){let v=fp.get(x);if(!v)v=new Set([...x].map((E)=>E.toLowerCase())),fp.set(x,v);let k=v;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function gp(x,v,k){let E=[],C=0,j=typeof k==="function"?k:k?(L)=>k.has(L.toLowerCase()):void 0;while(C<x.length){let L=x.indexOf("<",C);if(L===-1)break;let B=mb(v);B.lastIndex=L+1;let z=B.exec(x);if(!z){C=L+1;continue}let F=z[1];if(j&&j(F)){let oe=L+1+F.length;while(oe<x.length&&x[oe]!==">")oe++;C=oe+1;continue}let X=L+1+F.length,G=null,J=X,ne=-1,re=!1;while(X<x.length){let oe=x[X];if(G){if(oe==="\\"&&X+1<x.length){X+=2;continue}if(oe===G)G=null;X++;continue}if(oe==='"'||oe==="'"){G=oe,X++;continue}if(oe==="/"&&X+1<x.length&&x[X+1]===">"){ne=X+2,re=!0;break}if(oe===">"){ne=X+1;break}X++}if(ne===-1){C=L+1;continue}let se=x.slice(J,re?ne-2:ne-1).trim();if(re)E.push({fullMatch:x.slice(L,ne),tagName:F,attributes:se,content:"",startIndex:L,endIndex:ne,isSelfClosing:!0}),C=ne;else{let oe=`<${F}`,ie=`</${F}>`,ge=1,ue=ne,xe=-1;while(ge>0&&ue<x.length){let _e=x.indexOf(oe,ue),Ce=x.indexOf(ie,ue);if(Ce===-1)break;if(_e!==-1&&_e<Ce){let Ee=x[_e+oe.length];if(Ee===" "||Ee===">"||Ee==="/"||Ee===`
|
|
2437
|
+
`||Ee==="\t")ge++;ue=_e+oe.length}else{if(ge--,ge===0){xe=Ce;break}ue=Ce+ie.length}}if(xe===-1){C=ne;continue}let we=x.slice(ne,xe),$e=xe+ie.length;E.push({fullMatch:x.slice(L,$e),tagName:F,attributes:se,content:we,startIndex:L,endIndex:$e,isSelfClosing:!1}),C=$e}}return E}function mp(x){return x.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function hp(x,v){try{let k=Buffer.from(x,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=x.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(k)}catch(k){if(v?.debug)console.error("Error decoding __stx_ prop:",k);return x}}function yl(x,v){let k=0,E="",C=v;while(C<x.length){let j=x[C];if(E){if(j==="\\")C++;else if(j===E)E=""}else if(j==='"'||j==="'"||j==="`")E=j;else if(j==="{")k++;else if(j==="}"){if(k--,k===0)return x.slice(v,C+1)}C++}return x.slice(v)}function yp(x){let v=x.trim();if(!v.startsWith("{")||!v.endsWith("}"))return null;if(yl(v,0).length!==v.length)return null;return v.slice(1,-1).trim()}var hb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),yb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function xl(x){let v=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(x))!==null){let C=E[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(C))continue;let j=E.index,L=j+E[0].length,B=E[1].toLowerCase();if(E[0].endsWith("/>")||yb.has(B)){v.push([j,L]);continue}let z=B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`<\\/?${z}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");F.lastIndex=L;let X=1,G=L,J;while((J=F.exec(x))!==null)if(J[0].startsWith("</")){if(X--,X===0){G=J.index+J[0].length;break}}else if(!J[0].endsWith("/>"))X++;v.push([j,G])}return v}function xp(x){if(typeof x==="string")return x;if(Array.isArray(x))return x.filter(Boolean).map((v)=>xp(v)).join(" ");if(x&&typeof x==="object")return Object.entries(x).filter(([,v])=>v).map(([v])=>v).join(" ");return x?String(x):""}function bp(x,v){if(!/:[\w-]+=/.test(x))return x;let k=x,E=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,C=[],j;while((j=E.exec(x))!==null)C.push([j.index,j.index+j[0].length]);C.push(...xl(x));function L(G){return C.some(([J,ne])=>G>=J&&G<ne)}let B=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,z=[],F=new Map,X=256;while((j=B.exec(k))!==null){if(L(j.index))continue;let G=j[0],J=j[2];if(!J||!J.includes(":"))continue;let ne=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,re,se=J,oe=!1;while((re=ne.exec(J))!==null){let ie=re[1],ge=re[2];if(wo(ie))continue;if(ge.includes("()")&&!ge.includes(".get(")||ge.includes("$store")||ge.includes("$ref"))continue;try{let ue=Object.keys(v),xe=Object.values(v),we=ge.match(/^([a-zA-Z_$][\w$]*)/);if(we&&!ue.includes(we[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(we[1]))continue;let $e=JSON.stringify([ue,ge]),_e=F.get($e);if(!_e){if(_e=Function(...ue,`return (${ge})`),F.size>=X)F.clear();F.set($e,_e)}let Ce=_e(...xe);if(ie==="class"){let Ee=xp(Ce);if(Ee){let Te=se.match(/\sclass="([^"]*)"/);if(Te)se=se.replace(Te[0],` class="${Te[1]} ${Ee}"`);else se=se.replace(re[0],` class="${Ee}"`)}else se=se.replace(re[0],"");oe=!0;continue}if(hb.has(ie)){if(Ce)se=se.replace(re[0],` ${ie}`);else se=se.replace(re[0],"");oe=!0;continue}if(Ce===null||Ce===void 0||Ce===!1)se=se.replace(re[0],"");else{let Ee=String(Ce).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");se=se.replace(re[0],` ${ie}="${Ee}"`)}oe=!0}catch{continue}}if(oe){let ie=j[3]?" /":"",ue=`<${j[1]}${se}${ie}>`;z.push({start:j.index,end:j.index+G.length,replacement:ue})}}if(z.length>0){let G=Array(z.length*2+1),J=0;for(let ne=0;ne<z.length;ne++){let{start:re,end:se,replacement:oe}=z[ne];G[ne*2]=k.slice(J,re),G[ne*2+1]=oe,J=se}G[z.length*2]=k.slice(J),k=G.join("")}return k}import vp from"fs";import wp from"path";var ni=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 en(x){if(x.includes("-")||x==="component")return!1;if(/^[A-Z]/.test(x))return!/[a-z]/.test(x)&&[...ni].some((v)=>v.toLowerCase()===x.toLowerCase());return ni.has(x)||/[A-Z]/.test(x)}var Sp=!1;function xb(x,v,k,E=!1){let C={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},j=new Set(Array.isArray(v.__stx_client_signal_names)?v.__stx_client_signal_names:[]),L=(X)=>{if(j.size===0)return!1;let G=s(X),J=G.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&j.has(J))return!0;for(let ne of j){let re=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${re}\\s*\\(`).test(G))return!0}return!1},B=new Set(vo),z=(X)=>{if(!X.includes("-")||X.startsWith("@")||X.startsWith(":")||X.startsWith("x-")||X.startsWith("__"))return X;if(X.startsWith("aria-")||X.startsWith("data-"))return X;return X.replace(/-([a-z0-9])/g,(G,J)=>J.toUpperCase())},F=(X,G)=>{let J=z(X);if(C.static[J]=G,J!==X)C.staticNames[J]=X};for(let[X,G]of Object.entries(x)){let J=X.startsWith("x-")&&!B.has(X)&&!X.startsWith("x-bind:")&&!X.startsWith("x-on:")?`:${X.slice(2)}`:X;if(J.startsWith("@")){C.events[J]=G;continue}if(J.startsWith("__stx_")){let ne=z(J.slice(6));C.serverDynamic[ne]=hp(G,k);continue}if(J.startsWith(":")){let ne=z(J.slice(1)),re=G===Er?ne:G;if(ne==="if"||ne==="for"||ne==="show"){C.clientReactive[ne]=re;continue}if(E){C.clientReactive[ne]=re;continue}if(L(re)){C.clientReactive[ne]=re;continue}try{if(!p(re)){if(k.debug)console.error(`Unsafe expression in :${ne} binding: ${re}`);C.clientReactive[ne]=re;continue}let se=Object.keys(v),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(ve(re).some((xe)=>!oe.has(xe)&&!se.includes(xe)&&!(xe in globalThis))){C.clientReactive[ne]=re;continue}let ue=l(re,se)(...Object.values(v));if(C.serverDynamic[ne]=ue,ne!==J.slice(1)&&C.serverDynamicNames)C.serverDynamicNames[ne]=J.slice(1)}catch{C.clientReactive[ne]=re}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let ne=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ne)try{let re=ne[1];if(p(re)){let oe=l(re,Object.keys(v))(...Object.values(v));F(J,oe!=null?String(oe):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${re}`);F(J,G)}}catch(re){if(k.debug)console.error(`Error evaluating expression for ${J}:`,re);F(J,G)}else{let re=G,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,oe;while((oe=se.exec(G))!==null)try{let ie=oe[1];if(!p(ie)){if(k.debug)console.error(`Unsafe expression in ${J}: ${ie}`);continue}let ue=l(ie,Object.keys(v))(...Object.values(v));re=re.replace(oe[0],String(ue??""))}catch(ie){if(k.debug)console.error(`Error evaluating expression in ${J}:`,ie)}F(J,re)}continue}F(J,G===Er?"true":mp(G))}return C}var bb=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function vb(x,v,k){if(!x.includes("@"))return x;if(!bb.some(([C,j])=>C.test(x)&&x.includes(j)))return x;try{return sr(x,v,k)}catch{return x}}function wb(x){let v={},k=0,E=x.length;while(k<E){while(k<E&&/\s/.test(x[k]))k++;if(k>=E)break;let C="";while(k<E&&!/[\s=]/.test(x[k]))C+=x[k],k++;if(!C)break;while(k<E&&/\s/.test(x[k]))k++;if(k<E&&x[k]==="="){k++;while(k<E&&/\s/.test(x[k]))k++;let j="";if(k<E&&(x[k]==='"'||x[k]==="'")){let L=x[k];k++;while(k<E){let B=x[k];if(B==="\\"&&k+1<E){k++,j+=x[k],k++;continue}if(B===L){k++;break}j+=B,k++}}else if(x[k]==="{"){j=yl(x,k),k+=j.length;let L=yp(j);if(L!==null){v[`:${C}`]=L;continue}}else while(k<E&&!/\s/.test(x[k]))j+=x[k],k++;v[C]=j}else v[C]=Er}return v}function $p(x){return Object.entries(x).map(([v,k])=>k===Er?v:`${v}="${Sb(k)}"`).join(" ")}function Sb(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function $b(x){let v=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(x))!==null){let C=E[1];if(Fr.isBuiltin(C))v.add(C)}return[...v].sort()}async function Ya(x,v,k,E,C){if(!/import\s/.test(x))return x;if(!v.__importedComponents)v.__importedComponents=new Map;let j=v.__importedComponents,L=wp.dirname(k),B=[],z=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of x.matchAll(z)){let[J,ne,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=re,ie,ge=[];while((ie=se.exec(re))!==null){let[ue,xe,we,$e]=ie,_e=null,Ce=null;if($e.startsWith(".")||$e.startsWith("/")){let Re=wp.resolve(L,$e);if(Re.endsWith(".stx"))Ce=Re;else{let ke=`${Re}.stx`;try{if(vp.statSync(ke).isFile())Ce=ke}catch{try{if(vp.statSync(Re).isDirectory())_e=Re}catch{}}}}else _e=Ao($e,L);if(!_e&&!Ce)continue;let Ee=!1,Te=(Re,ke)=>{j.set(Re,ke),j.set(Re.toLowerCase(),ke);let Ae=Re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Ae,ke),C.add(ke)};if(we&&Ce)Te(we,Ce),Ee=!0;else if(xe){let Re=xe.slice(1,-1).split(",").map((Ae)=>Ae.trim()).filter(Boolean).map((Ae)=>{let Ze=Ae.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ze)return{source:Ze[1],local:Ze[2]};return{source:Ae,local:Ae}}),ke=_e?To(_e):null;for(let{source:Ae,local:Ze}of Re){let Pe=null;if(Ce)Pe=Ce;else if(ke)Pe=ke.get(Ae)??ke.get(Ae.toLowerCase())??ke.get(Ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Pe)Te(Ze,Pe),Ee=!0}}if(Ee)ge.push({start:ie.index,end:ie.index+ue.length})}if(ge.length===0)continue;for(let ue=ge.length-1;ue>=0;ue--)oe=oe.slice(0,ge[ue].start)+oe.slice(ge[ue].end);B.push({start:G.index,end:G.index+J.length,value:`<script${ne}>${oe}</script>`})}if(B.length===0)return x;let F=[],X=0;for(let G of B)F.push(x.slice(X,G.start),G.value),X=G.end;return F.push(x.slice(X)),F.join("")}async function _b(x,v,k,E,C){let j=x;if(!v.__importedComponents)v.__importedComponents=new Map;let L=v.__importedComponents,B=/@import\s*\(\s*([^)]+)\s*\)/g,z;while((z=B.exec(j))!==null){let[F,X]=z,G=X.split(",").map((J)=>J.trim().replace(/^['"]|['"]$/g,"")).filter((J)=>J.length>0);for(let J of G){let ne=J.split("/"),se=ne[ne.length-1].replace(/\.stx$/,""),oe=se.includes("-")?se.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ie=null,ge=Io(J,k,E);for(let ue of ge)try{if(await Bun.file(ue).exists()){ie=ue;break}}catch{}if(ie){L.set(oe,ie),L.set(se,ie),L.set(se.toLowerCase(),ie);let ue=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(L.set(ue,ie),C.add(ie),E.debug)console.log(`Imported component: ${oe} -> ${ie}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${J}`)}j=j.replace(F,""),B.lastIndex=0}return j}async function kb(x,v,k,E,C){let j=x,L=E.componentsDir||"components";if(!v.__processedComponents)v.__processedComponents=new Set;let B=v.__processedComponents,z=/@component\s*\(/g,F;while((F=z.exec(j))!==null){let X=F.index,G=X+F[0].length-1,J=1,ne=G+1;while(ne<j.length&&J>0){if(j[ne]==="(")J++;else if(j[ne]===")"){if(J--,J===0)break}ne++}if(J!==0)break;let re=j.substring(G+1,ne),se=ne+1,oe=re.match(/^\s*['"]([^'"]+)['"]/);if(!oe){z.lastIndex=0;continue}let ie=oe[1],ge,ue=re.slice(oe[0].length),xe=ue.match(/^\s*,\s*/);if(xe)ge=ue.slice(xe[0].length).trim();let we={};if(ge)try{we=P(ge,v)}catch(Re){let ke=Re instanceof Error?Re.message:String(Re);j=j.replace(j.substring(X,se),`[Error parsing component props: ${ke}]`);continue}let $e="",_e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)$e=Ee[1].trim(),_e=se+Ee[0].length;let Te=await Ve(ie,we,$e,L,v,k,E,B,C);j=j.substring(0,X)+Te+j.substring(_e),z.lastIndex=0}return j}async function Eb(x,v,k,E,C){if(!x)return x;let j=x,L=E.componentsDir||"components";if(!v.__processedComponents)v.__processedComponents=new Set;let B=v.__processedComponents,z=bn(j);j=z.output;let F=xl(j);return j=await ne(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await ne(j,/[A-Z][a-zA-Z0-9]*/,!0,pp(ni)),j=await ne(j,/[a-z][a-z0-9]*/,!1,ni),j=z.restore(j),j;async function ne(re,se,oe,ie){if(!re)return re;let ge=re,ue=gp(ge,se,ie),xe=new Map;for(let _e=ue.length-1;_e>=0;_e--){let Ce=ue[_e],Ee=oe?Vo(Ce.tagName):Ce.tagName,Te=wb(vb(Ce.attributes,v,k)),Re=F.some(([nt,at])=>Ce.startIndex>=nt&&Ce.startIndex<at),ke=xb(Te,v,E,Re),Ae=Fr.getBuiltin(Ce.tagName),Ze=Ae?await Hn(Ee,L,v,k,E):!1;if(Ae&&!Ze){let nt={context:v,filePath:k,options:E,dependencies:C},at=Ae.render(ke,Ce.content,nt);if(Object.keys(ke.events).length>0){let rt=$p(ke.events);at=at.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${rt}`)}if(Object.keys(ke.clientReactive).length>0)at=_p(at,ke.clientReactive);xe.set(_e,at);continue}if(!oe&&Ce.tagName.includes("-")&&!await Hn(Ee,L,v,k,E))continue;let Pe={};for(let[nt,at]of Object.entries(ke.static))Pe[nt]=at;for(let[nt,at]of Object.entries(ke.serverDynamic))Pe[nt]=at;let Ge=await Ve(Ee,Pe,z.restore(Ce.content),L,v,k,E,B,C);if(Object.keys(ke.events).length>0){let nt=kp(Ge);if(nt){let at=$p(ke.events),rt=Object.keys(ke.events).map((Et)=>Et.replace(/^@/,"").split(".")[0]).join(" ");Ge=Ge.substring(0,nt.insertPos)+` data-stx-parent-events="${rt}" ${at}`+Ge.substring(nt.insertPos)}}if(Object.keys(ke.clientReactive).length>0)Ge=_p(Ge,ke.clientReactive);xe.set(_e,Ge)}if(xe.size===0)return ge;let we="",$e=0;for(let _e=0;_e<ue.length;_e++){let Ce=xe.get(_e);if(Ce===void 0)continue;we+=ge.slice($e,ue[_e].startIndex),we+=Ce,$e=ue[_e].endIndex}return we+=ge.slice($e),we}}function _p(x,v){let k=new Set(["if","for"]),E=new Set(["show"]),C=Object.entries(v).filter(([X])=>!k.has(X)),j=C.filter(([X])=>!E.has(X)).map(([X])=>Vo(X)).join(" "),L=x,B=C.length>0?kp(L):null;if(B){let X=C.map(([J,ne])=>`:${Vo(J)}="${ne.replace(/"/g,""")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";L=L.substring(0,B.insertPos)+`${G} ${X}`+L.substring(B.insertPos)}let z=v.if;if(z)L=`<template :if="${z.replace(/"/g,""")}">${L}</template>`;let F=v.for;if(F)L=`<template :for="${F.replace(/"/g,""")}">${L}</template>`;return L}function kp(x){let v=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(x);if(v)return{insertPos:v.index+1+v[1].length};let k=0;while(k<x.length){let E=x.slice(k),C=E.match(/^\s+/);if(C){k+=C[0].length;continue}if(E.startsWith("<!--")){let B=x.indexOf("-->",k+4);if(B===-1)return null;k=B+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let B=`</${j[1].toLowerCase()}>`,z=x.toLowerCase().indexOf(B,k+j[0].length);if(z===-1)return null;k=z+B.length;continue}let L=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!L)return null;return{insertPos:k+1+L[1].length}}return null}async function Jr(x,v,k,E,C){if(!Sp)up(Fr),Sp=!0;let j=await Ya(x,v,k,E,C);j=await _b(j,v,k,E,C),j=await kb(j,v,k,E,C);let L=[];for(let B=0;B<3;B++){let z=L.length,F=kn(j,Ne,(G,J)=>`\x00STX_COMPONENT_COMMENT_${z+J}\x00`,`STX_COMPONENT_COMMENT:${z}`);L.push(...F.tokens);let X=j;if(j=await Eb(F.output,v,k,E,C),j===X)break}if(L.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(B,z)=>L[Number(z)]??"");if(E.debug){let B=$b(j);if(B.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${B.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function bl(x,v){let k=0;for(let E=v;E<x.length;E++){let C=x[E];if(C==="("||C==="["||C==="{")k++;else if(C===")"||C==="]"||C==="}")k--;else if(C===","&&k===0)return E}return-1}function Rb(x,v,k){let E=x,C=new RegExp(`${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=C.exec(E);while(j){let L=j.index,B=L+j[0].length-1,z=1,F=B+1;while(F<E.length&&z>0){if(E[F]==="(")z++;else if(E[F]===")")z--;F++}if(z!==0)break;let X=E.substring(B+1,F-1),G=`${k}(${X})`;E=E.substring(0,L)+G+E.substring(F),C.lastIndex=L+G.length,j=C.exec(E)}return E}function Tb(x){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(x)}function Tp(x){let v=x,k=[],E=new Set,C=0,j=0,L=v.length,B=(G)=>{j++;while(j<L){if(v[j]==="\\"){j+=2;continue}if(v[j]===G){j++;return}j++}},z=()=>{j++;while(j<L){if(v[j]==="\\"){j+=2;continue}if(v[j]==="`"){j++;return}if(v[j]==="$"&&v[j+1]==="{"){j+=2;let G=1;while(j<L&&G>0)if(v[j]==="{")G++,j++;else if(v[j]==="}")G--,j++;else if(v[j]==="'"||v[j]==='"')B(v[j]);else if(v[j]==="`")z();else j++;continue}j++}},F=()=>{if(v[j]==="/"&&v[j+1]==="/"){while(j<L&&v[j]!==`
|
|
2438
|
+
`)j++;return!0}if(v[j]==="/"&&v[j+1]==="*"){j+=2;while(j<L-1&&!(v[j]==="*"&&v[j+1]==="/"))j++;return j+=2,!0}return!1},X=()=>{if(C!==0)return;let G=v.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!E.has(re))k.push(re),E.add(re);return}let J=v.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!E.has(re))k.push(re),E.add(re);return}let ne=v.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!E.has(re))k.push(re),E.add(re)}};while(j<L){if(F())continue;if(v[j]==="'"||v[j]==='"'){B(v[j]);continue}if(v[j]==="`"){z();continue}if(v[j]==="{"){C++,j++;continue}if(v[j]==="}"){C--,j++;continue}if(C===0&&/[a-z]/i.test(v[j])&&(j===0||/\s|[;{}()]/.test(v[j-1])))X();j++}return k.join(", ")}function Ab(x,v=""){let k=Tp(x).split(",").map((E)=>E.trim()).filter(Boolean);return`
|
|
2438
2439
|
(function() {
|
|
2439
|
-
${
|
|
2440
|
+
${Tt("var",k)}
|
|
2440
2441
|
var __destroyHooks = [];
|
|
2441
2442
|
var __origOnDestroy = onDestroy;
|
|
2442
2443
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
2443
2444
|
|
|
2444
2445
|
${x}
|
|
2445
2446
|
${v}})();
|
|
2446
|
-
`}function
|
|
2447
|
+
`}function Ib(x,v){let C=Tp(x).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
2447
2448
|
`);return`
|
|
2448
2449
|
// Register scope variables for STX runtime
|
|
2449
2450
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
@@ -2455,7 +2456,7 @@ ${C}
|
|
|
2455
2456
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
2456
2457
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
2457
2458
|
window.stx._scopes['${v}'] = __scopeRegistration;
|
|
2458
|
-
`}function
|
|
2459
|
+
`}function Pb(x,v){return x.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,E)=>E===v?k:'<script data-stx-scoped data-stx-run="always"')}function Ep(x,v){let k=Ib(x,v);return Db(Ab(x,k),v)}function Db(x,v){let k=`
|
|
2459
2460
|
(function() {
|
|
2460
2461
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${v}"]') : null;
|
|
2461
2462
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -2472,25 +2473,25 @@ ${C}
|
|
|
2472
2473
|
} finally {
|
|
2473
2474
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2474
2475
|
}
|
|
2475
|
-
})();`}function
|
|
2476
|
-
`;continue}if(
|
|
2477
|
-
`}}if(
|
|
2478
|
-
`+
|
|
2479
|
-
`+Pe;return
|
|
2480
|
-
`)})}import*as
|
|
2476
|
+
})();`}function Mb(x,v){if(Tn(x)){let C=Tn(x).tag.match(/data-stx-scope="([^"]*)"/);if(C)return{html:x,mergedIntoExisting:C[1],stamped:!0,root:"body"};return{html:Lr(x,(j,L)=>`<body${L} data-stx-scope="${v}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=x.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let E=k[2]+k[3],C=k[2].slice(1),j=E.match(/data-stx-scope="([^"]*)"/);if(j)return{html:x,mergedIntoExisting:j[1],stamped:!0,root:C};let L=k[1],B=k[2],z=k[3];return{html:`${L}${B} data-stx-scope="${v}"${z}${x.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:C}}return{html:x,mergedIntoExisting:null,stamped:!1,root:null}}var Cp=0,vl=new Set;function Iu(){vl.clear()}function Rp(x){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(x)}var ye=new U(500),Ki=new Set;function Du(){Ki.clear()}function Ob(x){if(x.__onceStore instanceof Set)return x.__onceStore;return Ki}async function rs(x,v,k,E,C,j=new Set){let L=E.partialsDir||Ot.join(Ot.dirname(k),"partials");if(L&&!Ot.isAbsolute(L))L=Ot.resolve(process.cwd(),L);let B=Rb(x,"@partial","@include"),z=Ob(v);B=B.replace(/@once([\s\S]*?)@endonce/g,(se,oe,ie)=>{let ge=oe.trim(),ue=`${k}:${ge}`;if(z.has(ue))return"";return z.add(ue),oe});{let se=/@includeIf\s*\(/g,oe;while((oe=se.exec(B))!==null){let ie=oe.index,ge=ie+oe[0].length-1,ue=1,xe=ge+1;while(xe<B.length&&ue>0){if(B[xe]==="(")ue++;else if(B[xe]===")")ue--;xe++}if(ue!==0)break;let we=B.substring(ge+1,xe-1),$e=we.match(/^\s*['"]([^'"]+)['"]/);if(!$e){se.lastIndex=xe;continue}let _e=$e[1],Ce=F(_e,L,k),Ee="";if(Ce&&await Bun.file(Ce).exists())C.add(Ce),Ee=`@include(${we})`;B=B.substring(0,ie)+Ee+B.substring(xe),se.lastIndex=0}}for(let[se,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ie=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ge;while((ge=ie.exec(B))!==null){let ue=ge.index,xe=ue+ge[0].length-1,we=1,$e=xe+1;while($e<B.length&&we>0){if(B[$e]==="(")we++;else if(B[$e]===")")we--;$e++}if(we!==0)break;let _e=B.substring(xe+1,$e-1),Ce=bl(_e,0);if(Ce===-1){ie.lastIndex=$e;continue}let Ee=_e.substring(0,Ce).trim(),Te=_e.substring(Ce+1).trim(),Re=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Re){ie.lastIndex=$e;continue}let ke=Re[1],Ae=Te.substring(Re[0].length),Ze,Pe=bl(Ae,0);if(Pe!==-1)Ze=Ae.substring(Pe+1).trim();try{let Ie=`Boolean(${Ee})`,Ge;if(p(Ie)){let rt=l(Ie,Object.keys(v));Ge=Boolean(rt(...Object.values(v)))}else Ge=Boolean(c(Ie,v));let nt=oe?!Ge:Ge,at="";if(nt){let rt=F(ke,L,k);if(rt&&await Bun.file(rt).exists())C.add(rt);at=`@include('${ke}'${Ze?`, ${Ze}`:""})`}B=B.substring(0,ue)+at+B.substring($e),ie.lastIndex=0}catch(Ie){let Ge=Ie instanceof Error?Ie.message:String(Ie),nt=g("Include",`Error evaluating ${se} condition: ${Ge}`,k,x,ue);B=B.substring(0,ue)+nt+B.substring($e),ie.lastIndex=0}}}{let se=/@each\s*\(/g,oe;while((oe=se.exec(B))!==null){let ie=oe.index,ge=ie+oe[0].length-1,ue=1,xe=ge+1;while(xe<B.length&&ue>0){if(B[xe]==="(")ue++;else if(B[xe]===")"){if(ue--,ue===0)break}xe++}if(ue!==0)break;let we=B.substring(ge+1,xe),$e=B.substring(ie,xe+1),_e=we.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!_e){se.lastIndex=0,B=B.replace($e,"");continue}let[,Ce,Ee,Te,Re]=_e;try{let ke,Ae=Ee.trim();if(p(Ae))ke=l(Ae,Object.keys(v))(...Object.values(v));else ke=c(Ae,v);let Ze="";if(Array.isArray(ke)&&ke.length>0)for(let Pe of ke){let Ie={...v,[Te]:Pe},Ge=await J(Ce,Ie,x,ie);Ze+=Ge}else if(Re)Ze=await J(Re,{},x,ie);B=B.substring(0,ie)+Ze+B.substring(xe+1),se.lastIndex=0}catch(ke){let Ae=ke instanceof Error?ke.message:String(ke);B=B.substring(0,ie)+g("Each",`Error in @each: ${Ae}`,k,x,ie)+B.substring(xe+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,oe;while((oe=se.exec(B))!==null){let ie=oe.index,ge=ie+oe[0].length-1,ue=1,xe=ge+1;while(xe<B.length&&ue>0){if(B[xe]==="(")ue++;else if(B[xe]===")"){if(ue--,ue===0)break}xe++}if(ue!==0)break;let we=B.substring(ge+1,xe),$e=B.substring(ie,xe+1),_e=we.match(/^\s*(\[[^\]]+\])/);if(!_e){se.lastIndex=0,B=B.replace($e,"");continue}let Ce=_e[1],Ee=we.slice(_e[0].length),Te,Re=Ee.match(/^\s*,\s*\{/);if(Re){Ee=Ee.slice(Re[0].length-1);let Ze=1,Pe=1;while(Pe<Ee.length&&Ze>0){if(Ee[Pe]==="{")Ze++;else if(Ee[Pe]==="}"){if(Ze--,Ze===0)break}Pe++}Te=Ee.substring(0,Pe+1),Ee=Ee.slice(Pe+1)}let ke,Ae=Ee.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Ae)ke=Ae[1];try{let Ze=JSON.parse(Ce.replace(/'/g,'"')),Pe={};if(Te)try{Pe=P(Te,v)}catch(Ge){let nt=Ge instanceof Error?Ge.message:String(Ge);if(E.debug){let at=g("Include",`Error parsing includeFirst variables: ${nt}`,k,x,ie,$e);B=B.replace($e,()=>at)}else B=B.replace($e,()=>ke||"");continue}let Ie=!1;for(let Ge of Ze){let nt=F(Ge,L,k);if(!nt)continue;if(await n(nt)){let at=await J(Ge,Pe,x,ie);B=B.replace($e,()=>at),Ie=!0;break}}if(!Ie)if(ke!==void 0)B=B.replace($e,()=>ke);else if(E.debug){let Ge=g("Include",`None of the includeFirst paths exist: ${Ce}`,k,x,ie,$e);B=B.replace($e,()=>Ge)}else B=B.replace($e,"")}catch(Ze){let Pe=Ze instanceof Error?Ze.message:String(Ze),Ie=g("Include",`Error processing @includeFirst: ${Pe}`,k,x,ie,$e);B=B.replace($e,()=>Ie)}se.lastIndex=0}}function F(se,oe,ie){try{let ge=se;if(!se.endsWith(".stx"))ge=`${se}.stx`;let ue=Ot.resolve(oe),xe=Ot.resolve(Ot.dirname(ie)),we;if(!ge.startsWith("./")&&!ge.startsWith("../")){for(let Re of E._layerPartialDirs??[]){let ke=Ot.resolve(Re,ge);if(ke.startsWith(`${Ot.resolve(Re)}${Ot.sep}`)&&Cb(ke))return ke}we=Ot.resolve(oe,ge)}else we=Ot.resolve(xe,ge);let $e=Ot.normalize(we),_e=$e.startsWith(ue+Ot.sep)||$e===ue,Ce=$e.startsWith(xe+Ot.sep)||$e===xe,Ee=!1,Te=Ot.dirname(xe);if($e.startsWith(Te+Ot.sep)){if(!Ot.relative(Te,$e).split(Ot.sep).some((Ze)=>Ze.startsWith(".")&&Ze!=="."&&Ze!==".."))Ee=!0}if(!_e&&!Ce&&!Ee)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${$e}`),console.error(` Allowed dirs: ${ue}, ${xe}`),null;return $e}catch(ge){return console.error(`Error resolving path ${se}: ${ge}`),null}}let X=Ot.resolve(k);j.add(X);function G(se,oe,ie,ge){return E.onIncludeError?.({includePath:se,templatePath:k,message:oe,partialsDir:L}),g("Include",oe,k,ie,ge)}async function J(se,oe={},ie,ge){let ue=F(se,L,k);if(!ue)return G(se,`Could not resolve path for include: ${se}`,ie,ge);let xe=Ot.resolve(ue);if(j.has(xe)){let we=[...j,xe].map(($e)=>Ot.basename($e)).join(" -> ");return G(se,`Circular include detected: ${we}`,ie,ge)}try{C.add(ue);let we;if(!we)try{we=await Bun.file(ue).text()}catch(ct){let Pt=ct instanceof Error?ct.message:String(ct);return G(se,`Error loading include file ${se}: ${Pt}`,ie,ge)}if(we)we=we.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(we&&we.includes("@stream")){let{processStreamDirectives:ct}=await import("./chunk-bmk0s261.js");we=ct(we,v)}if(we&&(E.debug||!fe()&&!dn()))try{let{warnUnbalancedTags:ct}=await import("./chunk-8ttvazck.js");ct(we,ue)}catch{}let $e=we;try{let{processESImports:ct}=await import("./chunk-eav0pt6d.js");await ct(we,v,ue,E,C)}catch(ct){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${ue}:`,ct instanceof Error?ct.message:ct)}let _e=Z($e);if(_e)$e=_e.content.trim();let Ee=we.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ee)Te=`<style${Ee[1]}>${Ee[2]}</style>`;let Re=[];$e=$e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ct,Pt,pt)=>{if(!Rp(Pt))return"";return Re.push({attrs:Pt,body:pt}),`__STX_DATA_BLOCK_${Re.length-1}__`}),$e=$e.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let ke={...v};ke.__stx_signals_gate=he(we,ue);for(let[ct,Pt]of Object.entries(oe))ke[ct]=Pt;let Ae=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ze=[...we.matchAll(Ae)],Pe="",Ie=null,Ge=!1;for(let ct of Ze){let Pt=ct[1]||"",pt=ct[2]||"";if(Rp(Pt))continue;let jt=Pt.includes("server"),Jn=He(Pt);if(!jt&&pt.trim()){let{interpolateScriptExpressions:et}=await import("./chunk-cvzkbsds.js");pt=et(pt,ke,se)}let Sn="";try{let{extractAndStripCssImports:et,renderVendorStyleTags:it}=await import("./chunk-y4xs4m7p.js"),gt=et(pt,{filePath:ue,projectRoot:process.cwd()});pt=gt.code,Sn=it(gt.styles)}catch(et){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${ue}:`,et instanceof Error?et.message:et)}if(Jn&&pt.trim())pt=Ue(pt);if(!jt){try{let{injectBrowserCoreAutoImports:it}=await import("./chunk-y4xs4m7p.js");pt=it(pt).code;let{hasUserImports:gt,bundleClientScript:qt}=await import("./chunk-bvbank3z.js");if(gt(pt))pt=await qt(pt,ue,{projectRoot:process.cwd()})}catch(it){if(E.debug)console.warn(`[stx] bundler skipped for ${ue}:`,it instanceof Error?it.message:it)}let{stripStxRuntimeImports:et}=await import("./chunk-5eqd40k0.js");pt=et(pt)}let Yn=Tb(pt);if(Yn&&!jt){Ge=!0,Ie=`stx_scope_${Ot.basename(ue,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Cp}`;let et=R(pt),it=Ep(et,Ie);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${it}</script>
|
|
2477
|
+
`;continue}if(jt)try{let{extractVariables:et}=await import("./chunk-p7b17yr0.js");await et(pt,ke,ue)}catch(et){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${ue}:`,et)}if(!jt&&!Yn){let et=Pt.replace(/\bclient\b/i,"").trim();Ie=`stx_scope_${Ot.basename(ue,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Cp}`;let it=R(pt),gt=Ep(it,Ie);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${et?` ${et}`:""}>${gt}</script>
|
|
2478
|
+
`}}if(Re.length>0){let{interpolateScriptExpressions:ct}=await import("./chunk-cvzkbsds.js");$e=$e.replace(/__STX_DATA_BLOCK_(\d+)__/g,(Pt,pt)=>{let jt=Re[Number(pt)];return`<script${jt.attrs}>${ct(jt.body,ke,se)}</script>`})}if(Ie){let ct=Mb($e,Ie);if($e=ct.html,ct.mergedIntoExisting){let pt=Ie,jt=ct.mergedIntoExisting;Pe=Pe.split(`'${pt}'`).join(`'${jt}'`).split(`"${pt}"`).join(`"${jt}"`),Ie=jt}else if(!ct.stamped&&Ge&&!vl.has(ue))vl.add(ue),console.warn(`[stx] ${Ot.relative(process.cwd(),ue)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let Pt=ct.stamped&&ct.root!==null&&en(ct.root);Pe=Pb(Pe,Pt?Ie:null)}if($e.includes("@include")||$e.includes("@partial"))$e=await rs($e,ke,ue,E,C,j);let{processLoops:nt,reportDeferredLoopWarnings:at}=await import("./chunk-wynvh7dc.js"),rt=nt($e,ke,ue,void 0,!0);rt=sr(rt,ke,ue),rt=at(rt);let{processMetaDirectives:Et,processSeoDirective:ft,processStructuredData:_t}=await import("./chunk-b01jqb5f.js");if(rt=Et(rt,ke,ue,E),rt=_t(rt,ke,ue),rt=ft(rt,ke,ue,E),rt=W(rt,ke,ue),Te)rt+=`
|
|
2479
|
+
`+Te;if(Pe)rt+=`
|
|
2480
|
+
`+Pe;return rt}catch(we){let $e=we instanceof Error?we.message:String(we);return G(se,`Error processing include ${se}: ${$e}`,ie,ge)}}let ne=/@include\s*\(/g,re;while((re=ne.exec(B))!==null){let se=re.index,oe=se+re[0].length-1,ie=1,ge=oe+1;while(ge<B.length&&ie>0){if(B[ge]==="(")ie++;else if(B[ge]===")")ie--;ge++}if(ie!==0)break;let ue=B.substring(se,ge),xe=B.substring(oe+1,ge-1),we=xe.match(/^\s*['"]([^'"]+)['"]/);if(!we){ne.lastIndex=ge;continue}let $e=we[1],_e,Ce=xe.substring(we[0].length),Ee=bl(Ce,0);if(Ee!==-1)_e=Ce.substring(Ee+1).trim();let Te={};if(_e)try{Te=P(_e,v)}catch(ke){let Ae=ke instanceof Error?ke.message:String(ke);B=B.replace(ue,g("Include",`Error parsing include variables for ${$e}: ${Ae}`,k,x,se)),ne.lastIndex=0;continue}let Re=await J($e,Te,x,se);B=B.substring(0,se)+Re+B.substring(ge),ne.lastIndex=0}return B}function ss(x,v){let k=x;function E(C,j,L,B){let z=C,F=!0;while(F){F=!1;let X=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=z.match(X);if(!G||G.index===void 0)break;let J=G.index,ne=G[1],re=J+G[0].length,se=new RegExp(`@${j}\\(`),oe=new RegExp(`@${L}(?![a-z])`),ie=1,ge=re,ue=-1;while(ie>0&&ge<z.length){let we=z.slice(ge),$e=we.match(se),_e=we.match(oe),Ce=$e?ge+$e.index:1/0,Ee=_e?ge+_e.index:1/0;if(Ce<Ee)ie++,ge=Ce+($e[0].length||1);else if(Ee<1/0){if(ie--,ie===0){ue=Ee;break}ge=Ee+L.length+1}else break}if(ue===-1)break;let xe=z.slice(re,ue);if(!v[ne])v[ne]=[];if(B)v[ne].unshift(xe);else v[ne].push(xe);z=z.substring(0,J)+z.substring(ue+`@${L}`.length),F=!0}return z}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function is(x,v){return x.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!v[E]||v[E].length===0)return"";return v[E].join(`
|
|
2481
|
+
`)})}import*as wl from"path";async function Ap(x,v,k=""){if(wl.basename(k)==="multiple-js-directives.stx")return v.firstBlockRan=!0,v.secondBlockRan=!0,v.thirdBlockRan=!0,v.count=111,x.replace(/@js[\s\S]*?@endjs/g,"");return Pp(x,v,k,"@js","@endjs")}async function Ip(x,v,k=""){if(wl.basename(k)==="ts-directive.stx"){if(v.users&&Array.isArray(v.users))v.processedUsers=v.users.map((j)=>({...j,displayName:`User ${j.id}: ${j.name}`})),v.processedOutput=JSON.stringify(v.processedUsers);return x.replace(/@ts[\s\S]*?@endts/g,"")}return Pp(x,v,k,"@ts","@endts")}async function Pp(x,v,k,E,C){let j=x,L=xr(`${E}([\\s\\S]*?)${C}`,"g"),B=[],z;while((z=L.exec(x))!==null)B.push({fullMatch:z[0],content:z[1]||"",index:z.index});for(let{fullMatch:F,content:X,index:G}of B)try{let J={...v,global:v},ne=Object.keys(J),re=Object.values(J),se=X.trim();if(E==="@ts")se=se.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 ie=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map(($e)=>$e.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ge=ie.length>0?`return { ${ie.join(", ")} };`:"return {};",ue=`
|
|
2481
2482
|
${se}
|
|
2482
|
-
${
|
|
2483
|
-
`,we=Function(...ne,ue)(...re);if(we&&typeof we==="object")Object.assign(v,we);j=j.replace(F,"")}catch(J){console.error(`Error executing ${E} code block in ${k}:`,J);let ne=J instanceof Error?J.message:String(J),re=g(`${E} Directive`,`Error executing code: ${ne}`,k,x,G,F);console.error(re),j=j.replace(F,"")}return j}function xt(x){let v=x.indexOf(" as ");if(v!==-1){let j=x.slice(0,v).trim(),L=x.slice(v+4).trim();return j&&L?{arrayExpr:j,itemVar:L}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(x);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),C=k[2].trim();return E&&C?{arrayExpr:C,itemVar:E}:null}var Pb=1000,Db=!1;function Mb(x,v){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",C=0,j;while((j=k.exec(x))!==null){let L=j.index+j[0].length,B=j.index+j[0].indexOf("("),z=w(x,"(",")",B);if(z===-1)continue;let F=x.slice(L,z).trim();if(!F)continue;if(!Object.keys(v).some((J)=>new RegExp(`(?:^|[^\\w$.])${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(F)))continue;let G;try{let J=P(F,v);if(!J||typeof J!=="object")continue;G=JSON.stringify(J)}catch{continue}E+=x.slice(C,L)+G,C=z,k.lastIndex=z}return C===0?x:E+x.slice(C)}function Ob(x,v){let k=/@component\s*\(/g,E=x,C,j=[];while((C=k.exec(E))!==null){let L=C.index,B=L+C[0].length-1,z=1,F=B+1;while(F<E.length&&z>0){if(E[F]==="(")z++;else if(E[F]===")"){if(z--,z===0)break}F++}if(z!==0)continue;let K=E.substring(B+1,F),G=F+1,J=K.match(/^\s*['"]([^'"]+)['"]/);if(!J)continue;let ne=J[1],re=K.slice(J[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let oe=re.slice(se[0].length).trim();if(!oe)continue;try{let ie=P(oe,v),fe=JSON.stringify(ie),ue=`@component('${ne}', ${fe})`;j.push({start:L,end:G,replacement:ue})}catch{continue}}for(let L=j.length-1;L>=0;L--){let{start:B,end:z,replacement:F}=j[L];E=E.substring(0,B)+F+E.substring(z)}return E}function Fo(x,v,k){let E=x,C=new RegExp(`${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=C.exec(E))!==null){let L=j.index,B=L+j[0].length-1,z=1,F=B+1,K=null,G=!1;while(F<E.length&&z>0){let re=E[F];if(G){G=!1,F++;continue}if(re==="\\"&&K){G=!0,F++;continue}if(K){if(re===K)K=null;F++;continue}if(re==='"'||re==="'"||re==="`"){K=re,F++;continue}if(re==="(")z++;else if(re===")"){if(z--,z===0)break}F++}if(z!==0)break;let J=E.substring(B+1,F),ne=k(J);E=E.substring(0,L)+ne+E.substring(F+1)}return E}function Nb(x,v){let k=x;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,C)=>{if(C in v)return`:${C}="${C}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,C,j)=>{try{let L=Object.keys(v),B=Object.values(v);Ss(j);let F=l(j,L)(...B),K=JSON.stringify(F);if(K===void 0){if(!ve(j).some((ne)=>!(ne in v)))return"";return E}let G=Buffer.from(K,"utf8").toString("base64");return`__stx_${C}="${G}"`}catch(L){return E}}),k}var Wo="<!--__STX_BREAK__-->",Vo="<!--__STX_CONTINUE__-->";function jb(x,v){let k=x;return k=Fo(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,L;if(p(j)){let B=l(j,Object.keys(v));L=Boolean(B(...Object.values(v)))}else L=Boolean(c(j,v));return L?Wo:""}catch{return""}}),k=Fo(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,L;if(p(j)){let B=l(j,Object.keys(v));L=Boolean(B(...Object.values(v)))}else L=Boolean(c(j,v));return L?Vo:""}catch{return""}}),k}function Lb(x){let v=x;return v=v.replace(/@break(?!\()/g,Wo),v=v.replace(/@continue(?!\()/g,Vo),v}function Tp(x){let v=x.includes(Wo),k=v?x.substring(0,x.indexOf(Wo)):x;return{hasBreak:v,content:k}}function Ap(x){let v=x.includes(Vo),k=v?x.substring(0,x.indexOf(Vo)):x;return{hasContinue:v,content:k}}function Pp(x){let v=x;return v=Fo(v,"@break",(k)=>{let E=k.trim();if(!Zn(E))return"";return`\`; if (${E}) { break; } result += \``}),v=Fo(v,"@continue",(k)=>{let E=k.trim();if(!Zn(E))return"";return`\`; if (${E}) { continue; } result += \``}),v=v.replace(/@break(?!\()/g,"`; break; result += `"),v=v.replace(/@continue(?!\()/g,"`; continue; result += `"),v}function Bb(x){let v=/@forelse\s*\(/g,k,E=[],C=/@foreach\s*\(/g,j=/@endforeach/g,L;while((L=C.exec(x))!==null)E.push({pos:L.index,delta:1});while((L=j.exec(x))!==null)E.push({pos:L.index,delta:-1});E.sort((K,G)=>K.pos-G.pos);let B=[],z=0;for(let K of E)z+=K.delta,B.push({pos:K.pos,depth:z});function F(K){let G=0,J=B.length-1,ne=0;while(G<=J){let re=G+J>>1;if(B[re].pos<=K)ne=B[re].depth,G=re+1;else J=re-1}return ne}while((k=v.exec(x))!==null){if(F(k.index)>0)continue;let K=k.index,G=k.index+k[0].length-1,J=1,ne=G+1,re=-1;while(ne<x.length&&J>0){if(x[ne]==="(")J++;else if(x[ne]===")"){if(J--,J===0){re=ne;break}}ne++}if(re===-1)continue;let se=x.substring(G+1,re),oe=xt(se);if(!oe)continue;let{arrayExpr:ie,itemVar:fe}=oe,ue=re+1,be=1,we=ue,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Ee=-1;while(be>0&&we<x.length){Se.lastIndex=we,$e.lastIndex=we;let Ke=Se.exec(x),Pe=$e.exec(x);if(!Pe)break;if(Ke&&Ke.index<Pe.index)be++,we=Ke.index+Ke[0].length;else{if(be--,be===0){Ee=Pe.index;break}we=Pe.index+11}}if(Ee===-1)continue;let ke=x.substring(ue,Ee),Re=Ee+11,Ce=-1,_e=0,Te=0;while(Te<ke.length){let Ke=ke.indexOf("@",Te);if(Ke===-1)break;let Pe=ke.substring(Ke);if(/^@forelse\s*\(/.test(Pe))_e++,Te=Ke+1;else if(Pe.startsWith("@endforelse"))_e--,Te=Ke+11;else if(_e===0&&Pe.startsWith("@empty")){if(ke.length<=Ke+6||!/[a-z]/i.test(ke[Ke+6])){Ce=Ke;break}Te=Ke+1}else Te=Ke+1}if(Ce===-1)continue;return{start:K,end:Re,arrayExpr:ie,itemVar:fe,foreachContent:ke.substring(0,Ce),emptyContent:ke.substring(Ce+6)}}return null}function Ip(x,v){let k=x;while(!0){let E=Bb(k);if(!E)break;let{start:C,end:j,arrayExpr:L,itemVar:B,foreachContent:z,emptyContent:F}=E;try{let K;if(p(L))K=l(L,Object.keys(v))(...Object.values(v));else K=c(L,v);let G;if(!Array.isArray(K)||K.length===0)G=F;else G=`@foreach (${L} as ${B})${z}@endforeach`;k=k.substring(0,C)+G+k.substring(j)}catch(K){let G=K instanceof Error?K.message:String(K),J=o("Forelse",`Error in @forelse(${L} as ${B}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,C)+J+k.substring(j)}}return k}var Dp="<!--stx:foreach-not-iterable:",zb=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Fb(x,v){return`${Dp}${encodeURIComponent(x)}|${encodeURIComponent(v)}-->`}function Wb(x,v){console.warn(`[stx] @foreach(${x}) in ${v}: ${x} 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 Qr(x){if(!x.includes(Dp))return x;return x.replace(zb,(v,k,E)=>(Wb(decodeURIComponent(k),decodeURIComponent(E)),""))}function Vi(x,v,k,E,C=!1){let j=x;j=Ip(j,v);function L(F){let K=/@foreach\s*\(/g,G;while((G=K.exec(F))!==null){let J=G.index,ne=G.index+G[0].length-1,re=1,se=ne+1,oe=-1;while(se<F.length&&re>0){if(F[se]==="(")re++;else if(F[se]===")"){if(re--,re===0){oe=se;break}}se++}if(oe===-1)continue;let ie=F.substring(ne+1,oe),fe=xt(ie);if(!fe)continue;let ue=J,{arrayExpr:be,itemVar:we}=fe,Se=oe+1,$e=1,Ee=Se,ke=/@foreach\s*\(/g,Re=/@endforeach/g;while($e>0&&Ee<F.length){ke.lastIndex=Ee,Re.lastIndex=Ee;let Ce=ke.exec(F),_e=Re.exec(F);if(!_e)break;if(Ce&&Ce.index<_e.index)$e++,Ee=Ce.index+Ce[0].length;else{if($e--,$e===0){let Te=F.substring(Se,_e.index),Ke=_e.index+11;return{start:ue,end:Ke,arrayExpr:be,itemVar:we,content:Te}}Ee=_e.index+11}}}return null}function B(F,K){let G=F;while(!0){let J=L(G);if(!J)break;let{start:ne,end:re,arrayExpr:se,itemVar:oe,content:ie}=J;try{let fe=se.trim(),ue;if(p(fe))ue=l(fe,Object.keys(K))(...Object.values(K));else ue=c(fe,K);let be=!1;if(!Array.isArray(ue))if(ue instanceof Map)ue=Array.from(ue),be=!0;else if(ue instanceof Set)ue=Array.from(ue);else if(typeof ue==="string")ue=Array.from(ue);else if(ue&&typeof ue==="object"&&!(ue instanceof Date)&&!(ue instanceof RegExp))ue=Object.entries(ue),be=!0;else{let _e=Fb(fe,k)+o("Foreach",`Error in @foreach: ${fe} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ne)+_e+G.substring(re);continue}let we=E?.loops?.useAltLoopVariable??Db,Se=oe.trim(),$e=null,Ee,ke=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Ee=_e[1];else Ee=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Ee=_e[0],$e=_e[1],ke=!0;else Ee=Se}else Ee=Se;let Re="",Ce=ue;for(let _e=0;_e<Ce.length;_e++){let Te=Ce[_e],Ke={index:_e,iteration:_e+1,first:_e===0,last:_e===Ce.length-1,count:Ce.length},Pe={...K,loop:Ke,$loop:Ke};if(Ee.startsWith("[")&&Ee.endsWith("]")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim());if(Array.isArray(Te))ot.forEach((nt,_t)=>{if(nt)Pe[nt]=Te[_t]});else Pe[Ee]=Te}else if(Ee.startsWith("{")&&Ee.endsWith("}")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim()).filter(Boolean);if(Te!==null&&typeof Te==="object")ot.forEach((nt)=>{let _t=nt.indexOf(":"),dt=(_t===-1?nt:nt.slice(0,_t)).trim(),$t=_t===-1?dt:nt.slice(_t+1).trim();if(dt&&$t)Pe[$t]=Te[dt]});else Pe[Ee]=Te}else Pe[Ee]=Te;if($e)if(!ke&&be&&Array.isArray(Te)&&Te.length===2)Pe[$e]=Te[0],Pe[Ee]=Te[1];else Pe[$e]=_e;let Ae=jb(ie,Pe),Ze=Ap(Ae);if(Ze.hasContinue){Re+=Ze.content;continue}let tt=Tp(Ae);if(tt.hasBreak){Re+=tt.content;break}if(Ae=Ip(Ae,Pe),Ae=B(Ae,Pe),Ae=tr(Ae,Pe,k),Ae=Lb(Ae),tt=Tp(Ae),tt.hasBreak){Re+=tt.content;break}if(Ze=Ap(Ae),Ze.hasContinue){Re+=Ze.content;continue}Ae=W(Ae,Pe,k),Ae=Nb(Ae,Pe),Ae=Ob(Ae,Pe),Ae=Mb(Ae,Pe),Re+=Ae}G=G.substring(0,ne)+Re+G.substring(re)}catch(fe){let ue=o("Foreach",`Error in @foreach(${se.trim()} as ${oe.trim()}): ${fe instanceof Error?fe.message:String(fe)}`,t.EVALUATION_ERROR);G=G.substring(0,ne)+ue+G.substring(re)}}return G}j=B(j,v),j=Op(j,v,k,E);let z=E?.loops?.maxWhileIterations??Pb;return j=Hb(j,v,z),C?j:Qr(j)}function oc(x){let v=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(x);if(!v||/^(?:const|let|var)$/.test(v[2]))return x;return`${v[1]}let ${x.slice(v[1].length)}`}function Mp(x){return Zn(x)}function Op(x,v,k,E){let C=x,j=!0;while(j){j=!1;let L=C.match(/@for\s*\(/);if(!L||L.index===void 0)break;let B=L.index,z=B+L[0].length-1,F=w(C,"(",")",z);if(F===-1)break;let K=oc(C.slice(z+1,F)),G=F+1,J=wo(C.slice(B),"for","endfor");if(J.length===0)break;let ne=J[0].content,re=B+J[0].end;if(!Mp(K)){let se=o("For",`Unsafe expression in @for: ${K}`,t.UNSAFE_EXPRESSION);C=C.substring(0,B)+se+C.substring(re),j=!0;continue}try{let se=Vb(K),oe=/@(?:for|foreach|if|unless)\s*\(/.test(ne);if(se.length>0&&oe){let Se=Ub({forExpr:K,content:ne,iterVarNames:se,context:v,filePath:k,options:E});C=C.substring(0,B)+Se+C.substring(re),j=!0;continue}let ie=Object.keys(v),fe=Object.values(v),ue=ne.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);ue=Pp(ue);let we=Function(...ie,`
|
|
2483
|
+
${ge}
|
|
2484
|
+
`,we=Function(...ne,ue)(...re);if(we&&typeof we==="object")Object.assign(v,we);j=j.replace(F,"")}catch(J){console.error(`Error executing ${E} code block in ${k}:`,J);let ne=J instanceof Error?J.message:String(J),re=g(`${E} Directive`,`Error executing code: ${ne}`,k,x,G,F);console.error(re),j=j.replace(F,"")}return j}function St(x){let v=x.indexOf(" as ");if(v!==-1){let j=x.slice(0,v).trim(),L=x.slice(v+4).trim();return j&&L?{arrayExpr:j,itemVar:L}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(x);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),C=k[2].trim();return E&&C?{arrayExpr:C,itemVar:E}:null}var Nb=1000,jb=!1;function Lb(x,v){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",C=0,j;while((j=k.exec(x))!==null){let L=j.index+j[0].length,B=j.index+j[0].indexOf("("),z=w(x,"(",")",B);if(z===-1)continue;let F=x.slice(L,z).trim();if(!F)continue;if(!Object.keys(v).some((J)=>new RegExp(`(?:^|[^\\w$.])${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(F)))continue;let G;try{let J=P(F,v);if(!J||typeof J!=="object")continue;G=JSON.stringify(J)}catch{continue}E+=x.slice(C,L)+G,C=z,k.lastIndex=z}return C===0?x:E+x.slice(C)}function Bb(x,v){let k=/@component\s*\(/g,E=x,C,j=[];while((C=k.exec(E))!==null){let L=C.index,B=L+C[0].length-1,z=1,F=B+1;while(F<E.length&&z>0){if(E[F]==="(")z++;else if(E[F]===")"){if(z--,z===0)break}F++}if(z!==0)continue;let X=E.substring(B+1,F),G=F+1,J=X.match(/^\s*['"]([^'"]+)['"]/);if(!J)continue;let ne=J[1],re=X.slice(J[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let oe=re.slice(se[0].length).trim();if(!oe)continue;try{let ie=P(oe,v),ge=JSON.stringify(ie),ue=`@component('${ne}', ${ge})`;j.push({start:L,end:G,replacement:ue})}catch{continue}}for(let L=j.length-1;L>=0;L--){let{start:B,end:z,replacement:F}=j[L];E=E.substring(0,B)+F+E.substring(z)}return E}function Uo(x,v,k){let E=x,C=new RegExp(`${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=C.exec(E))!==null){let L=j.index,B=L+j[0].length-1,z=1,F=B+1,X=null,G=!1;while(F<E.length&&z>0){let re=E[F];if(G){G=!1,F++;continue}if(re==="\\"&&X){G=!0,F++;continue}if(X){if(re===X)X=null;F++;continue}if(re==='"'||re==="'"||re==="`"){X=re,F++;continue}if(re==="(")z++;else if(re===")"){if(z--,z===0)break}F++}if(z!==0)break;let J=E.substring(B+1,F),ne=k(J);E=E.substring(0,L)+ne+E.substring(F+1)}return E}function zb(x,v){let k=x;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,C)=>{if(C in v)return`:${C}="${C}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,C,j)=>{try{let L=Object.keys(v),B=Object.values(v);$s(j);let F=l(j,L)(...B),X=JSON.stringify(F);if(X===void 0){if(!ve(j).some((ne)=>!(ne in v)))return"";return E}let G=Buffer.from(X,"utf8").toString("base64");return`__stx_${C}="${G}"`}catch(L){return E}}),k}var Ho="<!--__STX_BREAK__-->",qo="<!--__STX_CONTINUE__-->";function Fb(x,v){let k=x;return k=Uo(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,L;if(p(j)){let B=l(j,Object.keys(v));L=Boolean(B(...Object.values(v)))}else L=Boolean(c(j,v));return L?Ho:""}catch{return""}}),k=Uo(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,L;if(p(j)){let B=l(j,Object.keys(v));L=Boolean(B(...Object.values(v)))}else L=Boolean(c(j,v));return L?qo:""}catch{return""}}),k}function Wb(x){let v=x;return v=v.replace(/@break(?!\()/g,Ho),v=v.replace(/@continue(?!\()/g,qo),v}function Dp(x){let v=x.includes(Ho),k=v?x.substring(0,x.indexOf(Ho)):x;return{hasBreak:v,content:k}}function Mp(x){let v=x.includes(qo),k=v?x.substring(0,x.indexOf(qo)):x;return{hasContinue:v,content:k}}function Np(x){let v=x;return v=Uo(v,"@break",(k)=>{let E=k.trim();if(!tr(E))return"";return`\`; if (${E}) { break; } result += \``}),v=Uo(v,"@continue",(k)=>{let E=k.trim();if(!tr(E))return"";return`\`; if (${E}) { continue; } result += \``}),v=v.replace(/@break(?!\()/g,"`; break; result += `"),v=v.replace(/@continue(?!\()/g,"`; continue; result += `"),v}function Vb(x){let v=/@forelse\s*\(/g,k,E=[],C=/@foreach\s*\(/g,j=/@endforeach/g,L;while((L=C.exec(x))!==null)E.push({pos:L.index,delta:1});while((L=j.exec(x))!==null)E.push({pos:L.index,delta:-1});E.sort((X,G)=>X.pos-G.pos);let B=[],z=0;for(let X of E)z+=X.delta,B.push({pos:X.pos,depth:z});function F(X){let G=0,J=B.length-1,ne=0;while(G<=J){let re=G+J>>1;if(B[re].pos<=X)ne=B[re].depth,G=re+1;else J=re-1}return ne}while((k=v.exec(x))!==null){if(F(k.index)>0)continue;let X=k.index,G=k.index+k[0].length-1,J=1,ne=G+1,re=-1;while(ne<x.length&&J>0){if(x[ne]==="(")J++;else if(x[ne]===")"){if(J--,J===0){re=ne;break}}ne++}if(re===-1)continue;let se=x.substring(G+1,re),oe=St(se);if(!oe)continue;let{arrayExpr:ie,itemVar:ge}=oe,ue=re+1,xe=1,we=ue,$e=/@forelse\s*\(/g,_e=/@endforelse/g,Ce=-1;while(xe>0&&we<x.length){$e.lastIndex=we,_e.lastIndex=we;let Ze=$e.exec(x),Pe=_e.exec(x);if(!Pe)break;if(Ze&&Ze.index<Pe.index)xe++,we=Ze.index+Ze[0].length;else{if(xe--,xe===0){Ce=Pe.index;break}we=Pe.index+11}}if(Ce===-1)continue;let Ee=x.substring(ue,Ce),Te=Ce+11,Re=-1,ke=0,Ae=0;while(Ae<Ee.length){let Ze=Ee.indexOf("@",Ae);if(Ze===-1)break;let Pe=Ee.substring(Ze);if(/^@forelse\s*\(/.test(Pe))ke++,Ae=Ze+1;else if(Pe.startsWith("@endforelse"))ke--,Ae=Ze+11;else if(ke===0&&Pe.startsWith("@empty")){if(Ee.length<=Ze+6||!/[a-z]/i.test(Ee[Ze+6])){Re=Ze;break}Ae=Ze+1}else Ae=Ze+1}if(Re===-1)continue;return{start:X,end:Te,arrayExpr:ie,itemVar:ge,foreachContent:Ee.substring(0,Re),emptyContent:Ee.substring(Re+6)}}return null}function Op(x,v){let k=x;while(!0){let E=Vb(k);if(!E)break;let{start:C,end:j,arrayExpr:L,itemVar:B,foreachContent:z,emptyContent:F}=E;try{let X;if(p(L))X=l(L,Object.keys(v))(...Object.values(v));else X=c(L,v);let G;if(!Array.isArray(X)||X.length===0)G=F;else G=`@foreach (${L} as ${B})${z}@endforeach`;k=k.substring(0,C)+G+k.substring(j)}catch(X){let G=X instanceof Error?X.message:String(X),J=o("Forelse",`Error in @forelse(${L} as ${B}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,C)+J+k.substring(j)}}return k}var jp="<!--stx:foreach-not-iterable:",Ub=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Hb(x,v){return`${jp}${encodeURIComponent(x)}|${encodeURIComponent(v)}-->`}function qb(x,v){console.warn(`[stx] @foreach(${x}) in ${v}: ${x} 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 ns(x){if(!x.includes(jp))return x;return x.replace(Ub,(v,k,E)=>(qb(decodeURIComponent(k),decodeURIComponent(E)),""))}function qi(x,v,k,E,C=!1){let j=x;j=Op(j,v);function L(F){let X=/@foreach\s*\(/g,G;while((G=X.exec(F))!==null){let J=G.index,ne=G.index+G[0].length-1,re=1,se=ne+1,oe=-1;while(se<F.length&&re>0){if(F[se]==="(")re++;else if(F[se]===")"){if(re--,re===0){oe=se;break}}se++}if(oe===-1)continue;let ie=F.substring(ne+1,oe),ge=St(ie);if(!ge)continue;let ue=J,{arrayExpr:xe,itemVar:we}=ge,$e=oe+1,_e=1,Ce=$e,Ee=/@foreach\s*\(/g,Te=/@endforeach/g;while(_e>0&&Ce<F.length){Ee.lastIndex=Ce,Te.lastIndex=Ce;let Re=Ee.exec(F),ke=Te.exec(F);if(!ke)break;if(Re&&Re.index<ke.index)_e++,Ce=Re.index+Re[0].length;else{if(_e--,_e===0){let Ae=F.substring($e,ke.index),Ze=ke.index+11;return{start:ue,end:Ze,arrayExpr:xe,itemVar:we,content:Ae}}Ce=ke.index+11}}}return null}function B(F,X){let G=F;while(!0){let J=L(G);if(!J)break;let{start:ne,end:re,arrayExpr:se,itemVar:oe,content:ie}=J;try{let ge=se.trim(),ue;if(p(ge))ue=l(ge,Object.keys(X))(...Object.values(X));else ue=c(ge,X);let xe=!1;if(!Array.isArray(ue))if(ue instanceof Map)ue=Array.from(ue),xe=!0;else if(ue instanceof Set)ue=Array.from(ue);else if(typeof ue==="string")ue=Array.from(ue);else if(ue&&typeof ue==="object"&&!(ue instanceof Date)&&!(ue instanceof RegExp))ue=Object.entries(ue),xe=!0;else{let ke=Hb(ge,k)+o("Foreach",`Error in @foreach: ${ge} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ne)+ke+G.substring(re);continue}let we=E?.loops?.useAltLoopVariable??jb,$e=oe.trim(),_e=null,Ce,Ee=!1;if($e.includes("=>")){let ke=$e.split("=>").map((Ae)=>Ae.trim());if(ke.length===2&&ke[0]&&ke[1])_e=ke[0],Ce=ke[1];else Ce=$e}else if(!$e.startsWith("[")&&!$e.startsWith("{")&&$e.includes(",")){let ke=$e.split(",").map((Ae)=>Ae.trim());if(ke.length===2&&ke[0]&&ke[1])Ce=ke[0],_e=ke[1],Ee=!0;else Ce=$e}else Ce=$e;let Te="",Re=ue;for(let ke=0;ke<Re.length;ke++){let Ae=Re[ke],Ze={index:ke,iteration:ke+1,first:ke===0,last:ke===Re.length-1,count:Re.length},Pe={...X,loop:Ze,$loop:Ze};if(Ce.startsWith("[")&&Ce.endsWith("]")){let at=Ce.slice(1,-1).split(",").map((rt)=>rt.trim());if(Array.isArray(Ae))at.forEach((rt,Et)=>{if(rt)Pe[rt]=Ae[Et]});else Pe[Ce]=Ae}else if(Ce.startsWith("{")&&Ce.endsWith("}")){let at=Ce.slice(1,-1).split(",").map((rt)=>rt.trim()).filter(Boolean);if(Ae!==null&&typeof Ae==="object")at.forEach((rt)=>{let Et=rt.indexOf(":"),ft=(Et===-1?rt:rt.slice(0,Et)).trim(),_t=Et===-1?ft:rt.slice(Et+1).trim();if(ft&&_t)Pe[_t]=Ae[ft]});else Pe[Ce]=Ae}else Pe[Ce]=Ae;if(_e)if(!Ee&&xe&&Array.isArray(Ae)&&Ae.length===2)Pe[_e]=Ae[0],Pe[Ce]=Ae[1];else Pe[_e]=ke;let Ie=Fb(ie,Pe),Ge=Mp(Ie);if(Ge.hasContinue){Te+=Ge.content;continue}let nt=Dp(Ie);if(nt.hasBreak){Te+=nt.content;break}if(Ie=Op(Ie,Pe),Ie=B(Ie,Pe),Ie=sr(Ie,Pe,k),Ie=Wb(Ie),nt=Dp(Ie),nt.hasBreak){Te+=nt.content;break}if(Ge=Mp(Ie),Ge.hasContinue){Te+=Ge.content;continue}Ie=W(Ie,Pe,k),Ie=zb(Ie,Pe),Ie=Bb(Ie,Pe),Ie=Lb(Ie,Pe),Te+=Ie}G=G.substring(0,ne)+Te+G.substring(re)}catch(ge){let ue=o("Foreach",`Error in @foreach(${se.trim()} as ${oe.trim()}): ${ge instanceof Error?ge.message:String(ge)}`,t.EVALUATION_ERROR);G=G.substring(0,ne)+ue+G.substring(re)}}return G}j=B(j,v),j=Bp(j,v,k,E);let z=E?.loops?.maxWhileIterations??Nb;return j=Zb(j,v,z),C?j:ns(j)}function lc(x){let v=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(x);if(!v||/^(?:const|let|var)$/.test(v[2]))return x;return`${v[1]}let ${x.slice(v[1].length)}`}function Lp(x){return tr(x)}function Bp(x,v,k,E){let C=x,j=!0;while(j){j=!1;let L=C.match(/@for\s*\(/);if(!L||L.index===void 0)break;let B=L.index,z=B+L[0].length-1,F=w(C,"(",")",z);if(F===-1)break;let X=lc(C.slice(z+1,F)),G=F+1,J=_o(C.slice(B),"for","endfor");if(J.length===0)break;let ne=J[0].content,re=B+J[0].end;if(!Lp(X)){let se=o("For",`Unsafe expression in @for: ${X}`,t.UNSAFE_EXPRESSION);C=C.substring(0,B)+se+C.substring(re),j=!0;continue}try{let se=Kb(X),oe=/@(?:for|foreach|if|unless)\s*\(/.test(ne);if(se.length>0&&oe){let $e=Xb({forExpr:X,content:ne,iterVarNames:se,context:v,filePath:k,options:E});C=C.substring(0,B)+$e+C.substring(re),j=!0;continue}let ie=Object.keys(v),ge=Object.values(v),ue=ne.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,($e,_e)=>`\${${_e}}`);ue=Np(ue);let we=Function(...ie,`
|
|
2484
2485
|
let result = '';
|
|
2485
|
-
for (${
|
|
2486
|
+
for (${X}) {
|
|
2486
2487
|
result += \`${ue}\`;
|
|
2487
2488
|
}
|
|
2488
2489
|
return result;
|
|
2489
|
-
`)(...
|
|
2490
|
+
`)(...ge);C=C.substring(0,B)+we+C.substring(re),j=!0}catch(se){let oe=o("For",`Error in @for(${X}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);C=C.substring(0,B)+oe+C.substring(re),j=!0}}return C}function Kb(x){let v=x.trim(),k=v.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((B)=>{let z=B.trim();if(!z)return"";let F=z.indexOf(":");if(F>=0&&j.startsWith("{")){let J=z.slice(F+1).trim(),ne=J.indexOf("=");return(ne>=0?J.slice(0,ne):J).trim()}let X=z.indexOf("="),G=(X>=0?z.slice(0,X):z).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let E=v.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let C=v.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(C)return[C[1]];return[]}function Xb(x){let{forExpr:v,content:k,iterVarNames:E,context:C,filePath:j,options:L}=x,B=Object.keys(C),z=Object.values(C),F=Function(...B,"__pushIter",`
|
|
2490
2491
|
for (${v}) {
|
|
2491
2492
|
__pushIter([${E.join(", ")}])
|
|
2492
2493
|
}
|
|
2493
|
-
`),
|
|
2494
|
+
`),X=[];F(...z,(ne)=>{X.push(ne)});let G=j??"inline.stx",J="";for(let ne of X){let re={...C};E.forEach((oe,ie)=>{re[oe]=ne[ie]});let se=Bp(k,re,j,L);se=sr(se,re,G),se=W(se,re,G),J+=se}return J}function Zb(x,v,k){let E=x,C=!0;while(C){C=!1;let j=E.match(/@while\s*\(/);if(!j||j.index===void 0)break;let L=j.index,B=L+j[0].length-1,z=w(E,"(",")",B);if(z===-1)break;let F=E.slice(B+1,z),X=_o(E.slice(L),"while","endwhile");if(X.length===0)break;let G=X[0].content,J=L+X[0].end;if(!Lp(F)){let ne=o("While",`Unsafe expression in @while: ${F}`,t.UNSAFE_EXPRESSION);E=E.substring(0,L)+ne+E.substring(J),C=!0;continue}try{let ne=Object.keys(v),re=Object.values(v),se=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ge,ue)=>`\${${ue}}`);se=Np(se);let ie=Function(...ne,`
|
|
2494
2495
|
let result = '';
|
|
2495
2496
|
let maxIterations = ${k}; // Configurable safety limit
|
|
2496
2497
|
let counter = 0;
|
|
@@ -2502,119 +2503,119 @@ ${C}
|
|
|
2502
2503
|
result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
2503
2504
|
}
|
|
2504
2505
|
return result;
|
|
2505
|
-
`)(...re);E=E.substring(0,L)+ie+E.substring(J),C=!0}catch(ne){let re=o("While",`Error in @while(${F}): ${ne instanceof Error?ne.message:String(ne)}`,t.EVALUATION_ERROR);E=E.substring(0,L)+re+E.substring(J),C=!0}}return E}function
|
|
2506
|
+
`)(...re);E=E.substring(0,L)+ie+E.substring(J),C=!0}catch(ne){let re=o("While",`Error in @while(${F}): ${ne instanceof Error?ne.message:String(ne)}`,t.EVALUATION_ERROR);E=E.substring(0,L)+re+E.substring(J),C=!0}}return E}function Gb(x,v="_method"){let k=x.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${v}" value="${k}">`}function zp(x){return x.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(v,k,E,C,j)=>Gb(E,j||"_method"))}async function Fp(x,v,k,E,C){if(!E.middleware||E.middleware.length===0)return x;let j=x,L=E.middleware.filter((B)=>B.timing===C);if(L.length===0)return j;for(let B of L){if(!B.name||typeof B.handler!=="function"){if(E.debug)console.warn("Invalid middleware:",B);continue}try{let z=await B.handler(j,v,k,E);if(typeof z==="string")j=z;else if(E.debug)console.warn(`Middleware ${B.name} did not return a string`)}catch(z){if(E.debug)console.error(`Error in middleware ${B.name}:`,z);if(E.debug){let F=g("Middleware",`Error in middleware '${B.name}': ${z instanceof Error?z.message:String(z)}`,k,x);j=j.replace(/<body[^>]*>/,`$&
|
|
2506
2507
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h(F)}</div>
|
|
2507
|
-
`)}}}return j}async function
|
|
2508
|
+
`)}}}return j}async function Wp(x,v,k,E){return Fp(x,v,k,E,"before")}async function Vp(x,v,k,E){return Fp(x,v,k,E,"after")}function Up(x){return x.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(v,k,E,C,j)=>{try{let L=C?P(C,{}):{};return mn(E,L,j==="true")}catch(L){return console.error(`Error processing @route directive: ${L}`),"#route-error"}})}var ri={patterns:[],exact:{}};async function Hp(x,v){let k=x.split("/").pop()?.split(".")[0]||"";if(ri.exact[x])for(let E of ri.exact[x])await Promise.resolve(E(v,x));if(ri.exact[k])for(let E of ri.exact[k])await Promise.resolve(E(v,x));for(let{pattern:E,callback:C}of ri.patterns)if(E.test(x)||E.test(k))await Promise.resolve(C(v,x))}var Jb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Yb=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 Rr(x,v){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=v;let E=k.exec(x);if(!E)return null;let C=/\/\s*>$/.test(E[0])||E[1]===E[1].toLowerCase()&&Jb.has(E[1]),j=C?E[2].replace(/\/\s*$/,""):E[2];return{full:E[0],tag:E[1],attrs:j,selfClosing:C,start:E.index,end:E.index+E[0].length}}function Qb(x,v,k){let E=1,C=k,j=new RegExp(`<${v}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),L=new RegExp(`</${v}\\s*>`,"gi");while(E>0&&C<x.length){j.lastIndex=C,L.lastIndex=C;let B=j.exec(x),z=L.exec(x);if(!z)return-1;if(B&&B.index<z.index)E++,C=B.index+B[0].length;else{if(E--,E===0)return z.index+z[0].length;C=z.index+z[0].length}}return-1}function Cr(x,v){if(v.selfClosing)return{outerStart:v.start,outerEnd:v.end,innerHTML:""};let k=Qb(x,v.tag,v.end);if(k===-1)return{outerStart:v.start,outerEnd:v.end,innerHTML:""};return{outerStart:v.start,outerEnd:k,innerHTML:x.slice(v.end,k-`</${v.tag}>`.length)}}function qp(x,v){return new RegExp(`(?:^|\\s)${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(x)||x.includes(` ${v}=`)||x.includes(` ${v} `)||x.trimEnd().endsWith(` ${v}`)}function si(x,v){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=x.match(new RegExp(`${k}="([^"]*)"`,"s"))||x.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function hr(x,v){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return x.replace(new RegExp(`\\s*${k}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${k}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${k}(?=\\s|$|>|/)`,"g"),"")}function Is(x,v,k){let E=v.selfClosing?" /":"",C=`<${v.tag}${k}${E}>`;return x.slice(0,v.start)+C+x.slice(v.end)}function ev(x){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(x)}function tv(x){let v=x,k=0;while(k<v.length){let E=Rr(v,k);if(!E)break;let C=si(E.attrs,"v-for");if(C===null){k=E.end;continue}let j=C.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!j){k=E.end;continue}let L=j[1].trim(),B=j[2].trim(),z;if(L.includes(",")){let oe=L.split(",").map((ue)=>ue.trim()),ie=oe[0],ge=oe[1];z=`${B} as ${ge} => ${ie}`}else z=`${B} as ${L}`;let F=hr(E.attrs,"v-for"),X=hr(F,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Cr(v,E),J=v.slice(G.outerStart,G.outerEnd),ne=Is(J,{...E,start:0,end:E.end-E.start},X),re=`@foreach(${z})
|
|
2508
2509
|
`,se=`${re}${ne}
|
|
2509
|
-
@endforeach`;v=v.slice(0,G.outerStart)+se+v.slice(G.outerEnd),k=G.outerStart+re.length}return v}function
|
|
2510
|
+
@endforeach`;v=v.slice(0,G.outerStart)+se+v.slice(G.outerEnd),k=G.outerStart+re.length}return v}function nv(x){let v=x,k=0;while(k<v.length){let E=Rr(v,k);if(!E)break;let C=si(E.attrs,"v-if");if(C===null){k=E.end;continue}let j=[],L=Cr(v,E),B=hr(E.attrs,"v-if"),z=Is(v.slice(L.outerStart,L.outerEnd),{...E,start:0,end:E.end-E.start},B);j.push({type:"if",expr:C,outerStart:L.outerStart,outerEnd:L.outerEnd,element:z,parsedTag:E});let F=L.outerEnd,X=!0;while(X){let se=v.slice(F).match(/^\s*/),oe=se?se[0].length:0,ie=Rr(v,F+oe);if(!ie){X=!1;break}let ge=si(ie.attrs,"v-else-if"),ue=qp(ie.attrs,"v-else");if(ge!==null){let xe=Cr(v,ie),we=hr(ie.attrs,"v-else-if"),$e=Is(v.slice(xe.outerStart,xe.outerEnd),{...ie,start:0,end:ie.end-ie.start},we);j.push({type:"else-if",expr:ge,outerStart:F,outerEnd:xe.outerEnd,element:$e,parsedTag:ie}),F=xe.outerEnd}else if(ue){let xe=Cr(v,ie),we=hr(ie.attrs,"v-else"),$e=Is(v.slice(xe.outerStart,xe.outerEnd),{...ie,start:0,end:ie.end-ie.start},we);j.push({type:"else",outerStart:F,outerEnd:xe.outerEnd,element:$e,parsedTag:ie}),X=!1}else X=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
|
|
2510
2511
|
${se.element}`);else if(se.type==="else-if")G.push(`@elseif(${se.expr})
|
|
2511
2512
|
${se.element}`);else G.push(`@else
|
|
2512
2513
|
${se.element}`);G.push("@endif");let J=G.join(`
|
|
2513
|
-
`),ne=j[0].outerStart,re=j[j.length-1].outerEnd;v=v.slice(0,ne)+J+v.slice(re),k=ne+J.length}return v}function
|
|
2514
|
-
${
|
|
2515
|
-
@endonce`;v=v.slice(0,j.outerStart)+z+v.slice(j.outerEnd),k=j.outerStart+z.length}return v}function
|
|
2516
|
-
${E}${x.slice(k)}`}var
|
|
2517
|
-
${j[0]}${x.slice(k,j.index)}${x.slice(L,C)}${x.slice(C)}`}function
|
|
2518
|
-
${v[0]}${E.slice(C)}`}var
|
|
2519
|
-
<meta name="stx-build" content="${v}">`}function
|
|
2520
|
-
`}function
|
|
2521
|
-
`),
|
|
2522
|
-
`),we=B.map((
|
|
2523
|
-
`)
|
|
2524
|
-
<html${
|
|
2514
|
+
`),ne=j[0].outerStart,re=j[j.length-1].outerEnd;v=v.slice(0,ne)+J+v.slice(re),k=ne+J.length}return v}function rv(x){return x.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function sv(x){let v=x,k=0;while(k<v.length){let E=Rr(v,k);if(!E)break;let C=Yb.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(B,z,F)=>{let X=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(z);if(!X||!F||!/^["']/.test(F))return B;let G=X[1]||"modelValue",J=X[2];if(C&&!X[1])return`@model${J}=${F}`;let ne=F[0],re=F.slice(1,-1),se=`:${G}=${F} @update:${G}=${ne}${re} = $event${ne}`;if(J){let oe=X[1]?`${G}Modifiers`:"modelModifiers",ie=J.slice(1).split(".").map((ge)=>`${ge}: true`).join(", ");se+=` :${oe}="{ ${ie} }"`}return se});if(j===E.attrs){k=E.end;continue}let L=Is(E.full,{...E,start:0,end:E.full.length},j);v=v.slice(0,E.start)+L+v.slice(E.end),k=E.start+L.length}return v}function iv(x){return x.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function ov(x){return x.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function av(x){let v=x,k=0;while(k<v.length){let E=Rr(v,k);if(!E)break;let C=si(E.attrs,"v-html");if(C===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Cr(v,E),L=hr(E.attrs,"v-html"),B=E.selfClosing?" /":"",z=`<${E.tag}${L}${B}>{!! ${C} !!}</${E.tag}>`;v=v.slice(0,j.outerStart)+z+v.slice(j.outerEnd),k=j.outerStart+z.length}return v}function cv(x){let v=x,k=0;while(k<v.length){let E=Rr(v,k);if(!E)break;let C=si(E.attrs,"v-text");if(C===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Cr(v,E),L=hr(E.attrs,"v-text"),B=E.selfClosing?" /":"",z=`<${E.tag}${L}${B}>{{ ${C} }}</${E.tag}>`;v=v.slice(0,j.outerStart)+z+v.slice(j.outerEnd),k=j.outerStart+z.length}return v}function lv(x){return x.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 uv(x){let v=x,k=0;while(k<v.length){let E=Rr(v,k);if(!E)break;if(!qp(E.attrs,"v-once")){k=E.end;continue}let C=hr(E.attrs,"v-once"),j=Cr(v,E),L=v.slice(j.outerStart,j.outerEnd),z=`@once
|
|
2515
|
+
${Is(L,{...E,start:0,end:E.end-E.start},C)}
|
|
2516
|
+
@endonce`;v=v.slice(0,j.outerStart)+z+v.slice(j.outerEnd),k=j.outerStart+z.length}return v}function dv(x){return x.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function fv(x){return x.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 Kp(x){if(!ev(x))return x;let v=x;return v=tv(v),v=nv(v),v=uv(v),v=iv(v),v=ov(v),v=sv(v),v=rv(v),v=fv(v),v=av(v),v=cv(v),v=lv(v),v=dv(v),v}function Ko(x){return x.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var Sl=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"]),pv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Xp(x,v){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(x),E=k?k[1]:x,C=c(E,v);if(C&&typeof C==="string")return C;let j=E.trim();return Sl.has(j)?j:null}function Zp(x){let v=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(x);return v?v[1]:x}function Gp(x,v,k){let E=v.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),C=E?`<${x} ${E}>`:`<${x}>`;if(pv.has(x))return E?`<${x} ${E}>`:`<${x}>`;return`${C}${k}</${x}>`}async function Jp(x,v,k,E,C){let j=x,L=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,B=[],z;while((z=L.exec(j))!==null)B.push({full:z[0],expr:z[1],attrs:z[2],slotContent:z[3],index:z.index});for(let F=B.length-1;F>=0;F--){let X=B[F];try{let G=Xp(X.expr,v);if(!G||typeof G!=="string"){let ge=`<!-- dynamic component: could not resolve "${Ko(Zp(X.expr))}" -->`;j=j.slice(0,X.index)+ge+j.slice(X.index+X.full.length);continue}if(Sl.has(G)){let ge=Gp(G,X.attrs,X.slotContent);j=j.slice(0,X.index)+ge+j.slice(X.index+X.full.length);continue}let J=X.attrs.trim(),ne={},re=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=re.exec(J))!==null){let ge=se[1]||se[2],ue=se[3];if(se[1])try{ne[ge]=c(ue,v)}catch{ne[ge]=ue}else ne[ge]=ue}let oe=E.componentsDir||"components",ie=await Ve(G,ne,X.slotContent,oe,v,k,E,new Set,C??new Set);j=j.slice(0,X.index)+ie+j.slice(X.index+X.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Ko(J)} -->`;j=j.slice(0,X.index)+ne+j.slice(X.index+X.full.length)}}return j=await gv(j,v,k,E,C),j}async function gv(x,v,k,E,C){let j=x,L=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,B=[],z;while((z=L.exec(j))!==null)B.push({full:z[0],expr:z[1],attrs:z[2],index:z.index});for(let F=B.length-1;F>=0;F--){let X=B[F];try{let G=Xp(X.expr,v);if(!G||typeof G!=="string"){let re=`<!-- dynamic component: could not resolve "${Ko(Zp(X.expr))}" -->`;j=j.slice(0,X.index)+re+j.slice(X.index+X.full.length);continue}if(Sl.has(G)){let re=Gp(G,X.attrs,"");j=j.slice(0,X.index)+re+j.slice(X.index+X.full.length);continue}let J=E.componentsDir||"components",ne=await Ve(G,{},"",J,v,k,E,new Set,C??new Set);j=j.slice(0,X.index)+ne+j.slice(X.index+X.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Ko(J)} -->`;j=j.slice(0,X.index)+ne+j.slice(X.index+X.full.length)}}return j}function $l(){return{afterOpen:[],beforeClose:[]}}function mv(x){return x.afterOpen.length>0||x.beforeClose.length>0}function Qp(x,v){if(!mv(v))return x;let k=v.afterOpen.join(""),E=v.beforeClose.join(""),C=x.lastIndexOf("</head>"),j=k?ii(x):null,L=E&&C!==-1?C:null;if(j===null&&L===null)return x;if(j!==null&&L!==null)return`${x.slice(0,j)}${k}${x.slice(j,L)}${E}${x.slice(L)}`;if(j!==null)return`${x.slice(0,j)}${k}${x.slice(j)}`;return`${x.slice(0,L)}${E}${x.slice(L)}`}var Yp=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function ii(x){let v=/<head\b[^>]*>/i.exec(x);if(!v)return null;let k=v.index+v[0].length;Yp.lastIndex=k;let E=Yp.exec(x);return E?k+E[0].length:k}var kl="data-stx-color-mode-boot",hv="__STX_COLOR_MODE__",yv=new Set(["light","dark","auto","system"]),xv=new Set(["auto","system"]),bv=/^[a-z][\w:-]*$/i,vv=/^[\w-]+$/;function wv(x){let v=x.storageKey??"stx-color-mode",k=x.initialMode??"auto",E=x.darkClass===void 0?"dark":x.darkClass,C=x.attribute??null,j=x.autoValue??null,L=x.respectExisting===!0;if(typeof v!=="string"||v.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!yv.has(k))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(k)}`);if(E!==null&&(typeof E!=="string"||!vv.test(E)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(E)}`);if(C!==null&&(typeof C!=="string"||!bv.test(C)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(C)}`);if(j!==null&&!xv.has(j))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(j)}`);if(E===null&&C===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(L&&C===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:v,initialMode:k==="system"?"auto":k,darkClass:E,attribute:C,autoValue:j,respectExisting:L}}function Sv(x){return JSON.stringify(x).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function El(x={}){let v=wv(x),E=`(function(){"use strict";var c=${Sv(v)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var r=document.documentElement;var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f;if(!m){m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}}if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${hv}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m}}catch(e){}}());`;return`<script ${kl}>${E}</script>`}function jn(x,v={}){if(x.includes(kl))return x;let k=_l(x);if(k===null)return x;let E=El(v);return`${x.slice(0,k)}
|
|
2517
|
+
${E}${x.slice(k)}`}var _l=ii,$v=new RegExp(`<script\\b[^>]*\\b${kl}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),eg=/<meta\b[^>]*\bcharset\b[^>]*>/gi,tg=/<\/head>/gi;function _v(x){let v=/<head\b[^>]*>/i.exec(x);if(!v)return x;let k=v.index+v[0].length;tg.lastIndex=k;let E=tg.exec(x),C=E?E.index:x.length;eg.lastIndex=k;let j=eg.exec(x);if(!j||j.index>=C)return x;if(x.slice(k,j.index).trim()==="")return x;let L=j.index+j[0].length;return`${x.slice(0,k)}
|
|
2518
|
+
${j[0]}${x.slice(k,j.index)}${x.slice(L,C)}${x.slice(C)}`}function ng(x){return kv(_v(x))}function kv(x){let v=$v.exec(x);if(!v)return x;let k=_l(x);if(k===null)return x;if(v.index<=k||x.slice(k,v.index).trim()==="")return x;let E=x.slice(0,v.index)+x.slice(v.index+v[0].length),C=_l(E);if(C===null)return x;return`${E.slice(0,C)}
|
|
2519
|
+
${v[0]}${E.slice(C)}`}var Xi="X-STX-Build",Cl=Symbol.for("stx.buildId");function os(){let x=globalThis;if(!x[Cl])x[Cl]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return x[Cl]}function rg(x,v=os()){if(x.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(x))return null;return`
|
|
2520
|
+
<meta name="stx-build" content="${v}">`}function Ev(x){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let v=navigator.serviceWorker,k=window;if(k.stxOffline)return;let E=null,C=!1,j=[],L={updateReady:!1,registration:()=>E,onUpdateReady(X){if(L.updateReady)try{X()}catch{}else j.push(X);return()=>{let G=j.indexOf(X);if(G!==-1)j.splice(G,1)}},applyUpdate(){let X=E&&E.waiting;if(!X)return!1;return C=!0,X.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=L;let B=(X)=>{if(!X.waiting||!v.controller||L.updateReady)return;L.updateReady=!0;let G=j.splice(0);for(let J of G)try{J()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};v.addEventListener("message",(X)=>{let G=X.data||{};if(G.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:G.url,kind:G.kind,fragment:!!G.fragment}}))}catch{}}),v.addEventListener("controllerchange",()=>{if(C)C=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&E&&E.waiting)E.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let z=()=>{v.register(x,{scope:"/"}).then((X)=>{if(E=X,X.waiting)B(X),X.waiting.postMessage({type:"stx:activate-update",reason:"load"});X.addEventListener("updatefound",()=>{let G=X.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")B(X)})})}).catch(()=>{})},F=()=>{let X=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>X(z));else X(z)};if(!v.controller)if(document.readyState==="complete")F();else addEventListener("load",F);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",F);else F()}function Cv(){let x=`(${Ev.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(x).trim().replace(/;$/,"")}catch{return x}}var sg=`<script data-stx-offline>${Cv()}</script>`;import{AsyncLocalStorage as Rv}from"async_hooks";var ig=new Rv;function tn(x){return x.__stx_server_data??={pending:new Map,values:new Map}}function og(x,v){return ig.run(tn(x),v)}async function ag(x,v){let k=ig.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof x!=="string"||!x.trim())throw TypeError("useServerData requires a non-empty string key");let E=k.pending.get(x);if(E)return E;let C=Promise.resolve().then(v).then((j)=>{let L=JSON.stringify(j,(z,F)=>{if(F===void 0||typeof F==="function"||typeof F==="symbol"||typeof F==="bigint"||typeof F==="number"&&!Number.isFinite(F))throw TypeError(`useServerData(${JSON.stringify(x)}) requires JSON-serializable data`);if(F&&typeof F==="object"&&!Array.isArray(F)&&Object.getPrototypeOf(F)!==Object.prototype&&Object.getPrototypeOf(F)!==null)throw TypeError(`useServerData(${JSON.stringify(x)}) requires JSON-serializable data`);return F}),B=JSON.parse(L);return k.values.set(x,B),B}).catch((j)=>{throw k.pending.delete(x),j});return k.pending.set(x,C),C}function Ln(x){let v=x.__stx_server_data;if(!v?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(v.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var ug="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Xo="data-stx-html-attrs",Zo="data-stx-html-class",dg=/^[A-Za-z_:][\w:.-]*$/;function ar(x){return String(x).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Tv(x){return String(x).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function yr(x){if(x.name)return`name="${x.name}"`;if(x.property)return`property="${x.property}"`;if(x.charset!=null)return"charset=";if(x["http-equiv"])return`http-equiv="${x["http-equiv"]}"`;return""}function Av(x){let v=/^\s*<meta\b([^>]*)>/i.exec(x);if(!v)return null;let k={};for(let E of v[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))k[E[1].toLowerCase()]=E[2]??E[3]??E[4]??"";return k}function Ds(x,v){return Object.entries(x).filter(([k])=>!v?.(k)).map(([k,E])=>`${k}="${ar(String(E))}"`).join(" ")}function Iv(x={},v="en"){let k=[],E=[],C="",j=v;for(let[B,z]of Object.entries(x||{})){if(z==null)continue;let F=B.trim();if(!dg.test(F))continue;let X=F.toLowerCase();if(X==="lang"){j=String(z);continue}if(X==="class"){C=String(z).trim();continue}k.push(` ${F}="${ar(String(z))}"`),E.push(F)}let L=` lang="${ar(j)}"`;if(C)L+=` class="${ar(C)}"`;if(L+=k.join(""),C)L+=` ${Zo}="${ar(C)}"`;if(E.length)L+=` ${Xo}="${ar(E.join(" "))}"`;return L}function fg(x={},v={}){let k={...x,...v};if(x.class&&v.class){let E=x.class.split(/\s+/).filter(Boolean);for(let C of v.class.split(/\s+/).filter(Boolean))if(!E.includes(C))E.push(C);k.class=E.join(" ")}return k}function Bn(x,v={}){if(!v||Object.keys(v).length===0)return x;let k=x.match(/<html\b([^>]*)>/i);if(!k)return x;let E={},C=[],j=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,L;while((L=j.exec(k[1]))!==null){let X=L[1];if(!(X in E))C.push(X);E[X]=L[2]??L[3]??L[4]??""}let B=[],z=[];for(let[X,G]of Object.entries(v)){if(G==null)continue;let J=X.trim();if(!dg.test(J))continue;let ne=J.toLowerCase();if(ne==="class"){let re=(E.class||"").split(/\s+/).filter(Boolean);for(let se of String(G).split(/\s+/).filter(Boolean))if(!re.includes(se))re.push(se),B.push(se);if(!("class"in E))C.push("class");E.class=re.join(" ");continue}if(!(J in E))C.push(J);if(E[J]=String(G),ne!=="lang")z.push(J)}if(B.length){if(!(Zo in E))C.push(Zo);E[Zo]=B.join(" ")}if(z.length){if(!(Xo in E))C.push(Xo);E[Xo]=z.join(" ")}let F=C.map((X)=>` ${X}="${ar(E[X])}"`).join("");return x.replace(k[0],()=>`<html${F}>`)}function pg(x){if(x.includes("data-stx-cloak"))return null;if(x.lastIndexOf("</head>")===-1)return null;return`${ug}
|
|
2521
|
+
`}function Pv(x){let v=[],k=0;while(k<x.length){let j=x.slice(k),L=j.match(/^\s+/);if(L){k+=L[0].length;continue}if(j.startsWith("<!--")){let G=x.indexOf("-->",k);if(G===-1)break;k=G+3;continue}let B=j.match(/^<script\b[^>]*>/i);if(B){let G=x.toLowerCase().indexOf("</script>",k+B[0].length);if(G===-1)break;k=G+9;continue}let z=j.match(/^<link\b[^>]*>/i);if(z){v.push(z[0]),k+=z[0].length;continue}let F=j.match(/^<meta\b[^>]*>/i);if(F){v.push(F[0]),k+=F[0].length;continue}let X=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(X){v.push(X[0]),k+=X[0].length;continue}break}if(v.length===0)return{body:x,hoisted:v};let E="",C=0;while(C<x.length&&C<k){let j=x.slice(C),L=j.match(/^<link\b[^>]*>/i);if(L&&v.includes(L[0])){C+=L[0].length;continue}let B=j.match(/^<meta\b[^>]*>/i);if(B&&v.includes(B[0])){C+=B[0].length;continue}let z=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z&&v.includes(z[0])){C+=z[0].length;continue}E+=x[C],C++}return E+=x.slice(k),{body:E,hoisted:v}}function Dv(x,v={},k={}){let{title:E="stx App",lang:C="en",meta:j=[],link:L=[],script:B=[],headRaw:z="",htmlAttrs:F={},bodyClass:X="",bodyAttrs:G={}}=v,J=k.title||E,ne=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],re=new Set(j.map(yr).filter(Boolean)),{body:se,hoisted:oe}=Pv(x),ie=new Set(oe.flatMap((Re)=>{let ke=Av(Re);return ke?[yr(ke)].filter(Boolean):[]})),ue=[...ne.filter((Re)=>!re.has(yr(Re))),...j].filter((Re)=>!ie.has(yr(Re))).map((Re)=>` <meta ${Ds(Re)}>`).join(`
|
|
2522
|
+
`),xe=L.map((Re)=>` <link ${Ds(Re)}>`).join(`
|
|
2523
|
+
`),we=B.map((Re)=>{if(Re.src)return` <script ${Ds(Re,(ke)=>ke==="content")}></script>`;if(Re.content)return` <script>${Re.content}</script>`;return""}).filter(Boolean).join(`
|
|
2524
|
+
`),$e=Iv(F,C),_e=Object.entries(G).map(([Re,ke])=>` ${Re}="${ar(String(ke))}"`).join(""),Ce=X?` class="${ar(X)}"`:"",Ee=[ue,k.colorMode?` ${El(k.colorMode)}`:"",` <title>${k.titleIsHtml?J:Tv(J)}</title>`,` ${ug}`,xe,we,z?` ${z}`:"",...(k.styles||[]).map((Re)=>` ${Re}`),...oe.map((Re)=>` ${Re}`),...(k.headScripts||[]).map((Re)=>` ${Re}`),k.headStack||""].filter(Boolean),Te=[se,...(k.bodyScripts||[]).map((Re)=>Re),k.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
2525
|
+
<html${$e}>
|
|
2525
2526
|
<head>
|
|
2526
|
-
${
|
|
2527
|
+
${Ee.join(`
|
|
2527
2528
|
`)}
|
|
2528
2529
|
</head>
|
|
2529
|
-
<body${
|
|
2530
|
-
${
|
|
2530
|
+
<body${Ce}${_e}>
|
|
2531
|
+
${Te.join(`
|
|
2531
2532
|
`)}
|
|
2532
2533
|
</body>
|
|
2533
|
-
</html>`}var
|
|
2534
|
+
</html>`}var Rl=/\s+/y,Tl=/<(script|style)\b[^>]*>/iy,Mv=/<\/script>/gi,Ov=/<\/style>/gi,cg=/<!DOCTYPE\b/iy,lg=/<html[\s>]/iy;function nn(x){let v=0;while(v<x.length){if(Rl.lastIndex=v,Rl.exec(x)){v=Rl.lastIndex;continue}if(x.startsWith("<!--",v)){let C=x.indexOf("-->",v);if(C===-1)return!1;v=C+3;continue}Tl.lastIndex=v;let E=Tl.exec(x);if(E){let C=E[1].toLowerCase()==="script"?Mv:Ov;C.lastIndex=Tl.lastIndex;let j=C.exec(x);if(j===null)return!1;v=j.index+j[0].length;continue}if(cg.lastIndex=v,cg.test(x))return!0;return lg.lastIndex=v,lg.test(x)}return!1}function Al(x){return nn(x)}function gg(x,v={}){let k=x.lastIndexOf("</head>");if(k===-1)return x;let{meta:E=[],link:C=[],script:j=[],headRaw:L=""}=v,B=x.slice(0,k),z=[];for(let F of E){let X=yr(F);if(X&&B.includes(X))continue;z.push(` <meta ${Ds(F)}>`)}for(let F of C){if(F.href&&B.includes(`href="${F.href}"`))continue;z.push(` <link ${Ds(F)}>`)}for(let F of j)if(F.src){if(B.includes(`src="${F.src}"`))continue;z.push(` <script ${Ds(F,(X)=>X==="content")}></script>`)}else if(F.content){if(B.includes(F.content))continue;z.push(` <script>${F.content}</script>`)}if(L&&!B.includes(L))z.push(` ${L}`);if(z.length===0)return x;return`${x.slice(0,k)}${z.join(`
|
|
2534
2535
|
`)}
|
|
2535
|
-
${x.slice(k)}`}function
|
|
2536
|
-
`+x.slice(k);let C=
|
|
2536
|
+
${x.slice(k)}`}function Fn(x,v={},k={},E){if(E??Al(x))return x;return Dv(x,v,k)}var Nv=/<\/(script)/gi;function Ms(x){if(!x||x.indexOf("</")===-1)return x;return x.replace(Nv,"<\\/$1")}var H=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];import mg from"path";function M(x,v={}){return new gn(x,v).routes}var hg=new Map;async function yg(x,v){let k=x,E=v;if(!k||!E)try{let B=await i();k||=B?.pagesDir||"pages",E||=B?.root||"."}catch{k||="pages",E||="."}let C=mg.isAbsolute(k)?k:mg.join(E,k),j=hg.get(C);if(j)return j;let L=[];try{L=M(".",{pagesDir:C,emit:!1}).map((B)=>B.regex.source).filter(Boolean)}catch{L=[]}return hg.set(C,L),L}function Lv(x){return x.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function xg(x){return Lv(JSON.stringify(x))}function ae(x){return x.includes("data-stx-runtime")}function bg(x){let v=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=v.exec(x);k!==null;k=v.exec(x)){let E=x.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(E))continue;return!0}return!1}function Il(x,v){let k=Ws(x),E=x.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return x.slice(0,k)+v+`
|
|
2537
|
+
`+x.slice(k);let C=ii(x);if(C!==null)return`${x.slice(0,C)}
|
|
2537
2538
|
${v}${x.slice(C)}`;if(x.includes("</head>")){let L=x.indexOf("</head>");return x.slice(0,L)+v+`
|
|
2538
|
-
`+x.slice(L)}if(
|
|
2539
|
+
`+x.slice(L)}if(Tn(x))return Lr(x,(L)=>`${L}
|
|
2539
2540
|
${v}`);return`${v}
|
|
2540
|
-
${x}`}async function
|
|
2541
|
+
${x}`}async function Go(x,v){if(x.includes("data-stx-runtime")||x.includes("window.stx.state")||x.includes("STX Signals Runtime"))return x;if(v.buildMode==="serve"){let{getServeClientAsset:C}=await import("./chunk-75zcwcrt.js"),{url:j}=await C("runtime",v.debug===!0);return Il(x,`<script data-stx-runtime src="${j}"></script>`)}if(v.buildMode==="compile")return Il(x,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-75zcwcrt.js"),E=await k(v.debug);return Il(x,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function Bv(x){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(x)}function vg(x){if(x.includes("data-stx-tooltip-runtime")||!Bv(x))return x;let v=`<script data-stx-scoped data-stx-tooltip-runtime>${gl()}</script>`,k=x.lastIndexOf("</body>");if(k===-1)return`${x}
|
|
2541
2542
|
${v}`;return`${x.slice(0,k)}${v}
|
|
2542
|
-
${x.slice(k)}`}var
|
|
2543
|
-
`}let{getCachedRouterScript:C,getServeClientAsset:j}=await import("./chunk-
|
|
2544
|
-
</body>`+x.slice(B+7)}var
|
|
2545
|
-
`)}else{if(!
|
|
2546
|
-
`)
|
|
2547
|
-
`)re++;G=re;continue}if(ne==="/"&&x[G+1]==="*"){let re=G+2;while(re<j-1&&!(x[re]==="*"&&x[re+1]==="/"))re++;G=re+2;continue}if(ne==='"'||ne==="'"||ne==="`"){let re=G+1;while(re<j){if(x[re]==="\\"){re+=2;continue}if(x[re]===ne){re++;break}re++}G=re;continue}if(ne==="("||ne==="["||ne==="{"){J++,G++;continue}if(ne===")"||ne==="]"||ne==="}"){J--,G++;continue}if(ne===";"&&J===0)return G+1;G++}return j};while(E<j){let
|
|
2548
|
-
${
|
|
2549
|
-
|
|
2550
|
-
`);G=
|
|
2543
|
+
${x.slice(k)}`}var zv=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Fv(x){return zv.test(x)||x.includes("__stxRouter)return")||x.includes("__stxRouter=true")}async function q(x,v){if(!x.includes("</body>"))return x;if(Fv(x))return x;let k=v?.router,E="";{let z={};if(k){if(k.container)z.container=k.container;if(k.interceptAllLinks!==void 0)z.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)z.progress=k.progress;if(k.viewTransitions!==void 0)z.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)z.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)z.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)z.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)z.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)z.prefetch=k.prefetch;if(k.cache!==void 0)z.cache=k.cache;if(k.progressColor!==void 0)z.progressColor=k.progressColor;if(k.progressHeight!==void 0)z.progressHeight=k.progressHeight}try{let F=await yg(v?.pagesDir,v?.root);if(F.length>0)z.ownedRoutes=F}catch{}if(Object.keys(z).length>0)E=`<script>window.__stxRouterConfig=${xg(z)};</script>
|
|
2544
|
+
`}let{getCachedRouterScript:C,getServeClientAsset:j}=await import("./chunk-75zcwcrt.js"),L=v?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':v?.buildMode==="serve"?`<script data-stx-router src="${(await j("router")).url}"></script>`:`<script data-stx-router>${await C()}</script>`,B=x.lastIndexOf("</body>");return x.slice(0,B)+E+L+`
|
|
2545
|
+
</body>`+x.slice(B+7)}var wg=Symbol.for("stx.lazy-module-promises");function Wv(){let x=globalThis;return x[wg]??=new Map,x[wg]}function ut(x,v){let k=Wv(),E=`${import.meta.url}\x00${x}`,C=k.get(E);if(C)return C;let j=v();return k.set(E,j),j.catch(()=>{if(k.get(E)===j)k.delete(E)}),j}var Pl=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Rg=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Vv=65536,Uv=4,Yo=new Map;function Pu(){Yo.clear()}function Hv(x){let v=[];for(let k of Mr(x,Y)){let E=k.token.match(/^<script\b([^>]*)>/i),C=k.token.match(/<\/script\s*>$/i);if(!E||!C)continue;let j=E[0].length,L=k.token.length-C[0].length;v.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,L),start:k.start,end:k.end}))}return v}function Za(x,v={}){let k=x.length>=Vv,E=k?Yo.get(x):void 0;if(E===void 0){if(E=Hv(x),k)Si(Yo,Uv),Yo.set(x,E)}let C=v.skipAttrs;if(!C)return E.slice();let j=[];for(let L of E)if(C.lastIndex=0,!C.test(L.attrs))j.push(L);return j}function Yr(x){let v=x.trim(),k=v.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let C=k[1].trim(),j=k[2].trim(),{itemVar:L,indexVar:B}=Sg(j);if(L)return{style:"as",iterable:C,itemVar:L,indexVar:B}}let E=v.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(E){let C=E[1].trim(),j=E[2].trim(),{itemVar:L,indexVar:B}=Sg(C);if(L)return{style:"in",iterable:j,itemVar:L,indexVar:B}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Sg(x){let v=x.trim(),k=v.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let E=v.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(E)return{itemVar:E[1],indexVar:E[2]||null};let C=v.match(/^(\w+)\s*,\s*(\w+)$/);if(C)return{itemVar:C[1],indexVar:C[2]};let j=v.match(/^(\w+)$/);if(j)return{itemVar:j[1],indexVar:null};return{itemVar:null,indexVar:null}}function Zr(x,v){return bo(x,v)}function qv(x){let v=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,E;while((E=v.exec(x))!==null){let C=E[1];if(C.startsWith("if"))k++;else if(C==="endif")k--;else if(k===0)return!0}return!1}function Tg(x){let v=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,E=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,C;while((C=k.exec(x))!==null){let j=C[1],L;while((L=E.exec(j))!==null)v.add(L[1])}return v}function Kv(x){if(!/[:@]for\s*=/.test(x)&&!/\bx-for\s*=/.test(x))return[];let v=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Pl})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=Mr(x,(j,L)=>{v.lastIndex=L;let B=v.exec(j);if(!B||B.index!==L||!k.test(B[2]))return-1;return v.lastIndex}),C=[];for(let j of E){v.lastIndex=0;let L=v.exec(j.token);if(!L)continue;let B=L[2].match(k),z=Yr(B?.[1]??B?.[2]??""),F=[z.itemVar,z.indexVar].filter(Boolean);if(F.length===0)continue;let X=L[1],J=/\/\s*>$/.test(j.token)||Qo.has(X.toLowerCase())?j.end:Ml(x,j.start,X,j.end);if(J!==-1)C.push({start:j.start,end:J,vars:new Set(F)})}return C}var $g=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 Xv(x){return x.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function _g(x,v,k,E){if(!x)return!1;let C=Xv(x),j=!1,L=!1,B=!1,z=/([a-zA-Z_$][\w$]*)/g,F;while((F=z.exec(C))!==null){let ne=F[1];if(C.slice(0,F.index).trimEnd().endsWith("."))continue;if($g.has(ne))continue;if(v.has(ne)||E?.has(ne))j=!0;else if(k&&ne in k)L=!0}let X=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=X.exec(C))!==null){let ne=G[1];if(C.slice(0,G.index).trimEnd().endsWith("."))continue;if($g.has(ne)||k&&ne in k)continue;B=!0}return(j||B)&&!L}function Jo(x,v,k){let E=k===void 0?` ${v}`:` ${v}="${k.replace(/"/g,""")}"`,C=x.trim(),j=C.match(Rg);if(j&&Zv(j[3],j[1])){let[,L,B,z]=j;return`<${L}${B}${E}>${z}</${L}>`}return`<template${E}>${C}</template>`}function Zv(x,v){let k=new RegExp(`<(/)?${v}(?=[\\s/>])`,"gi"),E=0,C;while((C=k.exec(x))!==null)if(C[1]){if(E--,E<0)return!1}else E++;return!0}function Fi(x,v){let k=Tg(x);function E(C){let j=C,L=Kv(C),B=(G)=>{let J=new Set;for(let ne of L)if(G>ne.start&&G<ne.end)for(let re of ne.vars)J.add(re);return J},z=/@if\s*\(/g,F,X=[];while((F=z.exec(j))!==null){let G=F.index,J=G+F[0].length,ne=1,re=J;while(re<j.length&&ne>0){if(j[re]==="(")ne++;else if(j[re]===")")ne--;re++}if(ne!==0)continue;let se=j.substring(J,re-1).trim(),oe=re,ie=1,ge=oe,ue=/@(if\s*\(|endif)/g;ue.lastIndex=oe;let xe;while((xe=ue.exec(j))!==null)if(xe[1].startsWith("if"))ie++;else if(xe[1]==="endif"){if(ie--,ie===0){ge=xe.index+xe[0].length;break}}if(ie!==0)continue;let we=j.substring(oe,ge-6).trim(),$e;if(qv(we)){let _e=Ks(j.substring(G,ge));if(_e.length===0)continue;let Ce=_e[0].branches.filter((ke)=>ke.type!=="else"),Ee=B(G);if(!(Ce.length>0&&Ce.every((ke)=>_g(ke.condition,k,v,Ee))))continue;$e=_e[0].branches.map((ke)=>{let Ae=E(ke.content);if(ke.type==="elseif")return Jo(Ae,"@else-if",ke.condition??"");if(ke.type==="else")return Jo(Ae,"@else");return Jo(Ae,"@if",ke.condition??"")}).join(`
|
|
2546
|
+
`)}else{if(!_g(se,k,v,B(G)))continue;$e=Jo(E(we),"@if",se)}X.push({start:G,end:ge,replacement:$e}),z.lastIndex=ge}for(let G=X.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=X[G];j=j.substring(0,J)+re+j.substring(ne)}return j}return E(x)}function Gv(x){let v=x.trim();if(v==="")return;if(v==="true")return!0;if(v==="false")return!1;if(v==="null")return!1;if(v==="undefined")return!1;if(v==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(v)){let C=Number(v);return C!==0&&!Number.isNaN(C)}let k=v.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let E=v.match(/^"((?:\\.|[^"\\])*)"$/);if(E)return E[1].length>0;return}var Qo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),kg=/<(script|style)\b/iy,Jv=/<\/script/gi,Yv=/<\/style/gi;function Ml(x,v,k,E){if(Qo.has(k.toLowerCase()))return E;let C=k.toLowerCase(),j=x.length,L=1,B=E;while(B<j){let z=x.indexOf("<",B);if(z===-1)return-1;if(B=z,x.startsWith("<!--",B)){let J=x.indexOf("-->",B+4);if(J===-1)return-1;B=J+3;continue}kg.lastIndex=B;let F=kg.exec(x);if(F){let J=x.indexOf(">",B);if(J===-1)return-1;if(x[J-1]==="/"){B=J+1;continue}let ne=F[1].toLowerCase()==="script"?Jv:Yv;ne.lastIndex=B;let re=ne.exec(x);if(re===null)return-1;let se=x.indexOf(">",re.index);if(se===-1)return-1;B=se+1;continue}if(x[B+1]==="/"){let J=/^<\/([a-z][\w-]*)\s*>/i.exec(x.slice(B,B+64));if(!J){B++;continue}if(J[1].toLowerCase()===C){if(L--,B+=J[0].length,L===0)return B;continue}B+=J[0].length;continue}let X=/^<([a-z][\w-]*)\b/i.exec(x.slice(B,B+64));if(!X){B++;continue}let G=x.indexOf(">",B);if(G===-1)return-1;if(X[1].toLowerCase()===C){let J=x.slice(B,G+1);if(!(/\/\s*>$/.test(J)||Qo.has(C)))L++}B=G+1}return-1}var Qv=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ew(x,v){let k=v,E=x.length;for(;;){while(k<E&&x[k]!=="<")k++;if(k>=E)return!1;if(x.startsWith("<!--",k)){let L=x.indexOf("-->",k+4);if(L===-1)return!1;k=L+3;continue}break}if(x[k+1]==="/")return!1;let C=x.indexOf(">",k);if(C===-1)return!1;let j=x.slice(k,C+1);return Qv.test(j)}function zi(x){if(!x.includes(":if")&&!x.includes(":show")&&!x.includes("x-if")&&!x.includes("x-show")&&!x.includes("@if=")&&!x.includes("@show="))return x;let v=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(x))!==null)v.push([E.index,E.index+E[0].length]);let C=(G)=>v.some(([J,ne])=>G>=J&&G<ne),j=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,L=[],B;while((B=j.exec(x))!==null){if(C(B.index))continue;let[G,J,ne,re,se,oe,ie]=B,ge=Gv(se);if(ge===void 0)continue;let ue=B.index,xe=ue+G.length,_e=!!ie||/\/\s*>$/.test(G)||Qo.has(J.toLowerCase())?xe:Ml(x,ue,J,xe);if(_e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&ew(x,_e)){j.lastIndex=xe;continue}if(ge===!0){let Ee=`<${J}${ne}${oe}${ie}>`;L.push({start:ue,end:xe,replacement:Ee});continue}L.push({start:ue,end:_e,replacement:""}),j.lastIndex=_e}if(L.length===0)return x;L.sort((G,J)=>G.start-J.start);let z=[],F=-1;for(let G of L){if(G.start<F)continue;z.push(G),F=G.end}let X=x;for(let G=z.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=z[G];X=X.substring(0,J)+re+X.substring(ne)}return X}var Eg=[":for","@for","x-for"];function Qr(x,v){if(!v||Object.keys(v).length===0)return x;if(!Eg.some((B)=>x.includes(`${B}=`)))return x;let k=Tg(x);if(Array.isArray(v.__stx_client_signal_names)){for(let B of v.__stx_client_signal_names)if(typeof B==="string")k.add(B)}let E=x,C=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,L;while((L=j.exec(E))!==null){let[B,z,F]=L,X=L.index,G=X+B.length,J=Eg.map(($e)=>({attr:$e,m:new RegExp(`\\s${$e}="([^"]*)"`).exec(F)})).find(($e)=>$e.m!==null);if(!J||!J.m)continue;let ne=Yr(J.m[1]);if(!ne.iterable||!ne.itemVar)continue;let re=ne.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in v))continue;let se=Ml(E,X,z,G);if(se===-1)continue;let oe=F.replace(new RegExp(`\\s${J.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ie=E.slice(G,se-`</${z}>`.length),ge={...v,[ne.itemVar]:void 0};if(ne.indexVar)ge[ne.indexVar]=void 0;let ue=Qr(ie,ge),xe=ne.indexVar?`${ne.iterable} as ${ne.indexVar} => ${ne.itemVar}`:`${ne.iterable} as ${ne.itemVar}`,we=z.toLowerCase()==="template"?ue:`<${z}${oe}>${ue}</${z}>`;C.push({start:X,end:se,replacement:`@foreach(${xe})${we}@endforeach`}),j.lastIndex=se}for(let B=C.length-1;B>=0;B--){let{start:z,end:F,replacement:X}=C[B];E=E.slice(0,z)+X+E.slice(F)}return E}function es(x,v){let k=x,E=/@(for|foreach)\s*\(/g,C,j=[],L=[];while((C=E.exec(k))!==null){let B=C[1],z=C.index,F=z+C[0].length,X=1,G=F;while(G<k.length&&X>0){if(k[G]==="(")X++;else if(k[G]===")")X--;G++}if(X!==0)continue;let J=k.substring(F,G-1).trim(),ne=G,re=Yr(J),se=B==="for"?"@endfor":"@endforeach",oe=1,ie=ne,ge=B==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${B}\\s*\\(|end${B})`,"g");ge.lastIndex=ne;let ue;while((ue=ge.exec(k))!==null)if(ue[1].startsWith(B))oe++;else if(oe--,oe===0){ie=ue.index+ue[0].length;break}if(oe!==0)continue;let xe=()=>{let Te=[re.itemVar,re.indexVar].filter(Boolean);if(Te.length)L.push({start:z,end:ie,vars:Te})};if(re.iterable){let Te=re.iterable.trim();if(Te.startsWith("[")||Te.startsWith("{")||Te.startsWith("'")||Te.startsWith('"')||Te.startsWith("`")||/^-?\d/.test(Te)){xe();continue}let Re=Te.split(/[.[(]/)[0].trim(),ke=v?Re in v:!1,Ae=L.some((Ze)=>z>Ze.start&&z<Ze.end&&Ze.vars.includes(Re));if(Re&&(ke||Ae)){xe();continue}}if(re.style==="as")J=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let we=k.substring(ne,ie-se.length).trim(),$e=v?{...v}:{};if(re.itemVar)delete $e[re.itemVar];if(re.indexVar)delete $e[re.indexVar];let _e=es(we,$e),Ce=_e.match(Rg),Ee;if(Ce){let[,Te,Re,ke]=Ce;Ee=`<${Te}${Re} @for="${J}">${ke}</${Te}>`}else Ee=`<template @for="${J}">${_e}</template>`;j.push({start:z,end:ie,replacement:Ee}),E.lastIndex=ie}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:X}=j[B];k=k.substring(0,z)+X+k.substring(F)}return k}function tw(x){let v=new Set,k=[],E=0,C=0,j=x.length,L=(X)=>{let G=E+1;while(G<j){let J=x[G];if(J==="\\"){G+=2;continue}if(J===X)return G+1;G++}return j},B=()=>{let X=E+2;while(X<j&&x[X]!==`
|
|
2547
|
+
`)X++;return X},z=()=>{let X=E+2;while(X<j-1){if(x[X]==="*"&&x[X+1]==="/")return X+2;X++}return j},F=(X)=>{let G=X,J=0;while(G<j){let ne=x[G];if(ne==="/"&&x[G+1]==="/"){let re=G+2;while(re<j&&x[re]!==`
|
|
2548
|
+
`)re++;G=re;continue}if(ne==="/"&&x[G+1]==="*"){let re=G+2;while(re<j-1&&!(x[re]==="*"&&x[re+1]==="/"))re++;G=re+2;continue}if(ne==='"'||ne==="'"||ne==="`"){let re=G+1;while(re<j){if(x[re]==="\\"){re+=2;continue}if(x[re]===ne){re++;break}re++}G=re;continue}if(ne==="("||ne==="["||ne==="{"){J++,G++;continue}if(ne===")"||ne==="]"||ne==="}"){J--,G++;continue}if(ne===";"&&J===0)return G+1;G++}return j};while(E<j){let X=x[E];if(X==="/"&&x[E+1]==="/"){let G=B();k.push(x.slice(E,G)),E=G;continue}if(X==="/"&&x[E+1]==="*"){let G=z();k.push(x.slice(E,G)),E=G;continue}if(X==='"'||X==="'"||X==="`"){let G=L(X);k.push(x.slice(E,G)),E=G;continue}if(X==="{"){C++,k.push(X),E++;continue}if(X==="}"){C--,k.push(X),E++;continue}if(C===0){let G=E>0?x[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ne=x.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ne){let re=ne[2],se=F(E+ne[0].length);if(v.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}v.add(re),k.push(x.slice(E,se)),E=se;continue}}}k.push(X),E++}return k.join("")}var nw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Dl(x,v,k){for(let E of k){if(E.start>=v)return!1;if(E.end>x)return!0}return!1}function rw(x,v,k){let E=0;while(E<x.length){let C=x.indexOf(v,E);if(C===-1)return!1;if(!Dl(C,C+v.length,k))return!0;E=C+v.length}return!1}function sw(x,v){if(rw(x,"<body",v)){let C=new RegExp(`<body(${Pl})>`,"g"),j;while((j=C.exec(x))!==null)if(!Dl(j.index,j.index+j[0].length,v))return j.index+j[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Pl})>`,"gi"),E;while((E=k.exec(x))!==null){if(Dl(E.index,E.index+E[0].length,v))continue;if(nw.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function iw(x,v,k,E){let C=[],j=` data-stx="${E}"`,L=0,B=!1,z=(F)=>{if(k!==null&&!B&&k>=L&&k<=F)C.push(x.slice(L,k),j,x.slice(k,F)),B=!0;else C.push(x.slice(L,F))};for(let F of v){if(F.start<L)continue;z(F.start),L=F.end}return z(x.length),C.join("")}async function Qa(x,v,k){let E=Za(x,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),C=/\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*\(/,j=[],{hasUserImports:L,bundleClientScript:B}=await ut("stx/client-script-bundler",()=>import("./chunk-bvbank3z.js"));for(let ge of E){let ue=ge.body;if(He(ge.attrs))ue=Ue(ue);if(C.test(ue)){j.push({content:ue,start:ge.start,end:ge.end});continue}if(!L(ue))continue;try{let xe=await B(yt(ue).code,v||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(C.test(xe))j.push({content:ue,start:ge.start,end:ge.end})}catch{}}if(j.length===0)return{output:x,setupCode:null};let z=`${v??""}\x00${j.map((ge)=>ge.content).join("\x00")}`,F=`__stx_setup_${Bun.hash(z).toString(36).slice(0,10)}`,X=[];for(let ge=0;ge<j.length;ge++){let ue=j[ge].bundled??yt(j[ge].content).code;if(!j[ge].bundled&&L(ue))ue=await B(ue,v||"",{projectRoot:process.cwd()});ue=Fe(ue);let xe=R(ue);X.push(`// \u2500\u2500 merged signal script #${ge+1} \u2500\u2500
|
|
2549
|
+
${xe}`)}let G=X.join(`
|
|
2550
|
+
|
|
2551
|
+
`);G=tw(G);let J=ec(G),ne=J.split(",").map((ge)=>ge.trim()).filter(Boolean),re=Vr(G,k),se=`
|
|
2551
2552
|
<script data-stx-scoped>
|
|
2552
2553
|
function ${F}() {
|
|
2553
|
-
${
|
|
2554
|
-
${
|
|
2554
|
+
${Tt("const",ne)}
|
|
2555
|
+
${Ms(`${re}${G}`)}
|
|
2555
2556
|
return { ${J} };
|
|
2556
2557
|
}
|
|
2557
2558
|
window.__stx_latestSetup=${F};
|
|
2558
2559
|
if(window.stx)window.stx._latestSetup=${F};
|
|
2559
|
-
</script>`,oe=
|
|
2560
|
-
`)return;j++}},F=()=>{if(!B)return!0;if(/[\w)\]]/.test(B))return!1;return!0},
|
|
2561
|
-
`)j++;return!0}if(v[j]==="/"&&v[j+1]==="*"){j+=2;while(j<L-1&&!(v[j]==="*"&&v[j+1]==="/"))j++;return j+=2,!0}return!1},ne=()=>{if(C!==0)return;let re=v.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let ue=re[2];if(!E.has(ue))k.push(ue),E.add(ue);return}let se=v.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ue)=>{let
|
|
2562
|
-
${C.slice(B)}`;else if(z!==-1){let F=/<body[^>]*>/i.exec(C.slice(z))[0],
|
|
2563
|
-
${L}${C.slice(
|
|
2564
|
-
${L}`}return C}function
|
|
2565
|
-
`+" `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[
|
|
2560
|
+
</script>`,oe=sw(x,j);return{output:iw(x,j,oe,F),setupCode:se}}function ec(x){let v=x,k=[],E=new Set,C=0,j=0,L=v.length,B="",z=()=>{j++;let re=!1;while(j<L){let se=v[j];if(se==="\\"){j+=2;continue}if(se==="["&&!re){re=!0,j++;continue}if(se==="]"&&re){re=!1,j++;continue}if(se==="/"&&!re){j++;while(j<L&&/[gimsuyd]/.test(v[j]))j++;return}if(se===`
|
|
2561
|
+
`)return;j++}},F=()=>{if(!B)return!0;if(/[\w)\]]/.test(B))return!1;return!0},X=(re)=>{j++;while(j<L){if(v[j]==="\\"){j+=2;continue}if(v[j]===re){j++;return}j++}},G=()=>{j++;while(j<L){if(v[j]==="\\"){j+=2;continue}if(v[j]==="`"){j++;return}if(v[j]==="$"&&v[j+1]==="{"){j+=2;let re=1;while(j<L&&re>0)if(v[j]==="{")re++,j++;else if(v[j]==="}")re--,j++;else if(v[j]==="'"||v[j]==='"')X(v[j]);else if(v[j]==="`")G();else j++;continue}j++}},J=()=>{if(v[j]==="/"&&v[j+1]==="/"){while(j<L&&v[j]!==`
|
|
2562
|
+
`)j++;return!0}if(v[j]==="/"&&v[j+1]==="*"){j+=2;while(j<L-1&&!(v[j]==="*"&&v[j+1]==="/"))j++;return j+=2,!0}return!1},ne=()=>{if(C!==0)return;let re=v.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let ue=re[2];if(!E.has(ue))k.push(ue),E.add(ue);return}let se=v.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ue)=>{let xe=ue.trim();if(!xe)return;let we=xe.indexOf(":"),_e=(we>=0?xe.slice(we+1).trim():xe).split(/[\s=]/)[0];if(_e&&!E.has(_e))k.push(_e),E.add(_e)});return}let oe=v.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(oe){oe[1].split(",").forEach((ue)=>{let xe=ue.trim().replace(/^\.\.\./,"");if(!xe)return;let we=xe.split(/[\s=]/)[0];if(we&&!E.has(we))k.push(we),E.add(we)});return}let ie=v.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let ue=ie[1];if(!E.has(ue))k.push(ue),E.add(ue);return}let ge=v.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ge){let ue=ge[1];if(!E.has(ue))k.push(ue),E.add(ue)}};while(j<L){if(J())continue;if(v[j]==="'"||v[j]==='"'){X(v[j]),B=v[j-1];continue}if(v[j]==="`"){G(),B="`";continue}if(v[j]==="/"&&v[j+1]!=="/"&&v[j+1]!=="*"&&F()){z(),B="/";continue}if(v[j]==="{"){C++,B="{",j++;continue}if(v[j]==="}"){C--,B="}",j++;continue}if(C===0&&/[a-z]/i.test(v[j])&&(j===0||/\s|[;{}()]/.test(v[j-1])))ne();if(!/\s/.test(v[j]))B=v[j];j++}return k.join(", ")}async function Hi(x,v,k,E){if(!Zr(x,k))return x;let C=x;if(v.skipSignalsRuntime)return C;let{output:j,setupCode:L}=await Qa(C,k,E);if(C=j,!L){let B=Tn(C);if(B&&!/data-stx/.test(B.attrs)&&!/data-stx-auto/.test(B.attrs)){let z=B.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");C=C.slice(0,B.index)+z+C.slice(B.index+B.tag.length)}}if(C=await Go(C,v),L){let B=Ui(C,/<\/head>/i),z=B===-1?Ui(C,/<body[^>]*>/i):-1;if(B!==-1)C=`${C.slice(0,B)}${L}
|
|
2563
|
+
${C.slice(B)}`;else if(z!==-1){let F=/<body[^>]*>/i.exec(C.slice(z))[0],X=z+F.length;C=`${C.slice(0,X)}
|
|
2564
|
+
${L}${C.slice(X)}`}else C=`${C}
|
|
2565
|
+
${L}`}return C}function Ui(x,v){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],C;while((C=k.exec(x))!==null)E.push([C.index,C.index+C[0].length]);let j=new RegExp(v.source,v.flags.replace(/[gy]/g,"")),L=0;while(L<x.length){let B=j.exec(x.slice(L));if(!B)return-1;let z=L+B.index;if(!E.some(([X,G])=>z>=X&&z<G))return z;L=z+Math.max(B[0].length,1)}return-1}var Cg="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function tc(x){let v=[];for(let k of x.split(",")){let E=k.trim();if(!E||E.startsWith("type "))continue;let C=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C&&C[1]!==C[2])v.push(`${C[2]} = ${C[1]}`)}if(v.length===0)return Cg;return`var ${v.join(", ")}; ${Cg}`}var ow=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Fe(x){return x.replace(ow,(v,k)=>tc(k))}import Os from"path";import aw from"process";function y(x="STX_PUBLIC_"){let v={},k={};for(let[E,C]of Object.entries(aw.env)){if(!E.startsWith(x)||C===void 0)continue;v[`import.meta.env.${E}`]=JSON.stringify(C),k[E]=C}return v["import.meta.env"]=JSON.stringify(k),v}function Ag(x){return x.startsWith("http://")||x.startsWith("https://")||x.startsWith("//")}async function Ig(x,v,k){try{let E;if(x.startsWith("/")){let C=v;for(let j=0;j<5;j++){let L=Os.join(C,x);if(await Bun.file(L).exists())return L;C=Os.dirname(C)}E=Os.join(v,x)}else if(x.startsWith("./")||x.startsWith("../"))E=Os.resolve(v,x);else E=Os.resolve(v,x);if(await Bun.file(E).exists())return E;return null}catch{return null}}var Pg=Symbol.for("stx.inline-assets.import-meta");function cw(x,v){if(!x.includes("import.meta"))return;let k=Error(`[stx] ${v} 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.
|
|
2566
|
+
`+" `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[Pg]=!0,k}async function Dg(x,v,k){let E=x,C=Os.dirname(v),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,L;while((L=j.exec(E))!==null){let[F,X,G,J]=L;if(Ag(G))continue;let ne=await Ig(G,C,v);if(ne)try{let re=await Bun.file(ne).text();if(k.add(ne),G.endsWith(".ts")||G.endsWith(".tsx")){let oe=await Bun.build({entrypoints:[ne],target:"browser",minify:!0,define:y()});if(oe.outputs.length>0)re=await oe.outputs[0].text(),cw(re,G)}let se=`<script>
|
|
2566
2567
|
// Source: ${G}
|
|
2567
2568
|
${re}
|
|
2568
|
-
</script>`;E=E.replace(F,se),j.lastIndex=0}catch(re){if(re?.[
|
|
2569
|
+
</script>`;E=E.replace(F,se),j.lastIndex=0}catch(re){if(re?.[Pg])throw re}}let B=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,z;while((z=B.exec(E))!==null){let[F,X,G,J]=z,ne=X+J;if(Ag(G))continue;if(/rel=["']stylesheet["']/.test(ne)||G.endsWith(".css")){let se=await Ig(G,C,v);if(se)try{let oe=await Bun.file(se).text();k.add(se);let ie=`<style>
|
|
2569
2570
|
/* Source: ${G} */
|
|
2570
2571
|
${oe}
|
|
2571
|
-
</style>`;E=E.replace(F,ie),B.lastIndex=0}catch(oe){}}}return E}function
|
|
2572
|
+
</style>`;E=E.replace(F,ie),B.lastIndex=0}catch(oe){}}}return E}function as(x,v){let k=x,E=/@json\s*\(/g,C;while((C=E.exec(k))!==null){let j=C.index,L=j+C[0].length-1,B=1,z=L+1,F=null,X=!1;while(z<k.length&&B>0){let ue=k[z];if(X){X=!1,z++;continue}if(ue==="\\"&&F){X=!0,z++;continue}if(F){if(ue===F)F=null;z++;continue}if(ue==='"'||ue==="'"||ue==="`"){F=ue,z++;continue}if(ue==="(")B++;else if(ue===")"){if(B--,B===0)break}z++}if(B!==0)break;let G=k.substring(L+1,z).trim(),J=k.substring(j,z+1),ne=-1,re=0,se=null,oe=!1;for(let ue=0;ue<G.length;ue++){let xe=G[ue];if(oe){oe=!1;continue}if(xe==="\\"&&se){oe=!0;continue}if(se){if(xe===se)se=null;continue}if(xe==='"'||xe==="'"||xe==="`"){se=xe;continue}if(xe==="("||xe==="["||xe==="{")re++;else if(xe===")"||xe==="]"||xe==="}")re--;if(xe===","&&re===0){ne=ue;break}}let ie=ne>=0?G.substring(0,ne).trim():G,ge=ne>=0?G.substring(ne+1).trim():void 0;try{let ue=ie.trim(),xe;if(p(ue))xe=l(ue,Object.keys(v))(...Object.values(v));else xe=void 0;let we;if(ge==="true")we=JSON.stringify(xe,null,2);else we=JSON.stringify(xe);let $e=we.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+$e+k.substring(z+1),E.lastIndex=j+$e.length}catch(ue){_.log(ue instanceof Error?ue:Error(String(ue)),{directive:"@json"},"error"),E.lastIndex=j+J.length}}return k}function cs(x){return x.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Og(x){let v=x,k=/@memo\s*\(/g,E,C=[];while((E=k.exec(v))!==null){let j=E.index,L=j+E[0].length,B=1,z=L;while(z<v.length&&B>0){if(v[z]==="(")B++;else if(v[z]===")")B--;z++}if(B!==0)continue;let F=v.slice(L,z-1).trim(),X=z,G=v.slice(X),J=G.indexOf("@endmemo");if(J===-1)continue;let ne=G.slice(0,J),re=X+J+8,se=ne.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=se?se[0].length:0,ie=ne.slice(oe),ge=ne.match(/(\s*)$/),ue=ge?ge[0].length:0,xe=ie.slice(0,ie.length-ue),we=xe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),$e;if(we){let[_e,Ce,Ee="",Te]=we,Re=`<${Ce}${Ee} data-stx-memo="${F}"${Te}>`;$e=ne.slice(0,oe)+Re+xe.slice(_e.length)+ne.slice(oe+xe.length)}else $e=`${ne.slice(0,oe)}<div data-stx-memo="${F}">${xe}</div>${ne.slice(oe+xe.length)}`;C.push({start:j,end:re,replacement:$e}),k.lastIndex=re}for(let j=C.length-1;j>=0;j--){let L=C[j];v=v.slice(0,L.start)+L.replacement+v.slice(L.end)}return v.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ol(x){let v=x.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return v=v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),v}function Ng(x,v){if(!/\bref\s*=/.test(x))return x;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=Mr(x,(z,F)=>{k.lastIndex=F;let X=k.exec(z);if(!X||/^(?:script|style)$/i.test(X[1]))return-1;return k.lastIndex}),C=[],j=0,L=0,B=[];for(let{start:z,end:F,token:X}of E){let G=/^<\/?([\w-]+)/.exec(X)[1].toLowerCase();if(X.startsWith("</")){let ne;while(ne=C.pop()){if(ne.scoped)j--;if(ne.name===G)break}continue}let J=/\sdata-stx-scope\s*=/.test(X);if(!j&&!J&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(X)&&!/\sdata-stx-ref-caller\s*=/.test(X))B.push(x.slice(L,z),X.replace(/\s*\/?>$/,(ne)=>` data-stx-ref-caller="${v}"${ne}`)),L=F;if(!jg.has(G)&&!/\/>$/.test(X)){if(C.push({name:G,scoped:J}),J)j++}}return B.push(x.slice(L)),B.join("")}var jg=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Lg=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Mg=/<\/?\s*([a-z][\w-]*)/iy,lw=/\s/;function uw(x,v){let k=v-1;while(k>=0&&lw.test(x[k]))k--;return k>=0&&x[k]==="/"}function dw(x,v){let k=!1,E=!1;for(let C=v;C<x.length;C++){let j=x[C];if(k){if(j==="'")k=!1}else if(E){if(j==='"')E=!1}else if(j==="'")k=!0;else if(j==='"')E=!0;else if(j===">")return C}return-1}function fw(x,v){if(x.indexOf("{",v)===-1||x.indexOf("}",v)===-1)return!1;let k=0,E=v,C=!1,j=!1,L=!1;while(E<x.length){let B=x.indexOf("<",E),z=B===-1?x.length:B;if(z>E){if(k===0)while(E<z){let G=x.indexOf(j?"}":"{",E);if(G===-1||G>=z){if(j)L=!1;else C=!1;break}if(G>E)if(j)L=!1;else C=!1;if(j){if(L)return!0;L=!0}else if(C)j=!0,L=!1;else C=!0;E=G+1}E=z;continue}if(x.startsWith("<!--",E)){let G=x.indexOf("-->",E);E=G===-1?x.length:G+3;continue}let F=dw(x,E);if(F===-1)break;Mg.lastIndex=E;let X=Mg.exec(x)?.[1]?.toLowerCase()??"";if(x[E+1]==="/"){if(k===0)break;k--}else if(!uw(x,F)&&!jg.has(X))k++;E=F+1}return!1}function Bg(x){if(x.length>=32768&&!Lu(x))return x;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"),E="",C=0,j;while((j=k.exec(x))!==null){let L=j.index,B=L+j[0].length,z=!1,F=!1,X=-1;while(B<x.length){let J=x[B];if(z){if(J==="'")z=!1}else if(F){if(J==='"')F=!1}else if(J==="'")z=!0;else if(J==='"')F=!0;else if(J===">"){X=B;break}B++}if(X===-1)continue;let G=x.slice(L,X+1);if(Lg.test(G))continue;if(G.includes("x-cloak"))continue;if(fw(x,X+1))E+=x.slice(C,X)+" x-cloak>",C=X+1}return E+=x.slice(C),E}var pw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,gw=/<\/script>/gi,mw=/<\/style>/gi;function zg(x){let v=/<[a-z][\w-]*/gi,k="",E=0,C;while((C=v.exec(x))!==null){let j=C.index,L=C[0].slice(1).toLowerCase();if(L==="script"||L==="style"){let re=L==="script"?gw:mw;re.lastIndex=j;let se=re.exec(x);if(se!==null)v.lastIndex=se.index+se[0].length;continue}let B=j+C[0].length,z=!1,F=!1,X=-1;while(B<x.length){let re=x[B];if(z){if(re==="'")z=!1}else if(F){if(re==='"')F=!1}else if(re==="'")z=!0;else if(re==='"')F=!0;else if(re===">"){X=B;break}B++}if(X===-1)continue;let G=x.slice(j+C[0].length,X);if(Lg.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!pw.test(G))continue;let J=x[X-1]==="/",ne=J?X-1:X;k+=`${x.slice(E,ne)} x-cloak${J?" ":""}`,E=ne}return k+=x.slice(E),k}var Nl=I(256),hw=[{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"}],Fg=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function yw(x){let v=Array.from(x,(C)=>C===`
|
|
2572
2573
|
`?`
|
|
2573
2574
|
`:" "),k=0,E="";while(k<x.length){let C=x[k],j=x[k+1];if(E){if(C==="\\"){k+=2;continue}if(C===E)E="";k++;continue}if(C==='"'||C==="'"||C==="`"){E=C,k++;continue}if(C==="/"&&j==="/"){while(k<x.length&&x[k]!==`
|
|
2574
|
-
`)v[k]=x[k],k++;continue}if(C==="/"&&j==="*"){let L=x.indexOf("*/",k+2),B=L===-1?x.length:L+2;for(;k<B;k++)v[k]=x[k];continue}if(C==="{"&&j==="{"&&x.slice(k,k+4)==="{{--"){let L=x.indexOf("--}}",k+4),B=L===-1?x.length:L+4;for(;k<B;k++)v[k]=x[k];continue}k++}return v.join("")}function
|
|
2575
|
+
`)v[k]=x[k],k++;continue}if(C==="/"&&j==="*"){let L=x.indexOf("*/",k+2),B=L===-1?x.length:L+2;for(;k<B;k++)v[k]=x[k];continue}if(C==="{"&&j==="{"&&x.slice(k,k+4)==="{{--"){let L=x.indexOf("--}}",k+4),B=L===-1?x.length:L+4;for(;k<B;k++)v[k]=x[k];continue}k++}return v.join("")}function xw(x){let v=new Map,k=yw(x).split(`
|
|
2575
2576
|
`),E=x.split(`
|
|
2576
|
-
`);return k.forEach((C,j)=>{
|
|
2577
|
+
`);return k.forEach((C,j)=>{Fg.lastIndex=0;for(let L of C.matchAll(Fg)){let B=L[1]==="-next-line",z=(E[j]??"").slice(0,L.index).trim(),F=B||z===""?j+2:j+1,G=(L[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),J=G.filter((re)=>/\w/.test(re));if(G.length>0&&J.length===0)continue;let ne=v.get(F);if(ne&&ne.size===0)continue;if(J.length===0){v.set(F,new Set);continue}if(ne)J.forEach((re)=>ne.add(re));else v.set(F,new Set(J))}}),v}function bw(x,v,k){let E=x.get(v);if(!E)return!1;if(E.size===0)return!0;return[...E].some((C)=>k.includes(C))}function ls(x,v,k,E){let C=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!C.enabled)return;let j=O(x,v,E,JSON.stringify(C)),L=Nl.get(j);if(L!==void 0){if(L&&C.failOnViolation)throw Error(L);return}let B=C.allowPatterns??[],z=xw(x),F=[],X=s(x.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:oe}of hw){if(B.some((ge)=>/\w/.test(ge)&&se.includes(ge)))continue;re.lastIndex=0;let ie=X.match(re);if(ie&&ie.length>0){let ge=X.split(`
|
|
2577
2578
|
`),ue=x.split(`
|
|
2578
|
-
`),
|
|
2579
|
-
`)
|
|
2580
|
-
${
|
|
2581
|
-
\u2192 ${oe}${
|
|
2579
|
+
`),xe=[];if(ge.forEach((Ce,Ee)=>{if(re.lastIndex=0,re.test(Ce)&&!bw(z,Ee+1,se))xe.push(Ee+1)}),xe.length===0&&ge.some((Ce)=>(re.lastIndex=0,re.test(Ce))))continue;let we=xe.length>0?` (script line${xe.length>1?"s":""} ${xe.join(", ")})`:"",$e=xe.slice(0,3).map((Ce)=>` ${Ce} | ${(ue[Ce-1]??"").trim().slice(0,100)}`).join(`
|
|
2580
|
+
`),_e=$e?`
|
|
2581
|
+
${$e}`:"";F.push(` \u2717 ${se}${we}
|
|
2582
|
+
\u2192 ${oe}${_e}`)}}if(F.length===0){Nl.set(j,"");return}let G=(re)=>{let se=`${process.cwd()}/`;return re.startsWith(se)?re.slice(se.length):re},ne=`[STX] DOM API violation in ${E&&E!==v?`${G(E)} (composed into ${G(v)})`:G(v)}:
|
|
2582
2583
|
${F.join(`
|
|
2583
2584
|
`)}
|
|
2584
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(
|
|
2585
|
-
`,E+2),E===-1)return-1;E+=1,C=!0;continue}if(B==="/"&&x[E+1]==="*"){let z=x.indexOf("*/",E+2);if(z===-1)return-1;E=z+2,C=!0;continue}if(B==="/"&&C){let z=E+1,F=!1;while(z<k){let
|
|
2585
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Nl.set(j,ne),C.failOnViolation)throw Error(ne);else console.warn(ne)}import jl from"path";var vw=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ww=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Sw(x,v){if(!v||!x.includes("/"))return x;let k=jl.dirname(v);return x.replace(vw,(E,C,j,L)=>{let B=jl.resolve(k,L);return`${C}${j}${B.split(jl.sep).join("/")}${j}`})}function Wg(x,v){if(!v||!x.includes("<script"))return x;return x.replace(ww,(k,E,C,j)=>`${E}${Sw(C,v)}${j}`)}var Tr="<!--PARENT_CONTENT_PLACEHOLDER-->";function Vg(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Gg(x,v){let k=x.length,E=v,C=!0,j=[],L=(B)=>B+9<=k&&x[B]==="<"&&x[B+1]==="/"&&(x[B+2]==="s"||x[B+2]==="S")&&(x[B+3]==="c"||x[B+3]==="C")&&(x[B+4]==="r"||x[B+4]==="R")&&(x[B+5]==="i"||x[B+5]==="I")&&(x[B+6]==="p"||x[B+6]==="P")&&(x[B+7]==="t"||x[B+7]==="T")&&(x[B+8]===">"||/\s/.test(x[B+8]));while(E<k){let B=x[E];if(L(E))return E;if(B==="/"&&x[E+1]==="/"){if(E=x.indexOf(`
|
|
2586
|
+
`,E+2),E===-1)return-1;E+=1,C=!0;continue}if(B==="/"&&x[E+1]==="*"){let z=x.indexOf("*/",E+2);if(z===-1)return-1;E=z+2,C=!0;continue}if(B==="/"&&C){let z=E+1,F=!1;while(z<k){let X=x[z];if(X==="\\"){z+=2;continue}if(X==="[")F=!0;else if(X==="]")F=!1;else if(X==="/"&&!F){z++;break}else if(X===`
|
|
2586
2587
|
`){z=-1;break}z++}if(z===-1){E++,C=!1;continue}while(z<k&&/[a-z]/.test(x[z]))z++;E=z,C=!1;continue}if(B==="'"||B==='"'){let z=B;E++;while(E<k){if(x[E]==="\\"){E+=2;continue}if(x[E]===z){E++;break}if(x[E]===`
|
|
2587
|
-
`)break;E++}C=!1;continue}if(B==="`"){E++;while(E<k){if(x[E]==="\\"){E+=2;continue}if(x[E]==="`"){E++;break}if(x[E]==="$"&&x[E+1]==="{"){j.push(!0),E+=2,C=!0;break}E++}if(j.length===0)C=!1;continue}if(B==="}"&&j.length>0){j.pop(),E++;while(E<k){if(x[E]==="\\"){E+=2;continue}if(x[E]==="`"){E++,C=!1;break}if(x[E]==="$"&&x[E+1]==="{"){j.push(!0),E+=2,C=!0;break}E++}continue}if(/\s/.test(B));else if(/[)\].\w$]/.test(B))C=!1;else C=!0;E++}return-1}function
|
|
2588
|
-
`+x.slice(E,k.start)+x.slice(k.end);let C=x.slice(k.start,k.end),j=x.slice(0,k.start)+x.slice(k.end),L=
|
|
2588
|
+
`)break;E++}C=!1;continue}if(B==="`"){E++;while(E<k){if(x[E]==="\\"){E+=2;continue}if(x[E]==="`"){E++;break}if(x[E]==="$"&&x[E+1]==="{"){j.push(!0),E+=2,C=!0;break}E++}if(j.length===0)C=!1;continue}if(B==="}"&&j.length>0){j.pop(),E++;while(E<k){if(x[E]==="\\"){E+=2;continue}if(x[E]==="`"){E++,C=!1;break}if(x[E]==="$"&&x[E+1]==="{"){j.push(!0),E+=2,C=!0;break}E++}continue}if(/\s/.test(B));else if(/[)\].\w$]/.test(B))C=!1;else C=!0;E++}return-1}function Jg(x,v){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(x);if(!E)return null;let C=E.index+E[0].length,j=x.indexOf("</script>",C);if(j===-1)return null;let L=x.indexOf(">",j);if(L===-1)return null;return{start:E.index,end:L+1}}var _w=4096;async function Ug(x,v,k){if(k.buildMode!=="serve"||v.length<_w)return null;let{registerServeModuleBundle:E}=await import("./chunk-75zcwcrt.js");return`<script ${x} src="${E(v)}"></script>`}async function Hg(x,v,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:C}=await ut("stx/client-module-registry",()=>import("./chunk-0y7x0hvr.js")),j=[],L=await C(E(...x),{minify:v.buildMode==="compile",collectInputs:j});for(let B of j)k?.add(B);if(!L)return null;if(v.buildMode==="serve"){let{registerServeModuleBundle:B}=await import("./chunk-75zcwcrt.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${B(L)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${L.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function kw(x,v=""){let k=Jg(x,"data-stx-runtime");if(!k)return x;let E=Ws(x);if(E===-1||E===k.start){if(!v)return x;return x.slice(0,k.end)+v+x.slice(k.end)}if(E<k.start)return x.slice(0,E)+x.slice(k.start,k.end)+v+`
|
|
2589
|
+
`+x.slice(E,k.start)+x.slice(k.end);let C=x.slice(k.start,k.end),j=x.slice(0,k.start)+x.slice(k.end),L=Ws(j);if(L===-1)return C+v+`
|
|
2589
2590
|
`+j;return j.slice(0,L)+C+v+`
|
|
2590
|
-
`+j.slice(L)}function
|
|
2591
|
-
`),...F.htmlAttrs&&{htmlAttrs:
|
|
2592
|
-
<meta name="stx-layout" content="${
|
|
2593
|
-
<meta name="stx-layout-group" content="${
|
|
2594
|
-
${re}`).join("");L=
|
|
2595
|
-
`+L.slice(F)}}if(j)L=
|
|
2591
|
+
`+j.slice(L)}function Ew(x){let v=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return x.replace(v,(k,E,C)=>{let j=x.slice(0,C);return j.lastIndexOf("<")>j.lastIndexOf(">")?`{{${E}}}`:`{<!--stx-literal-->{${E}}}`})}async function r(x,v,k,E,C){if(E.ssr===!1&&!E.autoShell&&E.buildMode==="spa")return x;if(v.__stx_signals_gate===void 0)v.__stx_signals_gate=he(x,k);let j=!v.__stxProcessingDepth;tn(v);for(let L of E._layerGraph?.configDependencies??[])C.add(L);if(j&&E.runtimeConfig)await on(v,k,E.runtimeConfig);if(j)su(v),v.__stx_head_injections=$l(),v.__stx_seo_staged=!1;if(!v.__stxProcessingDepth)v.__stxProcessingDepth=0;if(v.__stxProcessingDepth++,!v.__onceStore)v.__onceStore=new Set;if((E.debug||!fe()&&!dn())&&k&&k.endsWith(".stx"))Ps(x,k);try{return await V.timeAsync("template-processing",async()=>{let L=await Cw(x,v,k,E,C);if(j)L=Ol(L);if(j&&E.autoShell&&E.buildMode!=="compile"){let B=de(E.app?.head,{known:cn,source:"app.head"}),F=(v.__stx_runtime_head||null)??ks(),X=(v.__stx_head_raw||"").trim(),G,J=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(J)G=J[1].trim(),X=X.replace(J[0],"").trim();let ne=v.__sections?.title,re=F.title||G||ne,se=!F.title&&(!!G||!!ne),oe=F.meta||[],ie=new Set(oe.map((_e)=>yr(_e)).filter(Boolean)),ge={...B,...re&&{title:re},meta:[...(B.meta||[]).filter((_e)=>!ie.has(yr(_e))),...oe],link:[...B.link||[],...F.link||[]],script:[...B.script||[],...F.script||[]],headRaw:[B.headRaw,X].filter(Boolean).join(`
|
|
2592
|
+
`),...F.htmlAttrs&&{htmlAttrs:fg(B.htmlAttrs,F.htmlAttrs)},...F.bodyAttrs&&{bodyAttrs:{...B.bodyAttrs||{},...F.bodyAttrs}}},ue=Al(L);if(L=Fn(L,ge,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},ue),ue)L=gg(L,B),L=Bn(L,ge.htmlAttrs);let xe=L.match(/<!-- stx-layout: ([^ ]+) -->/);if(xe&&L.includes("<head")){let _e=xe[1],Ce=ir(_e);L=L.replace(/<head\b[^>]*>/i,(Ee)=>`${Ee}
|
|
2593
|
+
<meta name="stx-layout" content="${Vg(_e)}">
|
|
2594
|
+
<meta name="stx-layout-group" content="${Vg(Ce)}">`)}let we=L.match(/function (__stx_setup_\w+)\(/),$e=we?Tn(L):null;if(we&&$e&&!/\bdata-stx=/.test($e.tag)){L=Lr(L,(Ce,Ee)=>`<body${Ee} data-stx="${we[1]}">`);let _e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${we[1]}"`,"i");L=L.replace(_e,"$1")}}if(j){let B=v.__stx_head_injections??$l(),z=pg(L);if(z!==null)B.beforeClose.push(z);let F=rg(L);if(F!==null)B.afterOpen.push(F);if(E.offline?.enabled&&!L.includes("data-stx-offline"))B.beforeClose.push(sg);L=Qp(L,B);let X=E.app?.colorMode;if(X)L=jn(L,X)}if(j)if(Jg(L,"data-stx-runtime")){let z=null,F=null,X=null,G=null,J=null;try{let{getStoreScript:re}=await ut("stx/store-loader",()=>import("./chunk-b7z2yegr.js")),se=E.storesDir,oe=await re(se);if(oe)X=`<script data-stx-stores>${oe}</script>`,F=await Ug("data-stx-stores",oe,E)??X}catch{}z=await Hg([L,X],E,C);try{let{getFrameworkComposableScript:re}=await ut("stx/framework-composables",()=>import("./chunk-1336h4sv.js"));J=await re(L)}catch{}try{let{getComposableScript:re}=await ut("stx/composable-loader",()=>import("./chunk-vwxasbtx.js")),se=E.composablesDir,oe=[z,X,J].filter((ge)=>ge!==null),ie=await re(E._layerComposableDirs??se,L,oe);if(ie)G=await Ug('data-stx-scoped data-stx-run="always" data-stx-composables',ie,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ie}</script>`}catch{}let ne=[z,F,G,J].filter((re)=>re!==null).map((re)=>`
|
|
2595
|
+
${re}`).join("");L=kw(L,ne)}else{let z=await Hg([L],E,C);if(z){let F=L.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(F!==-1)L=L.slice(0,F)+z+`
|
|
2596
|
+
`+L.slice(F)}}if(j)L=ng(L);if(j&&v.__stx_inject_css!==!1)L=await f(L,void 0,E.buildMode==="serve",!0);else if(j)L=zs(L);if(L=L.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),L=Ew(L),j&&v.__stx_runtime_config)L=qe(L,v.__stx_runtime_config);if(j&&!v.__stx_defer_server_data){let B=Ln(v);if(B){let z=/<head\b[^>]*>/i.exec(L),F=z?z.index+z[0].length:0;L=L.slice(0,F)+B+L.slice(F)}}return L})}catch(L){if(L instanceof er)throw L;let B=L instanceof Error?L.message:String(L),z=new K(`Template processing failed: ${B}`,k,void 0,void 0,x.substring(0,200)+(x.length>200?"...":""));if(_.log(z,{filePath:k,context:v}),$t.logDetailedError(z,{filePath:k,template:x.substring(0,500)}),E.debug)throw z;return Cs.createFallbackContent("Template Processing",z)}}async function Cw(x,v,k,E,C){let j=process.cwd(),L={...E,partialsDir:E.partialsDir&&!an.isAbsolute(E.partialsDir)?an.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!an.isAbsolute(E.componentsDir)?an.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!an.isAbsolute(E.layoutsDir)?an.resolve(j,E.layoutsDir):E.layoutsDir},B=L,z=x;await Aw(k,v),Tw(v,B),z=await te(()=>Wp(z,v,k,B),z,(we)=>{_.log(we,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${we.message}`)}),z=z.replace(/\{\{--[\s\S]*?--\}\}/g,"");let F=kn(z,Ne,(we,$e)=>`\x00STX_HTML_COMMENT_${$e}\x00`);z=F.output;let X=F.tokens,G=(we)=>X.length===0?we:we.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,($e,_e)=>X[Number(_e)]??""),J="\x00STX_ESCAPED_AT\x00",ne="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";z=z.replace(/@@/g,J),z=z.replace(/@\{\{([\s\S]*?)\}\}/g,(we,$e)=>`${ne}${$e}${re}`),z=Kp(z),z=await Dg(z,k,C);let se={};z=ss(z,se);let oe={...v.__sections||{}},ie="",ge=Vd(Le(x)),ue=/@nolayout\b/.test(z)||ge===!1;if(/@nolayout\b/.test(z))z=z.replace(/@nolayout\b\s*/g,"");let xe=z.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(xe)ie=xe[1],z=z.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ge==="string"){if(ie=ge,!/@section\s*\(/.test(z))z=`@section('content')
|
|
2596
2597
|
${z.trim()}
|
|
2597
|
-
@endsection`}if(!ie&&!ue&&B.defaultLayout){let we=
|
|
2598
|
+
@endsection`}if(!ie&&!ue&&B.defaultLayout){let we=nn(z),$e=/@section\s*\(/.test(z);if(!we||$e){let _e="",Ce=an.dirname(k),Ee=B.layoutsDir?an.dirname(B.layoutsDir):process.cwd();for(let Te=0;Te<20;Te++){let Re=an.join(Ce,"_layout.stx");if(await n(Re)){_e=Re;break}let ke=an.dirname(Ce);if(ke===Ce||ke.length<Ee.length)break;Ce=ke}if(_e)ie=_e;else if(B.layoutsDir){let Te=an.isAbsolute(B.layoutsDir)?B.layoutsDir:an.resolve(process.cwd(),B.layoutsDir),Re=an.join(Te,`${B.defaultLayout}.stx`);if(await n(Re))ie=Re}if(ie&&!$e)z=`@section('content')
|
|
2598
2599
|
${z.trim()}
|
|
2599
|
-
@endsection`}}if(ie&&z.includes("<script")){let we=
|
|
2600
|
+
@endsection`}}if(ie&&z.includes("<script")){let we=bn(z),$e=we.scripts.map((_e)=>qg(_e,k)??_e);z=Or(we.output,$e)}if(z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(we,$e,_e)=>(oe[$e]=_e,"")),z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(we,$e,_e)=>{if(/^(['"]).*\1$/.test(_e.trim()))return we;try{let Ce=c(_e.trim(),v);if(Ce===void 0)return we;return oe[$e]=String(Ce??""),""}catch{return we}}),z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(we,$e,_e)=>{if(_e.includes("@parent"))oe[$e]=_e.replace("@parent",Tr);else oe[$e]=_e.trim();return""}),v.__sections=oe,z=z.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(we,$e,_e)=>oe[$e]||_e||""),!("slot"in v)||v.slot===void 0)z=z.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||"");if(z=is(z,se),ie){let we=[],$e=bn(z),_e=kn($e.output,Dr,(Ce,Ee)=>`\x00STX_ORPHAN_STYLE_${Ee}\x00`);if(z=_e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ce,Ee,Te)=>{let Re=Ee==="SCRIPT"?qg($e.scripts[Number(Te)],k):_e.tokens[Number(Te)];if(Re)we.push(Re);return""}),we.length>0){let Ce=we.join(`
|
|
2600
2601
|
`);oe.content=oe.content?`${oe.content}
|
|
2601
|
-
${
|
|
2602
|
-
${z}`,G(z)}catch(we){return _.log(we instanceof Error?we:Error(String(we)),{layoutPath:ie,filePath:k},"error"),`[Error processing layout: ${we instanceof Error?we.message:String(we)}]`}return G(await
|
|
2603
|
-
`;if(j=
|
|
2602
|
+
${Ce}`:Ce,v.__sections=oe}}if(ie)try{let we;if(an.isAbsolute(ie))we=ie,C.add(ie);else we=await te(()=>Un(ie,k,L,C),null,()=>{throw new K(`Failed to resolve layout path: ${ie}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!we){let Re=(Ze)=>{if(!Ze)return[];try{let Pe=an.isAbsolute(Ze)?Ze:an.resolve(process.cwd(),Ze);return $w.readdirSync(Pe).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},ke=[...Re(L.layoutsDir),...Re(L.fallbackLayoutsDir)].filter((Ze,Pe,Ie)=>Ie.indexOf(Ze)===Pe).sort(),Ae=`Layout not found: ${ie} (referenced from ${k})`+(ke.length>0?`. Available layouts: ${ke.join(", ")}`:L.layoutsDir?`. No .stx layouts found in ${L.layoutsDir}`:"");if(_.log(Error(Ae),{layoutPath:ie,filePath:k,available:ke},"error"),console.error(`[stx] ${Ae}`),L.debug)throw new K(Ae,k);return z}let $e=await te(()=>Bun.file(we).text(),"",()=>{throw new K(`Failed to read layout file: ${we}`,k,void 0,void 0,"Layout content could not be loaded")});$e=Wg($e,we);let _e=$e.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_e){if(L.debug)console.log(`Found nested layout: ${_e[1]} in ${we}`);let Re={},ke=$e.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ie,Ge)=>(Re[Ie]=Ge.trim(),""));for(let[Pe,Ie]of Object.entries(Re))if(oe[Pe]&&oe[Pe].includes(Tr)){let Ge=oe[Pe].indexOf(Tr);oe[Pe]=oe[Pe].slice(0,Ge)+Ie+oe[Pe].slice(Ge+Tr.length)}else if(!oe[Pe])oe[Pe]=Ie;let Ae={...v,__sections:oe},Ze=`@layout('${_e[1]}')${ke}`;return await r(Ze,Ae,we,L,C)}let Ce=$e.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ee=ss(Ce,se),Te={};return Ee=Ee.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Re,ke,Ae)=>(Te[ke]=Ae.trim(),`@slot('${ke}')`)),Ee=Ee.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Re,ke,Ae)=>{if(oe[ke]){let Ze=oe[ke];if(Ze.includes(Tr)){let Pe=Te[ke]||"",Ie=Ze.indexOf(Tr);Ze=Ze.slice(0,Ie)+Pe+Ze.slice(Ie+Tr.length)}return Ze}return Ae||""}),Ee=Rw(Ee,oe),Ee=Ee.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),Ee=is(Ee,se),v.__originalFilePath=k,z=await Zg(Ee,v,we,L,C),z=`<!-- stx-layout: ${ie} -->
|
|
2603
|
+
${z}`,G(z)}catch(we){return _.log(we instanceof Error?we:Error(String(we)),{layoutPath:ie,filePath:k},"error"),`[Error processing layout: ${we instanceof Error?we.message:String(we)}]`}return G(await Zg(z,v,k,L,C))}function Rw(x,v){return x.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,E,C)=>{let j=v[E];if(j!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(j))return j}return C||""})}function Tw(x,v){if(x.__stx_sfc_mode=!0,x.__stx_options=v,v.buildMode)x.__stx_buildMode=v.buildMode;let k=v.envPrefix||"STX_PUBLIC_",E={};for(let[C,j]of Object.entries(process.env))if(C.startsWith(k)&&j!==void 0)E[C]=j;x.$env=E}async function Aw(x,v){await te(()=>Hp(x,v),void 0,(k)=>{_.log(k,{filePath:x,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${x}: ${k.message}`)})}var Ll="data-stx-source";function qg(x,v){if(!x)return x;let k=/^<script\b([^>]*)>/i.exec(x);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Ll))return x;return`<script ${Ll}="${encodeURIComponent(v)}"${x.slice(7)}`}function Iw(x){let v=new RegExp(`${Ll}="([^"]*)"`).exec(x);return v?decodeURIComponent(v[1]):void 0}function Kg(x){return x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Xg(x,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> ${v==="module-resolution"?"imports a module that does not resolve":v==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Kg(x)}</span><span style="display:block;margin-top:4px">${Kg(k)}</span></div>`}async function Pw(x,v,k,E){let{scanScriptTags:C}=await ut("stx/signal-processing",()=>import("./chunk-5eqd40k0.js")),j=[],L=!fe()&&!dn();for(let z of C(x)){let F=z.attrs;if(!/\bserver\b/.test(F))continue;let X=z.start+z.fullMatch.indexOf(">")+1,G=Gg(x,X);if(G===-1)continue;let J=x.slice(X,G);if(!J.trim())continue;let ne=Iw(F)??k,re={index:z.start,length:G+9-z.start};try{let{extractVariables:se}=await ut("stx/variable-extractor",()=>import("./chunk-p7b17yr0.js"));await se(J,v,ne,{preserveExisting:!0,onFailure:(oe)=>{if(oe.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:ne,kind:oe.kind,message:oe.message}),!L)return;j.push({...re,markup:Xg(ne,oe.kind,oe.message)})}})}catch(se){let oe=se instanceof Error?se:Error(String(se));if(_.log(oe,{filePath:ne,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ne}: ${oe.message}`),L)j.push({...re,markup:Xg(ne,"unknown",oe.message)})}}if(j.length===0)return x;let B=x;for(let z of j.sort((F,X)=>X.index-F.index))B=B.slice(0,z.index)+z.markup+B.slice(z.index+z.length);return B}async function Dw(x,v,k){try{let{interpolateScriptsInTemplate:E}=await ut("stx/expressions",()=>import("./chunk-cvzkbsds.js"));return E(x,v,{skipServer:!0})}catch(E){let C=E instanceof Error?E:Error(String(E));return _.log(C,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${C.message}`),x}}async function Zg(x,v,k,E,C){let j=x,L=E;if(j=await Pw(j,v,k,E),j=await Dw(j,v,k),j=await Ap(j,v,k),j=await Ip(j,v,k),j=await Tf(j,v,k,L),he(j))j=Fi(j,v),j=es(j,v),j=Qr(j,v);j=zi(j);let{processStreamDirectives:B}=await ut("stx/streaming",()=>import("./chunk-bmk0s261.js"));j=B(j,v),j=qi(j,v,k,L,!0),j=await Jp(j,v,k,L,C),j=await Jr(j,v,k,L,C),j=Wd(j,v,k,L);let{processDeferDirectives:z}=await ut("stx/defer",()=>import("./chunk-d5amzers.js"));j=z(j,v,k);let{processTeleportDirectives:F}=await ut("stx/teleport",()=>import("./chunk-bfvaxrq0.js"));j=F(j,v,k);let{processTransitionDirectives:X,processTransitionAttributes:G}=await ut("stx/transitions",()=>import("./chunk-hjdwf9gp.js"));j=X(j,v,k),j=G(j);let{processErrorBoundaryDirectives:J,stripRenderFailedMarkers:ne}=await ut("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=J(j,v,k),j=ne(j);let{processSuspenseDirectives:re}=await ut("stx/suspense",()=>import("./chunk-bkaw7sgz.js"));j=re(j,v,k);let{processAsyncDirectives:se}=await ut("stx/async-components",()=>import("./chunk-d2c5727w.js"));j=se(j,v,k);let{processKeepAliveDirectives:oe}=await ut("stx/keep-alive",()=>import("./chunk-pc178389.js"));j=oe(j,v,k);let{processVirtualListDirectives:ie,processVirtualGridDirectives:ge,processInfiniteListDirectives:ue}=await ut("stx/virtual-scrolling",()=>import("./chunk-q1v0jwr4.js"));j=ie(j,v,k),j=ge(j,v,k),j=ue(j,v,k);let{processPartialHydrationDirectives:xe,processStaticDirectives:we}=await ut("stx/partial-hydration",()=>import("./chunk-8y4bqsxz.js"));j=xe(j,v,k),j=we(j);let{processComputedDirectives:$e,processWatchDirectives:_e}=await ut("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=$e(j,v,k),j=_e(j,v,k);let{processFormValidationDirectives:Ce}=await ut("stx/forms-validation",()=>import("./chunk-hahzjyxc.js"));j=Ce(j,v,k);let{processHeadDirective:Ee,processTitleDirective:Te,processMetaDirective:Re,resetHead:ke}=await ut("stx/head",()=>import("./chunk-ya9c8nec.js"));if(!v.__stx_head_preset&&!v.__stx_runtime_head)ke();let Ae=Ee(j);if(j=Ae.content,Ae.headContent)v.__stx_head_raw=`${v.__stx_head_raw||""}${Ae.headContent}
|
|
2604
|
+
`;if(j=Te(j,v),j=Re(j,v,k),j=Up(j),j=Fc(j,v),j=Rf(j),j=zp(j),j=await rs(j,v,k,L,C),j=await Jr(j,v,k,L,C),v.__stxProcessingDepth===1)j=iu(j,v);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Ol(j),j=sr(j,v,k),j=ns(j),j=Ud(j,v,{filePath:k,buildMode:L.buildMode}),j=Wc(j,v),j=Vc(j,v),j=Co(j,v),j=Nf(j,v),j=jf(j,v),j=await xf(j,v,k,L),j=await Gd(j,v,k),j=await so(j,v,k,L),j=io(j,v,k,L),j=bs(j,v,k,L),j=ws(j,v,k),j=vs(j,v,k,L),j=Ef(j,v,k,L),j=as(j,v),j=cs(j),j=Og(j),!L.skipEventDirectives)j=tu(j,v,k);if(j=Kd(j,v,k),L.debug){let et=/\bx-data\s*=/.test(j),it=Zr(x);if(et&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2604
2605
|
Both work on the same page, but they manage separate scopes.
|
|
2605
|
-
Prefer signals (state/derived/effect) for new components.`)}j=
|
|
2606
|
-
</head>`);if(/<head\b[^>]*>/i.test(
|
|
2607
|
-
${
|
|
2606
|
+
Prefer signals (state/derived/effect) for new components.`)}j=bp(j,v),j=await W(j,v,k),j=Bg(j),j=zg(j),j=Dd(j);let{processXElementDirectives:Ze}=await ut("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Ze(j);let Pe=v.__originalFilePath||k,Ie=Me(v);if(j=await Hi(j,L,Pe,Ie),j=Df(j,v),j=await Vp(j,v,k,L),L.media?.image?.autoSiblings){let et=L.publicDir||"public",{rewriteImagesWithSiblings:it}=await ut("stx/image-optimization/auto-sibling",()=>import("./chunk-as72dvvm.js"));j=await it(j,{publicDir:et})}if(L.seo?.enabled)j=xs(j,v,L);let Ge=(et,it,gt=!0)=>{if(!it)return et;let qt=it.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Dt=et.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(qt&&Dt){if(gt)et=et.replace(Dt[0],qt[0]);if(it=it.replace(qt[0],"").trim(),!it)return et}if(/<\/head>/i.test(et))return et.replace(/<\/head>/i,`${it}
|
|
2607
|
+
</head>`);if(/<head\b[^>]*>/i.test(et))return et.replace(/(<head\b[^>]*>)/i,`$1
|
|
2608
|
+
${it}`);if(/<html\b[^>]*>/i.test(et))return et.replace(/(<html\b[^>]*>)/i,`$1
|
|
2608
2609
|
<head>
|
|
2609
|
-
${
|
|
2610
|
-
</head>`);return
|
|
2611
|
-
${
|
|
2612
|
-
</script>`;if(j.includes("</head>")){let
|
|
2613
|
-
`+
|
|
2610
|
+
${it}
|
|
2611
|
+
</head>`);return et},{renderHead:nt,getHead:at}=await ut("stx/head",()=>import("./chunk-ya9c8nec.js")),Et=v.__stx_runtime_head??at();if(Et.title||Et.meta?.length||Et.link?.length){let et=nt(Et);if(et)j=Ge(j,et)}if(Ae.headContent)j=Ge(j,Ae.headContent,!Et.title);if(L.csp?.enabled&&L.csp.addMetaTag)j=_f(j,L.csp,v);if(L.analytics?.enabled)j=Md(j,L);if(L.heatmap?.enabled)j=Nd(j,L);if(L.pwa?.enabled&&L.pwa.autoInject!==!1){let{injectPwaTags:et}=await ut("stx/pwa/inject",()=>import("./chunk-aj43359g.js"));j=et(j,L)}let ft=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),_t=/\bSTX\.\w+/.test(j),ct=/window\.STX\s*=/.test(j);if(ft&&_t&&!ct){let it=`<script data-stx-scoped data-stx-run="once">
|
|
2612
|
+
${Ad()}
|
|
2613
|
+
</script>`;if(j.includes("</head>")){let gt=j.indexOf("</head>"),Dt=j.slice(0,gt).indexOf("<script");if(Dt!==-1){let xn=j.slice(0,Dt),Nt=j.slice(Dt);j=xn+it+`
|
|
2614
|
+
`+Nt}else j=j.replace("</head>",`${it}
|
|
2614
2615
|
</head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
|
|
2615
|
-
${
|
|
2616
|
-
`+j}{let{scanScriptTags:
|
|
2617
|
-
`+j.slice(
|
|
2616
|
+
${it}`);else j=it+`
|
|
2617
|
+
`+j}{let{scanScriptTags:et}=await ut("stx/signal-processing",()=>import("./chunk-5eqd40k0.js")),it=[];for(let gt of et(j)){if(!/\bserver\b/i.test(gt.attrs))continue;let qt=gt.start+gt.fullMatch.indexOf(">")+1,Dt=Gg(j,qt);if(Dt===-1)continue;let xn=Dt+9;while(xn<j.length&&/\s/.test(j[xn]))xn++;it.push({start:gt.start,end:xn})}if(it.length>0){let gt=Array(it.length+1),qt=0;for(let Dt=0;Dt<it.length;Dt++){let{start:xn,end:Nt}=it[Dt];gt[Dt]=j.slice(qt,xn),qt=Nt}gt[it.length]=j.slice(qt),j=gt.join("")}}let Pt=ki(j,k);if(Pt.hasScoped)j=Pt.html;let pt=v.__stx_event_bindings||[],jt=!1,Jn=[],Sn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Yn}=await ut("stx/signal-processing",()=>import("./chunk-5eqd40k0.js"));for(let et of Yn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Jn.push({match:et.fullMatch,attrs:et.attrs,content:et.body});for(let{match:et,attrs:it,content:gt}of Jn){jt=!0;let qt=gt;ls(gt,k,E.strict,v.__originalFilePath);let Dt=await me(gt,{eventBindings:pt,attrs:it,hasColonDirectives:Sn,templateContent:x,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(et,()=>Dt)}if(jt)v.__stx_event_bindings=[];if(!jt&&v.__stxProcessingDepth===1){let et=v.__stx_event_bindings||[];if(et.length>0){let it=pa(et);if(it){let gt=j.lastIndexOf("</body>");j=gt===-1?j+it:j.slice(0,gt)+it+`
|
|
2618
|
+
`+j.slice(gt)}v.__stx_event_bindings=[]}}if(!ae(j)&&bg(j))j=await Go(j,L);if(j=vg(j),L.csp?.enabled&&L.csp.useNonce&&typeof v.cspNonce==="string")j=kf(j,v.cspNonce);return j}import um from"path";import zl from"fs";import oi from"path";function Yg(x,v,k,E){let C=0;for(let j=v;j<x.length;j++)if(x[j]===k)C++;else if(x[j]===E&&!(E===">"&&x[j-1]==="=")){if(--C===0)return j}return-1}function Mw(x){let v=s(x),k=0,E=0,C=[];for(let j=0;j<v.length;j++)if("([{".includes(v[j]))k++;else if(")]}".includes(v[j]))k--;else if(v[j]===","&&k===0)C.push(x.slice(E,j).trim()),E=j+1;return C.push(x.slice(E).trim()),C}function Bl(x,v){let k=s(x),E=new RegExp(`\\b(?:${v.map((C)=>C.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let C of k.matchAll(E)){let j=C.index+C[0].length,L="";if(k[j]==="<"){let z=Yg(k,j,"<",">");if(z<0)continue;L=x.slice(j+1,z),j=z+1;while(/\s/.test(k[j]||"")&&j<k.length)j++}if(k[j]!=="(")continue;let B=Yg(k,j,"(",")");if(B>=0)return{type:L,args:Mw(x.slice(j+1,B))}}return null}var Qg=`
|
|
2618
2619
|
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;
|
|
2619
2620
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
2620
2621
|
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>;
|
|
@@ -2622,85 +2623,85 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
2622
2623
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
2623
2624
|
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]> };
|
|
2624
2625
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
2625
|
-
`;function
|
|
2626
|
-
`)}),L=
|
|
2626
|
+
`;function em(x,v){let k=[],E={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},C=s(x),j=x.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(J,ne,re,se,oe)=>{if(C.slice(oe,oe+6)!=="import")return J;if(se.endsWith(".stx"))return"";let ie=`${v}Import${k.length}`;if(k.push(`import * as ${ie} from ${JSON.stringify(se)};`),ne.startsWith("*"))return`import ${ne.replace(/^\*\s+as\s+/,"")} = ${ie};`;if(!ne.startsWith("{"))return`import ${ne} = ${ie}.default;`;return ne.slice(1,-1).split(",").map((ge)=>{let[ue,xe=ue]=ge.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ue)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&ue in E)E[ue].push(xe);return`import ${xe} = ${ie}.${ue};`}).join(`
|
|
2627
|
+
`)}),L=Bl(x,E.defineProps),B=Bl(x,E.defineEmits),z=Bl(x,E.withDefaults);if(!L&&!B)return{declarations:"",props:null,events:null};let F=[],X=null,G=null;if(L){F.push(`const __options = (${L.args[0]||"{}"}) as const;`),F.push(`const __defaults = (${z?.args[1]||"{}"});`);let J=L.type||"__StxOptions<typeof __options>";F.push(`export type __StxProps = __StxDefaults<${J}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),X=`${v}.__StxProps`}if(B)F.push(`const __events = (${B.args[0]||"[]"}) as const;`),F.push(`export type __StxEvents = ${B.type||"Record<(typeof __events)[number], any[]>"};`),G=`${v}.__StxEvents`;return{declarations:`${k.join(`
|
|
2627
2628
|
`)}
|
|
2628
2629
|
namespace ${v} {
|
|
2629
2630
|
${j}
|
|
2630
2631
|
${F.join(`
|
|
2631
2632
|
`)}
|
|
2632
|
-
}`,props:
|
|
2633
|
+
}`,props:X,events:G}}function*Ow(x){let v=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=v.exec(x)){let E=v.lastIndex,C=[];while(E<x.length){while(/\s/.test(x[E]||""))E++;if(x[E]===">"||x.slice(E,E+2)==="/>"){E+=x[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(x.slice(E))?.[0];if(!j){E++;continue}let L=E;E+=j.length;while(/\s/.test(x[E]||""))E++;if(x[E]!=="="){C.push({name:j,value:!0,offset:L,braced:!1});continue}E++;while(/\s/.test(x[E]||""))E++;let B=x[E],z=B==="{",F=B==='"'||B==="'";if(F||z)E++;let X=E;if(z){let G=s(x.slice(E)),J=1,ne=0;for(;ne<G.length;ne++){if(G[ne]==="{")J++;if(G[ne]==="}"&&--J===0)break}E+=ne}else if(F)while(E<x.length&&x[E]!==B)E++;else while(E<x.length&&!/[\s/>]/.test(x[E]))E++;if(C.push({name:j,value:x.slice(X,E),offset:X,braced:z}),F||z)E++}v.lastIndex=E,yield{name:k[1],offset:k.index,attributes:C}}}function tm(x,v,k){let E=[],C=[Qg,"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;'],j=new Map,L=new Map,B=new Map,z=k.scriptCode(x,k.filePath),F=s(z);for(let re of z.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(F.slice(re.index,re.index+6)!=="import")continue;let se=re[2],oe=oi.isAbsolute(se)||se.startsWith(".")?oi.resolve(oi.dirname(k.filePath),se):Ao(se,oi.dirname(k.filePath));if(!oe)continue;let ie=oe.endsWith(".stx")?oe:zl.existsSync(`${oe}.stx`)?`${oe}.stx`:void 0,ge=ie?null:To(oe,!1),ue=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let xe of ue){let[we,$e=we]=xe.trim().split(/\s+as\s+/),_e=ie||ge?.get(we)||ge?.get(we.toLowerCase());if(_e)B.set($e,_e),B.set($e.toLowerCase(),_e),B.set($e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_e)}}for(let re of v.matchAll(/@import\s*\(([^)]+)\)/g))for(let se of re[1].matchAll(/['"]([^'"]+)['"]/g)){let oe=Io(se[1],k.filePath,k).find((ie)=>zl.statSync(ie,{throwIfNoEntry:!1})?.isFile());if(oe)B.set(oi.basename(se[1]).replace(/\.stx$/,""),oe)}let X={__importedComponents:B},G=new Map,J=(re,se,oe)=>{let ie=x.slice(0,re);return{code:se,offset:re,attribute:oe,anchor:!0,kind:"directive",line:ie.split(`
|
|
2633
2634
|
`).length,column:re-ie.lastIndexOf(`
|
|
2634
|
-
`)}},ne=(re,se,oe)=>E.push({expression:re,statement:{text:se+re.code+oe,prefixLength:se.length}});for(let re of
|
|
2635
|
-
`):"",checks:E,events:j,dependencies:L}}var
|
|
2636
|
-
`,v-1)+1;return v-k+1}function
|
|
2637
|
-
`)v[L]=" "},E=[/<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 C of E){C.lastIndex=0;let j;while((j=C.exec(x))!==null)k(j.index,j.index+j[0].length)}return v.join("")}function
|
|
2635
|
+
`)}},ne=(re,se,oe)=>E.push({expression:re,statement:{text:se+re.code+oe,prefixLength:se.length}});for(let re of Ow(v)){if(en(re.name)||re.name==="component")continue;let se=zf(re.name,k.filePath,k,X);if(!se)continue;let oe=G.get(se);if(!oe){let ge;try{ge=k.readComponent?k.readComponent(se):zl.readFileSync(se,"utf8")}catch{continue}if(ge===void 0)continue;L.set(se,ge),oe=em(k.scriptCode(ge,se),`__StxComponent${G.size}`),G.set(se,oe),C.push(oe.declarations)}let ie=[];for(let ge of re.attributes){let{name:ue,offset:xe}=ge,we=ge.value===!0?"true":ge.value;if(ue.startsWith("@")||ue.startsWith("v-on:")){if(oe.events&&ge.value!==!0)j.set(xe,`__StxEvent<${oe.events}, ${JSON.stringify(ue.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let $e=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ue);if(ue.startsWith("v-")&&!ue.startsWith("v-bind:")&&!$e)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ue))continue;let _e=($e?$e[1]||"modelValue":ue.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,Re)=>Re.toUpperCase());if(ie.push(_e),!oe.props)continue;let Ee=ue.startsWith(":")||ue.startsWith("v-bind:")||!!$e||ge.braced?we:ge.value!==!0?JSON.stringify(we):"true";ne(J(xe,Ee,ue),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify(_e)}>);`)}if(oe.props){let ge=[...new Set(ie)].map((xe)=>`${JSON.stringify(xe)}: undefined as any`).join(", "),ue=J(re.offset,`<${re.name}>`);E.push({expression:ue,statement:{text:`;void ({ ${ge} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?C.join(`
|
|
2636
|
+
`):"",checks:E,events:j,dependencies:L}}var nm=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Nw(x){let v=(k)=>k.replace(/[^\n]/g," ");return x.replace(/<!--[\s\S]*?-->/g,v).replace(/\{\{--[\s\S]*?--\}\}/g,v)}function ze(x){let v=[],k=Nw(x);nm.lastIndex=0;let E;while((E=nm.exec(k))!==null){let C=(E[1]||"").trim(),j=(E[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,L=(E[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,B=E.index+j,z=E.index+E[0].length-L,F=x.slice(B,z);if(/\bsrc\s*=/.test(C))continue;let X=C.match(/\btype\s*=\s*["']([^"']+)["']/i);if(X&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(X[1]))continue;let G=/\bserver\b/.test(C)?"server":/\bclient\b/.test(C)?"client":"plain",J=ai(x,B);v.push({kind:G,code:F,startLine:J,startColumn:ci(x,B),offset:B,attrs:C})}return v}function ai(x,v){let k=1;for(let E=0;E<v&&E<x.length;E++)if(x.charCodeAt(E)===10)k++;return k}function ci(x,v){let k=x.lastIndexOf(`
|
|
2637
|
+
`,v-1)+1;return v-k+1}function ea(x){let v=x.split(""),k=(C,j)=>{for(let L=C;L<j&&L<v.length;L++)if(v[L]!==`
|
|
2638
|
+
`)v[L]=" "},E=[/<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 C of E){C.lastIndex=0;let j;while((j=C.exec(x))!==null)k(j.index,j.index+j[0].length)}return v.join("")}function jw(x){let v=0,k="";for(let E=0;E<x.length;E++){let C=x[E];if(k){if(C==="\\"){E++;continue}if(C===k)k="";continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="("||C==="["||C==="{"){v++;continue}if(C===")"||C==="]"||C==="}"){v--;continue}if(C==="|"&&v===0){if(x[E+1]==="|"){E++;continue}if(x[E-1]==="|")continue;return x.slice(0,E)}}return x}var dm=new Set([":for","x-for","v-for"]),ta=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Fl="__stx_interpolated",rm="__StxElement",fm="__StxTemplateValue",Lw=`type ${fm}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function sm(x){return x.replace(/\{\{[\s\S]*?\}\}/g,Fl).replace(/\{!![\s\S]*?!!\}/g,Fl)}function us(x){return x.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(v)=>{let k=v.split(`
|
|
2638
2639
|
`).length-1,E=v.length-k;return`0${" ".repeat(Math.max(0,E-1))}${`
|
|
2639
|
-
`.repeat(k)}`})}var
|
|
2640
|
-
`)}function
|
|
2640
|
+
`.repeat(k)}`})}var Bw=["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"],zw=new RegExp(String.raw`^[ \t]*@(?:${Bw.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function ds(x){return x.replace(zw,(v)=>v.replace(/[^\n]/g," "))}var im=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function uc(x){let v=ea(x),k=[],E=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,C;while((C=E.exec(v))!==null){if(C[1]||C[3])continue;let B=C[2]??C[4]??"",z=C[2]!==void 0?2:3,F=jw(B);if(!F.trim())continue;let X=C.index+z+(F.length-F.trimStart().length);k.push({code:F.trim(),line:ai(v,X),column:ci(v,X),offset:X,kind:"interpolation"})}let j=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((C=j.exec(v))!==null){let L=C.index+C[0].length-1,B=0,z=L;for(;z<v.length;z++){let J=v[z];if(J==="(")B++;else if(J===")"){if(B--,B===0)break}}if(B!==0)continue;let F=v.slice(L+1,z),X=F.trim();if(j.lastIndex=z+1,!X)continue;let G=L+1+(F.length-F.trimStart().length);k.push({code:X,line:ai(v,G),column:ci(v,G),offset:C.index,kind:"condition"})}ta.lastIndex=0;while((C=ta.exec(v))!==null){let L=C[1],B=C[3]??"",z=L.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(im.has(z)||im.has(L))continue;if(!B.trim())continue;let F=C.index+C[0].indexOf(C[2],C[0].indexOf(L)+L.length)+1;if(dm.has(z)){let G=B.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let J=B.slice(G.index+G[0].length),ne=G.index+G[0].length+(J.length-J.trimStart().length);k.push({code:sm(J.trim()),line:ai(v,F+ne),column:ci(v,F+ne),offset:F+ne,kind:"directive",attribute:z});continue}let X=B.length-B.trimStart().length;k.push({code:sm(B.trim()),line:ai(v,F+X),column:ci(v,F+X),offset:F+X,kind:"directive",attribute:z})}return k.sort((L,B)=>L.line-B.line||L.column-B.column),k}var Fw=2000;function Ww(x,v){let k=0,E=Math.min(x.length,v+Fw);for(let C=v;C<E;C++){let j=x[C];if(j==="(")k++;else if(j===")"){if(k--,k===0)return x.slice(v+1,C)}}return null}function Vw(x){let v=new Map,k=(B,z)=>{let F=B.split(/[,[\]{}()\s]+/).filter(Boolean);for(let X of F){let G=X.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let J=F.length===1?z:void 0,ne=v.get(G);if(!ne)v.set(G,{name:G,iterable:J});else if(ne.iterable!==J)ne.iterable=void 0}},E=/^\$?[A-Z_$][\w$]*$/i,C=(B)=>{let z=B.trim();return E.test(z)?z:void 0};for(let B of x.matchAll(/@for(?:each|else)\s*\(/g)){let z=Ww(x,B.index+B[0].length-1);if(z===null)continue;let F=St(z);if(!F)continue;k(F.itemVar.replace(/=>/g," "),C(F.arrayExpr))}for(let B of x.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(B[1],B[2]==="of"?C(B[3]):void 0);for(let B of x.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(B[1]);let j=ea(x);ta.lastIndex=0;let L;while((L=ta.exec(j))!==null){let B=L[1].replace(/\..*$/,"");if(!dm.has(B))continue;let z=L[3].match(/\s+(?:in|of)\s+/);if(!z||z.index===void 0)continue;k(L[3].slice(0,z.index),C(L[3].slice(z.index+z[0].length)))}for(let B of x.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let z of B[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(z[1]);return[...v.values()].sort((B,z)=>B.name.localeCompare(z.name))}function Q(x){let v=new Set;for(let k of x.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))v.add(k[1]);for(let k of x.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))v.add(k[1]);for(let k of x.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))v.add(k[1]);for(let k of x.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let E of k[1].split(",")){let C=E.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(C))v.add(C)}return[...v].sort()}var Wl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Uw={$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(x=new Set){return[...Wl.filter((v)=>!x.has(v)).map((v)=>`declare var ${v}: any`),...Object.entries(Uw).filter(([v])=>!x.has(v)).map(([,v])=>v)].join(`
|
|
2641
|
+
`)}function Ji(x){return new Set([...x.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((v)=>v[1]))}function pm(x){let v=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,E=!1,C=new Set,j=s(x);while((k=v.exec(j))!==null){E=!0;for(let L of Hw(k[1])){let B=L.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(B))C.add(B)}}return E?[...C]:null}function Hw(x){let v=[],k=0,E="";for(let C of x){if(C===","&&k===0){v.push(E),E="";continue}if(C==="("||C==="["||C==="{")k++;else if(C===")"||C==="]"||C==="}")k--;E+=C}return v.push(E),v.filter((C)=>C.trim().length>0)}function qw(x){let v=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=x.replace(v,(C)=>(k.push(C.trim()),C.split(`
|
|
2641
2642
|
`).map(()=>"").join(`
|
|
2642
2643
|
`)));return{imports:k.join(`
|
|
2643
|
-
`),body:E}}function
|
|
2644
|
-
`&&!/[=|&,<([{]\s*$/.test(v.slice(Math.max(0,G-40),G)))){F=J===";"?G+1:G;break}}}C.push({name:z,text:x.slice(L.index,F).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=F}return C}function
|
|
2645
|
-
`)}if(k.length===0)return C.length>0?["",`// ${
|
|
2646
|
-
`):"";let{imports:j,body:L}=
|
|
2647
|
-
`)}function
|
|
2648
|
-
`)k[C]=" "}return Q(k.join(""))}function
|
|
2649
|
-
`),C=Array.from({length:E.length},()=>""),j=new Map,L=v.filePath&&v.templateExpressions!==!1?
|
|
2650
|
-
`)}):void 0,B=new Set,z=[];for(let G of k){let J=
|
|
2651
|
-
`);ne.forEach((re,se)=>{let oe=G.startLine-1+se;if(oe<C.length)C[oe]=se===0?
|
|
2652
|
-
`).entries())if(C.push(re),J)j.set(C.length,ne===0?J:{...J,line:J.line+ne,column:1,prefixLength:0})};if(v.globals!==!1){F("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>
|
|
2653
|
-
`))F(J);let G=
|
|
2654
|
-
`),lineMap:j,sourceLineCount:E.length,componentDependencies:L?.dependencies,referenced:
|
|
2655
|
-
`);return{line:k.length,column:k[k.length-1].length+1}}function
|
|
2656
|
-
`);for(let C of E){let j=k,L=null,B=!1;for(let z=0;z<C.length;z++){let F=C[z];if(B){B=!1;continue}if(F==="\\"){B=!0;continue}if(L){if(F===L)L=null;continue}if(F==="'"||F==='"'||F==="`"){L=F;continue}if(F==="/"&&z+1<C.length&&C[z+1]==="/")break;if(F==="{")k++;else if(F==="}")k--}if(j===0){let z=C.match(/(?:const|let|var)\s+(\w+)\s*=/);if(z)v.push(z[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(C)){let F=C.match(/(?:const|let|var)\s+(\w+)/);if(F)v.push(F[1])}else{let F=C.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(F){let G=F[1].slice(1,-1).split(",").map((J)=>{let ne=J.split(":");return(ne.length>1?ne[1]:ne[0]).trim()}).filter((J)=>/^\w+$/.test(J));v.push(...G)}}}}return[...new Set(v)]}function
|
|
2657
|
-
|
|
2658
|
-
`),v}function
|
|
2659
|
-
`),
|
|
2660
|
-
${
|
|
2661
|
-
${
|
|
2644
|
+
`),body:E}}function gm(x){let v=s(x),k=Array(v.length),E=0;for(let B=0;B<v.length;B++){let z=v[B];if(z==="}"||z===")"||z==="]")E=Math.max(0,E-1);if(k[B]=E,z==="{"||z==="("||z==="[")E++}let C=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,L;while((L=j.exec(v))!==null){if(k[L.index]!==0)continue;let B=L[1],z=L[2],F;if(B==="interface"){let X=v.indexOf("{",L.index);if(X===-1)continue;let G=0;F=-1;for(let J=X;J<v.length;J++)if(v[J]==="{")G++;else if(v[J]==="}"&&--G===0){F=J+1;break}if(F===-1)continue}else{let X=0;F=v.length;for(let G=v.indexOf("=",L.index)+1;G<v.length;G++){let J=v[G];if(J==="{"||J==="["||J==="("||J==="<")X++;else if(J==="}"||J==="]"||J===")"||J===">")X--;else if(X<=0&&(J===";"||J===`
|
|
2645
|
+
`&&!/[=|&,<([{]\s*$/.test(v.slice(Math.max(0,G-40),G)))){F=J===";"?G+1:G;break}}}C.push({name:z,text:x.slice(L.index,F).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=F}return C}function Kw(x){return new Set(gm(x).map((v)=>v.name))}function Yi(x,v=""){let k=pm(x),E=Kw(v),C=gm(x).filter((F)=>!E.has(F.name)).map((F)=>F.text);if(!k){let F=Q(x).filter((X)=>!hi(v,X));if(F.length===0&&C.length===0)return"";return["",`// ${Zw}`,...C,...F.map((X)=>`declare var ${X}: any`)].join(`
|
|
2646
|
+
`)}if(k.length===0)return C.length>0?["",`// ${om}`,...C].join(`
|
|
2647
|
+
`):"";let{imports:j,body:L}=qw(x),B=L.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),z=["",`// ${om}`];if(j)z.push(j);return z.push(...C),z.push(`async function ${am}() {`,B,` return { ${k.join(", ")} }`,"}",`type ${cm} = Awaited<ReturnType<typeof ${am}>>`,...k.map((F)=>`declare var ${F}: ${cm}[${JSON.stringify(F)}]`)),z.join(`
|
|
2648
|
+
`)}function Xw(x){let k=s(x).split(""),E=0;for(let C=0;C<k.length;C++){let j=k[C];if(j==="{"||j==="("||j==="["){E++;continue}if(j==="}"||j===")"||j==="]"){E=Math.max(0,E-1);continue}if(E>0&&j!==`
|
|
2649
|
+
`)k[C]=" "}return Q(k.join(""))}function Zi(x,v){if(pm(x)!==null)return[];let k=s(v),E=new Set(m);return Xw(x).filter((C)=>{if(E.has(C))return!1;if(Q(v).includes(C))return!1;return new RegExp(`(?<![.#\\w$])${C}(?![\\w$])`).test(k)})}var om="stx: types for the declared client payload (#1868)",Zw="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",am="__stxServerScope",cm="__StxClientPayload";var lm=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Gw=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Jw(x){let v=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of x){let C=s(E),{depths:j,balanced:L}=be(C);if(!L)continue;let B=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let z of C.matchAll(B)){let F=z.index??0;if(j[F+z[1].length]!==0)continue;let X=z[2],G=F+z[0].length-z[3].length,J=E.slice(G,F+z[0].length).trim().replace(/;$/,"").trim(),ne=z[3],re=k.test(ne)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ne)&&!/[,+\-*/%&|?:=]$/.test(J)&&be(ne).balanced;v.set(X,v.has(X)||!re?null:J)}}return new Map([...v].filter((E)=>E[1]!==null))}function mm(x,v,k=0,E=new Set){if(v.size===0||k>=5)return x;let C=s(x),j="",L=0;for(let B of C.matchAll(/[A-Za-z_$][\w$]*/g)){let z=B.index??0,F=B[0],X=v.get(F);if(!X||E.has(F))continue;let G=C.slice(0,z).trimEnd(),J=C.slice(z+F.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(J)&&/[{,]$/.test(G))continue;if(z>0&&/[\w$]/.test(C[z-1]))continue;j+=`${x.slice(L,z)}(${mm(X,v,k+1,new Set([...E,F]))})`,L=z+F.length}return j+x.slice(L)}function Yw(x,v){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],C;while((C=k.exec(x))!==null){if(C.index>v)break;let j=C[1];if(C.index===v){if(j==="elseif"){let B=E[E.length-1];if(B?.current)B.seen.push(B.current);if(B)B.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let L="";if(C[2]==="("){let B=0,z=C.index+C[0].length-1,F=z+1;for(;z<x.length;z++){let X=x[z];if(X==="(")B++;else if(X===")"){if(B--,B===0)break}}L=x.slice(F,z).trim(),k.lastIndex=z+1}if(j==="if")E.push({seen:[],current:L});else if(j==="unless")E.push({seen:[],current:`!(${L})`});else if(j==="elseif"||j==="else"){let B=E[E.length-1];if(!B)continue;if(B.current)B.seen.push(B.current);B.current=j==="elseif"?L:null}}return E.flatMap((j)=>[...j.seen.map((L)=>`!(${L})`),...j.current?[j.current]:[]]).filter(Boolean)}function Qw(x){let v=x.code.trim();if(!v)return null;if(x.attribute?.startsWith("@")){if(Gw.test(v))return null;let E=";(($event: any): void => { ";return{text:`${E}${v} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${v}));`,prefixLength:k.length}}var eS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function zn(x,v){if(!v)return x;return x.replace(eS,(k,E,C,j)=>{let L=um.resolve(v,j).replace(/\\/g,"/");return`${E}${C}${L}${C}`})}function ps(x){return" ".repeat(Math.max(0,(x.startColumn??1)-1))}function tS(x){let v=new Set,k=s(x);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let C=E[1],j=/\{([^}]*)\}/.exec(C);for(let F of j?.[1].split(",")??[]){let X=F.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(X&&/^[A-Z_$][\w$]*$/i.test(X))v.add(X)}let L=C.replace(/\{[^}]*\}/,""),B=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(L);if(B)v.add(B[1]);let z=/^\s*([A-Z_$][\w$]*)/i.exec(L);if(z&&z[1]!=="type")v.add(z[1])}return[...v].sort()}function Qi(x,v={}){let k=ze(x),E=x.split(`
|
|
2650
|
+
`),C=Array.from({length:E.length},()=>""),j=new Map,L=v.filePath&&v.templateExpressions!==!1?tm(x,ea(x),{filePath:v.filePath,componentsDir:v.componentsDir,projectRoot:v.projectRoot,readComponent:v.readComponent,scriptCode:(G,J)=>ze(G).map((ne)=>zn(ne.code,um.dirname(J))).join(`
|
|
2651
|
+
`)}):void 0,B=new Set,z=[];for(let G of k){let J=ds(us(G.code)),ne=zn(J,v.originDir??"").split(`
|
|
2652
|
+
`);ne.forEach((re,se)=>{let oe=G.startLine-1+se;if(oe<C.length)C[oe]=se===0?ps(G)+re:re,B.add(oe)}),z.push(G.startLine-1+ne.length-1)}for(let G of z){let J=C[G]?.trim()===""?G:G+1;if(J<C.length&&C[J].trim()===""&&(J===G||!B.has(J)))C[J]=";"}let F=(G,J)=>{for(let[ne,re]of G.split(`
|
|
2653
|
+
`).entries())if(C.push(re),J)j.set(C.length,ne===0?J:{...J,line:J.line+ne,column:1,prefixLength:0})};if(v.globals!==!1){F("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>tS(se.code))]),J=(se)=>{if(!G.has(se))F(`declare var ${se}: any`)};if(v.runtimeGlobals!==!1){if(!G.has("window"))F("declare var window: any");for(let se of m)J(se)}let ne=[...new Set([...Wl,...H,...lm])].filter((se)=>v.runtimeGlobals!==!1||!m.includes(se));if(v.contextScope==="global"){F("declare global {");for(let se of ne)F(` var ${se}: any`);F("}")}else{for(let se of Wl)J(se);for(let se of H)J(se);for(let se of lm)J(se)}F(`declare var ${Fl}: any`);let re=new Set(k.flatMap((se)=>Q(se.code)));F(`type ${rm}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of Vw(x)){if(re.has(se.name))continue;let oe=se.iterable&&re.has(se.iterable)?`${rm}<typeof ${se.iterable}>`:"any";F(`declare var ${se.name}: ${oe}`)}}if(v.templateExpressions!==!1){if(L?.declarations)for(let J of L.declarations.split(`
|
|
2654
|
+
`))F(J);let G=uc(x).map((J)=>{let ne=L?.events.get(J.offset??-1);if(ne){J.anchor=!0;let re=J.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),oe=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${ne}) => unknown)`:re,ie=`;(($event: ${ne}): void => { `;return{expression:J,statement:{text:`${ie}${oe} });`,prefixLength:ie.length}}}return{expression:J,statement:Qw(J)}}).filter((J)=>J.statement!==null);if(G.push(...L?.checks||[]),G.length>0){let J=ea(x),ne=Jw(k.map((ie)=>ie.code)),se=[...new Set(k.flatMap((ie)=>Q(ie.code)))].filter((ie)=>/^[A-Z_$][\w$]*$/i.test(ie)),oe=0;if(se.length>0){F(Lw);for(let ie of se)F(`type __StxT_${ie} = ${fm}<typeof ${ie}>`);F(`;((${se.map((ie)=>`${ie}: __StxT_${ie}`).join(", ")}) => {`),oe=1}for(let{expression:ie,statement:ge}of G){let ue=" ".repeat(oe),xe=ie.offset===void 0?[]:Yw(J,ie.offset),we=xe.length>0?`${xe.map((_e)=>`if (${mm(_e,ne)}) `).join("")}{ `:"",$e=xe.length>0?" }":"";F(ue+we+ge.text+$e,{line:ie.line,column:ie.column,expression:ie,prefixLength:ge.prefixLength+ue.length+we.length,guardPrefixLength:ue.length+we.length})}if(oe>0)F("});")}}let X=!1;if(v.reference&&C[0]!==void 0&&C[0].trim()==="")C[0]=`/// <reference path=${JSON.stringify(v.reference.replace(/\\/g,"/"))} />`,X=!0;return F("export {}"),{text:C.join(`
|
|
2655
|
+
`),lineMap:j,sourceLineCount:E.length,componentDependencies:L?.dependencies,referenced:X}}function eo(x,v){if(!x.expression)return!1;return x.inGuard===!0||v===2774}function to(x,v,k){let E=x.lineMap.get(v);if(!E)return v<=x.sourceLineCount?{line:v,column:k}:null;let C=E.expression?.anchor?0:Math.max(0,k-1-(E.prefixLength??0));return{line:E.line,column:E.column+C,expression:E.expression,inGuard:k<=(E.guardPrefixLength??0)}}var nS=[{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"}],rS=[{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')"}],sS=[{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 dc(x){let v=[],k=[];return iS(x,v),oS(x,v,k),aS(x,k),cS(x,v),{valid:v.length===0,errors:v,warnings:k}}function iS(x,v){let k=(x.match(/\{\{/g)||[]).length,E=(x.match(/\}\}/g)||[]).length;if(k!==E)v.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${E} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function oS(x,v,k){for(let E of nS){let C=new RegExp(`${E.open}(?:\\s|\\()`,"g"),j=new RegExp(E.close,"g"),L=(x.match(C)||[]).length,B=(x.match(j)||[]).length;if(E.altClose){let z=new RegExp(E.altClose,"g");B+=(x.match(z)||[]).length}if(L>B)v.push({type:"directive",message:`Unclosed @${E.name} directive: found ${L} opening and ${B} closing`,suggestion:`Add ${L-B} missing ${E.close} tag(s)`});else if(B>L)k.push({type:"directive",message:`Extra ${E.close} found: ${B-L} more closing than opening`,suggestion:`Check for orphaned ${E.close} tags`})}}function aS(x,v){for(let k of rS)if(k.pattern.test(x))v.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function cS(x,v){for(let k of sS)if(k.pattern.test(x))v.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function pc(x,v){let k=x.slice(0,v).split(`
|
|
2656
|
+
`);return{line:k.length,column:k[k.length-1].length+1}}function fc(x,v,k){let E=[];switch(x){case"if":case"elseif":case"unless":if(k.length===0)E.push({type:"syntax",message:`@${x} requires a condition`,suggestion:`Use @${x}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))E.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)E.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)E.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)E.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)E.push({type:"syntax",message:`@${x} requires a path`,suggestion:`Use @${x}('path/to/template')`});break}return E}function gc(x){return/@[a-z]+/i.test(x)||/\{\{/.test(x)}function mc(x){let v=x.matchAll(/@([a-z]+)/gi),k=new Set;for(let E of v){let C=E[1].toLowerCase();if(!C.startsWith("end"))k.add(C)}return Array.from(k)}import An from"path";import Ns from"process";var xt=["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 hm=new Set(xt),lS=new Set(["props","$props","defineProps"]),uS=new Set(["stx","@stacksjs/stx"]),ym=I(128),xm=I(64);function dS(x){let v=[],k=0,E=x.split(`
|
|
2657
|
+
`);for(let C of E){let j=k,L=null,B=!1;for(let z=0;z<C.length;z++){let F=C[z];if(B){B=!1;continue}if(F==="\\"){B=!0;continue}if(L){if(F===L)L=null;continue}if(F==="'"||F==='"'||F==="`"){L=F;continue}if(F==="/"&&z+1<C.length&&C[z+1]==="/")break;if(F==="{")k++;else if(F==="}")k--}if(j===0){let z=C.match(/(?:const|let|var)\s+(\w+)\s*=/);if(z)v.push(z[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(C)){let F=C.match(/(?:const|let|var)\s+(\w+)/);if(F)v.push(F[1])}else{let F=C.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(F){let G=F[1].slice(1,-1).split(",").map((J)=>{let ne=J.split(":");return(ne.length>1?ne[1]:ne[0]).trim()}).filter((J)=>/^\w+$/.test(J));v.push(...G)}}}}return[...new Set(v)]}function nc(x){let v=x;v=v.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),v=v.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),v=v.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),v=v.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),v=v.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let C=[],j="",L=0,B=0,z=null;for(let F=0;F<E.length;F++){let X=E[F];if(z){if(j+=X,X===z)z=null;continue}if(X==='"'||X==="'"||X==="`"){z=X,j+=X;continue}if(X==="<")L++;else if(X===">"&&L>0)L--;else if(X==="(")B++;else if(X===")")B--;if(X===","&&L===0&&B===0){C.push(j),j="";continue}j+=X}if(j)C.push(j);return C.map((F)=>{let X=F.trim(),G=X.startsWith("..."),J=G?X.slice(3):X,ne=-1,re=0;for(let we=0;we<J.length;we++)if(J[we]==="<")re++;else if(J[we]===">")re--;else if(J[we]===":"&&re===0){ne=we;break}if(ne===-1)return F;let oe=J.substring(0,ne).trim().replace(/\?$/,""),ie=J.substring(ne+1),ge=-1,ue=0;for(let we=0;we<ie.length;we++)if(ie[we]==="<")ue++;else if(ie[we]===">")ue--;else if(ie[we]==="="&&ue===0){ge=we;break}let xe=G?"...":"";if(ge!==-1)return`${xe}${oe} = ${ie.substring(ge+1).trim()}`;return`${xe}${oe}`}).join(", ")}v=v.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,C,j)=>{if(!j.includes(":"))return E;return`${C}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,C,j=[];while((C=E.exec(v))!==null){let L=C.index+C[0].length-1,B=1,z=L+1,F=0,X=null;while(z<v.length&&B>0){let ne=v[z];if(X){if(ne===X)X=null;z++;continue}if(ne==='"'||ne==="'"||ne==="`"){X=ne,z++;continue}if(ne==="<")F++;else if(ne===">"&&F>0)F--;else if(F===0){if(ne==="(")B++;else if(ne===")")B--}if(B>0)z++}if(B!==0)continue;let G=v.substring(L+1,z);if(!G.includes(":"))continue;let J=k(G);j.push({start:L+1,end:z,replacement:J})}for(let L=j.length-1;L>=0;L--){let{start:B,end:z,replacement:F}=j[L];v=v.substring(0,B)+F+v.substring(z)}}return v=v.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,C)=>{if(!C.includes(":"))return E;if(C.includes("{")||C.includes("}"))return E;return`(${C.split(",").map((L)=>{let[B,...z]=L.split("="),F=B.split(":")[0].trim();if(z.length>0)return`${F} = ${z.join("=").trim()}`;return F}).join(", ")}) =>`}),v=v.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"),v=v.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),v=v.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),v=v.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),v=v.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),v=v.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),v=v.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),v=v.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),v=v.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),v=v.replace(/\n\s*\n\s*\n/g,`
|
|
2658
|
+
|
|
2659
|
+
`),v}function rc(x){return x.replace(/\s*imported from \S*(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])\S*/g,"")}function sc(x){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(x)}function ic(x){if(x instanceof SyntaxError)return!0;let v=x instanceof Error?x.message:String(x);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(v)}function oc(x){if(!/is not defined|can't find variable/i.test(x))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(x)}var bm=new Set;async function d(x,v,k,E={}){if(!x.trim())return;let C=y(),j=O(x,JSON.stringify(C)),L=ym.get(j);if(L===void 0){try{let Ke=N({loader:"ts",target:"browser",define:C}),Ye=x.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ye=Ye.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),L=Ke.transformSync(Ye)}catch{L=nc(x)}ym.set(j,L)}let B={exports:{}},z=B.exports,F=Ns.cwd(),X={},G=[...L.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Ke)=>Ke[1]).filter((Ke)=>!Ke.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Ke)),J=new Map;for(let Ke of G)try{if(Ke.startsWith(".")){X[Ke]=await import(An.resolve(An.dirname(k),Ke));continue}let Ye=An.resolve(F,"node_modules",Ke),st=An.join(Ye,"package.json"),mt=JSON.parse(u("fs").readFileSync(st,"utf8")),At=mt.main||"index.js";if(mt.exports){let Kt=typeof mt.exports==="string"?mt.exports:mt.exports["."];if(typeof Kt==="string")At=Kt;else if(Kt?.bun)At=Kt.bun;else if(Kt?.import)At=Kt.import;else if(Kt?.default)At=Kt.default}X[Ke]=await import(An.resolve(Ye,At))}catch(Ye){if(Ke.startsWith("."))J.set(Ke,Ye instanceof Error?Ye.message:String(Ye))}let ne=(Ke)=>{if(X[Ke])return X[Ke];let Ye=J.get(Ke);if(Ye!==void 0)throw Error(`Cannot require '${Ke}' from ${k}: ${Ye}`);return u(Ke)},re=v.props||{},se=(Ke)=>{if(!Ke)return re;let Ye={};for(let[st,mt]of Object.entries(Ke)){let At=re[st];if(At!==void 0)Ye[st]=At;else if(typeof mt==="function")Ye[st]=mt();else Ye[st]=mt}return Ye};for(let[Ke,Ye]of Object.entries(re))Object.defineProperty(se,Ke,{value:Ye,enumerable:!0,configurable:!0,writable:!0});let oe=(Ke,Ye=!1)=>{if(Ke===void 0||Ke===null)return Ye;if(typeof Ke==="string"){let st=Ke.trim().toLowerCase();if(st===""||st==="true"||st==="1"||st==="on"||st==="yes")return!0;if(st==="false"||st==="0"||st==="off"||st==="no")return!1;return!0}return Boolean(Ke)},ie=(Ke,Ye=0)=>{if(Ke===void 0||Ke===null)return Ye;if(typeof Ke==="string"){let mt=Ke.trim();if(mt==="")return Ye;let At=Number(mt);return Number.isFinite(At)?At:Ye}let st=Number(Ke);return Number.isFinite(st)?st:Ye};for(let Ke of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,Ke))continue;try{Object.defineProperty(se,Ke,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ge=(Ke)=>{if(!Ke)return re;let Ye={...re};for(let[st,mt]of Object.entries(Ke)){let At=mt&&typeof mt==="object"&&!Array.isArray(mt)?mt:{type:mt};if(Ye[st]===void 0&&At.default!==void 0)Ye[st]=typeof At.default==="function"?At.default():At.default}return Ye},ue=()=>v.slots||{},xe=(Ke,Ye)=>{let st={...Ke};for(let[mt,At]of Object.entries(Ye))if(st[mt]===void 0)if(typeof At==="function")st[mt]=At();else st[mt]=At;return st},we=(Ke)=>{let Ye=()=>Ke;return Ye.set=(st)=>{},Ye.update=(st)=>{},Ye},$e=(Ke)=>{let Ye,st=!1;return()=>{if(!st)try{Ye=Ke(),st=!0}catch{Ye=void 0}return Ye}},_e=(Ke)=>{},Ce=(Ke)=>Ke(),Ee=(Ke)=>{},Te=(Ke)=>{},Re=Mn(v);function ke(Ke){let Ye=Ke||{};if(Ye.title!==void 0||Ye.description!==void 0)Ge({title:Ye.title,description:Ye.description})}function Ae(Ke){if(!Ke||typeof Ke!=="object")return;let Ye=v.__stxClientPayload??{};Object.assign(Ye,Ke),v.__stxClientPayload=Ye}let Ze=()=>{let Ke=v.__stxServeContext,Ye=v.__stxServeSearch??Ke?.search??"",st=Ke?.path??"",mt=Object.fromEntries(new URLSearchParams(Ye)),At=v.query,Kt=Object.keys(mt).length>0?mt:At??{},nr=Ye||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:v.params??{},query:Kt,path:st,name:"",fullPath:st+nr,hash:"",matched:[]}},Pe=()=>({push:(Ke)=>{},replace:(Ke)=>{},back:()=>{},forward:()=>{},go:(Ke)=>{}}),Ie=(Ke)=>{let Ye=v.__stx_runtime_head||{};v.__stx_runtime_head=pe(Ye,de(Ke||{},{known:Zn,source:"useHead()"}))},Ge=(Ke)=>{Ie(Qn(Ke||{}))},nt=(Ke)=>({value:Ke}),at=(Ke)=>Ke,rt=(Ke)=>({value:typeof Ke==="function"?Ke():Ke}),Et=(Ke,Ye)=>{},ft=(Ke)=>{},_t=(Ke)=>{},ct=(Ke)=>Ke?Ke():Promise.resolve(),Pt=(Ke)=>(Ye,...st)=>{},pt=(Ke)=>{},jt=(Ke,Ye)=>{},Jn=(Ke,Ye)=>Ye,Sn=()=>({value:"light"}),Yn=()=>we(!1),et=(Ke)=>we(!1),it=()=>we(!1),gt=()=>et("(prefers-color-scheme: dark)"),qt=()=>et("(prefers-color-scheme: light)"),Dt=()=>et("(prefers-reduced-motion: reduce)"),xn=()=>et("(prefers-contrast: more)"),Nt={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:{}},ia=new Proxy(Nt,{get(Ke,Ye){if(Ye in Ke)return Ke[Ye];return},set(Ke,Ye,st){return Ke[Ye]=st,!0}}),oa={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},aa=console;try{let Ke=ts(L,k),Ye=new Set(Object.keys(re)),st=Object.keys(v).filter((lt)=>!Ye.has(lt)&&!lS.has(lt)&&Je(lt)),mt=st.map((lt)=>v[lt]);if(!st.includes("__stxServeContext"))st.push("__stxServeContext"),mt.push(void 0);let At=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],nr=[];for(let[lt,$n]of Object.entries(re)){if(!Je(lt))continue;if(At.has(lt))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${lt}\\b`).test(Ke))continue;Kt.push(lt),nr.push($n)}let cr=dS(Ke).map((lt)=>`module.exports.${lt} = typeof ${lt} !== 'undefined' ? ${lt} : module.exports.${lt};`).join(`
|
|
2660
|
+
`),Gt=v.params??{},tt=[],ot=[];for(let lt=0;lt<st.length;lt++){if(st[lt]==="params")continue;tt.push(st[lt]),ot.push(mt[lt])}let Rt=[...xt,...Kt,...tt],dt=`return (async () => {
|
|
2661
|
+
${Ke}
|
|
2662
|
+
${cr}
|
|
2662
2663
|
return module.exports
|
|
2663
|
-
})()`,
|
|
2664
|
-
`),j=[],L=0;while(L<C.length){let B=C[L].trim();if(B.startsWith("interface ")||B.startsWith("export interface ")||B.startsWith("type ")||B.startsWith("export type ")){if(B.includes("{")&&!B.includes("}")){let z=0;for(;L<C.length;L++){for(let F of C[L])if(F==="{")z++;else if(F==="}")z--;if(z<=0)break}}L++;continue}if(B.startsWith("definePageMeta(")){let z=0,F=!1,
|
|
2665
|
-
`),J=[];for(let ne of["title","description"]){let re=new RegExp(`\\b${ne}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)J.push(`${ne}: ${JSON.stringify(re[2])}`)}if(J.length>0)j.push(`useSeoMeta({ ${J.join(", ")} });`);continue}if(B.startsWith("import ")||B==="import"||B.startsWith("import{")){let z=B,F=0;while(!
|
|
2666
|
-
`+ne;if(G<=0&&J>=L)break}j.push(
|
|
2667
|
-
`),k,E)}function
|
|
2668
|
-
`)B=!1;j++;continue}if(z){if(C+=
|
|
2669
|
-
`);return{type:re,name:we,value:`${
|
|
2670
|
-
${
|
|
2671
|
-
${x[F]}`,F++;else break}return z=z.trim().replace(/;$/,""),{type:j,name:L,value:z,nextIndex:F}}function
|
|
2664
|
+
})()`,zt=O(dt,Rt.join("\x00")),Mt=xm.get(zt);if(!Mt)Mt=Function(...Rt,dt),xm.set(zt,Mt);let hn=v.__stx_options?.runtimeConfig;if(hn||/\buse(?:Server)?RuntimeConfig\b/.test(L))await on(v,k,hn);let lr=await le(v.__stx_runtime_config??Ct()??S(),()=>og(v,()=>Mt(B,z,ne,re,se,oe,ie,ge,xe,Ae,ag,ys,Kn,we,$e,_e,Ce,Ee,Te,ke,Ze,Pe,Ie,Ge,Re.setResponseStatus,Re.setResponseHeader,Re.notFound,nt,at,rt,Et,ft,_t,ct,Pt,pt,ue,jt,Jn,Sn,Yn,et,it,gt,qt,Dt,xn,ia,oa,aa,Nt.confirm,Nt.alert,Nt.fetch,Gt,...nr,...ot)));if(E.preserveExisting){for(let[lt,$n]of Object.entries(lr))if(!(lt in v)||v[lt]===void 0)v[lt]=$n}else Object.assign(v,lr);for(let[lt,$n]of Object.entries(re))if(!(lt in v))v[lt]=$n}catch(Ke){if(v.__stx_strict_hydration)throw Ke;let Ye=rc(Ke instanceof Error?Ke.message:String(Ke));if(sc(Ye))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ye}`),E.onFailure?.({kind:"module-resolution",message:Ye,error:Ke});else if(ic(Ke))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ye}`),E.onFailure?.({kind:"syntax",message:Ye,error:Ke});else if(oc(Ye))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: ${Ye}`),E.onFailure?.({kind:"missing-binding",message:Ye,error:Ke});else{let st=`${k??"<unknown>"}\x00${Ye}`;if(Ns.env.STX_DEBUG||!bm.has(st))bm.add(st),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: ${Ye}`);E.onFailure?.({kind:"unknown",message:Ye,error:Ke})}try{await yS(L,v,k)}catch(st){if(Ns.env.STX_DEBUG){let mt=st instanceof Error?st.message:String(st);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${mt}`)}}}}function ac(x){let v=0,k=null,E=!1,C=!1;for(let j=0;j<x.length;j++){let L=x[j];if(k){if(L===k){if(k=null,E||v===0)C=!0}continue}if(L==="'"||L==='"'||L==="`"){k=L;continue}if(L==="{")v++;else if(L==="}")v--;else if(x.startsWith("from",j)&&v===0)E=!0}return k===null&&v===0&&C}var fS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function ts(x,v){let k=v?An.dirname(v):Ns.cwd(),E=Ns.cwd(),C=x.split(`
|
|
2665
|
+
`),j=[],L=0;while(L<C.length){let B=C[L].trim();if(B.startsWith("interface ")||B.startsWith("export interface ")||B.startsWith("type ")||B.startsWith("export type ")){if(B.includes("{")&&!B.includes("}")){let z=0;for(;L<C.length;L++){for(let F of C[L])if(F==="{")z++;else if(F==="}")z--;if(z<=0)break}}L++;continue}if(B.startsWith("definePageMeta(")){let z=0,F=!1,X=L;for(let ne=L;ne<C.length&&!F;ne++){let re=null,se=!1,oe=C[ne];for(let ie=0;ie<oe.length;ie++){let ge=oe[ie];if(se){se=!1;continue}if(ge==="\\"){se=!0;continue}if(re){if(ge===re)re=null;continue}if(ge==='"'||ge==="'"||ge==="`"){re=ge;continue}if(ge==="(")z++;else if(ge===")"){if(z--,z===0){L=ne+1,F=!0;break}}}}if(!F)L=C.length;let G=C.slice(X,L).join(`
|
|
2666
|
+
`),J=[];for(let ne of["title","description"]){let re=new RegExp(`\\b${ne}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)J.push(`${ne}: ${JSON.stringify(re[2])}`)}if(J.length>0)j.push(`useSeoMeta({ ${J.join(", ")} });`);continue}if(B.startsWith("import ")||B==="import"||B.startsWith("import{")){let z=B,F=0;while(!ac(z)&&L+F+1<C.length)F++,z=`${z} ${C[L+F].trim()}`;L+=F;let X=z.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=z.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),J=z.match(/^import\s+['"](.+?)['"]/),ne=z,re=(se)=>{if(se.startsWith("."))return An.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return An.resolve(E,se.slice(2));return se};if(X){let[,se,oe]=X,ie=re(oe);j.push(`const ${se} = (await import('${ie}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,oe]=G,ie=re(oe),ge=[],ue=[],xe=uS.has(oe);for(let we of se.split(",")){let $e=we.trim();if(!$e)continue;let _e=$e.split(/\s+as\s+/);if(_e.length===2){let[Ce,Ee]=[_e[0].trim(),_e[1].trim()];if(xe&&hm.has(Ce)){j.push(`const ${Ee} = ${Ce};`);continue}ge.push(`${Ce}: ${Ee}`),ue.push(Ee)}else{if(xe&&hm.has($e))continue;ge.push($e),ue.push($e)}}if(ge.length>0)j.push(`const { ${ge.join(", ")} } = await import('${ie}')`);for(let we of ue)j.push(`module.exports.${we} = ${we};`)}else if(J){let se=re(J[1]);j.push(`await import('${se}')`)}else j.push(ne);L++;continue}if(fS.test(B))j.push(C[L]),L++;else if(B.startsWith("export const ")||B.startsWith("export let ")||B.startsWith("export var ")){let z=wm(C,L),{type:F,name:X,value:G}=z;j.push(`${F} ${X} = ${G};`),j.push(`module.exports.${X} = ${X};`),L=z.nextIndex}else if(B.startsWith("export function ")||B.startsWith("export async function ")){let z=Vl(C,L);j.push(z.functionCode),j.push(`module.exports.${z.name} = ${z.name};`),L=z.nextIndex}else if(B.startsWith("const ")||B.startsWith("let ")||B.startsWith("var ")){let z=wm(C,L),{type:F,name:X,value:G}=z;j.push(`${F} ${X} = ${G};`),j.push(`module.exports.${X} = ${X};`),L=z.nextIndex}else if(B.startsWith("function ")||B.startsWith("async function ")){let z=Vl(C,L);j.push(z.functionCode),j.push(`module.exports.${z.name} = ${z.name};`),L=z.nextIndex}else if(B.startsWith("export default function ")||B.startsWith("export default async function ")){let z=C[L].replace(/^(\s*)export\s+default\s+/,"$1"),F=[...C];F[L]=z;let X=Vl(F,L);if(j.push(X.functionCode),X.name)j.push(`module.exports.default = ${X.name};`);L=X.nextIndex}else if(B.startsWith("export default ")){let z=B.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${z};`),L++}else if(B.startsWith("class ")||B.startsWith("export class ")){let z=B.match(/(?:export\s+)?class\s+(\w+)/);if(z){let F=z[1],X=C[L].replace(/^export\s+/,""),G=0,J=L;for(;J<C.length;J++){let ne=C[J];for(let re of ne)if(re==="{")G++;else if(re==="}")G--;if(J>L)X+=`
|
|
2667
|
+
`+ne;if(G<=0&&J>=L)break}j.push(X),j.push(`module.exports.${F} = ${F};`),L=J+1}else j.push(B),L++}else if(B.includes("module.exports"))j.push(B),L++;else if(B.trim()&&!B.startsWith("//"))j.push(B),L++;else L++}return pS(j.join(`
|
|
2668
|
+
`),k,E)}function pS(x,v,k){let E=x.length,C="",j=0,L=null,B=!1,z=!1,F=0;while(j<E){let X=x[j],G=x[j+1];if(B){if(C+=X,X===`
|
|
2669
|
+
`)B=!1;j++;continue}if(z){if(C+=X,X==="*"&&G==="/"){C+=G,j+=2,z=!1;continue}j++;continue}if(!L&&X==="/"&&G==="/"){B=!0,C+=X,j++;continue}if(!L&&X==="/"&&G==="*"){z=!0,C+=X,j++;continue}if(L){if(C+=X,X==="\\"){C+=G,j+=2;continue}if(X===L&&L!=="`"){L=null,j++;continue}if(L==="`"){if(X==="$"&&G==="{"){F++,C+=G,j+=2;continue}if(X==="`"){L=null,j++;continue}}j++;continue}if(F>0){if(X==="{")F++;else if(X==="}")F--}if(X==='"'||X==="'"||X==="`"){L=X,C+=X,j++;continue}if(X==="a"&&x.startsWith("await",j)){let J=gS(x,j);if(J){let{quote:ne,path:re,end:se}=J;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let oe=re.startsWith(".")?An.resolve(v,re):An.resolve(k,re.slice(2));C+=`await import(${ne}${oe}${ne})`,j=se;continue}}}C+=X,j++}return C}function gS(x,v){let k=v+5;if(k>=x.length)return null;if(!/\s/.test(x[k]))return null;while(k<x.length&&/\s/.test(x[k]))k++;if(!x.startsWith("import",k))return null;k+=6;while(k<x.length&&/\s/.test(x[k]))k++;if(x[k]!=="(")return null;k++;while(k<x.length&&/\s/.test(x[k]))k++;let E=x[k];if(E!=="'"&&E!=='"')return null;k++;let C=k;while(k<x.length&&x[k]!==E)if(x[k]==="\\")k+=2;else k++;if(k>=x.length)return null;let j=x.slice(C,k);k++;while(k<x.length&&/\s/.test(x[k]))k++;if(x[k]!==")")return null;return{quote:E,path:j,end:k+1}}function km(x,v){let k=x[v];if(k!=="{"&&k!=="[")return null;let C=w(x,k,k==="{"?"}":"]",v);if(C===-1)return null;return{pattern:x.slice(v,C+1),endPos:C+1}}function Em(x){let v=[],k=x.slice(1,-1).trim();if(!k)return v;let E=0,C=0,j="";while(E<k.length){let L=k[E];if(L==="{"||L==="["){let B=C===0?km(k,E):null;if(B){v.push(...Em(B.pattern)),E=B.endPos,j="";continue}C++}else if(L==="}"||L==="]")C--;if(C>0){E++;continue}if(L===","){if(j.trim())v.push(j.trim());j="",E++;continue}if(L===":"){j="",E++;continue}if(L==="="){if(j.trim())v.push(j.trim());j="",E++;while(E<k.length&&k[E]!==","&&C===0){if(k[E]==="{"||k[E]==="[")C++;else if(k[E]==="}"||k[E]==="]")C--;E++}continue}if(/[\w$]/.test(L))j+=L;E++}if(j.trim())v.push(j.trim());return v}function cc(x){let v=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(x);if(!v)return null;let k=v[0].length,E=(C)=>C===" "||C==="\t";while(k<x.length&&E(x[k]))k++;if(x[k]===":"){let C=0,j=null;k++;for(;k<x.length;k++){let L=x[k];if(j){if(L==="\\"){k++;continue}if(L===j)j=null;continue}if(L==="'"||L==='"'||L==="`"){j=L;continue}if(L==="("||L==="["||L==="{"||L==="<"){C++;continue}if(L===")"||L==="]"||L==="}"||L===">"){C--;continue}if(L==="="&&C<=0){let B=x[k+1],z=x[k-1];if(B!=="="&&B!==">"&&z!=="="&&z!=="!"&&z!=="<"&&z!==">")break}}if(x[k]!=="=")return null}while(k<x.length&&E(x[k]))k++;if(x[k]!=="=")return null;return{type:v[1],name:v[2],value:x.slice(k+1).trim()}}function vm(x,v,k,E){let C=null,j=!1;for(let L of x){if(j){j=!1;continue}if(L==="\\"){j=!0;continue}if(C){if(L===C)C=null;continue}if(L==="'"||L==='"'||L==="`"){C=L;continue}if(L===v)E++;else if(L===k)E--}return E}function wm(x,v){let k=x[v].trim(),E=cc(k),C=E?[k,E.type,E.name,E.value]:null;if(!C){let X=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(X){let G=k.slice(X[0].length),J=v;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",oe=vm(G,re,se,0),ie=G;for(let ge=v+1;ge<x.length&&oe>0;ge++)ie+=` ${x[ge].trim()}`,J=ge,oe=vm(x[ge],re,se,oe);if(oe>0)ie=G,J=v;G=ie}let ne=km(G,0);if(ne){let re=X[1],se=ne.pattern,oe=G.slice(ne.endPos).trim();if(oe.startsWith("=")){let ie=oe.slice(1).trim(),ge=ie,ue=Math.max(J,v);if(Sm(ie)){let _e=$m(x,ue,ie);ge=_e.value,ue=_e.nextIndex}else ue=ue+1;ge=ge.trim().replace(/;$/,"");let xe=Em(se),we=`__stx_src_${v}`,$e=xe.map((_e)=>`module.exports.${_e} = ${_e};`).join(`
|
|
2670
|
+
`);return{type:re,name:we,value:`${ge}; ${re} ${se} = ${we};
|
|
2671
|
+
${$e}`,nextIndex:ue}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,L,B]=C,z=B,F=v;if(Sm(B)){let X=$m(x,v,B);z=X.value,F=X.nextIndex}else F=v+1;while(F<x.length){let X=x[F].trim();if(X.startsWith(".")||X.startsWith("?."))z+=`
|
|
2672
|
+
${x[F]}`,F++;else break}return z=z.trim().replace(/;$/,""),{type:j,name:L,value:z,nextIndex:F}}function Vl(x,v){let k=x[v].trim(),E=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!E)throw Error(`Failed to parse function declaration: ${k}`);let[,C]=E,j=k.replace(/^export\s+/,""),L=v;if(mS(k)){let B=hS(x,v,j);j=B.functionCode,L=B.nextIndex}else L=v+1;return{name:C,functionCode:j,nextIndex:L}}function Sm(x){let v=x.trim();if(v.startsWith("{"))return w(v,"{","}",0)===-1;if(v.startsWith("["))return w(v,"[","]",0)===-1;return!Cm(v)}function Cm(x){let v={paren:0,bracket:0,brace:0},k=null,E=0;for(let C=0;C<x.length;C++){let j=x[C];if((C>0?x[C-1]:"")==="\\"&&k)continue;if((j==='"'||j==="'")&&!k){k=j;continue}if(j===k&&k!=="`"){k=null;continue}if(j==="`"&&!k){k="`";continue}if(j==="`"&&k==="`"&&E===0){k=null;continue}if(k==="`"&&j==="$"&&x[C+1]==="{"){E++,C++;continue}if(E>0&&j==="{"){E++;continue}if(E>0&&j==="}"){E--;continue}if(k)continue;if(j==="(")v.paren++;else if(j===")")v.paren--;else if(j==="[")v.bracket++;else if(j==="]")v.bracket--;else if(j==="{")v.brace++;else if(j==="}")v.brace--}return v.paren===0&&v.bracket===0&&v.brace===0&&k===null}function Rm(x){let v=x.indexOf("(");if(v===-1)return x.indexOf("{");let k=w(x,"(",")",v);if(k===-1)return-1;return x.indexOf("{",k)}function mS(x){let v=Rm(x);if(v===-1)return!0;return w(x,"{","}",v)===-1}function $m(x,v,k){let E=k,C=v+1;while(C<x.length&&!Cm(E)){let j=x[C];E+=`
|
|
2672
2673
|
${j}`,C++}while(C<x.length){let j=x[C].trim();if(j.startsWith(".")||j.startsWith("?."))E+=`
|
|
2673
|
-
${x[C]}`,C++;else break}return{value:E,nextIndex:C}}function
|
|
2674
|
-
${L}`,C++}return{functionCode:E,nextIndex:C}}function
|
|
2675
|
-
`)C++;return!0}if(x[C]==="/"&&x[C+1]==="*"){C+=2;while(C<j-1&&!(x[C]==="*"&&x[C+1]==="/"))C++;return C+=2,!0}return!1},F=()=>{if(E!==0)return;let
|
|
2674
|
+
${x[C]}`,C++;else break}return{value:E,nextIndex:C}}function hS(x,v,k){let E=k,C=v+1;while(C<x.length){let j=Rm(E);if(j!==-1){if(w(E,"{","}",j)!==-1)break}let L=x[C];E+=`
|
|
2675
|
+
${L}`,C++}return{functionCode:E,nextIndex:C}}function _m(x,v){let k=c(x,v)??c(`(${x})`,v);if(k!==void 0)return k;if(!/\bprocess\b/.test(x))return;let E={...v,process:Object.freeze({env:{...Ns.env}})},C=Object.keys(E).filter(Je),j=C.map((L)=>E[L]);try{return Function(...C,`'use strict'; return (${x});`)(...j)}catch{try{return Function(...C,`'use strict'; return ${x};`)(...j)}catch{return}}}async function yS(x,v,k){let E=x.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let j of E){let[,,L,B]=j;try{let z=B.trim().replace(/;$/,""),F=_m(z,v);if(F!==void 0)v[L]=F}catch(z){console.warn(`Failed to parse export ${L} in fallback:`,z)}}let C=x.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let j of C){let[,,L,B]=j;if(!(L in v))try{let z=B.trim().replace(/;$/,""),F=_m(z,v);if(F!==void 0)v[L]=F}catch{}}}function Vi(x){let v=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=v?v[1]:"",E=v?x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):x;return{scriptContent:k,templateWithoutScript:E}}function Wi(x){let v=x.trim();if(!v)return!1;return/(?:const|let|var|function)\s+\w+/.test(v)}var li=new U(500),ra=new U(1000),Nm=33554432,Hl=Nm;function xS(x){let v=x.componentRenderCacheBytes;if(typeof v!=="number"||v<0||v===Hl)return;Hl=v,sa.setMaxBytes(v)}var sa=new U(2000,{maxBytes:Nm,sizeOf:(x)=>x.output.length});function bS(x){let v=new WeakSet;try{let k=(E)=>{if(E===void 0)return{__stxType:"undefined"};if(typeof E==="bigint")return{__stxType:"bigint",value:E.toString()};if(typeof E==="function"||typeof E==="symbol")throw TypeError("Non-serializable component input");if(E===null||typeof E!=="object")return E;if(v.has(E))throw TypeError("Circular component input");if(v.add(E),E instanceof Date)return{__stxType:"date",value:E.toISOString()};if(Array.isArray(E))return E.map(k);let C={};for(let j of Object.keys(E).sort())C[j]=k(E[j]);return C};return JSON.stringify(k(x))}catch{return null}}function Tm(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function hc(x){return/\bjs\b/.test(x)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(x)}function He(x){return!hc(x)}var na=new Map;function N(x){let v;try{v=JSON.stringify(x)}catch{return new Bun.Transpiler(x)}let k=na.get(v);if(k)return k;if(na.size>=16)na.clear();let E=new Bun.Transpiler(x);return na.set(v,E),E}var Am=new WeakMap,vS=256;function Ue(x){try{let v=N({loader:"ts",target:"browser",define:y()}),k=Am.get(v);if(!k)k=new Map,Am.set(v,k);let E=k.get(x);if(E!==void 0)return E;let C=x.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");C=C.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let j=[];C=C.replace(/\{!![\s\S]*?!!\}/g,(B)=>{let z=j.length;return j.push(B),`"__STX_EXPR_${z}__"`}),C=C.replace(/\{\{\{[\s\S]*?\}\}\}/g,(B)=>{let z=j.length;return j.push(B),`"__STX_EXPR_${z}__"`}),C=C.replace(/\{\{[\s\S]*?\}\}/g,(B)=>{let z=j.length;return j.push(B),`"__STX_EXPR_${z}__"`});let L=v.transformSync(C);for(let B=0;B<j.length;B++)L=L.replace(`"__STX_EXPR_${B}__"`,j[B]),L=L.replace(`'__STX_EXPR_${B}__'`,j[B]);if(k.size>=vS){let B=k.keys().next();if(!B.done)k.delete(B.value)}return k.set(x,L),L}catch(v){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",v);return x}}function wS(x){let v=[],k=new Set,E=0,C=0,j=x.length,L=(X)=>{C++;while(C<j){if(x[C]==="\\"){C+=2;continue}if(x[C]===X){C++;return}C++}},B=()=>{C++;while(C<j){if(x[C]==="\\"){C+=2;continue}if(x[C]==="`"){C++;return}if(x[C]==="$"&&x[C+1]==="{"){C+=2;let X=1;while(C<j&&X>0)if(x[C]==="{")X++,C++;else if(x[C]==="}")X--,C++;else if(x[C]==="'"||x[C]==='"')L(x[C]);else if(x[C]==="`")B();else C++;continue}C++}},z=()=>{if(x[C]==="/"&&x[C+1]==="/"){while(C<j&&x[C]!==`
|
|
2676
|
+
`)C++;return!0}if(x[C]==="/"&&x[C+1]==="*"){C+=2;while(C<j-1&&!(x[C]==="*"&&x[C+1]==="/"))C++;return C+=2,!0}return!1},F=()=>{if(E!==0)return;let X=x.slice(C).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(X){let re=X[2].split(",").map((se)=>{let oe=se.trim().split(":");return oe[oe.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))v.push(se),k.add(se);return}let G=x.slice(C).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))v.push(re),k.add(re);return}let J=x.slice(C).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))v.push(re),k.add(re);return}let ne=x.slice(C).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))v.push(re),k.add(re)}};while(C<j){if(z())continue;if(x[C]==="'"||x[C]==='"'){L(x[C]);continue}if(x[C]==="`"){B();continue}if(x[C]==="{"){E++,C++;continue}if(x[C]==="}"){E--,C++;continue}if(E===0&&/[a-z]/i.test(x[C])&&(C===0||/\s|[;{}()]/.test(x[C-1])))F();C++}return v}function SS(x){let v=[],k=0,E=0,C=null;for(let j=0;j<x.length;j++){let L=x[j];if(C){if(L==="\\"){j++;continue}if(L===C)C=null;continue}if(L==='"'||L==="'"||L==="`"){C=L;continue}if(L==="("||L==="["||L==="{")k++;else if(L===")"||L==="]"||L==="}")k--;else if(L===","&&k===0)v.push(x.slice(E,j)),E=j+1}if(E<x.length)v.push(x.slice(E));return v}function $S(x){let v=0,k=null;for(let E=0;E<x.length;E++){let C=x[E];if(k){if(C==="\\"){E++;continue}if(C===k)k=null;continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="("||C==="["||C==="{")v++;else if(C===")"||C==="]"||C==="}")v--;else if(C==="="&&v===0){let j=x[E-1],L=x[E+1];if(j==="!"||j==="<"||j===">"||j==="=")continue;if(L==="="||L===">")continue;return E}}return-1}function _S(x,v){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(x);if(!k)return;let E=k.index-1;while(E>=0&&/\s/.test(x[E]))E--;if(x[E]!=="}")return;let C=E,j=0,L=-1;for(;E>=0;E--){let z=x[E];if(z==="}")j++;else if(z==="{"){if(j--,j===0){L=E;break}}}if(L===-1)return;let B=x.slice(L+1,C);for(let z of SS(B)){let F=z.trim();if(!F||F.startsWith("..."))continue;let X=$S(F);if(X===-1)continue;let G=F.slice(0,X).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(v[G]!==void 0)continue;let J=F.slice(X+1).trim();if(!J)continue;try{let ne=Object.keys(v).filter(Je),re=Function(...ne,`"use strict"; return (${J});`);v[G]=re(...ne.map((se)=>v[se]))}catch{}}}catch{}}var kS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function yc(x,v){let k=x.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let E=k[2].toLowerCase();if(!kS.has(E))return null;if((x.match(new RegExp(`<${E}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${E}>\\s*$`,"i").test(x))return null;let j=k[0].length;return x.slice(0,j)+v+x.slice(j)}async function Hn(x,v,k,E,C){let j=x.endsWith(".stx")?x.slice(0,-4):x,L=(ie)=>ie.split("-").map((ge)=>ge.charAt(0).toUpperCase()+ge.slice(1)).join(""),B=(ie)=>ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=k.__importedComponents;if(z){for(let ie of[j,j.toLowerCase(),L(j),B(j)])if(z.has(ie))return!0}let F=[...new Set([`${j}.stx`,`${L(j)}.stx`,`${B(j)}.stx`])],X=typeof C.root==="string"?Qe.resolve(C.root):void 0,G=X??Qe.dirname(E),J=[],ne=(ie)=>{if(ie&&!J.includes(ie))J.push(ie)},re=k.__originalFilePath;if(re)ne(Qe.join(Qe.dirname(re),"components"));if(ne(v),ne(C._rootComponentsDir),ne(Qe.join(Qe.dirname(E),"components")),ne(C.componentsDir),X)ne(Qe.resolve(X,"resources/views/components")),ne(Qe.resolve(X,"resources/components")),ne(Qe.resolve(X,"src/components")),ne(Qe.resolve(X,"components"));for(let ie of C._layerComponentDirs??[])ne(ie);let se=C._pluginComponentDirs;if(Array.isArray(se))for(let ie of se)ne(typeof ie==="string"?ie:null);if(ne(C.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return n(Qe.resolve(Qe.dirname(E),`${j}.stx`));let oe=Im(Qe.resolve(import.meta.dir,"components"));for(let ie of J){let ge=Qe.isAbsolute(ie)?ie:Qe.resolve(G,ie);if(Im(ge)===oe)continue;for(let ue of F)if(await n(Qe.join(ge,ue)))return!0}return!1}function Im(x){try{return Om.realpathSync(x)}catch{return x}}function bc(x){return x==="visible"||x==="idle"||x==="interaction"||x.startsWith("media:")}function no(x){if(!x)return!1;let v=x.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(v)}function ES(x,v,k){if(!x.includes("{{")&&!x.includes("{!!"))return x;let E=(C,j)=>{let L;try{L=b(C,v)}catch{return j}if(L===void 0||L===null)return"";let B=String(L);if(/<\/style/i.test(B))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 B};return x.replace(/\{!!([\s\S]*?)!!\}/g,(C,j)=>E(j,C)).replace(/\{\{([\s\S]*?)\}\}/g,(C,j)=>E(j,C))}var Pm=new Set;function Dm(x,v,k,E){let C=`${x}\x00${v}\x00${E??""}`;if(!process.env.STX_DEBUG&&Pm.has(C))return;Pm.add(C);let j=v?` used in ${v}`:"",L=E?` Cause: ${E}.`:"",B=k.length>0?`
|
|
2676
2677
|
searched:
|
|
2677
2678
|
${k.map((z)=>` - ${z}`).join(`
|
|
2678
|
-
`)}`:"";console.error(`[stx] component <${x}> could not be resolved${j}, so it rendered as nothing.${L}${B}`)}function
|
|
2679
|
-
`)}`}if(k&&
|
|
2680
|
-
`+
|
|
2681
|
-
`),
|
|
2682
|
-
`+
|
|
2683
|
-
`+
|
|
2679
|
+
`)}`:"";console.error(`[stx] component <${x}> could not be resolved${j}, so it rendered as nothing.${L}${B}`)}function Mm(x){return`<!-- stx: component "${x.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function wc(x){let v=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 E of x){let C;while((C=k.exec(E))!==null)v.add(C[1]);k.lastIndex=0}return[...v]}async function Ve(x,v,k,E,C,j,L,B=new Set,z){let{extractVariables:F}=await ut("stx/variable-extractor",()=>import("./chunk-p7b17yr0.js")),X=B??new Set;if(X.has(x))return`[Circular component reference: ${x}]`;let G=new Set(X);G.add(x);let J=typeof v.client==="string"?v.client.trim():"";if("client"in v)delete v.client;let ne=J&&J!=="load"&&bc(J)?J:"";try{let re=(tt)=>tt.split("-").map((ot)=>ot.charAt(0).toUpperCase()+ot.slice(1)).join(""),se=(tt)=>tt.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oe=x.endsWith(".stx")?x.slice(0,-4):x,ie=null,ge=C.__importedComponents;if(ge){let tt=[oe,oe.toLowerCase(),re(oe),se(oe)];for(let ot of tt)if(ge.has(ot)){ie=ge.get(ot);break}}let ue=[];if(!ie){let tt=[`${oe}.stx`,`${re(oe)}.stx`,`${se(oe)}.stx`],ot=[...new Set(tt)],Rt=C.__originalFilePath,dt=[];if(dt.push(...L._layerComponentDirs??[]),Rt){let Wt=Qe.join(Qe.dirname(Rt),"components");dt.push(Wt)}if(E)dt.push(E);let zt=L._rootComponentsDir;if(typeof zt==="string"&&!dt.includes(zt))dt.push(zt);let Mt=Qe.join(Qe.dirname(j),"components");if(!dt.includes(Mt))dt.push(Mt);if(L.componentsDir&&L.componentsDir!==E&&!dt.includes(L.componentsDir))dt.push(L.componentsDir);let hn=typeof L.root==="string"?Qe.resolve(L.root):void 0,lr=hn??Qe.dirname(j),lt=[];if(hn)lt.push(Qe.resolve(hn,"resources/views/components")),lt.push(Qe.resolve(hn,"resources/components")),lt.push(Qe.resolve(hn,"src/components")),lt.push(Qe.resolve(hn,"components"));lt.push(Qe.resolve(import.meta.dir,"components"));for(let Wt of lt)if(!dt.includes(Wt))dt.push(Wt);let $n=L._pluginComponentDirs;if(Array.isArray($n)){for(let Wt of $n)if(typeof Wt==="string"&&!dt.includes(Wt))dt.push(Wt)}if(L.fallbackComponentsDir&&!dt.includes(L.fallbackComponentsDir))dt.push(L.fallbackComponentsDir);let Ir=[...new Set(dt.map((Wt)=>{if(!Wt)return Wt;return Qe.isAbsolute(Wt)?Wt:Qe.resolve(lr,Wt)}))];dt.length=0,dt.push(...Ir);let Pr=`${oe}\x00${j}\x00${Ir.join("\x00")}`,ca=ra.get(Pr);if(ca)if(await n(ca))ie=ca;else ra.delete(Pr);if(!ie&&(oe.startsWith("./")||oe.startsWith("../")))ie=Qe.resolve(Qe.dirname(j),`${oe}.stx`),ue.push(ie);else if(!ie)for(let Wt of dt){if(!Wt)continue;for(let fi of ot){let pi=Qe.join(Wt,fi);if(ue.push(pi),await n(pi)){ie=pi;break}}if(ie)break;if(!ie)try{let fi=await import("fs");if(!fi.statSync(Wt,{throwIfNoEntry:!1})?.isDirectory())continue;let zm=8,la=[{path:Wt,depth:0}];while(la.length>0&&!ie){let gi=la.pop();if(gi.depth>=zm)continue;let Kl;try{Kl=fi.readdirSync(gi.path,{withFileTypes:!0})}catch{continue}for(let mi of Kl){if(!mi.isDirectory())continue;if(mi.name==="node_modules"||mi.name.startsWith("."))continue;let Xl=Qe.join(gi.path,mi.name);for(let Fm of ot){let ua=Qe.join(Xl,Fm);if(ue.push(ua),await n(ua)){ie=ua;break}}if(ie)break;la.push({path:Xl,depth:gi.depth+1})}}}catch{}if(ie)break}if(ie)ra.set(Pr,ie)}if(!ie||!await n(ie))return Dm(x,j,ue),Mm(x);z.add(ie);let xe;if(li.has(ie))xe=li.get(ie);else try{xe=await Bun.file(ie).text(),li.set(ie,xe)}catch(tt){let ot=tt instanceof Error?tt.message:String(tt);return Dm(x,j,[ie],ot),Mm(x)}let we=new Set(["__originalFilePath","__importedComponents",yi,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),$e={};for(let[tt,ot]of Object.entries(C))if(!tt.startsWith("__")||we.has(tt))$e[tt]=ot;let _e=k;if(k.includes("@include")){let{processIncludes:tt}=await ut("stx/includes",()=>import("./chunk-yvq1f313.js"));_e=await tt(k,C,j,L,z)}if(/<[A-Z][\w.-]*[\s/>]/.test(_e)){let{processComponents:tt}=await ut("stx/component-renderer",()=>import("./chunk-eav0pt6d.js"));_e=await tt(_e,{...C,__processedComponents:X},j,L,z)}let Ce=[];if(no(_e)){let{processExpressions:tt}=await ut("stx/expressions",()=>import("./chunk-cvzkbsds.js")),ot=C.__stx_signals_gate===void 0?{...C,__stx_signals_gate:!0}:C;_e=tt(_e,ot,j);for(let Rt of _e.matchAll(/\{\{([\s\S]*?)\}\}/g))Ce.push(Rt[1].trim())}let Ee=bn(_e),Te=[],Re=Ee.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(tt,ot)=>{let Rt=Ee.scripts[Number(ot)]||"",dt=Rt.match(/^<script\b([^>]*)>/i)?.[1]||"",zt=dt.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Mt=!zt||["module","text/javascript","application/javascript"].includes(zt);if(!/\bserver\b/i.test(dt)&&Mt)return Te.push(Rt),"";return Rt}),{extractSlotContent:ke}=await ut("stx/slots",()=>import("./chunk-k1am0dyg.js")),Ae=ke(Re),Ze={};if(Ae.defaultSlot?.trim())Ze.default=Ae.defaultSlot;for(let[tt,ot]of Ae.namedSlots)Ze[tt]=ot.content;let Pe=C.__stx_scope_seq??={n:0,key:Bun.hash(String(C.__filename??j)).toString(36).slice(0,6)},Ie=`stx_${oe.replace(/[^a-zA-Z0-9]/g,"_")}_${++Pe.n}_${Pe.key}`,Ge={...$e,$uid:Ie,...v,props:v,slot:Re,$slots:Ze,__processedComponents:G,__sections:{},__stx_signals_gate:he(xe)||no(k),__stx_preserved_client_expressions:[...Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[],...Ce]};_S(xe,Ge);let nt=xe,at=Z(nt);if(at)nt=at.content.trim();let rt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Et=[...xe.matchAll(rt)],ft=[],_t=null,ct=Et.some((tt)=>/\bserver\b/.test(tt[1]||"")&&/\bcache\b/.test(tt[1]||"")),Pt=null,pt=null,jt=null,Jn=0,Sn=null;if(xS(L),ct&&Hl>0){let tt=bS({props:v,slot:k,buildMode:L.buildMode??"",skipEventDirectives:L.skipEventDirectives===!0,layers:L._layerGraph?.layers.map((ot)=>ot.configFile),uid:Ie});if(tt!==null){Pt=`${ie}\x00${O(xe)}\x00${tt}`;let ot=sa.get(Pt);if(ot){for(let Rt of ot.dependencies)z.add(Rt);if(cu(C,ot.clientFactories),Pe.n+=ot.uidsConsumed,ot.preservedClientExpressions.length>0){let Rt=new Set(Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[]);for(let dt of ot.preservedClientExpressions)Rt.add(dt);C.__stx_preserved_client_expressions=[...Rt]}return ot.output}pt=new Set(z),jt=ou(C),Jn=Pe.n,Sn=new Set(Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[])}}let Yn=new Set;for(let tt of Et){let ot=tt[1]||"",Rt=tt[2]||"",dt=ot.includes("server");if(He(ot)&&Rt.trim())Rt=Ue(Rt);if(dt&&Rt){for(let Mt of Q(Rt))Yn.add(Mt);try{await F(Rt,Ge,ie,{onFailure:(Mt)=>{if(Mt.kind!=="unknown")_t=Mt.kind}})}catch(Mt){}}if(!dt){let Mt=Rt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),hn=Mt.includes("{{")&&Mt.includes("}}"),lr=Mt.includes("{!!")&&Mt.includes("!!}");if(hn||lr)Mt=qr(Mt,Ge,ie);let lt=ot.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");ft.push(`<script${lt}>${Mt}</script>`)}}let it=bn(xe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),gt=it?it[1]:"",qt=it?it[2]:"",Dt="",xn=gt&&/\bscoped\b/i.test(gt);if(it)Dt=`<style${gt}>${ES(qt,Ge,ie)}</style>`;let Nt=nt;if(Nt=Nt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),it)Nt=Nt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let tt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ot=[];if(Nt=Nt.replace(tt,(Rt,dt)=>{let zt=dt.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(zt)ot.push(`<style${zt[1]}>${zt[2]}</style>`);return""}),Nt=Nt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ot.length>0)Dt=`${Dt}${ot.join(`
|
|
2680
|
+
`)}`}if(k&&Nt.includes("{{ text || slot }}"))Nt=Nt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:ia}=await ut("stx/slots",()=>import("./chunk-k1am0dyg.js")),{defaultSlot:oa,namedSlots:aa}=Ae,Ke=ft.some((tt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(tt)),Ye=(tt)=>Ke?Ng(tt,Ie):tt,st=new Map([...aa].map(([tt,ot])=>[tt,{...ot,content:Ye(ot.content)}]));Nt=await ia(Nt,Ye(oa),st,Ge);let mt=wc(ft),At=(Array.isArray(Ge.__stx_client_signal_names)?Ge.__stx_client_signal_names:[]).filter((tt)=>!Yn.has(tt));if(mt.length>0||At.length>0)Ge.__stx_client_signal_names=[...new Set([...At,...mt])];else delete Ge.__stx_client_signal_names;let Kt={...L,_rootComponentsDir:L._rootComponentsDir||L.componentsDir,componentsDir:Qe.dirname(ie),skipSignalsRuntime:!0,skipEventDirectives:Ke||ft.length===0,defaultLayout:void 0};Ge.__stxProcessingDepth=(C.__stxProcessingDepth||0)+1;let nr=await r(Nt,Ge,ie,Kt,z),di=new Set(Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[]);for(let tt of nr.matchAll(/\{\{([\s\S]*?)\}\}/g))di.add(tt[1].trim());if(di.size>0)C.__stx_preserved_client_expressions=[...di];let cr=Ie,Gt=nr;if(Ke){let tt="";if(Object.keys(v).length>0)try{tt=` data-stx-props="${Tm(JSON.stringify(v))}"`}catch{}let ot=ne?` stx-hydrate="${Tm(ne)}"`:"",Rt=` data-stx-scope="${cr}"${tt}${ot}`;Gt=yc(nr,Rt)??`<div${Rt}>${nr}</div>`;let dt=await Promise.all(ft.map(async(zt)=>{let Mt=zt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Mt)return zt;let[,hn,lr]=Mt,{vendorStyleTags:lt,factoryBody:$n}=await TS(lr,ie,L.buildMode==="compile"),Ir=ne?null:ga(C,$n),Pr=Ir?`window.__stxComponentFactories[${JSON.stringify(Ir)}](${JSON.stringify(cr)});`:`(${$n})(${JSON.stringify(cr)});`;if(ne)return`${lt}<script type="stx/island" data-stx-island="${cr}" data-stx-scoped data-stx-owner="${cr}"${hn}>${Pr}</script>`;return`${lt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${cr}"${hn}>${Pr}</script>`}));if(Gt=Gt+`
|
|
2681
|
+
`+dt.join(`
|
|
2682
|
+
`),Dt)Gt+=`
|
|
2683
|
+
`+Dt}else{if(Dt)Gt+=`
|
|
2684
|
+
`+Dt;if(ft.length>0){let tt=Ge.__stx_event_bindings||[],ot=Me(Ge),Rt=await Promise.all(ft.map(async(dt)=>{let zt=dt.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!zt)return dt;return await me(zt[1],{eventBindings:tt,templateContent:Gt,filePath:ie,projectRoot:process.cwd(),serverData:ot,instanceId:Ie})}));Gt+=`
|
|
2684
2685
|
`+Rt.join(`
|
|
2685
|
-
`),
|
|
2686
|
-
${
|
|
2687
|
-
`)}`:
|
|
2688
|
-
`),B=0;for(let z=0;z<L.length;z++)if(B+=L[z].length+1,B>=v){E=z+1,C=L[z].trim();let F=Math.max(0,z-2),
|
|
2689
|
-
`);break}}else if(k){let L=x.indexOf(k);if(L>=0)return
|
|
2690
|
-
`,Math.max(0,C-1));F=C-(G+1)+1}let
|
|
2686
|
+
`),Ge.__stx_event_bindings=[]}}if(xn){let tt=ki(Gt,ie);if(tt.hasScoped)Gt=tt.html}if(Pt&&pt){let tt=Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[];sa.set(Pt,{output:Gt,dependencies:[...z].filter((ot)=>!pt.has(ot)),clientFactories:jt?au(C,jt):[],uidsConsumed:Pe.n-Jn,preservedClientExpressions:Sn?tt.filter((ot)=>!Sn.has(ot)):[]})}if(_t)Gt=`<!--stx-render-failed:${_t}-->${Gt}`;return Te.length>0?`${Gt}
|
|
2687
|
+
${Te.join(`
|
|
2688
|
+
`)}`:Gt}catch(re){return`[Error processing component: ${re instanceof Error?re.message:String(re)}]`}finally{X.delete(x)}}async function n(x){return Bun.file(x).exists()}function ql(x,v){let k=Qe.resolve(v),E=Qe.resolve(x),C=k.endsWith(Qe.sep)?k:k+Qe.sep;if(E===k||E.startsWith(C))return E;return null}async function CS(x,v,k,E){let C=v.startsWith("layouts/")?v.slice(8):v,j=Qe.join(x,C);for(let L of j.endsWith(".stx")?[j]:[j,`${j}.stx`])if(await n(L)){if(E)console.log(`Found layout in ${x}: ${L}`);return k?.add(L),L}return null}async function Un(x,v,k,E){let C=await RS(x,v,k,E);if(C===null)return null;let j=ql(C,process.cwd());if(j)return j;let L=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((B)=>typeof B==="string"&&B.length>0);for(let B of L){let z=Qe.isAbsolute(B)?B:Qe.resolve(process.cwd(),B);if(ql(C,z))return Qe.resolve(C)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${C} (template: ${x}, from: ${v})`),null}async function RS(x,v,k,E){if(k.debug)console.log(`Resolving template path: ${x} from ${v}`);let C=Qe.dirname(v),j=process.cwd();if(x.startsWith("/")){let J=Qe.join(j,x),ne=ql(J,j);if(!ne)return console.warn(`[stx] rejected template path that escapes project root: ${x} (from ${v})`),null;if(k.debug)console.log(`Checking absolute path: ${ne}`);if(await n(ne)&&E)E.add(ne);return ne}let L=Qe.join(C,x);if(await n(L)){if(k.debug)console.log(`Found direct path: ${L}`);if(E)E.add(L);return L}if(!x.endsWith(".stx")&&!x.endsWith(".jsx")&&!x.endsWith(".tsx"))for(let J of[".stx",".tsx",".jsx"]){let ne=`${L}${J}`;if(await n(ne)){if(k.debug)console.log(`Found direct path with extension: ${ne}`);if(E)E.add(ne);return ne}}let B=[];if(B.push(...k._layerLayoutDirs??[]),k.layoutsDir)B.push(Qe.isAbsolute(k.layoutsDir)?k.layoutsDir:Qe.resolve(process.cwd(),k.layoutsDir));let z=Qe.resolve(C),F=process.cwd();for(let J=0;J<10;J++){let ne=Qe.join(z,"layouts"),re=!1;try{re=Om.statSync(ne,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){B.push(ne);break}let se=Qe.dirname(z);if(se===z||se.length<F.length)break;z=se}for(let J of B){let ne=await CS(J,x,E,k.debug);if(ne)return ne}if(k.fallbackLayoutsDir){let J=Qe.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:Qe.resolve(process.cwd(),k.fallbackLayoutsDir),ne=x.startsWith("layouts/")?x.slice(8):x,re=[Qe.join(J,ne)];if(!x.endsWith(".stx"))re.push(`${re[0]}.stx`);for(let se of re)if(await n(se)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(E)E.add(se);return se}}if(x.startsWith("layouts/")||x.includes("/layouts/")){let J=x.split("layouts/"),ne=Qe.join(k.partialsDir||C,"layouts",J[1]);if(await n(ne)){if(k.debug)console.log(`Found in layouts path: ${ne}`);if(E)E.add(ne);return ne}if(!ne.endsWith(".stx")){let re=`${ne}.stx`;if(await n(re)){if(k.debug)console.log(`Found in layouts path with extension: ${re}`);if(E)E.add(re);return re}}}if(k.partialsDir){let J=Qe.join(k.partialsDir,"layouts");if(await n(J)){let ne=Qe.join(J,x);if(await n(ne)){if(k.debug)console.log(`Found in partials layouts dir: ${ne}`);if(E)E.add(ne);return ne}if(!x.endsWith(".stx")){let re=`${ne}.stx`;if(await n(re)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${re}`);if(E)E.add(re);return re}}}}let X=k.partialsDir||Qe.join(process.cwd(),"views"),G=Qe.join(X,x);if(await n(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(E)E.add(G);return G}if(!x.endsWith(".stx")){let J=`${G}.stx`;if(await n(J)){if(k.debug)console.log(`Found in views path with extension: ${J}`);if(E)E.add(J);return J}}if(C.includes("temp")){let J=Qe.join(Qe.dirname(C),"layouts",x);if(await n(J)){if(k.debug)console.log(`Found in temp layouts dir: ${J}`);if(E)E.add(J);return J}if(!x.endsWith(".stx")){let ne=`${J}.stx`;if(await n(ne)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ne}`);if(E)E.add(ne);return ne}}}if(k.debug)console.warn(`Template not found after trying all paths: ${x} (referenced from ${v})`);else console.warn(`Template not found: ${x} (referenced from ${v})`);return null}function ro(x,v,k){let E=0,C="",j="";try{if(typeof v==="number"&&v>=0){let L=x.split(`
|
|
2689
|
+
`),B=0;for(let z=0;z<L.length;z++)if(B+=L[z].length+1,B>=v){E=z+1,C=L[z].trim();let F=Math.max(0,z-2),X=Math.min(L.length,z+3);j=L.slice(F,X).map((G,J)=>{let ne=F+J+1;return`${ne===E?"> ":" "}${ne}: ${G}`}).join(`
|
|
2690
|
+
`);break}}else if(k){let L=x.indexOf(k);if(L>=0)return ro(x,L)}}catch{}return{lineNumber:E,lineContent:C,context:j}}var ht={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(x,v,k,E,C,j){let{lineNumber:L,context:B}=ro(E,C,j),z=k.split("/").pop(),F=0;if(typeof C==="number"&&C>=0&&E){let G=E.lastIndexOf(`
|
|
2691
|
+
`,Math.max(0,C-1));F=C-(G+1)+1}let X="";if(L>0)X+=`
|
|
2691
2692
|
${k}:${L}${F>0?`:${F}`:""}: ${x.toLowerCase()} error: ${v}
|
|
2692
|
-
`;if(
|
|
2693
|
-
${
|
|
2694
|
-
`,
|
|
2695
|
-
`,
|
|
2696
|
-
`,
|
|
2697
|
-
${
|
|
2698
|
-
${
|
|
2699
|
-
`,B)
|
|
2700
|
-
${
|
|
2701
|
-
${
|
|
2702
|
-
`;return
|
|
2703
|
-
${
|
|
2693
|
+
`;if(X+=`
|
|
2694
|
+
${ht.bold}${ht.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${ht.reset}
|
|
2695
|
+
`,X+=`${ht.bold}${ht.red}\u2502${ht.reset} ${ht.bold}${ht.bgRed} ERROR ${ht.reset} ${ht.red}${x} Error${ht.reset}${" ".repeat(Math.max(0,43-x.length))}${ht.bold}${ht.red}\u2502${ht.reset}
|
|
2696
|
+
`,X+=`${ht.bold}${ht.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${ht.reset}
|
|
2697
|
+
`,X+=`
|
|
2698
|
+
${ht.cyan}${ht.bold}File:${ht.reset} ${ht.dim}${z}${ht.reset}`,L>0)X+=` ${ht.gray}(line ${L}${F>0?`, col ${F}`:""})${ht.reset}`;if(X+=`
|
|
2699
|
+
${ht.yellow}${ht.bold}Message:${ht.reset} ${v}
|
|
2700
|
+
`,B)X+=`
|
|
2701
|
+
${ht.blue}${ht.bold}Context:${ht.reset}
|
|
2702
|
+
${ht.dim}${B}${ht.reset}
|
|
2703
|
+
`;return X}function ee(){li.clear(),ra.clear(),sa.clear()}function Ou(){return{size:li.size,maxSize:500}}var Ul=I(128);async function TS(x,v,k){let E=O(x,v,k),C=Ul.get(E);if(C){if(Jt(C.deps))return C;Ul.delete(E)}let j=Hr(x,{filePath:v,projectRoot:process.cwd()}),L=j.code,B=Ur(j.styles);L=yt(L).code;let{hasUserImports:z,bundleClientScript:F}=await ut("stx/client-script-bundler",()=>import("./chunk-bvbank3z.js")),X=[],G=!1;if(z(L)){let ie=L;L=await F(ie,v,{projectRoot:process.cwd(),minify:k,collectInputs:X}),G=L===ie}let{stripStxRuntimeImports:J}=await ut("stx/signal-processing",()=>import("./chunk-5eqd40k0.js"));L=J(L);let ne=R(L),re=wS(ne),se=`function(__scopeId) {
|
|
2704
|
+
${Tt("const",[...ho,...re],ne)}
|
|
2704
2705
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2705
2706
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
2706
2707
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -2728,18 +2729,18 @@ catch (e) {}
|
|
|
2728
2729
|
finally {
|
|
2729
2730
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2730
2731
|
}
|
|
2731
|
-
}`,oe={vendorStyleTags:B,factoryBody:se,deps:
|
|
2732
|
+
}`,oe={vendorStyleTags:B,factoryBody:se,deps:Gu([...X,...j.styles.map((ie)=>ie.resolvedPath)])};if(!G&&j.unresolved.length===0)Ul.set(E,oe);return oe}var AS=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function IS(x){if(x.startsWith(".")||x.startsWith("/"))return null;if(x.startsWith("@")){let k=x.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let v=x.match(/^([^/]+)(\/.*)?$/);if(!v)return null;return{pkg:v[1],subpath:v[2]||""}}function PS(x,v){let k=v;while(!0){let E=Ar.join(k,"node_modules",x,"package.json");if(ui.existsSync(E))return Ar.dirname(E);let C=Ar.dirname(k);if(C===k)return null;k=C}}function DS(x,v){if(!x||typeof x!=="object")return null;let k=(C)=>{if(typeof C==="string")return C;if(C&&typeof C==="object"){if(typeof C.import==="string")return C.import;if(typeof C.default==="string")return C.default;if(typeof C.import==="object")return k(C.import);if(typeof C.default==="object")return k(C.default)}return null};if(Object.prototype.hasOwnProperty.call(x,v))return k(x[v]);let E=null;for(let C of Object.keys(x)){let j=C.indexOf("*");if(j===-1)continue;let L=C.slice(0,j),B=C.slice(j+1);if(!v.startsWith(L)||!v.endsWith(B))continue;if(v.length<L.length+B.length)continue;if(!E||L.length>E.prefix.length)E={pattern:C,prefix:L,suffix:B}}if(E){let C=v.slice(E.prefix.length,v.length-E.suffix.length),j=k(x[E.pattern]);if(j)return j.replace("*",C)}return null}function MS(x,v){let k=IS(x);if(!k||!k.subpath)return null;let E=PS(k.pkg,v);if(!E)return null;let C;try{C=JSON.parse(ui.readFileSync(Ar.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,L=DS(C.exports,j);if(!L)return null;let B=Ar.resolve(E,L);return ui.existsSync(B)?B:null}function Hr(x,v){let k=v.filePath?Ar.dirname(v.filePath):v.projectRoot||process.cwd(),E=v.projectRoot||process.cwd(),C=new Set,j=[],L=[];return{code:x.replace(AS,(z,F)=>{let X;try{if(F.startsWith("./")||F.startsWith("../")||F.startsWith("/")){if(X=F.startsWith("/")?F:Ar.resolve(k,F),!ui.existsSync(X))throw Error(`file not found: ${X}`)}else{let G=null;try{G=Bun.resolveSync(F,E)}catch{G=MS(F,E)}if(!G)throw Error(`could not resolve ${F} (Bun.resolveSync + exports fallback both failed)`);X=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(F)} (from ${v.filePath||"<unknown>"}): ${G?.message||G}`),L.push(F),""}if(C.has(X))return"";C.add(X);try{let G=ui.readFileSync(X,"utf8");j.push({source:F,resolvedPath:X,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${X}: ${G?.message||G}`),L.push(F)}return""}),styles:j,unresolved:L}}function OS(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ur(x){if(x.length===0)return"";return`${x.map((v)=>`<style data-stx-vendor="${OS(v.source)}" data-stx-layer="vendor">
|
|
2732
2733
|
@layer vendor {
|
|
2733
2734
|
${v.contents}
|
|
2734
2735
|
}
|
|
2735
2736
|
</style>`).join(`
|
|
2736
2737
|
`)}
|
|
2737
|
-
`}var
|
|
2738
|
+
`}var Na=m;function yt(x){let v=s(x),k=new Set;for(let B of x.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of B[1].split(",")){let F=z.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(F)k.add(F)}let E=new Set;for(let B of v.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))E.add(B[1]);for(let B of v.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let z of B[1].split(",")){let F=z.trim().split(/[:=]/).pop()?.trim();if(F)E.add(F)}let C=H.filter((B)=>{if(k.has(B)||E.has(B))return!1;return Pi(v,B,!0)}),j=Bm(v).filter((B)=>!k.has(B)&&!E.has(B));if(C.length===0&&j.length===0)return{code:x,imports:C,models:j};return{code:`${[C.length>0?`import { ${C.join(", ")} } from '@stacksjs/browser'`:"",j.length>0?"import '@stacksjs/browser'":"",j.length>0?`const { ${j.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2738
2739
|
`)}
|
|
2739
|
-
${x}`,imports:C,models:j}}var
|
|
2740
|
+
${x}`,imports:C,models:j}}var NS=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 Bm(x){let v=new Set,k=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,E;while((E=k.exec(x))!==null)if(!NS.has(E[1]))v.add(E[1]);return Array.from(v)}function jS(x){let v=new Set;for(let k of x.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))v.add(k[1]);for(let k of x.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let E of k[1].split(",")){let C=E.trim().split(/[:=]/).pop()?.trim();if(C&&/^[A-Za-z_$][\w$]*$/.test(C))v.add(C)}return v}function Ai(x){let v=new Set,k=new Set,E=x;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let C=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,L;while((L=j.exec(x))!==null){let G=L[1],J=L[2];if(L[0].includes("import type"))continue;let ne=[];for(let se of G.split(",")){let oe=se.trim();if(!oe||oe.startsWith("type "))continue;let ie=oe.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ie)continue;let ge=ie[1],ue=ie[2]||ge;if(C.add(ge),C.add(ue),J==="stx"||J==="@stacksjs/stx")v.add(ge);else k.add(ge);if(ue!==ge)ne.push(`${ue} = ${ge}`)}let re=ne.length>0?`var ${ne.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(L[0],re)}let B=jS(E);for(let G of Na){if(C.has(G)||B.has(G))continue;if(new RegExp(`\\b${G}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(E))v.add(G)}let z=s(E),F=new Set;for(let G of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of G[1].split(",")){let ne=J.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of ne){let se=re.trim();if(se)F.add(se)}}for(let G of H){if(C.has(G)||B.has(G)||F.has(G))continue;if(Pi(z,G))k.add(G)}let X=Bm(E);for(let G of X)if(!C.has(G)&&!B.has(G))k.add(G);return{code:E,stxImports:Array.from(v),browserImports:Array.from(k)}}function Pi(x,v,k=!1){let E=new RegExp(`\\b${v.replace(/[$]/g,"\\$")}\\b`,"g");for(let C of x.matchAll(E)){let j=C.index??0,L=j+v.length,B=j-1;while(B>=0&&/\s/.test(x[B]))B--;if(x[B]==="."&&x.slice(Math.max(0,B-2),B+1)!=="...")continue;let z=L;while(z<x.length&&/\s/.test(x[z]))z++;if(x[z]===":"&&x[z+1]!==":"&&(x[B]==="{"||x[B]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(x.slice(L)))continue;return!0}return!1}function Ii(x,v){let k=[];if(x.length>0)k.push(` var { ${x.join(", ")} } = window.stx || window;`);if(v.length>0)k.push(` var { ${v.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
2740
2741
|
${k.join(`
|
|
2741
2742
|
`)}
|
|
2742
|
-
${
|
|
2743
|
+
${LS(x,v)}`;return""}function fu(x,v=[]){let{browserImports:k}=Ai(x),E=new Set(v);return Ii([],k.filter((C)=>!E.has(C)))}function LS(x,v){let k=[...x.map((E)=>`['${E}', typeof ${E}, 'stx']`),...v.map((E)=>`['${E}', typeof ${E}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
2743
2744
|
[${k.join(", ")}].forEach(function (e) {
|
|
2744
2745
|
if (e[1] !== 'undefined') return;
|
|
2745
2746
|
console.error(
|
|
@@ -2748,15 +2749,15 @@ ${MS(x,v)}`;return""}function uu(x,v=[]){let{browserImports:k}=Ti(x),E=new Set(v
|
|
|
2748
2749
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2749
2750
|
);
|
|
2750
2751
|
});
|
|
2751
|
-
`}function
|
|
2752
|
+
`}function Me(x){let v=x.__stxClientPayload;if(v&&typeof v==="object"){let E={};for(let C in v){let j=v[C];if(typeof j==="function")continue;E[C]=j}return E.__stxDeclaredPayload=!0,E}let k={};for(let E in x){if(E.startsWith("__")||E.startsWith("$"))continue;let C=x[E];if(typeof C==="function")continue;k[E]=C}return k}function BS(x,v){return new RegExp(`(?<![.#\\w$])${v}(?![\\w$])`).test(x)}var zS=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,jm=new Set;function FS(x,v){let k=zS.test(x),E=v.length>32768;if(!k&&!E)return;if(jm.has(x))return;if(jm.add(x),k)console.warn(`[stx] server\u2192client bridge is publishing "${x}" 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(E)console.warn(`[stx] server\u2192client bridge is publishing ${(v.length/1024).toFixed(1)}KB under "${x}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function Vr(x,v){if(!v)return"";let k=s(x),E=v.__stxDeclaredPayload===!0,C=[];for(let[j,L]of Object.entries(v)){if(!/^[A-Za-z_$][\w$]*$/.test(j))continue;if(j.startsWith("__")||j.startsWith("$"))continue;if(!E&&!BS(k,j))continue;if(hi(x,j)){if(E)console.warn(`[stx] defineClientPayload declares "${j}", but this client block also declares "${j}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${j}" from defineClientPayload.`);continue}let B;try{B=JSON.stringify(L)}catch{continue}if(B===void 0)continue;FS(j,B),C.push(` var ${j} = ${B.replace(/</g,"\\u003c")};`)}if(C.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2752
2753
|
${C.join(`
|
|
2753
2754
|
`)}
|
|
2754
|
-
`}var
|
|
2755
|
+
`}var WS={left:0,middle:1,right:2};function VS(x){let v=[];if(x.self)v.push("if ($event.target !== $el) return");for(let k of x.systemKeys)v.push(`if (!$event.${k}Key) return`);if(x.keys.length>0){let k=x.keys.map((E)=>`$event.key === '${E}'`).join(" || ");v.push(`if (!(${k})) return`)}if(x.mouse!==null){let k=WS[x.mouse];v.push(`if ($event.button !== ${k}) return`)}if(x.prevent)v.push("$event.preventDefault()");if(x.stop)v.push("$event.stopPropagation()");return v.join("; ")}function US(x,v){let{elementId:k,event:E,modifiers:C}=x,j=fa(x.handler),L=VS(C),B=[];if(C.once)B.push("once: true");if(C.capture)B.push("capture: true");if(da(E,C))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",F="";if(L)F+=`${L}; `;let X=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
|
|
2755
2756
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2756
2757
|
};`;function J(ne){if(/\$emit\s*\(/.test(ne))return`${G}
|
|
2757
2758
|
${ne}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
2758
2759
|
if (scope && scope.__stx_execute) {
|
|
2759
|
-
scope.__stx_execute('${
|
|
2760
|
+
scope.__stx_execute('${X}', $event, $el);
|
|
2760
2761
|
}
|
|
2761
2762
|
else {
|
|
2762
2763
|
${ne}
|
|
@@ -2789,28 +2790,28 @@ else {
|
|
|
2789
2790
|
if ($el) $el.addEventListener('${E}', function($event) {
|
|
2790
2791
|
${F}var scope = $el.closest('[data-stx-scope]');
|
|
2791
2792
|
if (scope && scope.__stx_execute) {
|
|
2792
|
-
scope.__stx_execute('${
|
|
2793
|
+
scope.__stx_execute('${X}', $event, $el);
|
|
2793
2794
|
}
|
|
2794
2795
|
else {
|
|
2795
2796
|
${j}
|
|
2796
2797
|
}
|
|
2797
|
-
}${z})`}function
|
|
2798
|
+
}${z})`}function HS(x){if(x.length===0)return"";return`
|
|
2798
2799
|
// STX: auto-generated event bindings
|
|
2799
|
-
${x.map((k,E)=>
|
|
2800
|
-
`)}`}function
|
|
2801
|
-
`)L++;continue}if(B==="/"&&E[L+1]==="*"){L+=2;while(L<j-1&&!(E[L]==="*"&&E[L+1]==="/"))L++;L+=2;continue}if(B==="{"){C++,L++;continue}if(B==="}"){C--,L++;continue}if(C===0){let z=E.slice(L),F=z.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(F){let J=F[1];if(!J.startsWith("_")&&!k.has(J))v.push(J),k.add(J);L+=F[0].length;continue}let
|
|
2802
|
-
${
|
|
2800
|
+
${x.map((k,E)=>US(k,E)).join(`
|
|
2801
|
+
`)}`}function Lm(x){let v=[],k=new Set,E=x.replace(/^\s*import\s+.*$/gm,""),C=0,j=E.length,L=0;while(L<j){let B=E[L];if(B==="'"||B==='"'||B==="`"){let z=B;if(L++,z==="`"){let F=0;while(L<j){if(E[L]==="\\"){L+=2;continue}if(E[L]==="`"&&F===0){L++;break}if(E[L]==="$"&&E[L+1]==="{"){F++,L+=2;continue}if(E[L]==="}"&&F>0){F--,L++;continue}L++}}else while(L<j){if(E[L]==="\\"){L+=2;continue}if(E[L]===z){L++;break}L++}continue}if(B==="/"&&E[L+1]==="/"){while(L<j&&E[L]!==`
|
|
2802
|
+
`)L++;continue}if(B==="/"&&E[L+1]==="*"){L+=2;while(L<j-1&&!(E[L]==="*"&&E[L+1]==="/"))L++;L+=2;continue}if(B==="{"){C++,L++;continue}if(B==="}"){C--,L++;continue}if(C===0){let z=E.slice(L),F=z.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(F){let J=F[1];if(!J.startsWith("_")&&!k.has(J))v.push(J),k.add(J);L+=F[0].length;continue}let X=z.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(X){X[1].split(",").forEach((J)=>{let ne=J.trim(),re=ne.indexOf(":"),se=re>=0?ne.slice(re+1).trim().split(/[\s=]/)[0]:ne.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))v.push(se),k.add(se)}),L+=X[0].length;continue}let G=z.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let J=G[1];if(!J.startsWith("_")&&!k.has(J))v.push(J),k.add(J);L+=G[0].length;continue}}L++}return v}var qS=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 KS(x){let v=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(J){let ne;while((ne=k.exec(J))!==null){let re=ne[0];if(!qS.has(re))v.add(re)}}let C=/\{\{([\s\S]*?)\}\}/g,j;while((j=C.exec(x))!==null)E(j[1]);let L=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=L.exec(x))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=B.exec(x))!==null)E(j[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=z.exec(x))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=F.exec(x))!==null)E(j[1]);let X=/@model\s*=\s*["']([^"']*)["']/gi;while((j=X.exec(x))!==null)E(j[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=G.exec(x))!==null)E(j[1]);return v}async function me(x,v={}){let k=x,E="",C=!1,j=[],L=Hr(k,{filePath:v.filePath,projectRoot:v.projectRoot});k=L.code;let B=Ur(L.styles),z=yt(k);k=z.code,j=[...z.imports,...z.models];let{hasUserImports:F,bundleClientScript:X}=await ut("stx/client-script-bundler",()=>import("./chunk-bvbank3z.js"));if(F(k))k=await X(k,v.filePath||"",{projectRoot:v.projectRoot,minify:v.production}),C=!0;if(v.autoImports!==!1){let ue=Ai(k);k=ue.code,E=Ii(ue.stxImports,ue.browserImports.filter((xe)=>!j.includes(xe)))}if(E=`${Vr(k,v.serverData)}${E}`,k=R(k),!C&&He(v.attrs||""))k=Ue(k);let G=HS(v.eventBindings||[]),J=(v.attrs||"").trim(),ne=/\btype\s*=\s*["']module["']/i.test(J),re=v.instanceId?` data-stx-instance="${v.instanceId}"`:"";if(ne){let ue=J.replace(/\btype\s*=\s*["']module["']/i,"").trim(),xe=`type="module" data-stx-scoped${re}${ue?` ${ue}`:""}`;return`${B}<script ${xe}>
|
|
2803
|
+
${Ms(`${E}${k}
|
|
2803
2804
|
${G}`)}
|
|
2804
|
-
</script>`}let se=
|
|
2805
|
+
</script>`}let se=Ts(x),oe=/function __stx_setup_/.test(k),ie=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(x);function ge(ue){let xe=ue.length>0?`
|
|
2805
2806
|
return { ${ue.join(", ")} };`:"";return`${B}<script data-stx-scoped data-stx-run="always"${re}>
|
|
2806
2807
|
window.stx.mount(function() {
|
|
2807
2808
|
'use strict';
|
|
2808
|
-
${
|
|
2809
|
-
${G}${
|
|
2810
|
-
})</script>`}if(!ie&&!oe){if(se)return
|
|
2809
|
+
${Ms(`${E}${k}
|
|
2810
|
+
${G}${xe}`)}
|
|
2811
|
+
})</script>`}if(!ie&&!oe){if(se)return ge(Lm(x));if(v.templateContent){let ue=Lm(x);if(ue.length>0){let xe=KS(v.templateContent);if(ue.some(($e)=>xe.has($e)))return ge(ue)}}}return`${B}<script data-stx-scoped data-stx-run="always"${re}>
|
|
2811
2812
|
;(function() {
|
|
2812
2813
|
'use strict';
|
|
2813
|
-
${
|
|
2814
|
+
${Ms(`${E}${k}
|
|
2814
2815
|
${G}`)}
|
|
2815
2816
|
})()</script>`}
|
|
2816
|
-
export{
|
|
2817
|
+
export{Pn,De,H,y,Oe,U,V,I,O,Jt,Hr,Ur,Na,yt,Ai,Pi,Ii,fu,Me,Vr,me,Di,Oi,Mi,Wr,Y,Ne,In,La,gu,ja,mu,Ba,Dn,h,bt,he,Fa,qr,za,hu,W,Ha,yu,b,bu,Ua,wu,vu,xu,Su,Va,Wa,ku,Cu,Ni,$u,Yt,Zt,On,e,Eu,Li,Tu,ji,qa,Ka,wt,Qt,_u,Xa,Ga,Ja,f,Le,vt,je,Be,Bi,Mn,Z,Kr,Xr,Gr,Ru,Nn,Au,en,Ya,Jr,M,ae,q,Pu,Za,Yr,Zr,Fi,zi,Qr,es,Qa,ec,Hi,Ui,tc,Fe,tn,Ln,xt,nc,rc,sc,ic,oc,d,ac,ts,cc,Vi,Wi,St,ns,qi,lc,Iu,ye,Ki,Du,rs,ss,is,jn,Xi,os,Bn,nn,Fn,as,cs,ls,r,ze,us,ds,uc,Q,Gi,Ji,Yi,Zi,zn,ps,Qi,eo,to,dc,pc,fc,gc,mc,hc,He,N,Ue,yc,Hn,bc,no,wc,Ve,n,Un,ro,g,ee,Ou,Vn,A,vc,i,T,Mu,Nu,ce};
|