@stacksjs/stx 0.2.416 → 0.2.417
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-072f6hnz.js +2 -0
- package/dist/{chunk-a47yp92z.js → chunk-072mzamc.js} +5 -5
- package/dist/{chunk-dd5fa7d6.js → chunk-08p07eq7.js} +2 -2
- package/dist/chunk-0x076wz1.js +2 -0
- package/dist/{chunk-zyxp0nb3.js → chunk-0xgf3xgy.js} +16 -16
- package/dist/chunk-1680nbq4.js +2816 -0
- package/dist/{chunk-7tabykst.js → chunk-25n4gmek.js} +2 -2
- package/dist/chunk-2gfj59pt.js +2 -0
- package/dist/chunk-2gntnw7e.js +2 -0
- package/dist/chunk-2hvvwhmv.js +2 -0
- package/dist/{chunk-rfdqrv5v.js → chunk-31a8eh0j.js} +4 -4
- package/dist/{chunk-vvs75dse.js → chunk-3aqe7wy7.js} +2 -2
- package/dist/{chunk-x0mq57pe.js → chunk-3f5td68v.js} +2 -2
- package/dist/chunk-3senpdjt.js +3 -0
- package/dist/{chunk-jr4dwkvc.js → chunk-3wmxb126.js} +2 -2
- package/dist/{chunk-znbay168.js → chunk-47h689h6.js} +2 -2
- package/dist/chunk-4bhertga.js +2 -0
- package/dist/chunk-4s9dypby.js +2 -0
- package/dist/{chunk-rqc4jx2v.js → chunk-5f3k2mke.js} +1 -1
- package/dist/{chunk-nj8edn4m.js → chunk-5fwy3xap.js} +3 -3
- package/dist/{chunk-zcctf7tx.js → chunk-5vzamjf6.js} +4 -4
- package/dist/chunk-5z56g0n4.js +2 -0
- package/dist/chunk-68rq2fqt.js +12 -0
- package/dist/chunk-6ad0nseq.js +2 -0
- package/dist/{chunk-rhw7pqhy.js → chunk-76japd6k.js} +4 -4
- package/dist/chunk-7eazcxzf.js +2 -0
- package/dist/chunk-7hy29tcy.js +2 -0
- package/dist/{chunk-gxrewzhv.js → chunk-7q1yy18q.js} +2 -2
- package/dist/{chunk-rp4khnan.js → chunk-85bm5xrm.js} +3 -3
- package/dist/{chunk-bfjzfrw3.js → chunk-865xvpp2.js} +2 -2
- package/dist/chunk-8fyqbq14.js +2 -0
- package/dist/chunk-92xzpt6p.js +2 -0
- package/dist/{chunk-sh5c60a2.js → chunk-94ky725r.js} +2 -2
- package/dist/{chunk-89xcpdsp.js → chunk-9af8qbwb.js} +5 -5
- package/dist/{chunk-m9xdkzm6.js → chunk-9bq4w4d6.js} +3 -3
- package/dist/chunk-9kmmafp4.js +2 -0
- package/dist/{chunk-gq97zh73.js → chunk-9r5ycpdg.js} +3 -3
- package/dist/{chunk-fctjn68q.js → chunk-9yt899e7.js} +6 -6
- package/dist/chunk-atgwc7r7.js +2 -0
- package/dist/{chunk-a688m6js.js → chunk-ayd5r3se.js} +2 -2
- package/dist/{chunk-yzv8n6qw.js → chunk-bk5ndwv3.js} +2 -2
- package/dist/chunk-bs6y5wy2.js +2 -0
- package/dist/{chunk-j8rxdbe5.js → chunk-bt11a8z4.js} +3 -3
- package/dist/{chunk-fkhxz1dx.js → chunk-c8p4v1rd.js} +5 -5
- package/dist/chunk-ccg6xjr1.js +2 -0
- package/dist/chunk-ckv4aty5.js +2 -0
- package/dist/{chunk-1ctvgd7v.js → chunk-d0ynfema.js} +1 -1
- package/dist/chunk-d6h9rpm4.js +30 -0
- package/dist/chunk-dbh7h0kt.js +2 -0
- package/dist/chunk-dhqkg0ph.js +2 -0
- package/dist/{chunk-6agy2x1f.js → chunk-dw961rvn.js} +2 -2
- package/dist/{chunk-h8wegkb5.js → chunk-dym1eteb.js} +1 -1
- package/dist/{chunk-41k0th97.js → chunk-e2m674vf.js} +4 -4
- package/dist/{chunk-9t2xx2y4.js → chunk-e83j8xe9.js} +4 -4
- package/dist/chunk-ettat5ah.js +2 -0
- package/dist/{chunk-cn9hgyh5.js → chunk-ev8bhsc0.js} +2 -2
- package/dist/chunk-f4ws0qcd.js +2 -0
- package/dist/chunk-f97v10zr.js +2 -0
- package/dist/chunk-fe5st320.js +2 -0
- package/dist/chunk-fet3hce8.js +2 -0
- package/dist/chunk-fq7128p1.js +2 -0
- package/dist/{chunk-y5cqkmkf.js → chunk-fr8jq2ys.js} +2 -2
- package/dist/chunk-fwy2h1ms.js +2 -0
- package/dist/{chunk-ddk6fx5b.js → chunk-fxhvkenf.js} +2 -2
- package/dist/{chunk-v096a6fw.js → chunk-g947brd0.js} +6 -6
- package/dist/{chunk-wjag92ch.js → chunk-gfm7g98y.js} +85 -85
- package/dist/chunk-gtkhykc4.js +2 -0
- package/dist/{chunk-vvp4cmfq.js → chunk-h8f18cc5.js} +6 -6
- package/dist/chunk-h8pkm7c5.js +2 -0
- package/dist/{chunk-yt6h8c6g.js → chunk-hg3tyzn5.js} +11 -11
- package/dist/{chunk-std6xw3y.js → chunk-hkxxfzfd.js} +2 -2
- package/dist/{chunk-3wrmz1j9.js → chunk-hm2k9a04.js} +7 -7
- package/dist/chunk-hneg0155.js +2 -0
- package/dist/chunk-hs90en70.js +2 -0
- package/dist/{chunk-n5k88y07.js → chunk-jfjym18d.js} +5 -5
- package/dist/chunk-jgsgd6rt.js +17 -0
- package/dist/chunk-jn3njpxs.js +2 -0
- package/dist/chunk-ka8x4sw6.js +18 -0
- package/dist/{chunk-9rnh52t2.js → chunk-kds79hq3.js} +11 -11
- package/dist/{chunk-rg6csnkw.js → chunk-kkj5x9rp.js} +1 -1
- package/dist/chunk-mcqn70v8.js +3 -0
- package/dist/chunk-mcs7p3fy.js +2 -0
- package/dist/{chunk-wpe72ann.js → chunk-mj6fme15.js} +5 -5
- package/dist/{chunk-yk63jd7v.js → chunk-mj9yv1vb.js} +1 -1
- package/dist/chunk-mmtg0jxd.js +2 -0
- package/dist/chunk-mrsxwd0h.js +2 -0
- package/dist/chunk-mscky0ww.js +2 -0
- package/dist/chunk-mtphm33a.js +2 -0
- package/dist/chunk-p2jbc71s.js +2 -0
- package/dist/{chunk-p1tb8kxq.js → chunk-pb0fgdvn.js} +4 -4
- package/dist/{chunk-at0ar6t3.js → chunk-psmdbcbc.js} +4 -4
- package/dist/chunk-pvd9k3kx.js +2 -0
- package/dist/chunk-pz1jc3db.js +2 -0
- package/dist/chunk-q8swb7na.js +4 -0
- package/dist/{chunk-7mbpjv9e.js → chunk-qmzwhtr2.js} +2 -2
- package/dist/chunk-qvr6e2ve.js +3 -0
- package/dist/chunk-ra0pkkvd.js +2 -0
- package/dist/chunk-rcbtd4w3.js +2 -0
- package/dist/chunk-rd2r9jvn.js +2 -0
- package/dist/chunk-s8srb8bg.js +2 -0
- package/dist/{chunk-3t0yaexe.js → chunk-sjjc670z.js} +9 -9
- package/dist/chunk-snf2b68p.js +2 -0
- package/dist/chunk-t2bfwr9v.js +2 -0
- package/dist/chunk-tbmwdahm.js +2 -0
- package/dist/{chunk-388rx71h.js → chunk-v15g9jjh.js} +6 -6
- package/dist/{chunk-de2pv6ys.js → chunk-vdqa5gt7.js} +2 -2
- package/dist/{chunk-rv5bk83t.js → chunk-vepc9rbt.js} +2 -2
- package/dist/{chunk-0es4h5v1.js → chunk-vfdwvt23.js} +2 -2
- package/dist/chunk-vpv896zx.js +2 -0
- package/dist/{chunk-3g8zzdgs.js → chunk-vyfg2qd2.js} +5 -5
- package/dist/{chunk-tfhjbjq5.js → chunk-w5zmvn7b.js} +3 -3
- package/dist/chunk-w6h63b48.js +2 -0
- package/dist/{chunk-cq408jrm.js → chunk-wgzxmh7w.js} +3 -3
- package/dist/{chunk-ppse812s.js → chunk-wpkxbggq.js} +1 -1
- package/dist/chunk-wrk3gkgg.js +2 -0
- package/dist/chunk-wtd71jsa.js +2 -0
- package/dist/{chunk-c4bkj1xw.js → chunk-wweasgq9.js} +18 -18
- package/dist/chunk-wymf1ek6.js +2 -0
- package/dist/chunk-wz8hyh8h.js +4 -0
- package/dist/chunk-x32wpjs0.js +2 -0
- package/dist/chunk-x4q2eyt0.js +2 -0
- package/dist/chunk-x95ejws0.js +2 -0
- package/dist/chunk-xket8ejt.js +2 -0
- package/dist/{chunk-t9axxwy9.js → chunk-xt6d3zws.js} +4 -4
- package/dist/{chunk-qff4qkx5.js → chunk-xvn3sv3v.js} +3 -3
- package/dist/{chunk-tfexmdkt.js → chunk-xwkdv585.js} +2 -2
- package/dist/{chunk-ae7j3n39.js → chunk-y9t55tv7.js} +6 -6
- package/dist/chunk-ypfzy1mq.js +2 -0
- package/dist/{chunk-7zjvsacw.js → chunk-yrbzsrde.js} +2 -2
- package/dist/chunk-zg68pwy8.js +2 -0
- package/dist/chunk-zs58fnme.js +2 -0
- package/dist/chunk-zy3p0vmx.js +3 -0
- 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.d.ts +11 -0
- package/dist/dev-server/ts-css.js +13 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +17 -17
- package/package.json +5 -5
- package/dist/chunk-02k2v1mb.js +0 -2
- package/dist/chunk-0dh1rgg8.js +0 -2
- package/dist/chunk-0hrqt5c2.js +0 -2
- package/dist/chunk-0vtk2rpr.js +0 -2
- package/dist/chunk-1rd3jzrq.js +0 -2
- package/dist/chunk-26j2q9rq.js +0 -32
- package/dist/chunk-2py27bzq.js +0 -2
- package/dist/chunk-2qa7hjp2.js +0 -3
- package/dist/chunk-35e6zj5x.js +0 -2
- package/dist/chunk-3ch40ebr.js +0 -2
- package/dist/chunk-49cpqjx2.js +0 -2
- package/dist/chunk-4k1nkp9r.js +0 -2
- package/dist/chunk-50vq8k55.js +0 -2
- package/dist/chunk-56pkjk55.js +0 -2
- package/dist/chunk-5hnh00ry.js +0 -2
- package/dist/chunk-5j52h3e3.js +0 -2
- package/dist/chunk-5y1mekxe.js +0 -2
- package/dist/chunk-5zryk911.js +0 -2
- package/dist/chunk-72w28vm8.js +0 -2
- package/dist/chunk-7s7k94as.js +0 -2
- package/dist/chunk-7wb6jf17.js +0 -2
- package/dist/chunk-8cbkqckh.js +0 -2
- package/dist/chunk-8ycy1b0e.js +0 -2
- package/dist/chunk-8ygks6dx.js +0 -3
- package/dist/chunk-95165j9c.js +0 -4
- package/dist/chunk-9fyss0yk.js +0 -3
- package/dist/chunk-aqrnpgn7.js +0 -2
- package/dist/chunk-b9rebdtq.js +0 -2
- package/dist/chunk-c4thhfx9.js +0 -2
- package/dist/chunk-cw6kqb63.js +0 -2
- package/dist/chunk-d3vtgnep.js +0 -2
- package/dist/chunk-d4ynv4z2.js +0 -2
- package/dist/chunk-d7xrewxq.js +0 -2
- package/dist/chunk-dg1n3g1d.js +0 -2785
- package/dist/chunk-ecr598p7.js +0 -2
- package/dist/chunk-eev80mpy.js +0 -2
- package/dist/chunk-ef5vz9w5.js +0 -2
- package/dist/chunk-et0rr8c7.js +0 -3
- package/dist/chunk-f5qd84w8.js +0 -2
- package/dist/chunk-g69tnqga.js +0 -2
- package/dist/chunk-gacycmb0.js +0 -2
- package/dist/chunk-ggywfyzm.js +0 -2
- package/dist/chunk-gp1bhn7t.js +0 -2
- package/dist/chunk-gr3r9xdh.js +0 -2
- package/dist/chunk-gyv1t0f0.js +0 -30
- package/dist/chunk-hec0bvvf.js +0 -12
- package/dist/chunk-hg1eq72d.js +0 -2
- package/dist/chunk-hvyqs5tf.js +0 -2
- package/dist/chunk-kbysqxmd.js +0 -2
- package/dist/chunk-kjbv8a3m.js +0 -2
- package/dist/chunk-kmnsrvrp.js +0 -2
- package/dist/chunk-m6fvj7g1.js +0 -2
- package/dist/chunk-mgw2cvb7.js +0 -2
- package/dist/chunk-mvwt1c8f.js +0 -2
- package/dist/chunk-nvh31cxn.js +0 -2
- package/dist/chunk-p34gbb4z.js +0 -2
- package/dist/chunk-peyt18ce.js +0 -2
- package/dist/chunk-qpx8kvd8.js +0 -2
- package/dist/chunk-qzkebqm3.js +0 -4
- package/dist/chunk-rb272g9d.js +0 -3
- package/dist/chunk-rh1dyfsn.js +0 -2
- package/dist/chunk-rspc8gn8.js +0 -2
- package/dist/chunk-rvs61c88.js +0 -2
- package/dist/chunk-sf1vhfrb.js +0 -2
- package/dist/chunk-tc274fcv.js +0 -18
- package/dist/chunk-ty7t3gp4.js +0 -3
- package/dist/chunk-vc9wa97m.js +0 -2
- package/dist/chunk-wjzqz3yr.js +0 -2
- package/dist/chunk-x7j0krz8.js +0 -2
- package/dist/chunk-xkv0evbf.js +0 -2
- package/dist/chunk-y6rahx7t.js +0 -17
- package/dist/chunk-yt452b4a.js +0 -2
- package/dist/chunk-yxfx44fv.js +0 -2
|
@@ -0,0 +1,2816 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{un,m,fo,Et,Cs,go,mo,ho,yo}from"./chunk-bk5ndwv3.js";import{R}from"./chunk-vdqa5gt7.js";import{t,X,Yn,o,te,xs,_,Ct,cn,Ss,c,p,P,ve,Ge,l,Zn}from"./chunk-wweasgq9.js";import{pn,fn,nr,xe}from"./chunk-76japd6k.js";import{w,vs,Xe,ws,de,Jn}from"./chunk-31a8eh0j.js";import{ms,hs,ys,bs,qn,Xn}from"./chunk-0xgf3xgy.js";import{co,ds,Vn,Un}from"./chunk-e2m674vf.js";import{le,kt,Wn,gs,S,We}from"./chunk-7q1yy18q.js";import{sn}from"./chunk-vepc9rbt.js";import{_s}from"./chunk-865xvpp2.js";import{to,no,so,io}from"./chunk-xvn3sv3v.js";import{Ue}from"./chunk-xwkdv585.js";import{s,ye}from"./chunk-e83j8xe9.js";import{St,uo,nn,a,rn}from"./chunk-mcqn70v8.js";import{u}from"./chunk-cg8hg6cs.js";import{pe,D,ln}from"./chunk-qvr6e2ve.js";import{rr}from"./chunk-47h689h6.js";import Cr from"path";import ai from"fs";var Lm=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ca(x,v){if(v.passive)return!0;if(v.prevent||v.nonpassive)return!1;return Lm.has(x.toLowerCase())}var ql=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"]),Kl={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"},Bm=new Set(["ctrl","alt","shift","meta"]),Gl={left:0,middle:1,right:2};function Xl(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(Bm.has(E))v.systemKeys.push(E);else if(E in Gl)v.mouse=E;else if(E in Kl||/^[a-z]$/.test(E))v.keys.push(Kl[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 Jl(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,K=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,fe=oe.split("."),ue=fe[0];if(!ql.has(ue))continue;J.push({attribute:`@${oe}`,event:ue,handler:ie,modifiers:Xl(fe.slice(1)),elementId:G})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(z))!==null){let[,oe,ie]=re,fe=oe.split("."),ue=fe[0];if(!ql.has(ue))continue;J.push({attribute:`@${oe}`,event:ue,handler:ie,modifiers:Xl(fe.slice(1)),elementId:G})}if(J.length>0)k.push({originalTag:L,elementId:G,events:J,startIndex:F,endIndex:K})}return k}function zm(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=Gl[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 Fm(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 la(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 Wm(x){let{modifiers:v}=x,k=x.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=zm(x),C=Fm(la(x.handler),v),j=[];if(v.once)j.push("once: true");if(v.capture)j.push("capture: true");if(ca(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
|
+
(function() {
|
|
4
|
+
var $el = document.getElementById('${k}');
|
|
5
|
+
if (!$el) return;
|
|
6
|
+
// Run mounted handler immediately (DOM is ready)
|
|
7
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
8
|
+
if (scope && scope.__stx_execute) {
|
|
9
|
+
scope.__stx_execute('${B}', null, $el);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
__stx_runHandler('${B}', null, $el);
|
|
13
|
+
}
|
|
14
|
+
})();`;if(x.event==="unmounted")return`
|
|
15
|
+
(function() {
|
|
16
|
+
var $el = document.getElementById('${k}');
|
|
17
|
+
if (!$el) return;
|
|
18
|
+
// Set up MutationObserver to detect removal
|
|
19
|
+
var observer = new MutationObserver(function(mutations) {
|
|
20
|
+
for (var m of mutations) {
|
|
21
|
+
for (var node of m.removedNodes) {
|
|
22
|
+
if (node === $el || (node.contains && node.contains($el))) {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
25
|
+
if (scope && scope.__stx_execute) {
|
|
26
|
+
scope.__stx_execute('${B}', null, $el);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
__stx_runHandler('${B}', null, $el);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
+
// Store observer for cleanup
|
|
38
|
+
$el.__stx_unmount_observer = observer;
|
|
39
|
+
})();`;return`
|
|
40
|
+
(function() {
|
|
41
|
+
var $el = document.getElementById('${k}');
|
|
42
|
+
if (!$el) return;
|
|
43
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
44
|
+
$el.addEventListener('${x.event}', function($event) {
|
|
45
|
+
${E?E+";":""}
|
|
46
|
+
// Find the closest reactive scope and execute within its context
|
|
47
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
48
|
+
if (scope && scope.__stx_execute) {
|
|
49
|
+
scope.__stx_execute('${B}', $event, $el);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
+
__stx_runHandler('${B}', $event, $el);
|
|
54
|
+
}
|
|
55
|
+
}${L});
|
|
56
|
+
})();`}function ua(x){if(x.length===0)return"";return`
|
|
57
|
+
<script data-stx-events>
|
|
58
|
+
(function() {
|
|
59
|
+
'use strict';
|
|
60
|
+
|
|
61
|
+
// Utility functions
|
|
62
|
+
function __stx_debounce(fn, delay) {
|
|
63
|
+
var timeout;
|
|
64
|
+
return function() {
|
|
65
|
+
var args = arguments;
|
|
66
|
+
var ctx = this;
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __stx_throttle(fn, delay) {
|
|
73
|
+
var last = 0;
|
|
74
|
+
return function() {
|
|
75
|
+
var now = Date.now();
|
|
76
|
+
if (now - last >= delay) {
|
|
77
|
+
last = now;
|
|
78
|
+
fn.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
|
|
84
|
+
// so the surrounding script element can never contain raw markup, including
|
|
85
|
+
// its own closing tag; we decode it to JS only in memory here, then run it
|
|
86
|
+
// with $event/$el in scope.
|
|
87
|
+
//
|
|
88
|
+
// This comment must not spell that closing tag out. It used to, as an
|
|
89
|
+
// example, and a browser ends the script element at the FIRST one it sees \u2014
|
|
90
|
+
// so everything below this line, __stx_runHandler included, was emitted as
|
|
91
|
+
// page text and no listener was ever bound. The comment about escaping was
|
|
92
|
+
// the thing that needed escaping.
|
|
93
|
+
function __stx_runHandler(h, $event, $el) {
|
|
94
|
+
var code = h
|
|
95
|
+
.replace(/</g, '<')
|
|
96
|
+
.replace(/>/g, '>')
|
|
97
|
+
.replace(/"/g, '"')
|
|
98
|
+
.replace(/'/g, "'")
|
|
99
|
+
.replace(/'/g, "'")
|
|
100
|
+
.replace(/&/g, '&');
|
|
101
|
+
try {
|
|
102
|
+
// eslint-disable-next-line no-new-func
|
|
103
|
+
(new Function('$event', '$el', code)).call($el, $event, $el);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Event listeners
|
|
111
|
+
${x.map(Wm).join(`
|
|
112
|
+
`)}
|
|
113
|
+
})();
|
|
114
|
+
</script>`}function Vm(x,v=""){let k=Jl(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,"\\$&"),K=new RegExp(`\\s*${F}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${F}\\s*=\\s*'[^']*'`,"g");B=B.replace(K,""),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 Zl(x){let v=x.$uid;return typeof v==="string"&&v?`${v}_`:""}function Yl(x,v,k){if(go(x))return x;if(v.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(x))return x;let{template:B,bindings:z}=Vm(x,Zl(v)),F=v.__stx_event_bindings||[];return v.__stx_event_bindings=[...F,...z],B}let E=Jl(x,Zl(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 K=F.match(/id=["']([^"']+)["']/);if(K)for(let G of z.events)G.elementId=K[1]}for(let K of z.events){let G=K.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=ua(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 Ql(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 pi(x,v){let k=s(x),{depths:E,balanced:C}=ye(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)&&Ql(B[1],!0).has(v))return!0;for(let B of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(B.index??0)&&Ql(B[1],!1).has(v))return!0;return!1}import Im from"fs";import Ye from"path";import{createHash as Um}from"crypto";var gi="__stx_component_client_factories";function mi(x){let v=x[gi];return v instanceof Map?v:null}function tu(x){x[gi]=new Map}function da(x,v){let k=mi(x);if(!k)return null;let E=Um("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 nu(x,v){let k=mi(v);if(!k?.size)return x;let E=new Map;for(let[K,G]of k)if(G.instances===1)E.set(K,G.body);let C=[];if(E.size>0){let K=[...E.keys()].map((ne)=>JSON.stringify(ne).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${K})\\]\\(("[^"]+")\\);`,"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(([,K])=>K.instances>1);if(j.length===0)return eu(x,C);let B=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
|
+
(function() {
|
|
117
|
+
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
|
+
${j.map(([K,G])=>` try { factories[${JSON.stringify(K)}] = factories[${JSON.stringify(K)}] || ${G.body}; }
|
|
119
|
+
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(K)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
120
|
+
`)}
|
|
121
|
+
})();
|
|
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=ah(C);if(j>0){let B=C.substring(0,j).trim(),z=C.substring(j+1).trim(),F=b(B,v,!0,E);return Ba(F,z,v)}let L=cn(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=lh(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 lh(x,v){let k=null;for(let C of v){if(C===x)continue;let j=uh(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 uh(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 mu(x){if(!x)return"";return x.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Uu from"fs";class V{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 Dr=new Map,dh=500;function mr(x,v){if(v?.includes("g"))return new RegExp(x,v);let k=`${x}:${v||""}`;if(!Dr.has(k)){if(Dr.size>=dh){let E=Dr.keys().next().value;if(E)Dr.delete(E)}Dr.set(k,new RegExp(x,v))}return Dr.get(k)}class Wu{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}`,K=C.get(F);if(!K){if(C.size>=j){let G=C.keys().next().value;if(G)C.delete(G)}K=Function(...v,`
|
|
125
|
+
'use strict';
|
|
126
|
+
try {
|
|
127
|
+
return ${z};
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
throw e;
|
|
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 nd={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 rd(x){return`--stx-radius-${x}`}function sd(){let x={};for(let[v,k]of Object.entries(nd))x[v]=`var(${rd(v)}, ${k.value})`;return x}function id(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(nd).map(([x,v])=>` ${rd(x)}: ${v.value};`),"}",""].join(`
|
|
137
|
+
`)}function od(x){return typeof x==="object"&&x!==null&&!Array.isArray(x)}function Ea(x,v){let k={...x};for(let[E,C]of Object.entries(v))k[E]=od(C)&&od(k[E])?Ea(k[E],C):C;return k}function ad(x={},v={}){let k=x.theme||{},E=v.theme||{},{extend:C,...j}=E,{extend:L,...B}=k,z=B.colors||{};B.colors={...z,...ed(z)};let F=B.borderRadius||{};B.borderRadius={...F,...sd()};let K=Ea(B,j),G=Ea(L||{},C||{});if(Object.keys(G).length>0)K.extend=G;let J=[...x.safelist||[],...v.safelist||[]],ne={...x.shortcuts||{},...v.shortcuts||{}},re=[...x.preflights||[],...v.preflights||[]];return{config:{...x,...v,theme:K,safelist:J,shortcuts:ne,...re.length>0?{preflights:re}:{},content:[],output:""},safelist:J,shortcuts:ne,includePreflight:v.preflight!==!1,minify:v.minify===!0,tokenCSS:td(z)+id()}}function cd(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 ld(x,v,k={}){let{prefix:E="",preserveHost:C=!0,scopeKeyframes:j=!0,scopeCustomProperties:L=!1}=k;if(!x.trim())return"";let B=Ca(x),z=[],F=new Map;if(j)for(let K of B){let G=K.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 K of B){let G=ud(K,v,E,C,F,L);z.push(G)}return z.join(`
|
|
138
|
+
|
|
139
|
+
`)}function Ca(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[,K,G,J]=F;if(K==="keyframes")v.push({selector:`@keyframes ${G.trim()}`,declarations:J.trim()});else if(K==="media"||K==="supports"||K==="container"){let ne=Ca(J);v.push({selector:`@${K} ${G.trim()}`,declarations:ne.map((re)=>`${re.selector} { ${re.declarations} }`).join(`
|
|
140
|
+
`)})}else v.push({selector:`@${K} ${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 ud(x,v,k,E,C,j){let{selector:L,declarations:B}=x;if(L.startsWith("@")){if(L.startsWith("@keyframes")){let K=L.replace("@keyframes ","").trim();return`@keyframes ${C.get(K)||K} { ${B} }`}if(L.startsWith("@media")||L.startsWith("@supports")||L.startsWith("@container")){let G=Ca(`x { ${B} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((J)=>ud(J,v,k,E,C,j)).join(`
|
|
141
|
+
`);return`${L} {
|
|
142
|
+
${G}
|
|
143
|
+
}`}return`${L} { ${B} }`}let z=yh(L,v,k,E),F=B;for(let[K,G]of C)F=F.replace(new RegExp(`\\b${K}\\b`,"g"),G);if(j)F=F.replace(/--([a-z-]+)/gi,`--${v}-$1`);return`${z} { ${F} }`}function yh(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=xh(L,v);if(z)j.push(k?`${k} ${z}`:z)}return j.join(", ")}function xh(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 pd=String.raw`(?<![\w-])scoped(?![\w-])`,Ra=/<style\s+([^>]*)>/gi,dd=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,gd=new RegExp(pd,"i"),bh=new RegExp(pd,"gi"),Ta=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function vh(x){Ra.lastIndex=0;let v=Ra.exec(x);while(v!==null){if(gd.test(v[1]))return!0;v=Ra.exec(x)}return!1}function Aa(x){let v=new Set,k=[];Ta.lastIndex=0;let E=Ta.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=Ta.exec(x)}return k}function js(x){let v=Aa(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 Si(x,v){if(!vh(x))return{html:x,hasScoped:!1};let k=cd(v),E=`data-v-${k}`,C=x,j=!1;if(dd.lastIndex=0,C=C.replace(dd,(L,B,z)=>{if(!gd.test(B))return L;j=!0;let F=wh(z,E),K=B.replace(bh,"").trim(),G=K?` ${K}`:"";return`<style data-stx-scoped="${k}"${G}>${F}</style>`}),!j)return{html:x,hasScoped:!1};return C=$h(C,E),{html:C,hasScoped:!0}}function wh(x,v){return ld(x,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${v}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${v}]`)}var Sh=(x)=>`\x00stx-scope-mask-${x}\x00`,fd=/\u0000stx-scope-mask-(\d+)\u0000/g;function $h(x,v){let k=$n(x,(C,j)=>{let L=Y(C,j);return L>j?L:Ar(C,j)},(C,j)=>Sh(j)),E=_h(k.output,v);return fd.lastIndex=0,E.replace(fd,(C,j)=>k.tokens[Number(j)])}function _h(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 kn=null,Pa=!1,br=null,Ls="",Mr=!1,xd=256,ar=new Map,En=new Map,$i=null,bd=null,ki=new Map;function Ei(x){return Bun.hash(x).toString(16).padStart(16,"0").slice(0,16)}function Ia(x,v){if(ar.has(x))ar.delete(x);else if(ar.size>=xd)ar.delete(ar.keys().next().value);ar.set(x,v)}function kh(x){let v=Ei(x);if(En.has(v))En.delete(v);else if(En.size>=xd)En.delete(En.keys().next().value);return En.set(v,x),v}function ku(x){let v=En.get(x);if(v===void 0)return;return En.delete(x),En.set(x,v),v}async function Eh(x,v=$i){if(!v)return null;try{let k=Bun.file(At.join(v,`cw-${Ei(x)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Ch(x,v,k=$i){if(!k)return;try{if(!fs.existsSync(k))fs.mkdirSync(k,{recursive:!0});await Bun.write(At.join(k,`cw-${Ei(x)}.css`),v)}catch{}}async function hd(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 Rh=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Th=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ah(){let x=[],v=process.cwd();while(v!==At.dirname(v)){for(let k of["node_modules","pantry"])for(let E of Rh)x.push(At.join(v,k,...E));v=At.dirname(v)}return x}function Ih(){let x=[],v=process.env.HOME||process.env.USERPROFILE||"",k=[v&&At.join(v,"Code","Tools","ts-css"),v&&At.join(v,"Code","Tools","crosswind"),v&&At.join(v,"repos","stacks-org","ts-css"),v&&At.join(v,"repos","stacks-org","crosswind"),At.join(process.cwd(),"..","ts-css"),At.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)x.push(At.join(E,"packages","toolkit","dist","engine","index.js")),x.push(At.join(E,"packages","toolkit","src","engine","index.ts"));if(v)x.push(At.join(v,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return x}async function Oi(){if(Pa)return kn;Pa=!0;try{let x=async(C)=>{for(let j of C){if(!await Bun.file(j).exists())continue;let L=await hd(j);if(L){if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${At.dirname(At.dirname(j))}`);return L}}return null};if(process.env.CROSSWIND_SRC){let C=At.resolve(process.env.CROSSWIND_SRC),j=await x([C]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${C}`);return kn=j,kn}let v=await x(Ah());if(v)return kn=v,kn;let k=Th;for(let C of k){let j=await hd(C);if(j){if(kn=j,!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return kn}}let E=await x(Ih());if(E)return kn=E,kn;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 Cu(){xc.clear(),kn=null,Pa=!1,br=null,Ls="",ar.clear(),En.clear(),bd=null,ki.clear()}var yd=!1;async function Mi(x){try{let v=md({name:"css",cwd:x})?"css":md({name:"crosswind",cwd:x})?"crosswind":null;if(!v)return null;if(v==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!yd)yd=!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=At.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 Va(x){let v=null;try{let{loadStxConfig:k}=await import("./chunk-zs58fnme.js"),E=await k(x);if(E.css)if(typeof E.css==="string"){let C=At.isAbsolute(E.css)?E.css:At.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=At.isAbsolute(E.css.config)?E.css.config:At.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 Mi(x)}function Ua(x){try{let v=new WeakSet;return Ei(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 bt(x){if(Mr)return Ls;Mr=!0;try{let v=await Oi();if(!v||!v.build)return Mr=!1,"";if(!br)br=await Mi(x);if(!br)return Mr=!1,"";let k=v.defaultConfig?.theme||{},E=br.theme||{},C={...v.defaultConfig,...br,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),L=await v.build(C),B=performance.now()-j;if(Ls=L.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${L.classes.size} classes in ${B.toFixed(1)}ms`),C.output){let z=At.isAbsolute(C.output)?C.output:At.join(x,C.output),F=At.dirname(z);if(!fs.existsSync(F))fs.mkdirSync(F,{recursive:!0});await Bun.write(z,L.css)}return Mr=!1,L.css}catch(v){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,v),Mr=!1,Ls}}async function Zt(x){br=null,await bt(x)}function $u(){return Ls}function Wa(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 qa(x,v){let k=()=>ki.get(v?At.resolve(v):process.cwd())?.fingerprint??null,E=xc.get(O(x,v,k()));if(E!==void 0)return E;let C=await Ph(x,v);if(C)xc.set(O(x,v,k()),C);return C}function Xa(x){let v=[];for(let k of x.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Di(k[1]);if(E)v.push(E)}return v.length?`${x}
|
|
144
|
+
${v.join(`
|
|
145
|
+
`)}`:x}async function Ph(x,v){try{let k=await Oi();if(!k)return"";let E=Xa(x),C=typeof k.extractClasses==="function"?k.extractClasses(E):Wa(E);if(C.size===0)return"";let j=v?At.resolve(v):process.cwd(),L=a(j,"cache");if(!$i)$i=L;let B=ki.get(j);if(!B){let ke=await Va(j);B={config:ke,fingerprint:Ua(ke)},ki.set(j,B),bd=B.fingerprint}let z=[...C].sort().join(" "),F=`${B.fingerprint||"default"}::${z}`,K=ar.get(F);if(K!==void 0)return Ia(F,K),K;let G=await Eh(F,L);if(G!==null)return Ia(F,G),G;let J=k.defaultConfig||k.config,ne=B.config||{},re=ad(J,ne),{safelist:se,includePreflight:oe,minify:ie,tokenCSS:fe}=re,ue=re.config,be=new k.CSSGenerator(ue),we=ue.shortcuts||ne.shortcuts||{},Se=Object.keys(we).filter((ke)=>C.has(ke)||se.includes(ke));for(let ke of se)if(!we[ke])be.generate(ke);for(let ke of C)if(!we[ke])be.generate(ke);let $e="";if(Se.length>0){let ke=new k.CSSGenerator(ue);for(let Re of Se)ke.generate(Re);if($e=ke.toCSS(!1,ie),$e&&!$e.endsWith(`
|
|
146
|
+
`))$e+=`
|
|
147
|
+
`}let Ee=$e+be.toCSS(oe,ie);return Ee=fe+Ee,Ia(F,Ee),Ch(F,Ee,L),Ee}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(x,v,k=!1,E=!1){let C=await qa(x,v);if(!C)return E?js(x):x;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${kh(C)}.css">`:`<style data-css="generated">
|
|
148
|
+
${C}
|
|
149
|
+
</style>`;if(E)return Dh(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
|
+
</head>`);if(x.includes("<body"))return x.replace(/<body([^>]*)>/,`<body$1>
|
|
151
|
+
${j}`);return j+x}function Dh(x,v){let k=Aa(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
|
+
`});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 Mh(js(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 Mh(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
|
+
</head>`);if(x.includes("<body"))return x.replace(/<body([^>]*)>/,`<body$1>
|
|
155
|
+
${v}`);return v+x}var bc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],vd=/<body\b([^>]*)>/gi;function Cn(x){let v=0,k,E=bc.map(()=>{return});while(v<x.length){if(k===void 0||k!==null&&k.index<v)vd.lastIndex=v,k=vd.exec(x);if(!k)return null;let C=k.index,j=-1,L=null;for(let z=0;z<bc.length;z++){let F=bc[z],K=E[z];if(K===void 0||K!==null&&K.index<v)F.open.lastIndex=v,K=F.open.exec(x),E[z]=K;if(!K)continue;if(K.index<C&&(j===-1||K.index<j))j=K.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 Or(x,v){let k=Cn(x);if(!k)return x;return x.slice(0,k.index)+v(k.tag,k.attrs)+x.slice(k.index+k.tag.length)}var wd=/<style\b[^>]*>/iy,Sd=/<\/style>/gi,$d=/<script\b[^>]*>/iy,_d=/<template(?=[\s>/])[^>]*>/iy,kd=/<\/template\s*>/iy;function Bs(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}wd.lastIndex=C;let j=wd.exec(x);if(j){Sd.lastIndex=C+j[0].length;let z=Sd.exec(x);v=z===null?x.length:z.index+8;continue}_d.lastIndex=C;let L=_d.exec(x);if(L){if(k===0)E=C;k++,v=C+L[0].length;continue}kd.lastIndex=C;let B=kd.exec(x);if(B){if(k>0)k--;v=C+B[0].length;continue}if($d.lastIndex=C,$d.test(x))return k>0?E:C;v=C+1}return-1}function Ed(){return`
|
|
156
|
+
// STX Lifecycle Runtime
|
|
157
|
+
(function() {
|
|
158
|
+
if (typeof window === 'undefined') return;
|
|
159
|
+
|
|
160
|
+
const instances = new Map();
|
|
161
|
+
let currentInstance = null;
|
|
162
|
+
let idCounter = 0;
|
|
163
|
+
|
|
164
|
+
function generateId() {
|
|
165
|
+
return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function createInstance(element) {
|
|
169
|
+
const instance = {
|
|
170
|
+
id: generateId(),
|
|
171
|
+
element: element,
|
|
172
|
+
mountHooks: [],
|
|
173
|
+
destroyHooks: [],
|
|
174
|
+
updateHooks: [],
|
|
175
|
+
refs: new Map(),
|
|
176
|
+
watchers: [],
|
|
177
|
+
isMounted: false
|
|
178
|
+
};
|
|
179
|
+
instances.set(instance.id, instance);
|
|
180
|
+
return instance;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
window.STX = window.STX || {};
|
|
184
|
+
|
|
185
|
+
// Lifecycle hooks
|
|
186
|
+
window.STX.onMount = function(hook) {
|
|
187
|
+
if (currentInstance) currentInstance.mountHooks.push(hook);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
window.STX.onDestroy = function(hook) {
|
|
191
|
+
if (currentInstance) currentInstance.destroyHooks.push(hook);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
window.STX.onUpdate = function(hook) {
|
|
195
|
+
if (currentInstance) currentInstance.updateHooks.push(hook);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// Aliases
|
|
199
|
+
window.STX.onMounted = window.STX.onMount;
|
|
200
|
+
window.STX.onUnmounted = window.STX.onDestroy;
|
|
201
|
+
window.STX.onUpdated = window.STX.onUpdate;
|
|
202
|
+
|
|
203
|
+
// Refs
|
|
204
|
+
window.STX.ref = function(initialValue) {
|
|
205
|
+
const r = { value: initialValue || null };
|
|
206
|
+
Object.defineProperty(r, 'current', {
|
|
207
|
+
get: function() { return this.value; }
|
|
208
|
+
});
|
|
209
|
+
if (currentInstance) {
|
|
210
|
+
currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
|
|
211
|
+
}
|
|
212
|
+
return r;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Watch
|
|
216
|
+
window.STX.watch = function(source, callback, options) {
|
|
217
|
+
options = options || {};
|
|
218
|
+
let oldValue;
|
|
219
|
+
let cleanup;
|
|
220
|
+
let isActive = true;
|
|
221
|
+
|
|
222
|
+
function run() {
|
|
223
|
+
if (!isActive) return;
|
|
224
|
+
const newValue = source();
|
|
225
|
+
if (oldValue !== newValue || options.immediate) {
|
|
226
|
+
if (cleanup) cleanup();
|
|
227
|
+
cleanup = callback(newValue, oldValue);
|
|
228
|
+
oldValue = newValue;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (options.immediate) {
|
|
233
|
+
run();
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
oldValue = source();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const intervalId = setInterval(run, 16);
|
|
240
|
+
|
|
241
|
+
function stop() {
|
|
242
|
+
isActive = false;
|
|
243
|
+
clearInterval(intervalId);
|
|
244
|
+
if (cleanup) cleanup();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (currentInstance) {
|
|
248
|
+
currentInstance.watchers.push({ stop: stop });
|
|
249
|
+
currentInstance.destroyHooks.push(stop);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return stop;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// Computed
|
|
256
|
+
window.STX.computed = function(getter) {
|
|
257
|
+
let cached;
|
|
258
|
+
let dirty = true;
|
|
259
|
+
return {
|
|
260
|
+
get value() {
|
|
261
|
+
if (dirty) {
|
|
262
|
+
cached = getter();
|
|
263
|
+
dirty = false;
|
|
264
|
+
queueMicrotask(function() { dirty = true; });
|
|
265
|
+
}
|
|
266
|
+
return cached;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// Component management
|
|
272
|
+
window.STX.setupComponent = function(element, setup) {
|
|
273
|
+
const instance = createInstance(element);
|
|
274
|
+
currentInstance = instance;
|
|
275
|
+
try {
|
|
276
|
+
setup();
|
|
277
|
+
}
|
|
278
|
+
finally {
|
|
279
|
+
currentInstance = null;
|
|
280
|
+
}
|
|
281
|
+
return instance;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
window.STX.mountComponent = function(instance) {
|
|
285
|
+
if (instance.isMounted) return;
|
|
286
|
+
instance.isMounted = true;
|
|
287
|
+
instance.mountHooks.forEach(function(hook) {
|
|
288
|
+
try {
|
|
289
|
+
const cleanup = hook();
|
|
290
|
+
if (typeof cleanup === 'function') {
|
|
291
|
+
instance.destroyHooks.push(cleanup);
|
|
292
|
+
}
|
|
293
|
+
else if (cleanup && typeof cleanup.then === 'function') {
|
|
294
|
+
cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
console.error('[stx] onMount error:', e);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
window.STX.destroyComponent = function(instance) {
|
|
304
|
+
if (!instance.isMounted) return;
|
|
305
|
+
instance.watchers.forEach(function(w) { w.stop(); });
|
|
306
|
+
instance.destroyHooks.forEach(function(hook) {
|
|
307
|
+
try { hook(); }
|
|
308
|
+
catch (e) { console.error('[stx] onDestroy error:', e); }
|
|
309
|
+
});
|
|
310
|
+
instance.refs.forEach(function(ref) { ref.value = null; });
|
|
311
|
+
instance.isMounted = false;
|
|
312
|
+
instances.delete(instance.id);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// ==========================================================================
|
|
316
|
+
// Vue-Style Refs System - No document.** required!
|
|
317
|
+
// ==========================================================================
|
|
318
|
+
|
|
319
|
+
// Internal: Query for ref elements without exposing document API
|
|
320
|
+
function queryRef(name, root) {
|
|
321
|
+
return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function queryAllRefs(root) {
|
|
325
|
+
return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Auto-bind refs from ref attributes (Vue-style)
|
|
329
|
+
window.STX.bindRefs = function(root, refs) {
|
|
330
|
+
if (!root) return;
|
|
331
|
+
queryAllRefs(root).forEach(function(el) {
|
|
332
|
+
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
333
|
+
if (refs[refName]) {
|
|
334
|
+
refs[refName].value = el;
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// Vue-style useRefs() - returns object with all refs as direct elements
|
|
340
|
+
// Usage: const { input, button, container } = STX.useRefs()
|
|
341
|
+
window.STX.useRefs = function(root) {
|
|
342
|
+
var refs = {};
|
|
343
|
+
queryAllRefs(root).forEach(function(el) {
|
|
344
|
+
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
345
|
+
if (refName) {
|
|
346
|
+
refs[refName] = el;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
return refs;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
// Get a single ref by name - Vue's useTemplateRef equivalent
|
|
353
|
+
// Usage: const input = STX.useRef('input')
|
|
354
|
+
window.STX.useRef = function(name, root) {
|
|
355
|
+
return queryRef(name, root);
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// Two-way binding helper for form elements
|
|
359
|
+
// Usage: STX.model(inputEl, state, 'username')
|
|
360
|
+
window.STX.model = function(el, state, key) {
|
|
361
|
+
if (!el || !state) return;
|
|
362
|
+
|
|
363
|
+
var isCheckbox = el.type === 'checkbox';
|
|
364
|
+
var isRadio = el.type === 'radio';
|
|
365
|
+
var isSelect = el.tagName === 'SELECT';
|
|
366
|
+
|
|
367
|
+
// Set initial value
|
|
368
|
+
if (isCheckbox) {
|
|
369
|
+
el.checked = !!state[key];
|
|
370
|
+
}
|
|
371
|
+
else if (isRadio) {
|
|
372
|
+
el.checked = el.value === state[key];
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
el.value = state[key] || '';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Listen for changes
|
|
379
|
+
var eventType = isCheckbox || isRadio ? 'change' : 'input';
|
|
380
|
+
el.addEventListener(eventType, function() {
|
|
381
|
+
if (isCheckbox) {
|
|
382
|
+
state[key] = el.checked;
|
|
383
|
+
}
|
|
384
|
+
else if (isRadio) {
|
|
385
|
+
if (el.checked) state[key] = el.value;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
state[key] = el.value;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
// Return cleanup function
|
|
393
|
+
return function() {
|
|
394
|
+
el.removeEventListener(eventType, arguments.callee);
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// Batch event binding helper - cleaner than manual addEventListener
|
|
399
|
+
// Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
|
|
400
|
+
window.STX.on = function(el, event, handler) {
|
|
401
|
+
if (!el) return function() {};
|
|
402
|
+
el.addEventListener(event, handler);
|
|
403
|
+
return function() { el.removeEventListener(event, handler); };
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Bind multiple events at once
|
|
407
|
+
// Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
|
|
408
|
+
window.STX.events = function(el, eventMap) {
|
|
409
|
+
if (!el) return function() {};
|
|
410
|
+
var cleanups = [];
|
|
411
|
+
Object.keys(eventMap).forEach(function(event) {
|
|
412
|
+
el.addEventListener(event, eventMap[event]);
|
|
413
|
+
cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
|
|
414
|
+
});
|
|
415
|
+
return function() { cleanups.forEach(function(c) { c(); }); };
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// ==========================================================================
|
|
419
|
+
// DOM Helpers - Eliminate document.* usage
|
|
420
|
+
// ==========================================================================
|
|
421
|
+
|
|
422
|
+
// Global keyboard event listener
|
|
423
|
+
// Usage: STX.onKey('Escape', () => closeModal())
|
|
424
|
+
window.STX.onKey = function(key, handler, options) {
|
|
425
|
+
var listener = function(e) {
|
|
426
|
+
if (e.key === key) {
|
|
427
|
+
handler(e);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
document.addEventListener('keydown', listener, options);
|
|
431
|
+
return function() { document.removeEventListener('keydown', listener, options); };
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
// Create element helper
|
|
435
|
+
// Usage: STX.el('div', { class: 'foo' }, 'text content')
|
|
436
|
+
window.STX.el = function(tag, attrs, content) {
|
|
437
|
+
var el = document.createElement(tag);
|
|
438
|
+
if (attrs) {
|
|
439
|
+
Object.keys(attrs).forEach(function(key) {
|
|
440
|
+
if (key === 'class') {
|
|
441
|
+
el.className = attrs[key];
|
|
442
|
+
}
|
|
443
|
+
else if (key.startsWith('on')) {
|
|
444
|
+
el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
el.setAttribute(key, attrs[key]);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
if (content) {
|
|
452
|
+
if (typeof content === 'string') {
|
|
453
|
+
el.textContent = content;
|
|
454
|
+
}
|
|
455
|
+
else if (Array.isArray(content)) {
|
|
456
|
+
content.forEach(function(child) { el.appendChild(child); });
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
el.appendChild(content);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return el;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// Get currently focused element
|
|
466
|
+
// Usage: const focused = STX.activeElement()
|
|
467
|
+
window.STX.activeElement = function() {
|
|
468
|
+
return document.activeElement;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// Escape HTML helper
|
|
472
|
+
// Usage: const safe = STX.escapeHtml(userInput)
|
|
473
|
+
window.STX.escapeHtml = function(text) {
|
|
474
|
+
var div = document.createElement('div');
|
|
475
|
+
div.textContent = text;
|
|
476
|
+
return div.innerHTML;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
// MutationObserver for automatic lifecycle management
|
|
480
|
+
const observer = new MutationObserver(function(mutations) {
|
|
481
|
+
mutations.forEach(function(mutation) {
|
|
482
|
+
// Handle removed nodes
|
|
483
|
+
mutation.removedNodes.forEach(function(node) {
|
|
484
|
+
if (node.nodeType === 1 && node.__stx_instance__) {
|
|
485
|
+
window.STX.destroyComponent(node.__stx_instance__);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
// Start observing when DOM is ready
|
|
492
|
+
if (document.readyState === 'loading') {
|
|
493
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
494
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
console.log('[stx] Lifecycle runtime initialized');
|
|
502
|
+
})();
|
|
503
|
+
`}function vc(x){return Symbol(x)}var K0=vc("theme"),X0=vc("router"),Z0=vc("i18n");import*as Rd from"crypto";function Cd(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 Oh(){return`stx-${Rd.randomBytes(4).toString("hex")}`}function Nh(x){return/\$\w+\./.test(x)}function jh(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=[],K=!1,G=B,J=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ne=[...B.matchAll(J)];for(let oe of ne){let ie=oe[0],fe=oe[1],ue=oe[2];if(Nh(ue)){K=!0;let be=ue.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(be){let we=be[1];if(F.push({attr:fe,expr:we,fullMatch:ie,originalAttr:fe}),Cd(we).forEach(($e)=>k.add($e)),fe==="text")G=G.replace(ie,"");else if(fe==="class")G=G.replace(ie,'class=""');else if(fe==="disabled"||fe==="hidden")G=G.replace(ie,"");else G=G.replace(ie,`${fe}=""`)}}}if(!K)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=Oh(),G=` id="${se}"${G}`;for(let oe of F)v.push({elementId:se,attribute:oe.attr,expression:oe.expr,stores:Cd(oe.expr)});return`<${L}${G}${z}`}),{html:C,bindings:v,stores:k}}function Lh(x,v){if(x.length===0)return"";let k=Array.from(v),E=`
|
|
504
|
+
<script>
|
|
505
|
+
(function() {
|
|
506
|
+
'use strict';
|
|
507
|
+
|
|
508
|
+
// Wait for stores to be available
|
|
509
|
+
function initBindings() {
|
|
510
|
+
var stores = window.VoideStores;
|
|
511
|
+
if (!stores) {
|
|
512
|
+
setTimeout(initBindings, 10);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Store references for expressions
|
|
517
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
518
|
+
var $state = {};
|
|
519
|
+
`;for(let C of k)E+=` $state.${C} = stores.${C} ? stores.${C}.get() : {};
|
|
520
|
+
`;E+=`
|
|
521
|
+
// Binding update functions
|
|
522
|
+
function updateBindings() {
|
|
523
|
+
`;for(let C of x){let{elementId:j,attribute:L,expression:B}=C,z=B.replace(/\$(\w+)\./g,"$state.$1.");if(L==="text")E+=` (function() {
|
|
524
|
+
var el = document.getElementById('${j}');
|
|
525
|
+
if (el) {
|
|
526
|
+
try {
|
|
527
|
+
el.textContent = ${z};
|
|
528
|
+
}
|
|
529
|
+
catch (e) { console.error('Binding error:', e); }
|
|
530
|
+
}
|
|
531
|
+
})();
|
|
532
|
+
`;else if(L==="html")E+=` (function() {
|
|
533
|
+
var el = document.getElementById('${j}');
|
|
534
|
+
if (el) {
|
|
535
|
+
try {
|
|
536
|
+
el.innerHTML = ${z};
|
|
537
|
+
}
|
|
538
|
+
catch (e) { console.error('Binding error:', e); }
|
|
539
|
+
}
|
|
540
|
+
})();
|
|
541
|
+
`;else if(L==="class")E+=` (function() {
|
|
542
|
+
var el = document.getElementById('${j}');
|
|
543
|
+
if (el) {
|
|
544
|
+
try {
|
|
545
|
+
var value = ${z};
|
|
546
|
+
if (typeof value === 'string') {
|
|
547
|
+
// Dynamic class string - merge with existing static classes
|
|
548
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
549
|
+
var staticClasses = el.getAttribute('data-static-class') || el.className;
|
|
550
|
+
if (!el.hasAttribute('data-static-class')) {
|
|
551
|
+
el.setAttribute('data-static-class', el.className);
|
|
552
|
+
}
|
|
553
|
+
el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
|
|
554
|
+
}
|
|
555
|
+
else if (typeof value === 'object') {
|
|
556
|
+
// Object syntax: { 'class-name': condition }
|
|
557
|
+
for (var cls in value) {
|
|
558
|
+
if (value[cls]) {
|
|
559
|
+
el.classList.add(cls);
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
el.classList.remove(cls);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
catch (e) { console.error('Binding error:', e); }
|
|
568
|
+
}
|
|
569
|
+
})();
|
|
570
|
+
`;else if(L==="show")E+=` (function() {
|
|
571
|
+
var el = document.getElementById('${j}');
|
|
572
|
+
if (el) {
|
|
573
|
+
try {
|
|
574
|
+
el.style.display = (${z}) ? '' : 'none';
|
|
575
|
+
}
|
|
576
|
+
catch (e) { console.error('Binding error:', e); }
|
|
577
|
+
}
|
|
578
|
+
})();
|
|
579
|
+
`;else if(L==="if")E+=` (function() {
|
|
580
|
+
var el = document.getElementById('${j}');
|
|
581
|
+
if (el) {
|
|
582
|
+
try {
|
|
583
|
+
el.style.visibility = (${z}) ? 'visible' : 'hidden';
|
|
584
|
+
}
|
|
585
|
+
catch (e) { console.error('Binding error:', e); }
|
|
586
|
+
}
|
|
587
|
+
})();
|
|
588
|
+
`;else E+=` (function() {
|
|
589
|
+
var el = document.getElementById('${j}');
|
|
590
|
+
if (el) {
|
|
591
|
+
try {
|
|
592
|
+
var value = ${z};
|
|
593
|
+
if (value === false || value === null || value === undefined) {
|
|
594
|
+
el.removeAttribute('${L}');
|
|
595
|
+
}
|
|
596
|
+
else if (value === true) {
|
|
597
|
+
el.setAttribute('${L}', '');
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
el.setAttribute('${L}', value);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
catch (e) { console.error('Binding error:', e); }
|
|
604
|
+
}
|
|
605
|
+
})();
|
|
606
|
+
`}E+=` }
|
|
607
|
+
|
|
608
|
+
// Subscribe to stores and update on changes. Capture the disposers so
|
|
609
|
+
// SPA fragment swaps can tear down old bindings before the next page's
|
|
610
|
+
// runtime takes over \u2014 without this, every navigation between pages
|
|
611
|
+
// using reactive-bindings stacked another subscription on every store,
|
|
612
|
+
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
613
|
+
var _disposers = [];
|
|
614
|
+
`;for(let C of k)E+=` if (stores.${C}) {
|
|
615
|
+
var _unsub_${C} = stores.${C}.subscribe(function(state) {
|
|
616
|
+
$state.${C} = state;
|
|
617
|
+
updateBindings();
|
|
618
|
+
});
|
|
619
|
+
// store.subscribe() may return the disposer (preferred) or void; both
|
|
620
|
+
// are tolerated here.
|
|
621
|
+
if (typeof _unsub_${C} === 'function') _disposers.push(_unsub_${C});
|
|
622
|
+
}
|
|
623
|
+
`;return E+=`
|
|
624
|
+
// Initial update
|
|
625
|
+
updateBindings();
|
|
626
|
+
|
|
627
|
+
// Register this runtime's cleanup so SPA navigation can run it before
|
|
628
|
+
// swapping pages. The router (and any code) can call
|
|
629
|
+
// window.__stxCleanupBindings() to dispose subscriptions; we also wire
|
|
630
|
+
// 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
|
|
631
|
+
function _cleanup() {
|
|
632
|
+
for (var i = 0; i < _disposers.length; i++) {
|
|
633
|
+
try { _disposers[i](); } catch (e) { /* swallow */ }
|
|
634
|
+
}
|
|
635
|
+
_disposers.length = 0;
|
|
636
|
+
}
|
|
637
|
+
if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
|
|
638
|
+
window.__stxBindingsCleanups.push(_cleanup);
|
|
639
|
+
if (!window.__stxCleanupBindings) {
|
|
640
|
+
window.__stxCleanupBindings = function() {
|
|
641
|
+
var fns = window.__stxBindingsCleanups || [];
|
|
642
|
+
for (var i = 0; i < fns.length; i++) {
|
|
643
|
+
try { fns[i](); } catch (e) { /* swallow */ }
|
|
644
|
+
}
|
|
645
|
+
window.__stxBindingsCleanups = [];
|
|
646
|
+
};
|
|
647
|
+
window.addEventListener('popstate', window.__stxCleanupBindings);
|
|
648
|
+
window.addEventListener('beforeunload', window.__stxCleanupBindings);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// Start when DOM is ready
|
|
653
|
+
if (document.readyState === 'loading') {
|
|
654
|
+
document.addEventListener('DOMContentLoaded', initBindings);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
initBindings();
|
|
658
|
+
}
|
|
659
|
+
})();
|
|
660
|
+
</script>
|
|
661
|
+
`,E}function Td(x){let{html:v,bindings:k,stores:E}=jh(x);if(k.length===0)return x;let C=Lh(k,E),j=v.lastIndexOf("</body>");if(j!==-1)return v.slice(0,j)+C+v.slice(j);return v+C}function Bh(x){let v=x.analytics;if(!v?.enabled)return"";switch(v.driver){case"fathom":return zh(v);case"google-analytics":return Fh(v);case"plausible":return Wh(v);case"self-hosted":return Vh(v);case"custom":return Uh(v);default:return""}}function zh(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="${mn(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="${mn(v.canonical)}"`);if(v.auto===!1)C.push('data-auto="false"');return`
|
|
662
|
+
<!-- Fathom Analytics -->
|
|
663
|
+
<script src="${mn(k)}" ${C.join(" ")}${E}></script>
|
|
664
|
+
`}function Fh(x){let v=x.googleAnalytics;if(!v?.measurementId)return"";let k=mn(v.measurementId),E=v.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
|
|
665
|
+
<!-- Google Analytics -->
|
|
666
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
|
|
667
|
+
<script>
|
|
668
|
+
window.dataLayer = window.dataLayer || [];
|
|
669
|
+
function gtag(){dataLayer.push(arguments);}
|
|
670
|
+
gtag('js', new Date());
|
|
671
|
+
gtag('config', '${k}');
|
|
672
|
+
${E}
|
|
673
|
+
</script>
|
|
674
|
+
`}function Wh(x){let v=x.plausible;if(!v?.domain)return"";let k=v.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${mn(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
|
+
<!-- Plausible Analytics -->
|
|
676
|
+
<script defer data-domain="${mn(v.domain)}" src="${mn(C)}"></script>
|
|
677
|
+
`}function Vh(x){let v=x.selfHosted;if(!v?.siteId||!v?.apiEndpoint)return"";let k=mn(v.siteId),E=mn(v.apiEndpoint),C=v.honorDnt?'if(n.doNotTrack==="1")return;':"",j=v.trackHashChanges?"w.addEventListener('hashchange',pv);":"",L=v.trackOutboundLinks?`
|
|
678
|
+
d.addEventListener('click',function(e){
|
|
679
|
+
var a=e.target.closest('a');
|
|
680
|
+
if(a&&a.hostname!==location.hostname){
|
|
681
|
+
t('outbound',{url:a.href});
|
|
682
|
+
}
|
|
683
|
+
});`:"";return`
|
|
684
|
+
<!-- Self-Hosted Analytics -->
|
|
685
|
+
<script data-site="${k}" data-api="${E}" defer>
|
|
686
|
+
(function(){
|
|
687
|
+
'use strict';
|
|
688
|
+
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
689
|
+
var site=s.dataset.site,api=s.dataset.api;
|
|
690
|
+
${C}
|
|
691
|
+
var q=[],sid=Math.random().toString(36).slice(2);
|
|
692
|
+
function t(e,p){
|
|
693
|
+
var x=new XMLHttpRequest();
|
|
694
|
+
x.open('POST',api+'/collect',true);
|
|
695
|
+
x.setRequestHeader('Content-Type','application/json');
|
|
696
|
+
x.send(JSON.stringify({
|
|
697
|
+
s:site,sid:sid,e:e,p:p||{},
|
|
698
|
+
u:location.href,r:d.referrer,t:d.title,
|
|
699
|
+
sw:screen.width,sh:screen.height
|
|
700
|
+
}));
|
|
701
|
+
}
|
|
702
|
+
function pv(){t('pageview');}
|
|
703
|
+
${j}
|
|
704
|
+
${L}
|
|
705
|
+
if(d.readyState==='complete')pv();
|
|
706
|
+
else w.addEventListener('load',pv);
|
|
707
|
+
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
708
|
+
})();
|
|
709
|
+
</script>
|
|
710
|
+
`}function Uh(x){let v=x.custom;if(!v)return"";if(v.inlineScript)return`
|
|
711
|
+
<!-- Custom Analytics -->
|
|
712
|
+
<script>
|
|
713
|
+
${v.inlineScript}
|
|
714
|
+
</script>
|
|
715
|
+
`;if(!v.scriptUrl)return"";let k=[];if(v.scriptId)k.push(`id="${mn(v.scriptId)}"`);if(v.attributes)for(let[C,j]of Object.entries(v.attributes))k.push(`${mn(C)}="${mn(j)}"`);return`
|
|
716
|
+
<!-- Custom Analytics -->
|
|
717
|
+
<script${k.length>0?` ${k.join(" ")}`:""} src="${mn(v.scriptUrl)}" defer></script>
|
|
718
|
+
`}function Ad(x,v){let k=Bh(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 mn(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Hh={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 Id(x){let v=x.heatmap;if(!v?.enabled)return"";let k={...Hh,...v};return`
|
|
719
|
+
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
720
|
+
<script>
|
|
721
|
+
(function() {
|
|
722
|
+
'use strict';
|
|
723
|
+
|
|
724
|
+
// Configuration
|
|
725
|
+
var config = ${JSON.stringify({trackMouse:k.trackMouse,trackClicks:k.trackClicks,trackScroll:k.trackScroll,samplingRate:k.samplingRate,honorDnt:k.honorDnt,endpoint:k.endpoint,batchSize:k.batchSize,maxDataPoints:k.maxDataPoints,sessionTimeout:k.sessionTimeout,persistData:k.persistData,storagePrefix:k.storagePrefix,captureAttributes:k.captureAttributes,ignoreSelectors:k.ignoreSelectors,zones:k.zones,debugOverlay:k.debugOverlay,minViewportWidth:k.minViewportWidth,maxViewportWidth:k.maxViewportWidth})};
|
|
726
|
+
|
|
727
|
+
// Check Do Not Track
|
|
728
|
+
if (config.honorDnt && navigator.doNotTrack === '1') {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// Check viewport constraints
|
|
733
|
+
var vw = window.innerWidth;
|
|
734
|
+
if (config.minViewportWidth && vw < config.minViewportWidth) return;
|
|
735
|
+
if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
|
|
736
|
+
|
|
737
|
+
// Session management (anonymous, no cookies)
|
|
738
|
+
var session = {
|
|
739
|
+
sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
|
|
740
|
+
page: location.pathname,
|
|
741
|
+
vw: window.innerWidth,
|
|
742
|
+
vh: window.innerHeight,
|
|
743
|
+
points: [],
|
|
744
|
+
started: Date.now(),
|
|
745
|
+
lastActivity: Date.now()
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
// Throttle helper
|
|
749
|
+
var lastMove = 0;
|
|
750
|
+
function throttle(fn, wait) {
|
|
751
|
+
return function() {
|
|
752
|
+
var now = Date.now();
|
|
753
|
+
if (now - lastMove >= wait) {
|
|
754
|
+
lastMove = now;
|
|
755
|
+
fn.apply(this, arguments);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// Get relative coordinates (percentage)
|
|
761
|
+
function getRelativeCoords(e) {
|
|
762
|
+
return {
|
|
763
|
+
x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
|
|
764
|
+
y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// Check if element should be ignored
|
|
769
|
+
function shouldIgnore(el) {
|
|
770
|
+
if (!el || !config.ignoreSelectors) return false;
|
|
771
|
+
for (var i = 0; i < config.ignoreSelectors.length; i++) {
|
|
772
|
+
if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
|
|
773
|
+
if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
|
|
774
|
+
}
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// Get element selector (simplified, no IDs to preserve privacy)
|
|
779
|
+
function getSelector(el) {
|
|
780
|
+
if (!el || !el.tagName) return null;
|
|
781
|
+
var tag = el.tagName.toLowerCase();
|
|
782
|
+
var classes = el.className && typeof el.className === 'string'
|
|
783
|
+
? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
|
|
784
|
+
: '';
|
|
785
|
+
return tag + classes;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// Find zone for element
|
|
789
|
+
function findZone(el) {
|
|
790
|
+
if (!config.zones || !el) return null;
|
|
791
|
+
for (var i = 0; i < config.zones.length; i++) {
|
|
792
|
+
var zone = config.zones[i];
|
|
793
|
+
if (el.closest && el.closest(zone.selector)) {
|
|
794
|
+
return zone.id;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// Capture custom attributes
|
|
801
|
+
function captureAttributes(el) {
|
|
802
|
+
if (!config.captureAttributes || !el) return null;
|
|
803
|
+
var attrs = {};
|
|
804
|
+
var hasAttrs = false;
|
|
805
|
+
for (var i = 0; i < config.captureAttributes.length; i++) {
|
|
806
|
+
var attr = config.captureAttributes[i];
|
|
807
|
+
var value = el.getAttribute && el.getAttribute(attr);
|
|
808
|
+
if (value) {
|
|
809
|
+
attrs[attr] = value;
|
|
810
|
+
hasAttrs = true;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return hasAttrs ? attrs : null;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// Add data point
|
|
817
|
+
function addPoint(point) {
|
|
818
|
+
session.lastActivity = Date.now();
|
|
819
|
+
if (session.points.length >= config.maxDataPoints) {
|
|
820
|
+
session.points.shift();
|
|
821
|
+
}
|
|
822
|
+
session.points.push(point);
|
|
823
|
+
|
|
824
|
+
// Send batch if threshold reached
|
|
825
|
+
if (config.endpoint && session.points.length >= config.batchSize) {
|
|
826
|
+
sendData();
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// Send data to endpoint
|
|
831
|
+
function sendData() {
|
|
832
|
+
if (!config.endpoint || session.points.length === 0) return;
|
|
833
|
+
|
|
834
|
+
var data = {
|
|
835
|
+
sid: session.sid,
|
|
836
|
+
page: session.page,
|
|
837
|
+
vw: session.vw,
|
|
838
|
+
vh: session.vh,
|
|
839
|
+
points: session.points.splice(0, config.batchSize)
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
// Use sendBeacon for reliability
|
|
843
|
+
if (navigator.sendBeacon) {
|
|
844
|
+
navigator.sendBeacon(config.endpoint, JSON.stringify(data));
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
var xhr = new XMLHttpRequest();
|
|
848
|
+
xhr.open('POST', config.endpoint, true);
|
|
849
|
+
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
850
|
+
xhr.send(JSON.stringify(data));
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// Mouse move handler
|
|
855
|
+
if (config.trackMouse) {
|
|
856
|
+
document.addEventListener('mousemove', throttle(function(e) {
|
|
857
|
+
if (shouldIgnore(e.target)) return;
|
|
858
|
+
var coords = getRelativeCoords(e);
|
|
859
|
+
addPoint({
|
|
860
|
+
x: coords.x,
|
|
861
|
+
y: coords.y,
|
|
862
|
+
type: 'move',
|
|
863
|
+
t: Date.now(),
|
|
864
|
+
zone: findZone(e.target)
|
|
865
|
+
});
|
|
866
|
+
}, config.samplingRate), { passive: true });
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// Click handler
|
|
870
|
+
if (config.trackClicks) {
|
|
871
|
+
document.addEventListener('click', function(e) {
|
|
872
|
+
if (shouldIgnore(e.target)) return;
|
|
873
|
+
var coords = getRelativeCoords(e);
|
|
874
|
+
var point = {
|
|
875
|
+
x: coords.x,
|
|
876
|
+
y: coords.y,
|
|
877
|
+
type: 'click',
|
|
878
|
+
t: Date.now(),
|
|
879
|
+
el: getSelector(e.target),
|
|
880
|
+
zone: findZone(e.target)
|
|
881
|
+
};
|
|
882
|
+
var attrs = captureAttributes(e.target);
|
|
883
|
+
if (attrs) point.attrs = attrs;
|
|
884
|
+
addPoint(point);
|
|
885
|
+
}, { passive: true });
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// Scroll handler
|
|
889
|
+
if (config.trackScroll) {
|
|
890
|
+
var lastScrollDepth = 0;
|
|
891
|
+
document.addEventListener('scroll', throttle(function() {
|
|
892
|
+
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
893
|
+
var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
|
|
894
|
+
var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
|
|
895
|
+
|
|
896
|
+
// Only track significant scroll changes (every 10%)
|
|
897
|
+
if (Math.abs(depth - lastScrollDepth) >= 10) {
|
|
898
|
+
lastScrollDepth = depth;
|
|
899
|
+
addPoint({
|
|
900
|
+
x: 50,
|
|
901
|
+
y: depth,
|
|
902
|
+
type: 'scroll',
|
|
903
|
+
t: Date.now(),
|
|
904
|
+
depth: depth
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
}, config.samplingRate * 2), { passive: true });
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// Send remaining data on page unload
|
|
911
|
+
window.addEventListener('beforeunload', sendData);
|
|
912
|
+
window.addEventListener('visibilitychange', function() {
|
|
913
|
+
if (document.visibilityState === 'hidden') {
|
|
914
|
+
sendData();
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
// Persist data to localStorage if enabled
|
|
919
|
+
if (config.persistData) {
|
|
920
|
+
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
921
|
+
|
|
922
|
+
// Load existing data
|
|
923
|
+
try {
|
|
924
|
+
var stored = localStorage.getItem(storageKey);
|
|
925
|
+
if (stored) {
|
|
926
|
+
var parsed = JSON.parse(stored);
|
|
927
|
+
if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
|
|
928
|
+
session.points = parsed.points || [];
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
catch (e) {}
|
|
933
|
+
|
|
934
|
+
// Save periodically
|
|
935
|
+
setInterval(function() {
|
|
936
|
+
try {
|
|
937
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
938
|
+
points: session.points,
|
|
939
|
+
lastActivity: session.lastActivity
|
|
940
|
+
}));
|
|
941
|
+
}
|
|
942
|
+
catch (e) {}
|
|
943
|
+
}, 5000);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// Debug overlay
|
|
947
|
+
if (config.debugOverlay) {
|
|
948
|
+
var overlay = document.createElement('div');
|
|
949
|
+
overlay.id = 'stx-heatmap-overlay';
|
|
950
|
+
overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
|
|
951
|
+
document.body.appendChild(overlay);
|
|
952
|
+
|
|
953
|
+
var canvas = document.createElement('canvas');
|
|
954
|
+
canvas.width = window.innerWidth;
|
|
955
|
+
canvas.height = window.innerHeight;
|
|
956
|
+
canvas.style.cssText = 'width:100%;height:100%;';
|
|
957
|
+
overlay.appendChild(canvas);
|
|
958
|
+
var ctx = canvas.getContext('2d');
|
|
959
|
+
|
|
960
|
+
function renderOverlay() {
|
|
961
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
962
|
+
session.points.forEach(function(p) {
|
|
963
|
+
var x = (p.x / 100) * canvas.width;
|
|
964
|
+
var y = (p.y / 100) * canvas.height;
|
|
965
|
+
ctx.beginPath();
|
|
966
|
+
ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
|
|
967
|
+
ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
|
|
968
|
+
ctx.fill();
|
|
969
|
+
});
|
|
970
|
+
requestAnimationFrame(renderOverlay);
|
|
971
|
+
}
|
|
972
|
+
renderOverlay();
|
|
973
|
+
|
|
974
|
+
window.addEventListener('resize', function() {
|
|
975
|
+
canvas.width = window.innerWidth;
|
|
976
|
+
canvas.height = window.innerHeight;
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// Expose API for manual tracking and data export
|
|
981
|
+
window.stxHeatmap = {
|
|
982
|
+
// Get current session data
|
|
983
|
+
getData: function() {
|
|
984
|
+
return {
|
|
985
|
+
sid: session.sid,
|
|
986
|
+
page: session.page,
|
|
987
|
+
vw: session.vw,
|
|
988
|
+
vh: session.vh,
|
|
989
|
+
points: session.points.slice(),
|
|
990
|
+
started: session.started,
|
|
991
|
+
lastActivity: session.lastActivity
|
|
992
|
+
};
|
|
993
|
+
},
|
|
994
|
+
// Export data as JSON
|
|
995
|
+
exportJSON: function() {
|
|
996
|
+
return JSON.stringify(this.getData(), null, 2);
|
|
997
|
+
},
|
|
998
|
+
// Export data as CSV
|
|
999
|
+
exportCSV: function() {
|
|
1000
|
+
var data = this.getData();
|
|
1001
|
+
var lines = ['x,y,type,timestamp,element,zone,depth'];
|
|
1002
|
+
data.points.forEach(function(p) {
|
|
1003
|
+
lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
|
|
1004
|
+
});
|
|
1005
|
+
return lines.join('\\n');
|
|
1006
|
+
},
|
|
1007
|
+
// Manual data send
|
|
1008
|
+
flush: function() {
|
|
1009
|
+
sendData();
|
|
1010
|
+
},
|
|
1011
|
+
// Clear data
|
|
1012
|
+
clear: function() {
|
|
1013
|
+
session.points = [];
|
|
1014
|
+
if (config.persistData) {
|
|
1015
|
+
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
1016
|
+
try { localStorage.removeItem(storageKey); }
|
|
1017
|
+
catch (e) {}
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
// Add custom event
|
|
1021
|
+
track: function(type, data) {
|
|
1022
|
+
addPoint({
|
|
1023
|
+
x: data && data.x || 0,
|
|
1024
|
+
y: data && data.y || 0,
|
|
1025
|
+
type: type,
|
|
1026
|
+
t: Date.now(),
|
|
1027
|
+
attrs: data
|
|
1028
|
+
});
|
|
1029
|
+
},
|
|
1030
|
+
// Generate heatmap visualization
|
|
1031
|
+
visualize: function(options) {
|
|
1032
|
+
options = options || {};
|
|
1033
|
+
var data = this.getData();
|
|
1034
|
+
var width = options.width || data.vw;
|
|
1035
|
+
var height = options.height || data.vh;
|
|
1036
|
+
var radius = options.radius || 20;
|
|
1037
|
+
var blur = options.blur || 15;
|
|
1038
|
+
var maxOpacity = options.maxOpacity || 0.6;
|
|
1039
|
+
|
|
1040
|
+
var canvas = document.createElement('canvas');
|
|
1041
|
+
canvas.width = width;
|
|
1042
|
+
canvas.height = height;
|
|
1043
|
+
var ctx = canvas.getContext('2d');
|
|
1044
|
+
|
|
1045
|
+
// Create heat points
|
|
1046
|
+
data.points.forEach(function(p) {
|
|
1047
|
+
var x = (p.x / 100) * width;
|
|
1048
|
+
var y = (p.y / 100) * height;
|
|
1049
|
+
var intensity = p.type === 'click' ? 1 : 0.3;
|
|
1050
|
+
|
|
1051
|
+
var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
|
|
1052
|
+
gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
|
|
1053
|
+
gradient.addColorStop(1, 'rgba(255,0,0,0)');
|
|
1054
|
+
ctx.fillStyle = gradient;
|
|
1055
|
+
ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
// Apply blur
|
|
1059
|
+
ctx.filter = 'blur(' + blur + 'px)';
|
|
1060
|
+
ctx.drawImage(canvas, 0, 0);
|
|
1061
|
+
ctx.filter = 'none';
|
|
1062
|
+
|
|
1063
|
+
// Colorize
|
|
1064
|
+
var imageData = ctx.getImageData(0, 0, width, height);
|
|
1065
|
+
var pixels = imageData.data;
|
|
1066
|
+
for (var i = 0; i < pixels.length; i += 4) {
|
|
1067
|
+
var alpha = pixels[i + 3];
|
|
1068
|
+
if (alpha > 0) {
|
|
1069
|
+
var ratio = alpha / 255;
|
|
1070
|
+
// Gradient: blue -> cyan -> green -> yellow -> red
|
|
1071
|
+
if (ratio < 0.25) {
|
|
1072
|
+
pixels[i] = 0;
|
|
1073
|
+
pixels[i + 1] = Math.round(ratio * 4 * 255);
|
|
1074
|
+
pixels[i + 2] = 255;
|
|
1075
|
+
}
|
|
1076
|
+
else if (ratio < 0.5) {
|
|
1077
|
+
pixels[i] = 0;
|
|
1078
|
+
pixels[i + 1] = 255;
|
|
1079
|
+
pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
|
|
1080
|
+
}
|
|
1081
|
+
else if (ratio < 0.75) {
|
|
1082
|
+
pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
|
|
1083
|
+
pixels[i + 1] = 255;
|
|
1084
|
+
pixels[i + 2] = 0;
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
pixels[i] = 255;
|
|
1088
|
+
pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
|
|
1089
|
+
pixels[i + 2] = 0;
|
|
1090
|
+
}
|
|
1091
|
+
pixels[i + 3] = Math.round(alpha * maxOpacity);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
ctx.putImageData(imageData, 0, 0);
|
|
1095
|
+
|
|
1096
|
+
return canvas;
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
})();
|
|
1100
|
+
</script>
|
|
1101
|
+
`}function Pd(x,v){let k=Id(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 Dd={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=qh(v.join(" "));C.heatmap={...C.heatmap,...j,enabled:!0}}return Id(C)}};function qh(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 er={duration:300,delay:0,ease:"ease",direction:"both"};function Kh(x,v={}){let{duration:k,delay:E,ease:C,direction:j,custom:L}={...er,...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
|
+
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1103
|
+
@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
|
+
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
1105
|
+
@keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${j==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); 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);"}
|
|
1106
|
+
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
|
|
1107
|
+
@keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${j==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(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);"}
|
|
1108
|
+
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1109
|
+
@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
|
+
@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 Xh(){return`
|
|
1112
|
+
<script data-stx-scoped data-stx-run="once">
|
|
1113
|
+
// Motion preferences handling
|
|
1114
|
+
(function() {
|
|
1115
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
1116
|
+
|
|
1117
|
+
if (prefersReducedMotion) {
|
|
1118
|
+
// Apply reduced motion settings
|
|
1119
|
+
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1120
|
+
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
// Listen for changes in preference
|
|
1127
|
+
window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
|
|
1128
|
+
if (e.matches) {
|
|
1129
|
+
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1130
|
+
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1131
|
+
}
|
|
1132
|
+
else {
|
|
1133
|
+
document.documentElement.style.setProperty('--stx-transition-duration', '');
|
|
1134
|
+
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
})();
|
|
1138
|
+
</script>
|
|
1139
|
+
`}function Zh(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 Gh(x=0.1,v="0px"){return`
|
|
1140
|
+
<script data-stx-scoped data-stx-run="always">
|
|
1141
|
+
// Intersection Observer for scroll animations
|
|
1142
|
+
(function() {
|
|
1143
|
+
const initObserver = () => {
|
|
1144
|
+
if (!('IntersectionObserver' in window)) {
|
|
1145
|
+
// For browsers that don't support IntersectionObserver, show all elements immediately
|
|
1146
|
+
const elements = document.querySelectorAll('.stx-observe');
|
|
1147
|
+
elements.forEach(el => el.classList.remove('stx-out'));
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// Create the observer
|
|
1152
|
+
const options = {
|
|
1153
|
+
root: null, // Use viewport
|
|
1154
|
+
rootMargin: '${v}',
|
|
1155
|
+
threshold: ${x}
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
const observer = new IntersectionObserver((entries) => {
|
|
1159
|
+
entries.forEach(entry => {
|
|
1160
|
+
if (entry.isIntersecting) {
|
|
1161
|
+
entry.target.classList.remove('stx-out');
|
|
1162
|
+
// Stop observing after animation is triggered
|
|
1163
|
+
observer.unobserve(entry.target);
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
}, options);
|
|
1167
|
+
|
|
1168
|
+
// Start observing elements
|
|
1169
|
+
const elements = document.querySelectorAll('.stx-observe');
|
|
1170
|
+
elements.forEach(el => observer.observe(el));
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// Initialize observer when DOM is ready
|
|
1174
|
+
if (document.readyState === 'loading') {
|
|
1175
|
+
document.addEventListener('DOMContentLoaded', initObserver);
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
initObserver();
|
|
1179
|
+
}
|
|
1180
|
+
})();
|
|
1181
|
+
</script>
|
|
1182
|
+
`}function Jh(){return`
|
|
1183
|
+
<style id="stx-animation-base">
|
|
1184
|
+
:root {
|
|
1185
|
+
--stx-transition-duration: 300ms;
|
|
1186
|
+
--stx-transition-delay: 0ms;
|
|
1187
|
+
--stx-transition-ease: ease;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1191
|
+
:root {
|
|
1192
|
+
--stx-transition-duration: 0ms;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
[data-animate="false"] * {
|
|
1197
|
+
--stx-transition-duration: 0ms !important;
|
|
1198
|
+
animation-duration: 0ms !important;
|
|
1199
|
+
transition-duration: 0ms !important;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/* Base transition classes */
|
|
1203
|
+
.stx-transition {
|
|
1204
|
+
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1205
|
+
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1206
|
+
backface-visibility: hidden; /* Improve animation performance */
|
|
1207
|
+
transform-style: preserve-3d; /* Better 3D transforms */
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/* Fade animations */
|
|
1211
|
+
.stx-fade {
|
|
1212
|
+
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
.stx-fade.stx-out {
|
|
1216
|
+
opacity: 0 !important;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/* Scale animations */
|
|
1220
|
+
.stx-scale {
|
|
1221
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1222
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.stx-scale.stx-out {
|
|
1226
|
+
transform: scale(0.85) !important;
|
|
1227
|
+
opacity: 0 !important;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/* Flip animations */
|
|
1231
|
+
.stx-flip {
|
|
1232
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1233
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1234
|
+
perspective: 600px;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.stx-flip.stx-out {
|
|
1238
|
+
transform: perspective(600px) rotateX(-90deg) !important;
|
|
1239
|
+
opacity: 0 !important;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/* Rotate animations */
|
|
1243
|
+
.stx-rotate {
|
|
1244
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1245
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.stx-rotate.stx-out {
|
|
1249
|
+
transform: rotate(-90deg) !important;
|
|
1250
|
+
opacity: 0 !important;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/* Direction-based animations */
|
|
1254
|
+
.stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
|
|
1255
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1256
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
.stx-from-left.stx-out {
|
|
1260
|
+
transform: translateX(-30px) !important;
|
|
1261
|
+
opacity: 0 !important;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.stx-from-right.stx-out {
|
|
1265
|
+
transform: translateX(30px) !important;
|
|
1266
|
+
opacity: 0 !important;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.stx-from-top.stx-out {
|
|
1270
|
+
transform: translateY(-30px) !important;
|
|
1271
|
+
opacity: 0 !important;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.stx-from-bottom.stx-out {
|
|
1275
|
+
transform: translateY(30px) !important;
|
|
1276
|
+
opacity: 0 !important;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/* Generic slide animations */
|
|
1280
|
+
.stx-slide {
|
|
1281
|
+
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1282
|
+
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
.stx-slide.stx-out {
|
|
1286
|
+
transform: translateY(30px) !important;
|
|
1287
|
+
opacity: 0 !important;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/* Scroll animation observer class */
|
|
1291
|
+
.stx-observe {
|
|
1292
|
+
will-change: opacity, transform;
|
|
1293
|
+
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1294
|
+
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1295
|
+
}
|
|
1296
|
+
</style>
|
|
1297
|
+
`}function Yh(x,v,k={}){let{staggerDelay:E=50,sequence:C=!1}=k;return`
|
|
1298
|
+
<script data-stx-scoped data-stx-run="always">
|
|
1299
|
+
// Animation Group: ${x}
|
|
1300
|
+
(function() {
|
|
1301
|
+
const elements = ${JSON.stringify(v)};
|
|
1302
|
+
const staggerDelay = ${E};
|
|
1303
|
+
const sequence = ${C};
|
|
1304
|
+
|
|
1305
|
+
function animateGroup() {
|
|
1306
|
+
elements.forEach((selector, index) => {
|
|
1307
|
+
const element = document.querySelector(selector);
|
|
1308
|
+
if (!element) return;
|
|
1309
|
+
|
|
1310
|
+
const delay = sequence ? index * staggerDelay : 0;
|
|
1311
|
+
element.style.setProperty('--stx-transition-delay', delay + 'ms');
|
|
1312
|
+
|
|
1313
|
+
// For elements using animation keyframes
|
|
1314
|
+
element.style.animationDelay = delay + 'ms';
|
|
1315
|
+
|
|
1316
|
+
// If the element is initially hidden, show it
|
|
1317
|
+
if (element.classList.contains('stx-out')) {
|
|
1318
|
+
setTimeout(() => {
|
|
1319
|
+
element.classList.remove('stx-out');
|
|
1320
|
+
}, 10); // Small delay to ensure styles are applied
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// Run when DOM is fully loaded
|
|
1326
|
+
if (document.readyState === 'loading') {
|
|
1327
|
+
document.addEventListener('DOMContentLoaded', animateGroup);
|
|
1328
|
+
}
|
|
1329
|
+
else {
|
|
1330
|
+
animateGroup();
|
|
1331
|
+
}
|
|
1332
|
+
})();
|
|
1333
|
+
</script>
|
|
1334
|
+
`}var Md={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)||er.duration:er.duration,L=v.length>2?v[2]||er.ease:er.ease,B=v.length>3?Number.parseInt(v[3],10)||er.delay:er.delay,z=v.length>4?v[4]||er.direction:er.direction,F=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=Kh(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":""}"
|
|
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"},Od={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)}`,K=`--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="${K}" data-threshold="${B}">${x}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Nd={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=Yh(C,j,{staggerDelay:L,sequence:B});return`${x}
|
|
1336
|
+
${z}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},jd={name:"motion",handler:(x,v,k,E)=>{let C=v.length>0?v[0].toLowerCase()==="true":!0,j=Xh();return`<div data-animate="${C?"auto":"true"}">${x}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Ld(x,v,k,E){let C=x;if(E.animation?.enabled===!1)return C;let j=k.includes("test")&&k.includes("animation");if(!Zh(C)&&!j)return C;if(!C.includes('<style id="stx-animation-base">')){let B=Jh();C=C.replace("</head>",`${B}
|
|
1337
|
+
</head>`)}if(C.includes("stx-observe")){if(!C.includes("Intersection Observer for scroll animations")){let z=Gh(),F=C.lastIndexOf("</body>");if(F!==-1)C=C.slice(0,F)+z+`
|
|
1338
|
+
`+C.slice(F)}}return C}function Ne(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 Bd(x){let v=x?.layout;if(v===!1)return!1;return typeof v==="string"&&v.trim()?v.trim():void 0}var Qh=100,ey=599,Sc="__stxResponseStatus",zs="__stxResponseHeaders";function Ci(x){return typeof x==="number"&&Number.isInteger(x)&&x>=Qh&&x<=ey}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(Ci(E))return E}return}function wc(x,v){if(!x||typeof x!=="object")return!1;let k=typeof v==="string"&&/^\d+$/.test(v.trim())?Number(v.trim()):v;if(!Ci(k))return!1;return x[Sc]=k,!0}function ty(x,v,k){if(!x||typeof x!=="object")return;let E=String(v??"").trim();if(!E)return;x[zs]={...x[zs],[E]:String(k)}}function Le(x){let v=x?.[Sc];return Ci(v)?v:void 0}function je(x){let v=x?.[zs];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 Ni(x,v){if(!x||!v||x===v||typeof v!=="object")return;let k=Le(x);if(k!==void 0)v[Sc]=k;let E=je(x);if(E)v[zs]={...v[zs],...E}}function Dn(x){return{setResponseStatus:(v)=>{wc(x,v)},notFound:(v=404)=>{let k=Ci(v)&&v>=400?v:404;wc(x,k)},setResponseHeader:(v,k)=>{ty(x,v,k)}}}function zd(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 K=ny(x,F.index+F[0].length-1);if(K<0)break;let G=x.slice(F.index+F[0].length,K).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(!wc(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=K+1+(x.slice(K+1).match(/^[^\S\n]*\n?/)?.[0].length??0),z.lastIndex=B}return B===0?x:L+x.slice(B)}function ny(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 ry=0,sy=0;function Fd(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 iy(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=Fd(L,"x-data");if(!z)continue;let F=`__stx_scope_${ry++}`,K=Fd(L,"x-init"),G=oy(x,j,B+C.length),J=x.slice(B,G.endIndex),ne=ay(J);v.push({id:F,selector:`[data-stx-scope="${F}"]`,stateExpr:z,initExpr:K,bindings:[],refs:ne})}return v}function oy(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),K=B.exec(x);if(K&&K.index<(z?.index??1/0)){C=K.index+K[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 ay(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=cy(j);v.set(L,B)}return v}function cy(x){let v=x.match(/\bid\s*=\s*["']([^"']*)["']/);if(v)return v[1];return`__stx_el_${sy++}`}function ly(){return`
|
|
1339
|
+
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1340
|
+
(function() {
|
|
1341
|
+
var style = document.createElement('style');
|
|
1342
|
+
style.textContent = [
|
|
1343
|
+
'[x-cloak] { display: none !important; }',
|
|
1344
|
+
// Default transition classes
|
|
1345
|
+
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
1346
|
+
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
1347
|
+
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
1348
|
+
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
1349
|
+
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
1350
|
+
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
1351
|
+
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
1352
|
+
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
1353
|
+
].join('\\n');
|
|
1354
|
+
document.head.appendChild(style);
|
|
1355
|
+
})();
|
|
1356
|
+
|
|
1357
|
+
// STX Reactive Runtime
|
|
1358
|
+
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
1359
|
+
window.__stx_reactive = (function() {
|
|
1360
|
+
'use strict';
|
|
1361
|
+
|
|
1362
|
+
// Deep reactive proxy that triggers onChange for any mutation
|
|
1363
|
+
function reactive(obj, onChange) {
|
|
1364
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
1365
|
+
return new Proxy(obj, {
|
|
1366
|
+
get(target, prop) {
|
|
1367
|
+
const value = target[prop];
|
|
1368
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
1369
|
+
return reactive(value, onChange);
|
|
1370
|
+
}
|
|
1371
|
+
return value;
|
|
1372
|
+
},
|
|
1373
|
+
set(target, prop, value) {
|
|
1374
|
+
target[prop] = value;
|
|
1375
|
+
onChange(prop, value);
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
1382
|
+
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
1383
|
+
function initScope(scopeEl, initialState, bindings, refs, initExpr) {
|
|
1384
|
+
// Parse initial state (may contain methods including async init())
|
|
1385
|
+
var state;
|
|
1386
|
+
try {
|
|
1387
|
+
state = new Function('return (' + initialState + ')')();
|
|
1388
|
+
} catch (e) {
|
|
1389
|
+
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// Build $refs object
|
|
1394
|
+
var $refs = {};
|
|
1395
|
+
for (var name in refs) {
|
|
1396
|
+
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
1397
|
+
(function(refName, refId) {
|
|
1398
|
+
Object.defineProperty($refs, refName, {
|
|
1399
|
+
get: function() { return document.getElementById(refId); }
|
|
1400
|
+
});
|
|
1401
|
+
})(name, refs[name]);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
// Extract init method from state if present (Alpine.js convention)
|
|
1406
|
+
var initMethod = state.init;
|
|
1407
|
+
if (typeof initMethod === 'function') {
|
|
1408
|
+
delete state.init;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
1412
|
+
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
1413
|
+
var stx = window.stx;
|
|
1414
|
+
|
|
1415
|
+
// Create signals for each state property so the signals runtime can track dependencies
|
|
1416
|
+
var signalState = {};
|
|
1417
|
+
var rawState = {};
|
|
1418
|
+
var derivedState = {};
|
|
1419
|
+
var accessors = {};
|
|
1420
|
+
// A getter must NOT be read here. Reading one calls it, and the old loop did
|
|
1421
|
+
// exactly that: the returned value is not a function, so it was wrapped as a
|
|
1422
|
+
// plain state() -- a snapshot of the answer at construction time, frozen
|
|
1423
|
+
// forever while plain properties beside it updated (#2053). A getter is a
|
|
1424
|
+
// derived value, so it is registered as one below, once ctxProxy exists for
|
|
1425
|
+
// it to read through.
|
|
1426
|
+
var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
|
|
1427
|
+
for (var key in state) {
|
|
1428
|
+
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
1429
|
+
var descriptor = ownDescriptors[key];
|
|
1430
|
+
if (descriptor && typeof descriptor.get === 'function') {
|
|
1431
|
+
accessors[key] = descriptor;
|
|
1432
|
+
continue;
|
|
1433
|
+
}
|
|
1434
|
+
if (typeof state[key] === 'function') {
|
|
1435
|
+
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
1436
|
+
signalState[key] = state[key];
|
|
1437
|
+
} else {
|
|
1438
|
+
// Data properties \u2014 wrap in signals for reactivity
|
|
1439
|
+
signalState[key] = stx.state(state[key]);
|
|
1440
|
+
rawState[key] = true;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
1446
|
+
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
1447
|
+
var ctx = {};
|
|
1448
|
+
var ctxProxy = new Proxy(ctx, {
|
|
1449
|
+
get: function(target, prop) {
|
|
1450
|
+
if (prop === '$refs') return $refs;
|
|
1451
|
+
if (prop === '$el') return scopeEl;
|
|
1452
|
+
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
1453
|
+
var s = signalState[prop];
|
|
1454
|
+
if (!s) return undefined;
|
|
1455
|
+
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
1456
|
+
return s.value; // unwrap signal
|
|
1457
|
+
}
|
|
1458
|
+
if (typeof s === 'function' && !rawState[prop]) {
|
|
1459
|
+
return s.bind(ctxProxy); // bind methods to proxy
|
|
1460
|
+
}
|
|
1461
|
+
return s;
|
|
1462
|
+
},
|
|
1463
|
+
set: function(target, prop, value) {
|
|
1464
|
+
var accessor = derivedState[prop];
|
|
1465
|
+
if (accessor) {
|
|
1466
|
+
// A getter/setter pair writes through its setter. A getter alone has
|
|
1467
|
+
// nowhere to put the value: a derived has no .value setter, so the
|
|
1468
|
+
// assignment would be a silent no-op, which is the same class of
|
|
1469
|
+
// failure as the stale read this replaces.
|
|
1470
|
+
if (typeof accessor.set === 'function') {
|
|
1471
|
+
accessor.set.call(ctxProxy, value);
|
|
1472
|
+
return true;
|
|
1473
|
+
}
|
|
1474
|
+
console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
|
|
1475
|
+
return true;
|
|
1476
|
+
}
|
|
1477
|
+
var s = signalState[prop];
|
|
1478
|
+
if (rawState[prop] && s && typeof s === 'function') {
|
|
1479
|
+
s.value = value; // write through signal \u2014 triggers effects
|
|
1480
|
+
} else {
|
|
1481
|
+
signalState[prop] = value;
|
|
1482
|
+
}
|
|
1483
|
+
return true;
|
|
1484
|
+
},
|
|
1485
|
+
has: function(target, prop) {
|
|
1486
|
+
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
|
|
1487
|
+
},
|
|
1488
|
+
ownKeys: function() {
|
|
1489
|
+
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
1490
|
+
},
|
|
1491
|
+
getOwnPropertyDescriptor: function(target, prop) {
|
|
1492
|
+
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
1493
|
+
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
1494
|
+
}
|
|
1495
|
+
return undefined;
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
|
|
1499
|
+
// Now that ctxProxy exists, a getter becomes a derived that reads through it,
|
|
1500
|
+
// so it tracks whatever it touches and recomputes when that changes. derived()
|
|
1501
|
+
// is lazy, so nothing is evaluated until a binding actually reads it.
|
|
1502
|
+
//
|
|
1503
|
+
// Marked rawState as well: that is what makes the proxy unwrap it and what
|
|
1504
|
+
// exposes the signal itself to the runtime below, which is where dependency
|
|
1505
|
+
// tracking comes from. A getter needs both, exactly like a data property.
|
|
1506
|
+
for (var accessorKey in accessors) {
|
|
1507
|
+
if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
|
|
1508
|
+
(function(name, descriptor) {
|
|
1509
|
+
signalState[name] = stx.derived(function() {
|
|
1510
|
+
return descriptor.get.call(ctxProxy);
|
|
1511
|
+
});
|
|
1512
|
+
rawState[name] = true;
|
|
1513
|
+
derivedState[name] = descriptor;
|
|
1514
|
+
})(accessorKey, accessors[accessorKey]);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
1519
|
+
// We need to provide getter/setter descriptors so signals track properly.
|
|
1520
|
+
var scopeVars = {};
|
|
1521
|
+
for (var k in signalState) {
|
|
1522
|
+
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
1523
|
+
if (rawState[k]) {
|
|
1524
|
+
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
1525
|
+
scopeVars[k] = signalState[k];
|
|
1526
|
+
} else {
|
|
1527
|
+
// Method: bind to ctxProxy so 'this' works
|
|
1528
|
+
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
scopeVars.$refs = $refs;
|
|
1533
|
+
scopeVars.$el = scopeEl;
|
|
1534
|
+
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
1535
|
+
|
|
1536
|
+
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
1537
|
+
if (!stx._scopes) stx._scopes = {};
|
|
1538
|
+
stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
1539
|
+
|
|
1540
|
+
// Store on element for findElementScope
|
|
1541
|
+
scopeEl.__stx_scope = scopeVars;
|
|
1542
|
+
|
|
1543
|
+
// Run init() if present (supports async)
|
|
1544
|
+
function runInit() {
|
|
1545
|
+
var maybePromise;
|
|
1546
|
+
if (initMethod) {
|
|
1547
|
+
maybePromise = initMethod.call(ctxProxy);
|
|
1548
|
+
}
|
|
1549
|
+
if (initExpr) {
|
|
1550
|
+
try {
|
|
1551
|
+
var keys = Object.keys(scopeVars);
|
|
1552
|
+
var vals = keys.map(function(k) { return scopeVars[k]; });
|
|
1553
|
+
var fn = new Function(keys.join(','), initExpr);
|
|
1554
|
+
var result = fn.apply(ctxProxy, vals);
|
|
1555
|
+
if (result && typeof result.then === 'function') maybePromise = result;
|
|
1556
|
+
} catch (e) {
|
|
1557
|
+
console.warn('[stx-reactive] init expression error:', e);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
// If init is async, signal updates will trigger effects automatically
|
|
1561
|
+
// when init() resolves and sets this.prop = value (writes through signal)
|
|
1562
|
+
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
1563
|
+
maybePromise.catch(function(e) {
|
|
1564
|
+
console.error('[stx-reactive] async init() error:', e);
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// Run init before the signals runtime processes this scope
|
|
1570
|
+
runInit();
|
|
1571
|
+
|
|
1572
|
+
// Expose for debugging
|
|
1573
|
+
scopeEl.__stx_state = ctxProxy;
|
|
1574
|
+
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
1575
|
+
try {
|
|
1576
|
+
// Run the statement with the reactive proxy as the lexical scope.
|
|
1577
|
+
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
1578
|
+
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
1579
|
+
// each state key as a local function parameter \u2014 bare assignments
|
|
1580
|
+
// would otherwise just rebind the local and never reach the signal.
|
|
1581
|
+
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
1582
|
+
fn.call(ctxProxy, $event, $el);
|
|
1583
|
+
} catch (e) {
|
|
1584
|
+
console.warn('[stx-reactive] execute error:', e);
|
|
1585
|
+
}
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
return { initScope: initScope, reactive: reactive };
|
|
1590
|
+
})();
|
|
1591
|
+
`}function Wd(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 K;try{K=b(B,v,!0)}catch{return z}if(K===void 0)return z;if(F){let G=String(K).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 K==="string"){let G=K.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(K)}}function uy(x,v){if(x.length===0)return"";let k=x.map((E)=>{let C=JSON.stringify(Object.fromEntries(E.refs)),j=Wd(E.stateExpr,v),L=E.initExpr?Wd(E.initExpr,v):null,B=JSON.stringify(j),z=L?JSON.stringify(L):"null";return`
|
|
1592
|
+
(function() {
|
|
1593
|
+
var scopeEl = document.querySelector('${E.selector}');
|
|
1594
|
+
if (!scopeEl) return;
|
|
1595
|
+
var refs = ${C};
|
|
1596
|
+
__stx_reactive.initScope(scopeEl, ${B}, [], refs, ${z});
|
|
1597
|
+
})();`}).join(`
|
|
1598
|
+
`);return`
|
|
1599
|
+
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1600
|
+
${ly()}
|
|
1601
|
+
${k}
|
|
1602
|
+
</script>`}function Vd(x,v,k){if(!fy(x))return x;let E=iy(x);if(E.length===0)return x;let C=dy(x,E),j=uy(E,v),L=C.lastIndexOf("</body>");if(L!==-1)C=C.slice(0,L)+j+`
|
|
1603
|
+
`+C.slice(L);else C+=j;return C}function dy(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 fy(x){return/x-data\s*=\s*["']/.test(x)}import Gy from"fs";import Oc from"path";import{createHighlighter as Jy}from"ts-syntax-highlighter";import xo from"fs";import an from"path";import{loadConfigWithResult as Uy}from"bunfig";async function py(x,v,k,E){let C=v[0]?.replace(/['"]/g,"")||"main",j=xe();if(C!=="main")j=j.replace("container:'main'",`container:'${C}'`);return`<script data-stx-router>${j}</script>`}var Ud={name:"stxRouter",handler:py,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function cr(x){return x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Hd(x){let v=x.trim().toLowerCase();return!v.startsWith("javascript:")&&!v.startsWith("vbscript:")&&!v.startsWith("data:text/html")}function Rn(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(`
|
|
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(),K=B.slice(z+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}j[F]=K}return{data:j,content:C.trim()}}function Ie(x,v={}){let{gfm:k=!0,breaks:E=!1}=v,C=x,j=[];if(C=C.replace(/```(\w*)\n([\s\S]*?)```/g,(K,G,J)=>{let ne=j.length,re=G?` class="language-${cr(G)}"`:"";return j.push(`<pre><code${re}>${cr(J.trim())}</code></pre>`),`\x00CODEBLOCK${ne}\x00`}),C=C.replace(/`([^`]*)`/g,(K,G)=>`<code>${cr(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,(K,G,J)=>`<img src="${Hd(J)?cr(J):""}" alt="${cr(G)}" />`),C=C.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,G,J)=>`<a href="${Hd(J)?cr(J):""}">${G}</a>`),C=C.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),C=C.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),C=C.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
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,(K,G,J)=>{let re=`<tr>${G.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${cr(oe)}</th>`).join("")}</tr>`,se=J.trim().split(`
|
|
1606
|
+
`).map((oe)=>`<tr>${oe.split("|").map((fe)=>fe.trim()).filter(Boolean).map((fe)=>`<td>${cr(fe)}</td>`).join("")}</tr>`).join(`
|
|
1607
|
+
`);return`<table>
|
|
1608
|
+
<thead>
|
|
1609
|
+
${re}
|
|
1610
|
+
</thead>
|
|
1611
|
+
<tbody>
|
|
1612
|
+
${se}
|
|
1613
|
+
</tbody>
|
|
1614
|
+
</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 K of L){let G=K.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
|
+
`)}</p>`),F=[],z=!1;B.push(K)}else z=!0,F.push(G)}if(z&&F.length>0)B.push(`<p>${F.join(E?`<br />
|
|
1618
|
+
`:`
|
|
1619
|
+
`)}</p>`);if(C=B.join(`
|
|
1620
|
+
`),E)C=C.replace(/\n/g,`<br />
|
|
1621
|
+
`);for(let K=0;K<j.length;K++)C=C.replace(`\x00CODEBLOCK${K}\x00`,j[K]);return C=C.replace(/<p>\s*<\/p>/g,""),C.trim()}async function qd(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]:"",K=B+L[0].length,G=1,J=K,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 fe=x[oe+9];if(fe==="("||fe===`
|
|
1622
|
+
`||fe==="\r"||fe===" "||fe===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(K,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:K}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=Ie(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,K,B);E=E.split(B).join(ne)}return E}async function Kd(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}),Ie(x.trim(),C)}var Nr=[320,480,640,768,1024,1280,1536,1920,2560],gy=[1,1.5,2,3],Fs=["avif","webp","jpeg"],my={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function $c(x,v=Nr,k={},E){return v.sort((C,j)=>C-j).map((C)=>`${Ws(x,{...k,w:C,fm:E})} ${C}w`).join(", ")}function Xd(x,v,k=gy,E={},C){return k.sort((j,L)=>j-L).map((j)=>{let L=Math.round(v*j);return`${Ws(x,{...E,w:L,dpr:j,fm:C})} ${j}x`}).join(", ")}function _c(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 Ws(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 kc(x){return my[x]||"application/octet-stream"}var hy={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Cc=`
|
|
1623
|
+
.stx-img-placeholder {
|
|
1624
|
+
position: relative;
|
|
1625
|
+
overflow: hidden;
|
|
1626
|
+
background-size: cover;
|
|
1627
|
+
background-position: center;
|
|
1628
|
+
background-repeat: no-repeat;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
.stx-img-placeholder img {
|
|
1632
|
+
opacity: 0;
|
|
1633
|
+
transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.stx-img-placeholder.stx-img-loaded img {
|
|
1637
|
+
opacity: 1;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
.stx-img-blur {
|
|
1641
|
+
filter: blur(20px);
|
|
1642
|
+
transform: scale(1.1);
|
|
1643
|
+
transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
|
|
1644
|
+
transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
.stx-img-loaded .stx-img-blur {
|
|
1648
|
+
filter: blur(0);
|
|
1649
|
+
transform: scale(1);
|
|
1650
|
+
}
|
|
1651
|
+
`.trim();async function yy(){try{return await import("ts-images")}catch{return null}}async function xy(x,v={}){let k={...hy,...v},E=await yy();if(E)try{return await by(x,k,E)}catch(C){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${C}`)}return vy(x,k)}async function by(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 vy(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 Zd(x,v,k={}){let E=k.transitionDuration||300,C=k.easing||"ease-out";return`
|
|
1652
|
+
#${x} {
|
|
1653
|
+
--stx-img-transition-duration: ${E}ms;
|
|
1654
|
+
--stx-img-transition-easing: ${C};
|
|
1655
|
+
background-image: url('${v.dataURL}');
|
|
1656
|
+
background-size: cover;
|
|
1657
|
+
background-position: center;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
#${x} img {
|
|
1661
|
+
opacity: 0;
|
|
1662
|
+
transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
#${x}.stx-img-loaded img {
|
|
1666
|
+
opacity: 1;
|
|
1667
|
+
}
|
|
1668
|
+
`.trim()}var Ec=new Map;async function Gd(x,v={}){let k=`${x}:${JSON.stringify(v)}`;if(Ec.has(k))return Ec.get(k);let E=await xy(x,v);return Ec.set(k,E),E}async function wy(){try{return await import("./chunk-rd2r9jvn.js")}catch(x){if(!Jd)console.warn("[stx-media] Image processor not available, some features disabled:",x),Jd=!0;return null}}var Jd=!1,Rc=80,oo="async",ao="lazy",Yd=!1;async function ro(x,v={}){let k=v,E=x;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return ky(E,k)}if(k.processedResult?.processed)return Ic(x,k.processedResult,v);if(k.responsiveVariants)return tf(x,k.responsiveVariants,v);let{src:C,alt:j,width:L,height:B,sizes:z,widths:F=Nr,dpr:K,formats:G=Fs,quality:J=Rc,params:ne={},placeholder:re="none",placeholderOptions:se={},lazy:oe=!0,priority:ie=!1,loading:fe=ie?"eager":ao,decoding:ue=oo,fetchpriority:be,objectFit:we,objectPosition:Se,crossorigin:$e,referrerpolicy:Ee}=x,{class:ke,style:Re,id:Ce}=x,_e=x.data||{},{isDev:Te=!1,baseUrl:Ke=""}=v;if(Te&&!v.optimize)return _y(x);let Pe,Ae,Ze=Ce||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!ie)try{Pe=await Gd(C,{strategy:re,...se}),Ae=Zd(Ze,Pe,se)}catch{}let tt=K!==void 0&&L!==void 0,ot;if(tt)ot=$y(x,Ze,Pe,v);else ot=await Sy(x,Ze,Pe,v);let nt;if(ie){let $t=G.includes("webp")?"webp":G[0],at=$c(C,F,{...ne,q:J},$t),It=typeof z==="object"?_c(z):z||"100vw";nt=`<link rel="preload" as="image" imagesrcset="${at}" imagesizes="${It}" />`}let _t=[];if(!Yd&&re!=="none")_t.push(Cc),Yd=!0;if(Ae)_t.push(Ae);let dt=oe?ef(Ze):void 0;return{html:ot,preloadLink:nt,css:_t.length>0?_t.join(`
|
|
1669
|
+
`):void 0,script:dt}}async function Sy(x,v,k,E){let{src:C,alt:j,width:L,height:B,sizes:z,widths:F=Nr,formats:K=Fs,quality:G=Rc,params:J={},lazy:ne=!0,priority:re=!1,loading:se=re?"eager":ao,decoding:oe=oo,fetchpriority:ie,objectFit:fe,objectPosition:ue,crossorigin:be,referrerpolicy:we}=x,{class:Se,style:$e}=x,Ee=x.data||{},ke=typeof z==="object"?_c(z):z||"100vw",Re=[];for(let Te of K){let Ke=$c(C,F,{...J,q:G},Te),Pe=kc(Te);if(ne&&!re)Re.push(` <source type="${Pe}" data-srcset="${Ke}" data-sizes="${ke}" />`);else Re.push(` <source type="${Pe}" srcset="${Ke}" sizes="${ke}" />`)}let Ce=Tc({src:Ws(C,{...J,q:G}),alt:j,width:L,height:B,loading:re?void 0:se,decoding:oe,fetchpriority:re?"high":ie,objectFit:fe,objectPosition:ue,crossorigin:be,referrerpolicy:we,className:Qd(Se,k),style:Ac($e,fe,ue,k),lazy:ne&&!re,data:Ee}),_e;if(k){let Te=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${v}" class="stx-img-placeholder" style="${Te}">
|
|
1670
|
+
<picture>
|
|
1671
|
+
${Re.join(`
|
|
1672
|
+
`)}
|
|
1673
|
+
<img ${Ce} />
|
|
1674
|
+
</picture>
|
|
1675
|
+
</div>`}else _e=`<picture${v?` id="${v}"`:""}>
|
|
1676
|
+
${Re.join(`
|
|
1677
|
+
`)}
|
|
1678
|
+
<img ${Ce} />
|
|
1679
|
+
</picture>`;return _e}function $y(x,v,k,E){let{src:C,alt:j,width:L,height:B,dpr:z=[1,2,3],quality:F=Rc,params:K={},lazy:G=!0,priority:J=!1,loading:ne=J?"eager":ao,decoding:re=oo,fetchpriority:se,objectFit:oe,objectPosition:ie,crossorigin:fe,referrerpolicy:ue}=x,{class:be,style:we}=x,Se=x.data||{},$e=typeof L==="number"?L:Number.parseInt(String(L),10),Ee=Xd(C,$e,z,{...K,q:F}),ke=Tc({src:Ws(C,{...K,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:fe,referrerpolicy:ue,className:Qd(be,k),style:Ac(we,oe,ie,k),lazy:G&&!J,data:Se}),Re=G&&!J?`data-srcset="${Ee}"`:`srcset="${Ee}"`;if(k){let Ce=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${v}" class="stx-img-placeholder" style="${Ce}">
|
|
1680
|
+
<img ${ke} ${Re} />
|
|
1681
|
+
</div>`}return`<img ${v?`id="${v}" `:""}${ke} ${Re} />`}function _y(x){let{src:v,alt:k,width:E,height:C,loading:j=ao,decoding:L=oo,fetchpriority:B,objectFit:z,objectPosition:F,crossorigin:K,referrerpolicy:G,priority:J=!1}=x,{class:ne,style:re,id:se}=x,oe=x.data||{};return{html:`<img ${Tc({src:v,alt:k,width:E,height:C,loading:J?"eager":j,decoding:L,fetchpriority:J?"high":B,objectFit:z,objectPosition:F,crossorigin:K,referrerpolicy:G,className:ne,style:Ac(re,z,F),id:se,data:oe})} />`}}function Tc(x){let v=[];if(x.lazy)v.push(`data-src="${Sn(x.src)}"`),v.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else v.push(`src="${Sn(x.src)}"`);if(v.push(`alt="${Sn(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="${Sn(x.className)}"`);if(x.style)v.push(`style="${Sn(x.style)}"`);if(x.id)v.push(`id="${Sn(x.id)}"`);if(x.data)for(let[k,E]of Object.entries(x.data))v.push(`data-${k}="${Sn(E)}"`);if(x.lazy)v.push("data-stx-lazy");return v.join(" ")}function Qd(x,v){let k=[];if(x)k.push(x);if(v)k.push("stx-img-blur");return k.join(" ")||""}function Ac(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 Sn(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function ef(x){return`
|
|
1682
|
+
(function() {
|
|
1683
|
+
const container = document.getElementById('${x}');
|
|
1684
|
+
if (!container) return;
|
|
1685
|
+
|
|
1686
|
+
const img = container.querySelector('img[data-stx-lazy]') || container;
|
|
1687
|
+
if (!img.dataset.src && !img.dataset.srcset) return;
|
|
1688
|
+
|
|
1689
|
+
const observer = new IntersectionObserver((entries) => {
|
|
1690
|
+
entries.forEach(entry => {
|
|
1691
|
+
if (entry.isIntersecting) {
|
|
1692
|
+
// Load image
|
|
1693
|
+
if (img.dataset.src) img.src = img.dataset.src;
|
|
1694
|
+
if (img.dataset.srcset) img.srcset = img.dataset.srcset;
|
|
1695
|
+
|
|
1696
|
+
// Load sources
|
|
1697
|
+
const sources = container.querySelectorAll('source[data-srcset]');
|
|
1698
|
+
sources.forEach(source => {
|
|
1699
|
+
if (source.dataset.srcset) source.srcset = source.dataset.srcset;
|
|
1700
|
+
if (source.dataset.sizes) source.sizes = source.dataset.sizes;
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1703
|
+
// Handle load completion
|
|
1704
|
+
img.onload = () => {
|
|
1705
|
+
img.style.opacity = '1';
|
|
1706
|
+
if (container.classList.contains('stx-img-placeholder')) {
|
|
1707
|
+
container.classList.add('stx-img-loaded');
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
|
|
1711
|
+
observer.disconnect();
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
}, { rootMargin: '50px' });
|
|
1715
|
+
|
|
1716
|
+
observer.observe(container);
|
|
1717
|
+
})();
|
|
1718
|
+
`.trim()}async function ky(x,v){let k=await wy();if(!k)return ro({...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 tf(x,j,v)}else{let j=await k.processImage(x.src,x,E);if(j.processed)return Ic(x,j,v)}return ro({...x,process:!1},v)}async function Ic(x,v,k){let{alt:E,width:C,height:j,lazy:L=!0,priority:B=!1,objectFit:z,objectPosition:F,crossorigin:K,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((Ae)=>Ae.format==="jpeg")||oe.find((Ae)=>Ae.format==="webp")||oe[0],fe=ie?.url||x.src,ue=oe.filter((Ae)=>Ae.format===(ie?.format||"jpeg")).map((Ae)=>`${Ae.url} ${Ae.width}w`).join(", "),be=new Map;for(let Ae of oe){if(!be.has(Ae.format))be.set(Ae.format,[]);be.get(Ae.format).push(Ae)}let we=[],Se=["avif","webp","jpeg","png"];for(let Ae of Se){let Ze=be.get(Ae);if(Ze&&Ze.length>0){let tt=Ze.map((nt)=>`${nt.url} ${nt.width}w`).join(", "),ot=kc(Ae);if(L&&!B)we.push(` <source type="${ot}" data-srcset="${tt}" />`);else we.push(` <source type="${ot}" srcset="${tt}" />`)}}let $e=[];if(L&&!B){if($e.push(`data-src="${Sn(fe)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ue)$e.push(`data-srcset="${ue}"`)}else if($e.push(`src="${Sn(fe)}"`),ue)$e.push(`srcset="${ue}"`);$e.push(`alt="${Sn(E)}"`);let Ee=C||v.originalWidth,ke=j||v.originalHeight;if(Ee)$e.push(`width="${Ee}"`);if(ke)$e.push(`height="${ke}"`);if(!B)$e.push(`loading="${L?"lazy":"eager"}"`);if($e.push('decoding="async"'),B)$e.push('fetchpriority="high"');if(K)$e.push(`crossorigin="${K}"`);if(G)$e.push(`referrerpolicy="${G}"`);let Re=[];if(z)Re.push(`object-fit: ${z}`);if(F)Re.push(`object-position: ${F}`);if(v.placeholder&&L)Re.push("opacity: 0; transition: opacity 300ms ease-out");if(ne)Re.push(ne);if(Re.length>0)$e.push(`style="${Re.join("; ")}"`);let Ce=[];if(J)Ce.push(J);if(v.placeholder)Ce.push("stx-img-blur");if(Ce.length>0)$e.push(`class="${Ce.join(" ")}"`);if(L&&!B)$e.push("data-stx-lazy");for(let[Ae,Ze]of Object.entries(se))$e.push(`data-${Ae}="${Sn(Ze)}"`);let _e;if(v.placeholder||v.dominantColor&&x.useDominantColor){let Ae=v.placeholder?`background-image: url('${v.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${v.dominantColor};`;_e=`<div id="${re}" class="stx-img-placeholder" style="${Ae}">
|
|
1719
|
+
<picture>
|
|
1720
|
+
${we.join(`
|
|
1721
|
+
`)}
|
|
1722
|
+
<img ${$e.join(" ")} />
|
|
1723
|
+
</picture>
|
|
1724
|
+
</div>`}else _e=`<picture${re?` id="${re}"`:""}>
|
|
1725
|
+
${we.join(`
|
|
1726
|
+
`)}
|
|
1727
|
+
<img ${$e.join(" ")} />
|
|
1728
|
+
</picture>`;let Te=[];if(v.placeholder)Te.push(Cc);let Ke=L?ef(re):void 0,Pe;if(B&&ue)Pe=`<link rel="preload" as="image" imagesrcset="${ue}" />`;return{html:_e,preloadLink:Pe,css:Te.length>0?Te.join(`
|
|
1729
|
+
`):void 0,script:Ke}}async function tf(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 Ic(x,E,k)}function Ey(){return Ue({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}=Cy(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||Nr,formats:L.formats||Fs,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 ro(B,{isDev:z}),K=F.html;if(F.preloadLink)K=F.preloadLink+`
|
|
1730
|
+
`+K;if(F.css)K+=`
|
|
1731
|
+
<style>${F.css}</style>`;if(F.script)K+=`
|
|
1732
|
+
<script>${F.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Cy(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=Ry(E),j=Pc(C[0],k)||"",L=Pc(C[1],k)||"",B={};if(C[2]){let z=Pc(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 Ry(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 Pc(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 nf=Ey();async function sf(){try{return await import("./chunk-0x076wz1.js")}catch(x){if(!rf)console.warn("[stx-media] Video processor not available, some features disabled:",x),rf=!0;return null}}var rf=!1,of=!0,af="metadata",Ty="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function lo(x,v={}){let k=v,E=x;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return My(E,k)}if(k.processedResult?.processed)return lf(x,k.processedResult,v);let C;if(E.generatePoster&&E.src&&!x.poster)C=await Oy(E,k);let{src:j,sources:L=[],poster:B,posterPlaceholder:z,controls:F=of,autoplay:K=!1,muted:G=!1,loop:J=!1,preload:ne=af,playsinline:re=!0,lazy:se=!0,player:oe="native",type:ie,width:fe,height:ue,crossorigin:be,disablePictureInPicture:we=!1,disableRemotePlayback:Se=!1}=x,$e=C||B,{class:Ee,style:ke}=x,Re=x.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return Iy(x,v);if(ie&&ie!=="video")return Ay(j||"",ie,x);let Ce=L.length>0?L:j?[{src:j,type:cf(j)}]:[],_e=[`id="${Re}"`];if(F)_e.push("controls");if(K)_e.push("autoplay");if(G)_e.push("muted");if(J)_e.push("loop");if(re)_e.push("playsinline");if(we)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(be)_e.push(`crossorigin="${be}"`);if(se){if(_e.push(`data-preload="${ne}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Vt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${ne}"`),$e)_e.push(`poster="${Vt($e)}"`);if(fe)_e.push(`width="${fe}"`);if(ue)_e.push(`height="${ue}"`);if(Ee)_e.push(`class="${Vt(Ee)}"`);if(ke)_e.push(`style="${Vt(ke)}"`);let Te=Ce.map((Ae)=>` <source ${se?`data-src="${Vt(Ae.src)}"`:`src="${Vt(Ae.src)}"`} type="${Ae.type}"${Ae.media?` media="${Ae.media}"`:""} />`).join(`
|
|
1733
|
+
`),Ke=`<video ${_e.join(" ")}>
|
|
1734
|
+
${Te}
|
|
1735
|
+
Your browser does not support the video tag.
|
|
1736
|
+
</video>`,Pe;if(se)Pe=`
|
|
1737
|
+
(function() {
|
|
1738
|
+
var video = document.getElementById('${Re}');
|
|
1739
|
+
if (!video) return;
|
|
1740
|
+
|
|
1741
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
1742
|
+
entries.forEach(function(entry) {
|
|
1743
|
+
if (entry.isIntersecting) {
|
|
1744
|
+
// Load poster
|
|
1745
|
+
if (video.dataset.poster) {
|
|
1746
|
+
video.poster = video.dataset.poster;
|
|
1747
|
+
delete video.dataset.poster;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
// Load sources
|
|
1751
|
+
var sources = video.querySelectorAll('source[data-src]');
|
|
1752
|
+
sources.forEach(function(source) {
|
|
1753
|
+
source.src = source.dataset.src;
|
|
1754
|
+
delete source.dataset.src;
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1757
|
+
// Set preload
|
|
1758
|
+
if (video.dataset.preload) {
|
|
1759
|
+
video.preload = video.dataset.preload;
|
|
1760
|
+
delete video.dataset.preload;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
video.load();
|
|
1764
|
+
observer.disconnect();
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
}, { rootMargin: '50px' });
|
|
1768
|
+
|
|
1769
|
+
observer.observe(video);
|
|
1770
|
+
})();
|
|
1771
|
+
`.trim();return{html:Ke,script:Pe}}function Ay(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=Py(x),z=F?`https://www.youtube-nocookie.com/embed/${F}`:x;break;case"vimeo":F=Dy(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 K=[`id="${B}"`,`src="${Vt(z)}"`,`width="${E}"`,`height="${C}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)K.push(`class="${Vt(j)}"`);if(L)K.push(`style="${Vt(L)}"`);if(k.lazy)K.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1772
|
+
<iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1773
|
+
</div>`}}function Iy(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:K=!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:K,preload:F,poster:C,controls:j,title:x.title},fe=["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
|
+
<div
|
|
1775
|
+
id="${oe}"
|
|
1776
|
+
class="ts-video-player${re?" "+Vt(re):""}"
|
|
1777
|
+
style="${fe}"
|
|
1778
|
+
data-ts-video-player
|
|
1779
|
+
data-config='${JSON.stringify(ie)}'
|
|
1780
|
+
${G?"data-lazy":""}
|
|
1781
|
+
>
|
|
1782
|
+
<div class="ts-video-player__container">
|
|
1783
|
+
${C?`
|
|
1784
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${Vt(C)}');">
|
|
1785
|
+
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1786
|
+
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1787
|
+
<path d="M8 5v14l11-7z"/>
|
|
1788
|
+
</svg>
|
|
1789
|
+
</button>
|
|
1790
|
+
</div>
|
|
1791
|
+
`:""}
|
|
1792
|
+
</div>
|
|
1793
|
+
</div>
|
|
1794
|
+
`.trim(),be=`
|
|
1795
|
+
(function() {
|
|
1796
|
+
var container = document.getElementById('${oe}');
|
|
1797
|
+
if (!container) return;
|
|
1798
|
+
|
|
1799
|
+
var config = JSON.parse(container.dataset.config || '{}');
|
|
1800
|
+
var isLazy = container.hasAttribute('data-lazy');
|
|
1801
|
+
|
|
1802
|
+
function loadPlayer() {
|
|
1803
|
+
if (typeof TSVideoPlayer !== 'undefined') {
|
|
1804
|
+
initPlayer();
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
// Load ts-video-player from CDN
|
|
1809
|
+
var script = document.createElement('script');
|
|
1810
|
+
script.src = '${Ty}';
|
|
1811
|
+
script.onload = initPlayer;
|
|
1812
|
+
script.onerror = function() {
|
|
1813
|
+
console.error('[stx] Failed to load ts-video-player');
|
|
1814
|
+
fallbackToNative();
|
|
1815
|
+
};
|
|
1816
|
+
document.head.appendChild(script);
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
function initPlayer() {
|
|
1820
|
+
var player = TSVideoPlayer.createPlayer(container, config);
|
|
1821
|
+
if (config.src) {
|
|
1822
|
+
player.setSrc(config.src);
|
|
1823
|
+
}
|
|
1824
|
+
container.__tsVideoPlayer = player;
|
|
1825
|
+
|
|
1826
|
+
// Remove placeholder
|
|
1827
|
+
var placeholder = container.querySelector('.ts-video-player__placeholder');
|
|
1828
|
+
if (placeholder) {
|
|
1829
|
+
placeholder.style.display = 'none';
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
function fallbackToNative() {
|
|
1834
|
+
// Fallback to native video element
|
|
1835
|
+
var video = document.createElement('video');
|
|
1836
|
+
video.controls = config.controls !== false;
|
|
1837
|
+
video.autoplay = config.autoplay;
|
|
1838
|
+
video.muted = config.muted;
|
|
1839
|
+
video.loop = config.loop;
|
|
1840
|
+
video.playsInline = config.playsinline;
|
|
1841
|
+
video.preload = config.preload || 'metadata';
|
|
1842
|
+
if (config.poster) video.poster = config.poster;
|
|
1843
|
+
if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
|
|
1844
|
+
video.style.width = '100%';
|
|
1845
|
+
video.style.height = '100%';
|
|
1846
|
+
|
|
1847
|
+
var containerEl = container.querySelector('.ts-video-player__container');
|
|
1848
|
+
if (containerEl) {
|
|
1849
|
+
containerEl.innerHTML = '';
|
|
1850
|
+
containerEl.appendChild(video);
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
if (isLazy) {
|
|
1855
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
1856
|
+
entries.forEach(function(entry) {
|
|
1857
|
+
if (entry.isIntersecting) {
|
|
1858
|
+
loadPlayer();
|
|
1859
|
+
observer.disconnect();
|
|
1860
|
+
}
|
|
1861
|
+
});
|
|
1862
|
+
}, { rootMargin: '50px' });
|
|
1863
|
+
observer.observe(container);
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
if (document.readyState === 'loading') {
|
|
1867
|
+
document.addEventListener('DOMContentLoaded', loadPlayer);
|
|
1868
|
+
}
|
|
1869
|
+
else {
|
|
1870
|
+
loadPlayer();
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// Handle play button click
|
|
1875
|
+
var playButton = container.querySelector('.ts-video-player__play-button');
|
|
1876
|
+
if (playButton) {
|
|
1877
|
+
playButton.addEventListener('click', function() {
|
|
1878
|
+
loadPlayer();
|
|
1879
|
+
var check = setInterval(function() {
|
|
1880
|
+
if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
|
|
1881
|
+
container.__tsVideoPlayer.play();
|
|
1882
|
+
clearInterval(check);
|
|
1883
|
+
}
|
|
1884
|
+
}, 100);
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
})();
|
|
1888
|
+
`.trim(),we=`
|
|
1889
|
+
.ts-video-player {
|
|
1890
|
+
position: relative;
|
|
1891
|
+
background: #000;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
.ts-video-player__container {
|
|
1895
|
+
position: relative;
|
|
1896
|
+
width: 100%;
|
|
1897
|
+
padding-bottom: 56.25%;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
.ts-video-player__container > * {
|
|
1901
|
+
position: absolute;
|
|
1902
|
+
top: 0;
|
|
1903
|
+
left: 0;
|
|
1904
|
+
width: 100%;
|
|
1905
|
+
height: 100%;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
.ts-video-player__placeholder {
|
|
1909
|
+
display: flex;
|
|
1910
|
+
align-items: center;
|
|
1911
|
+
justify-content: center;
|
|
1912
|
+
background-color: #1a1a1a;
|
|
1913
|
+
background-size: cover;
|
|
1914
|
+
background-position: center;
|
|
1915
|
+
cursor: pointer;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
.ts-video-player__play-button {
|
|
1919
|
+
display: flex;
|
|
1920
|
+
align-items: center;
|
|
1921
|
+
justify-content: center;
|
|
1922
|
+
width: 80px;
|
|
1923
|
+
height: 80px;
|
|
1924
|
+
background: rgba(0, 0, 0, 0.7);
|
|
1925
|
+
border: none;
|
|
1926
|
+
border-radius: 50%;
|
|
1927
|
+
color: white;
|
|
1928
|
+
cursor: pointer;
|
|
1929
|
+
transition: transform 0.2s, background 0.2s;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
.ts-video-player__play-button:hover {
|
|
1933
|
+
transform: scale(1.1);
|
|
1934
|
+
background: rgba(0, 0, 0, 0.9);
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
.ts-video-player__play-button svg {
|
|
1938
|
+
margin-left: 4px;
|
|
1939
|
+
}
|
|
1940
|
+
`.trim();return{html:ue,script:be,css:we}}function cf(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 Py(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 Dy(x){let v=x.match(/vimeo\.com\/(\d+)/);return v?v[1]:null}function Vt(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function My(x,v){let k=await sf();if(!k)return lo({...x,process:!1},v);let E=v.tsVideosConfig,C=await k.processVideo(x.src,x,E,x.onProcessProgress);if(C.processed)return lf(x,C,v);return lo({...x,process:!1},v)}async function Oy(x,v){let k=await sf();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 lf(x,v,k){let{controls:E=of,autoplay:C=!1,muted:j=!1,loop:L=!1,preload:B=af,playsinline:z=!0,lazy:F=!0,width:K,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)}`,fe=x.src,ue=cf(fe);if(v.transcoded)fe=v.transcoded.url,ue="video/mp4";let be=v.streaming?.hls||v.streaming?.dash;if(be){if(v.streaming?.hls)fe=v.streaming.hls.manifestUrl,ue="application/x-mpegURL";else if(v.streaming?.dash)fe=v.streaming.dash.manifestUrl,ue="application/dash+xml"}let we=v.poster?.url||x.poster,Se=[`id="${ie}"`];if(E)Se.push("controls");if(C)Se.push("autoplay");if(j)Se.push("muted");if(L)Se.push("loop");if(z)Se.push("playsinline");if(ne)Se.push("disablepictureinpicture");if(re)Se.push("disableremoteplayback");if(J)Se.push(`crossorigin="${J}"`);if(F){if(Se.push(`data-preload="${B}"`),Se.push('preload="none"'),we)Se.push(`data-poster="${Vt(we)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${B}"`),we)Se.push(`poster="${Vt(we)}"`);let $e=K||v.metadata?.width,Ee=G||v.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Ee)Se.push(`height="${Ee}"`);if(se)Se.push(`class="${Vt(se)}"`);if(oe)Se.push(`style="${Vt(oe)}"`);let Re=` <source ${F?`data-src="${Vt(fe)}"`:`src="${Vt(fe)}"`} type="${ue}" />`,Ce=`<video ${Se.join(" ")}>
|
|
1941
|
+
${Re}
|
|
1942
|
+
Your browser does not support the video tag.
|
|
1943
|
+
</video>`;if(v.spriteSheet)Ce=`<div class="stx-video-wrapper" data-sprite-sheet="${Vt(v.spriteSheet.url)}" data-sprite-cols="${v.spriteSheet.columns}" data-sprite-interval="${v.spriteSheet.interval}">
|
|
1944
|
+
${Ce}
|
|
1945
|
+
</div>`;let _e;if(F)_e=`
|
|
1946
|
+
(function() {
|
|
1947
|
+
var video = document.getElementById('${ie}');
|
|
1948
|
+
if (!video) return;
|
|
1949
|
+
|
|
1950
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
1951
|
+
entries.forEach(function(entry) {
|
|
1952
|
+
if (entry.isIntersecting) {
|
|
1953
|
+
// Load poster
|
|
1954
|
+
if (video.dataset.poster) {
|
|
1955
|
+
video.poster = video.dataset.poster;
|
|
1956
|
+
delete video.dataset.poster;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
// Load sources
|
|
1960
|
+
var sources = video.querySelectorAll('source[data-src]');
|
|
1961
|
+
sources.forEach(function(source) {
|
|
1962
|
+
source.src = source.dataset.src;
|
|
1963
|
+
delete source.dataset.src;
|
|
1964
|
+
});
|
|
1965
|
+
|
|
1966
|
+
// Set preload
|
|
1967
|
+
if (video.dataset.preload) {
|
|
1968
|
+
video.preload = video.dataset.preload;
|
|
1969
|
+
delete video.dataset.preload;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
video.load();
|
|
1973
|
+
observer.disconnect();
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
}, { rootMargin: '50px' });
|
|
1977
|
+
|
|
1978
|
+
observer.observe(video);
|
|
1979
|
+
})();
|
|
1980
|
+
`.trim();let Te;if(be)Te=`
|
|
1981
|
+
.stx-video-wrapper {
|
|
1982
|
+
position: relative;
|
|
1983
|
+
width: 100%;
|
|
1984
|
+
}
|
|
1985
|
+
.stx-video-wrapper video {
|
|
1986
|
+
width: 100%;
|
|
1987
|
+
height: auto;
|
|
1988
|
+
}
|
|
1989
|
+
`.trim();return{html:Ce,script:_e,css:Te}}function uf(){return Ue({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}=Ny(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 lo(L,z),K=F.html;if(F.css)K+=`
|
|
1990
|
+
<style>${F.css}</style>`;if(F.script)K+=`
|
|
1991
|
+
<script>${F.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Ny(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=jy(E),j=df(C[0],k)||"",L={};if(C[1]){let B=df(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 jy(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 df(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 Dc=uf();import Ly from"fs";import xn from"path";async function Hn(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 By(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 By(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(xn.isAbsolute(C)&&await n(C))B=C;else if(v.componentsDir){let se=xn.join(v.componentsDir,C);if(await n(se))B=se}if(!B)B=await zn(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 K=(x.outputFormat||"js")==="ts",G=K?Fy({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||{}}):zy({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 Ly.promises.mkdir(J,{recursive:!0});let ne=K?"ts":"js",re=xn.join(J,`${j}.${ne}`);if(await Bun.write(re,G),v.debug)console.log(`Built web component ${E} -> ${re}`);return re}function zy(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 K="";if(B)K=`<link rel="stylesheet" href="${B}">`;return`/**
|
|
1992
|
+
* ${v} Web Component
|
|
1993
|
+
* Auto-generated from stx component
|
|
1994
|
+
*/
|
|
1995
|
+
class ${v.replace(/\W/g,"")} extends ${E} {
|
|
1996
|
+
constructor() {
|
|
1997
|
+
super()
|
|
1998
|
+
this._initialized = false
|
|
1999
|
+
${j?"":"this._slotContent = []"}
|
|
2000
|
+
${j?'this.attachShadow({ mode: "open" })':""}
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
${L?`
|
|
2004
|
+
_createTemplate() {
|
|
2005
|
+
const template = document.createElement('template')
|
|
2006
|
+
template.innerHTML = \`${K}${F}\`
|
|
2007
|
+
${j?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2008
|
+
this._processSlots()
|
|
2009
|
+
}
|
|
2010
|
+
`:`
|
|
2011
|
+
_render() {
|
|
2012
|
+
${j?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${K}${F}\`
|
|
2013
|
+
this._processSlots()
|
|
2014
|
+
}
|
|
2015
|
+
`}
|
|
2016
|
+
|
|
2017
|
+
_processSlots() {
|
|
2018
|
+
${j?`// Shadow DOM handles slot assignment automatically
|
|
2019
|
+
// Listen for slot changes if needed
|
|
2020
|
+
const slots = this.shadowRoot.querySelectorAll('slot')
|
|
2021
|
+
slots.forEach(slot => {
|
|
2022
|
+
slot.addEventListener('slotchange', (e) => {
|
|
2023
|
+
const assignedNodes = slot.assignedNodes()
|
|
2024
|
+
this.dispatchEvent(new CustomEvent('slot-changed', {
|
|
2025
|
+
detail: { slotName: slot.name || 'default', assignedNodes }
|
|
2026
|
+
}))
|
|
2027
|
+
})
|
|
2028
|
+
})`:`// Manual slot processing for non-shadow DOM mode
|
|
2029
|
+
const slots = this.querySelectorAll('[data-slot]')
|
|
2030
|
+
|
|
2031
|
+
// Process named slots
|
|
2032
|
+
slots.forEach(slotEl => {
|
|
2033
|
+
const slotName = slotEl.getAttribute('data-slot')
|
|
2034
|
+
const slottedContent = this._slotContent.filter(
|
|
2035
|
+
node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
|
|
2036
|
+
)
|
|
2037
|
+
if (slottedContent.length > 0) {
|
|
2038
|
+
slotEl.innerHTML = ''
|
|
2039
|
+
slottedContent.forEach(content => slotEl.appendChild(content))
|
|
2040
|
+
}
|
|
2041
|
+
})
|
|
2042
|
+
|
|
2043
|
+
// Process default slot
|
|
2044
|
+
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
|
|
2045
|
+
if (defaultSlot) {
|
|
2046
|
+
const unslottedContent = this._slotContent.filter(
|
|
2047
|
+
node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
|
|
2048
|
+
)
|
|
2049
|
+
if (unslottedContent.length > 0) {
|
|
2050
|
+
defaultSlot.innerHTML = ''
|
|
2051
|
+
unslottedContent.forEach(content => defaultSlot.appendChild(content))
|
|
2052
|
+
}
|
|
2053
|
+
}`}
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
${z.length>0?`
|
|
2057
|
+
static get observedAttributes() {
|
|
2058
|
+
return [${z.map((G)=>`'${G}'`).join(", ")}]
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
2062
|
+
if (oldValue !== newValue) {
|
|
2063
|
+
this[name] = newValue
|
|
2064
|
+
${L?"":"if (this._initialized) this._render()"}
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
`:""}
|
|
2068
|
+
|
|
2069
|
+
connectedCallback() {
|
|
2070
|
+
if (this._initialized) return
|
|
2071
|
+
${j?"":"this._slotContent = Array.from(this.childNodes)"}
|
|
2072
|
+
this._initialized = true
|
|
2073
|
+
${L?"this._createTemplate()":"this._render()"}
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
disconnectedCallback() {
|
|
2077
|
+
// Component removed from the DOM
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
// Register the web component
|
|
2082
|
+
customElements.define('${k}', ${v.replace(/\W/g,"")})
|
|
2083
|
+
`}function Fy(x){let{name:v,tag:k,baseElement:E="HTMLElement",source:C,shadowDOM:j,template:L,styleSource:B,attributes:z=[],attributeTypes:F={}}=x,K=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,(Se,$e)=>$e.toUpperCase()),se=z.map((we)=>` private _${re(we)}: ${ne(we)} | null = null;`).join(`
|
|
2084
|
+
`),oe=z.map((we)=>{let Se=ne(we),$e=re(we);return`
|
|
2085
|
+
get ${$e}(): ${Se} | null {
|
|
2086
|
+
return this._${$e};
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
set ${$e}(value: ${Se} | null) {
|
|
2090
|
+
this._${$e} = value;
|
|
2091
|
+
if (value !== null) {
|
|
2092
|
+
this.setAttribute('${we}', String(value));
|
|
2093
|
+
}
|
|
2094
|
+
else {
|
|
2095
|
+
this.removeAttribute('${we}');
|
|
2096
|
+
}
|
|
2097
|
+
}`}).join(`
|
|
2098
|
+
`),ie=z.length>0?`/**
|
|
2099
|
+
* Props interface for ${v}
|
|
2100
|
+
*/
|
|
2101
|
+
export interface ${K}Props {
|
|
2102
|
+
${z.map((we)=>{let Se=ne(we);return` ${re(we)}?: ${Se};`}).join(`
|
|
2103
|
+
`)}
|
|
2104
|
+
}
|
|
2105
|
+
`:"",fe=z.length>0?`
|
|
2106
|
+
static get observedAttributes(): string[] {
|
|
2107
|
+
return [${z.map((we)=>`'${we}'`).join(", ")}];
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
2111
|
+
if (oldValue !== newValue) {
|
|
2112
|
+
const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
|
|
2113
|
+
(this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
|
|
2114
|
+
${L?"":"if (this._initialized) this._render();"}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
private _parseAttributeValue(name: string, value: string | null): unknown {
|
|
2119
|
+
if (value === null) return null;
|
|
2120
|
+
const typeMap: Record<string, string> = ${JSON.stringify(F)};
|
|
2121
|
+
const type = typeMap[name] || 'string';
|
|
2122
|
+
switch (type) {
|
|
2123
|
+
case 'number': return Number(value);
|
|
2124
|
+
case 'boolean': return value !== 'false' && value !== '0';
|
|
2125
|
+
case 'object': try { return JSON.parse(value); }
|
|
2126
|
+
catch { return value; }
|
|
2127
|
+
default: return value;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
`:"",ue=L?`
|
|
2131
|
+
private _createTemplate(): void {
|
|
2132
|
+
const template = document.createElement('template');
|
|
2133
|
+
template.innerHTML = \`${J}${G}\`;
|
|
2134
|
+
${j?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
|
|
2135
|
+
this._processSlots();
|
|
2136
|
+
}`:`
|
|
2137
|
+
private _render(): void {
|
|
2138
|
+
${j?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${J}${G}\`;
|
|
2139
|
+
this._processSlots();
|
|
2140
|
+
}`;return`/**
|
|
2141
|
+
* ${v} Web Component
|
|
2142
|
+
* Auto-generated from stx component (TypeScript)
|
|
2143
|
+
*
|
|
2144
|
+
* @example
|
|
2145
|
+
* \`\`\`html
|
|
2146
|
+
* <${k}></${k}>
|
|
2147
|
+
* \`\`\`
|
|
2148
|
+
*/
|
|
2149
|
+
|
|
2150
|
+
/**
|
|
2151
|
+
* Detail type for slot-changed event
|
|
2152
|
+
*/
|
|
2153
|
+
interface SlotChangeDetail {
|
|
2154
|
+
slotName: string;
|
|
2155
|
+
assignedNodes: Node[];
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
${ie}
|
|
2159
|
+
/**
|
|
2160
|
+
* ${v} custom element class
|
|
2161
|
+
* @customElement ${k}
|
|
2162
|
+
*/
|
|
2163
|
+
export class ${K} extends ${E} {
|
|
2164
|
+
${se}
|
|
2165
|
+
private _initialized = false;
|
|
2166
|
+
${j?"":"private _slotContent: Node[] = [];"}
|
|
2167
|
+
|
|
2168
|
+
constructor() {
|
|
2169
|
+
super();
|
|
2170
|
+
${j?'this.attachShadow({ mode: "open" });':""}
|
|
2171
|
+
}
|
|
2172
|
+
${ue}
|
|
2173
|
+
${j?`
|
|
2174
|
+
private _processSlots(): void {
|
|
2175
|
+
const slots = this.shadowRoot!.querySelectorAll('slot');
|
|
2176
|
+
slots.forEach((slot) => {
|
|
2177
|
+
slot.addEventListener('slotchange', () => {
|
|
2178
|
+
const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
|
|
2179
|
+
this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
|
|
2180
|
+
detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
|
|
2181
|
+
}));
|
|
2182
|
+
});
|
|
2183
|
+
});
|
|
2184
|
+
}`:`
|
|
2185
|
+
private _processSlots(): void {
|
|
2186
|
+
const slots = this.querySelectorAll('[data-slot]');
|
|
2187
|
+
slots.forEach((slotEl) => {
|
|
2188
|
+
const slotName = slotEl.getAttribute('data-slot');
|
|
2189
|
+
if (slotName) {
|
|
2190
|
+
const slottedContent = this._slotContent.filter(
|
|
2191
|
+
node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
|
|
2192
|
+
);
|
|
2193
|
+
if (slottedContent.length > 0) {
|
|
2194
|
+
slotEl.innerHTML = '';
|
|
2195
|
+
slottedContent.forEach(content => slotEl.appendChild(content));
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
|
|
2200
|
+
if (defaultSlot) {
|
|
2201
|
+
const unslottedContent = this._slotContent.filter(
|
|
2202
|
+
node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
|
|
2203
|
+
);
|
|
2204
|
+
if (unslottedContent.length > 0) {
|
|
2205
|
+
defaultSlot.innerHTML = '';
|
|
2206
|
+
unslottedContent.forEach(content => defaultSlot.appendChild(content));
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
}`}
|
|
2210
|
+
${fe}
|
|
2211
|
+
${oe}
|
|
2212
|
+
|
|
2213
|
+
connectedCallback(): void {
|
|
2214
|
+
if (this._initialized) return;
|
|
2215
|
+
${j?"":"this._slotContent = Array.from(this.childNodes);"}
|
|
2216
|
+
this._initialized = true;
|
|
2217
|
+
${L?"this._createTemplate();":"this._render();"}
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
disconnectedCallback(): void {
|
|
2221
|
+
// Component removed from the DOM
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
adoptedCallback(): void {
|
|
2225
|
+
// Component moved to a new document
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
// Type augmentation for HTMLElementTagNameMap
|
|
2230
|
+
declare global {
|
|
2231
|
+
interface HTMLElementTagNameMap {
|
|
2232
|
+
'${k}': ${K};
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
// Register the web component
|
|
2237
|
+
customElements.define('${k}', ${K});
|
|
2238
|
+
`}function Wy(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),K=F?F[1].trim():"";return{tag:C,props:j,template:z,styles:K,script:E,shadowDOM:L}}function Vy(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(", "),K=k.map((G)=>`
|
|
2239
|
+
get ${G}() {
|
|
2240
|
+
return this.getAttribute('${G}') || '';
|
|
2241
|
+
}
|
|
2242
|
+
set ${G}(value) {
|
|
2243
|
+
if (value) {
|
|
2244
|
+
this.setAttribute('${G}', value);
|
|
2245
|
+
}
|
|
2246
|
+
else {
|
|
2247
|
+
this.removeAttribute('${G}');
|
|
2248
|
+
}
|
|
2249
|
+
}`).join(`
|
|
2250
|
+
`);return`/**
|
|
2251
|
+
* ${L} Web Component
|
|
2252
|
+
* Auto-generated from SFC
|
|
2253
|
+
*/
|
|
2254
|
+
class ${L} extends HTMLElement {
|
|
2255
|
+
constructor() {
|
|
2256
|
+
super();
|
|
2257
|
+
${j?"this.attachShadow({ mode: 'open' });":""}
|
|
2258
|
+
this._render();
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
static get observedAttributes() {
|
|
2262
|
+
return [${F}];
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
2266
|
+
if (oldValue !== newValue) {
|
|
2267
|
+
this._render();
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
${K}
|
|
2271
|
+
|
|
2272
|
+
_render() {
|
|
2273
|
+
const template = \`${z?`<style>${z}</style>`:""}${B}\`;
|
|
2274
|
+
|
|
2275
|
+
// Interpolate {{ prop }} with attribute values
|
|
2276
|
+
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
|
|
2277
|
+
return this.getAttribute(prop) || '';
|
|
2278
|
+
});
|
|
2279
|
+
|
|
2280
|
+
${j?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
connectedCallback() {
|
|
2284
|
+
this._render();
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
customElements.define('${v}', ${L});
|
|
2289
|
+
`}async function ff(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=xn.isAbsolute(L)?[xn.join(L,`${C}.stx`),xn.join(xn.dirname(E),`${C}.stx`)]:[xn.join(xn.dirname(E),L,`${C}.stx`),xn.join(process.cwd(),L,`${C}.stx`),xn.join(xn.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=Wy(z,C);return`<script type="module">
|
|
2290
|
+
${Vy(F)}
|
|
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
|
+
${_o("@csrf",v)}`,!["GET","POST"].includes(ne))se+=`
|
|
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(Ee){let dt=[];if(C)for(let $t of qr(C))dt.push(`<source type="image/${$t.format}" srcset="${Lt($t.srcset)}"${_e?` sizes="${Lt(_e)}"`:""} />`);if(!C&&(G==="avif"||G==="auto")){let $t=Gs(E,ke,Re,se,"avif"),at=Ce?nl(E,el,se,"avif"):`${$t}`;dt.push(`<source type="image/avif" srcset="${Lt(at)}"${_e?` sizes="${Lt(_e)}"`:""} />`)}if(!C&&(G==="webp"||G==="auto")){let $t=Gs(E,ke,Re,se,"webp"),at=Ce?nl(E,el,se,"webp"):`${$t}`;dt.push(`<source type="image/webp" srcset="${Lt(at)}"${_e?` sizes="${Lt(_e)}"`:""} />`)}return`${_t}<picture>
|
|
2296
|
+
${dt.join(`
|
|
2297
|
+
`)}
|
|
2298
|
+
${nt}
|
|
2299
|
+
</picture>`}return`${_t}${nt}`}};var Yf="/images/safe-image-default.svg";function Js(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ks(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 sb=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Yf}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,sl={name:"SafeImage",aliases:["safe-image","safe-img"],render(x,v,k){let E=ks(x,"src")||"",C=ks(x,"alt")||"",j=ks(x,"fallback")||Yf,L=ks(x,"class")||ks(x,"className")||"",B=ks(x,"fallbackClassName")||"",z=[];if(z.push(`src="${Js(E)}"`),z.push(`alt="${Js(C)}"`),L)z.push(`class="${Js(L)}"`);if(z.push(`data-fallback="${Js(j)}"`),B)z.push(`data-fallback-class="${Js(B)}"`);z.push('onerror="window.__stxSafeImageHandler(this)"');let F=new Set(["src","alt","fallback","class","className","fallbackClassName"]);z.push(...us(x,F)),z.push(...ps(x,F));let K=`<img ${z.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${sb}${K}`;return K}};function il(x){return x.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Ys(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 No(x,v,k){let E=Ys(x,v);if(E!==void 0){let C=Number.parseInt(E,10);if(!Number.isNaN(C))return C}return k}var ol={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(x,v,k){let E=il(Ys(x,"color")||"#6366f1"),C=il(Ys(x,"initialColor")||Ys(x,"initial-color")||""),j=il(Ys(x,"height")||"3px"),L=No(x,"duration",2000),B=No(x,"throttle",200),z=No(x,"zIndex",999999)||No(x,"z-index",999999),F=C?`linear-gradient(to right, ${C}, ${E})`:E;return`
|
|
2300
|
+
<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
|
+
<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
|
+
</div>
|
|
2303
|
+
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
2304
|
+
<script>
|
|
2305
|
+
(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 ep(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 ib(x,v,k){let E=ep(x,v);if(E!==void 0){let C=Number.parseInt(E,10);if(!Number.isNaN(C))return C}return k}var Qf={"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%)"},al={name:"StxToast",aliases:["stx-toast"],render(x,v,k){let E=Wt(ep(x,"position")||"top-right"),C=ib(x,"max",5),j=Qf[E]||Qf["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
|
+
<style>
|
|
2308
|
+
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
2309
|
+
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
2310
|
+
@keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
|
|
2311
|
+
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
2312
|
+
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
2313
|
+
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
2314
|
+
</style>`}};function jo(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 tp={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)"},cl={name:"StxModal",aliases:["stx-modal"],render(x,v,k){let E=jo(x,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let C=Wt(E),j=jo(x,"size")||"md",L=jo(x,"closeOnBackdrop")!=="false",B=jo(x,"closeOnEscape")!=="false",z=tp[j]||tp.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
|
+
<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
|
+
<div style="padding:1.5rem">${v}</div>
|
|
2317
|
+
</div>
|
|
2318
|
+
</div>
|
|
2319
|
+
<style>
|
|
2320
|
+
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2321
|
+
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2322
|
+
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2323
|
+
</style>`}};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 np={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ll={name:"StxDrawer",aliases:["stx-drawer"],render(x,v,k){let E=Es(x,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let C=Wt(E),j=Es(x,"side")||"right",L=Es(x,"size")||"md",B=Es(x,"closeOnBackdrop")!=="false",z=Es(x,"closeOnEscape")!=="false",F=Es(x,"overlay")!=="false",K=np[L]||np.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">
|
|
2324
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${J};width:${K};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
|
+
<div style="padding:1.5rem">${v}</div>
|
|
2326
|
+
</div>
|
|
2327
|
+
</div>
|
|
2328
|
+
<style>
|
|
2329
|
+
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2330
|
+
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2331
|
+
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2332
|
+
</style>`}};import{existsSync as ob,readFileSync as ab}from"fs";var Lo=new Map,rp=new Set;function cb(x){if(rp.has(x))return;rp.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 lb(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(ob(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 ub(x){if(Lo.has(x))return Lo.get(x);let v=lb(x);if(!v)return cb(x),null;try{let k=JSON.parse(ab(v,"utf8"));return Lo.set(x,k.icons),k.icons}catch{return null}}function Rs(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 ul={name:"Icon",aliases:["icon","stx-icon"],render(x,v,k){let E=Rs(x,"name")??Rs(x,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let C="lucide",j=E;if(E.includes(":")){let fe=E.split(":");C=fe[0],j=fe[1]}let L=Wt(Rs(x,"size")||"24"),B=Wt(Rs(x,"color")||"currentColor"),z=Wt(Rs(x,"class")||""),F=Wt(Rs(x,"style")||""),K=Lo.get(C)??ub(C);if(!K)return`<!-- Icon: collection "${C}" not loaded -->`;let G=K[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 dl(){return`
|
|
2333
|
+
(function(){
|
|
2334
|
+
var tip=null,hideTimer=null,currentEl=null;
|
|
2335
|
+
|
|
2336
|
+
function createTip(){
|
|
2337
|
+
tip=document.createElement("div");
|
|
2338
|
+
tip.id="stx-tooltip";
|
|
2339
|
+
tip.style.cssText="position:absolute;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;z-index:999999;pointer-events:none;opacity:0;transition:opacity .15s ease;white-space:pre-wrap;word-wrap:break-word;box-shadow:0 2px 8px rgba(0,0,0,.25)";
|
|
2340
|
+
var arrow=document.createElement("div");
|
|
2341
|
+
arrow.className="stx-tip-arrow";
|
|
2342
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
|
|
2343
|
+
tip.appendChild(arrow);
|
|
2344
|
+
var text=document.createElement("span");
|
|
2345
|
+
text.className="stx-tip-text";
|
|
2346
|
+
tip.appendChild(text);
|
|
2347
|
+
document.body.appendChild(tip);
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
function position(el){
|
|
2351
|
+
var pos=el.getAttribute("x-tooltip-position")||"top";
|
|
2352
|
+
var r=el.getBoundingClientRect();
|
|
2353
|
+
var sy=window.scrollY,sx=window.scrollX;
|
|
2354
|
+
tip.style.display="block";
|
|
2355
|
+
tip.style.opacity="0";
|
|
2356
|
+
// Force layout so we can measure
|
|
2357
|
+
var tw=tip.offsetWidth,th=tip.offsetHeight;
|
|
2358
|
+
var arrow=tip.querySelector(".stx-tip-arrow");
|
|
2359
|
+
var left,top;
|
|
2360
|
+
|
|
2361
|
+
if(pos==="top"){
|
|
2362
|
+
left=r.left+r.width/2-tw/2+sx;
|
|
2363
|
+
top=r.top-th-8+sy;
|
|
2364
|
+
if(top-sy<0){pos="bottom";}
|
|
2365
|
+
}
|
|
2366
|
+
if(pos==="bottom"){
|
|
2367
|
+
left=r.left+r.width/2-tw/2+sx;
|
|
2368
|
+
top=r.bottom+8+sy;
|
|
2369
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
|
|
2370
|
+
}
|
|
2371
|
+
if(pos==="left"){
|
|
2372
|
+
left=r.left-tw-8+sx;
|
|
2373
|
+
top=r.top+r.height/2-th/2+sy;
|
|
2374
|
+
if(left-sx<0){pos="right";}
|
|
2375
|
+
}
|
|
2376
|
+
if(pos==="right"){
|
|
2377
|
+
left=r.right+8+sx;
|
|
2378
|
+
top=r.top+r.height/2-th/2+sy;
|
|
2379
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
// Set arrow for top/left after potential flips
|
|
2383
|
+
if(pos==="top"){
|
|
2384
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
|
|
2385
|
+
}
|
|
2386
|
+
if(pos==="left"){
|
|
2387
|
+
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
// Clamp horizontal
|
|
2391
|
+
if(left<sx+4) left=sx+4;
|
|
2392
|
+
if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
|
|
2393
|
+
|
|
2394
|
+
tip.style.left=left+"px";
|
|
2395
|
+
tip.style.top=top+"px";
|
|
2396
|
+
tip.style.opacity="1";
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
function showTip(el){
|
|
2400
|
+
if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
|
|
2401
|
+
if(!tip) createTip();
|
|
2402
|
+
var text=el.getAttribute("x-tooltip");
|
|
2403
|
+
if(!text) return;
|
|
2404
|
+
tip.querySelector(".stx-tip-text").textContent=text;
|
|
2405
|
+
currentEl=el;
|
|
2406
|
+
position(el);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
function hideTip(){
|
|
2410
|
+
if(!tip) return;
|
|
2411
|
+
tip.style.opacity="0";
|
|
2412
|
+
hideTimer=setTimeout(function(){
|
|
2413
|
+
if(tip) tip.style.display="none";
|
|
2414
|
+
currentEl=null;
|
|
2415
|
+
},150);
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
document.addEventListener("mouseover",function(e){
|
|
2419
|
+
var el=e.target.closest("[x-tooltip]");
|
|
2420
|
+
if(el) showTip(el);
|
|
2421
|
+
});
|
|
2422
|
+
document.addEventListener("mouseout",function(e){
|
|
2423
|
+
var el=e.target.closest("[x-tooltip]");
|
|
2424
|
+
if(el&&el===currentEl) hideTip();
|
|
2425
|
+
});
|
|
2426
|
+
document.addEventListener("focusin",function(e){
|
|
2427
|
+
var el=e.target.closest("[x-tooltip]");
|
|
2428
|
+
if(el) showTip(el);
|
|
2429
|
+
});
|
|
2430
|
+
document.addEventListener("focusout",function(e){
|
|
2431
|
+
var el=e.target.closest("[x-tooltip]");
|
|
2432
|
+
if(el) hideTip();
|
|
2433
|
+
});
|
|
2434
|
+
})();
|
|
2435
|
+
`}function sp(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 ip(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 fl={name:"Suspense",aliases:["suspense"],render(x,v,k){let E=ip(v,"fallback"),C=E.rest,j=ip(C,"error"),L=j.rest,B=E.region??sp(x,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',z=j.region??sp(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 Bo(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 pl={name:"TransitionGroup",aliases:["transition-group"],render(x,v,k){let E=(Bo(x,"name")||"v").replace(/["'<>]/g,""),C=(Bo(x,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=Bo(x,"class"),L=Bo(x,"id"),B=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",L?`id="${L}"`:""].filter(Boolean).join(" ");return`<${C} ${B}>${v}</${C}>`}};function op(x=Lr){x.registerBuiltin(qc),x.registerBuiltin(rl),x.registerBuiltin(sl),x.registerBuiltin(ol),x.registerBuiltin(al),x.registerBuiltin(cl),x.registerBuiltin(ll),x.registerBuiltin(ul),x.registerBuiltin(fl),x.registerBuiltin(pl)}function zo(x){return x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ap=new Map;function db(x){let v=ap.get(x.source);if(!v)v=new RegExp(`(${x.source})(?![\\w.:-])`,"y"),ap.set(x.source,v);return v}var cp=new WeakMap;function lp(x){let v=cp.get(x);if(!v)v=new Set([...x].map((E)=>E.toLowerCase())),cp.set(x,v);let k=v;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function up(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=db(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 K=L+1+F.length,G=null,J=K,ne=-1,re=!1;while(K<x.length){let oe=x[K];if(G){if(oe==="\\"&&K+1<x.length){K+=2;continue}if(oe===G)G=null;K++;continue}if(oe==='"'||oe==="'"){G=oe,K++;continue}if(oe==="/"&&K+1<x.length&&x[K+1]===">"){ne=K+2,re=!0;break}if(oe===">"){ne=K+1;break}K++}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}>`,fe=1,ue=ne,be=-1;while(fe>0&&ue<x.length){let $e=x.indexOf(oe,ue),Ee=x.indexOf(ie,ue);if(Ee===-1)break;if($e!==-1&&$e<Ee){let ke=x[$e+oe.length];if(ke===" "||ke===">"||ke==="/"||ke===`
|
|
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},K=()=>{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])))K();j++}return k.join(", ")}function Eb(x,v=""){let k=kp(x).split(",").map((E)=>E.trim()).filter(Boolean);return`
|
|
2438
|
+
(function() {
|
|
2439
|
+
${Et("var",k)}
|
|
2440
|
+
var __destroyHooks = [];
|
|
2441
|
+
var __origOnDestroy = onDestroy;
|
|
2442
|
+
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
2443
|
+
|
|
2444
|
+
${x}
|
|
2445
|
+
${v}})();
|
|
2446
|
+
`}function Cb(x,v){let C=kp(x).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
2447
|
+
`);return`
|
|
2448
|
+
// Register scope variables for STX runtime
|
|
2449
|
+
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2450
|
+
var __scopeRegistration = window.stx._scopes['${v}'] || { __destroyCallbacks: __destroyHooks };
|
|
2451
|
+
${C}
|
|
2452
|
+
// #1767: when the bundler renamed a component const that collided with an
|
|
2453
|
+
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
2454
|
+
// renamed declaration so it resolves to the component's value, not the
|
|
2455
|
+
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
2456
|
+
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
2457
|
+
window.stx._scopes['${v}'] = __scopeRegistration;
|
|
2458
|
+
`}function Rb(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 Sp(x,v){let k=Cb(x,v);return Tb(Eb(x,k),v)}function Tb(x,v){let k=`
|
|
2459
|
+
(function() {
|
|
2460
|
+
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${v}"]') : null;
|
|
2461
|
+
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
2462
|
+
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
2463
|
+
if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
|
|
2464
|
+
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2465
|
+
window.stx._scopes['${v}'] = {};
|
|
2466
|
+
}
|
|
2467
|
+
try {`,E=`
|
|
2468
|
+
} finally {
|
|
2469
|
+
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2470
|
+
}
|
|
2471
|
+
})();`;return k+x+`
|
|
2472
|
+
} finally {
|
|
2473
|
+
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2474
|
+
}
|
|
2475
|
+
})();`}function Ab(x,v){if(Cn(x)){let C=Cn(x).tag.match(/data-stx-scope="([^"]*)"/);if(C)return{html:x,mergedIntoExisting:C[1],stamped:!0,root:"body"};return{html:Or(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 $p=0,yl=new Set;function Ru(){yl.clear()}function _p(x){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(x)}var he=new V(500),Ui=new Set;function Au(){Ui.clear()}function Ib(x){if(x.__onceStore instanceof Set)return x.__onceStore;return Ui}async function es(x,v,k,E,C,j=new Set){let L=E.partialsDir||Mt.join(Mt.dirname(k),"partials");if(L&&!Mt.isAbsolute(L))L=Mt.resolve(process.cwd(),L);let B=_b(x,"@partial","@include"),z=Ib(v);B=B.replace(/@once([\s\S]*?)@endonce/g,(se,oe,ie)=>{let fe=oe.trim(),ue=`${k}:${fe}`;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,fe=ie+oe[0].length-1,ue=1,be=fe+1;while(be<B.length&&ue>0){if(B[be]==="(")ue++;else if(B[be]===")")ue--;be++}if(ue!==0)break;let we=B.substring(fe+1,be-1),Se=we.match(/^\s*['"]([^'"]+)['"]/);if(!Se){se.lastIndex=be;continue}let $e=Se[1],Ee=F($e,L,k),ke="";if(Ee&&await Bun.file(Ee).exists())C.add(Ee),ke=`@include(${we})`;B=B.substring(0,ie)+ke+B.substring(be),se.lastIndex=0}}for(let[se,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ie=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),fe;while((fe=ie.exec(B))!==null){let ue=fe.index,be=ue+fe[0].length-1,we=1,Se=be+1;while(Se<B.length&&we>0){if(B[Se]==="(")we++;else if(B[Se]===")")we--;Se++}if(we!==0)break;let $e=B.substring(be+1,Se-1),Ee=hl($e,0);if(Ee===-1){ie.lastIndex=Se;continue}let ke=$e.substring(0,Ee).trim(),Re=$e.substring(Ee+1).trim(),Ce=Re.match(/^\s*['"]([^'"]+)['"]/);if(!Ce){ie.lastIndex=Se;continue}let _e=Ce[1],Te=Re.substring(Ce[0].length),Ke,Pe=hl(Te,0);if(Pe!==-1)Ke=Te.substring(Pe+1).trim();try{let Ae=`Boolean(${ke})`,Ze;if(p(Ae)){let nt=l(Ae,Object.keys(v));Ze=Boolean(nt(...Object.values(v)))}else Ze=Boolean(c(Ae,v));let tt=oe?!Ze:Ze,ot="";if(tt){let nt=F(_e,L,k);if(nt&&await Bun.file(nt).exists())C.add(nt);ot=`@include('${_e}'${Ke?`, ${Ke}`:""})`}B=B.substring(0,ue)+ot+B.substring(Se),ie.lastIndex=0}catch(Ae){let Ze=Ae instanceof Error?Ae.message:String(Ae),tt=g("Include",`Error evaluating ${se} condition: ${Ze}`,k,x,ue);B=B.substring(0,ue)+tt+B.substring(Se),ie.lastIndex=0}}}{let se=/@each\s*\(/g,oe;while((oe=se.exec(B))!==null){let ie=oe.index,fe=ie+oe[0].length-1,ue=1,be=fe+1;while(be<B.length&&ue>0){if(B[be]==="(")ue++;else if(B[be]===")"){if(ue--,ue===0)break}be++}if(ue!==0)break;let we=B.substring(fe+1,be),Se=B.substring(ie,be+1),$e=we.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){se.lastIndex=0,B=B.replace(Se,"");continue}let[,Ee,ke,Re,Ce]=$e;try{let _e,Te=ke.trim();if(p(Te))_e=l(Te,Object.keys(v))(...Object.values(v));else _e=c(Te,v);let Ke="";if(Array.isArray(_e)&&_e.length>0)for(let Pe of _e){let Ae={...v,[Re]:Pe},Ze=await J(Ee,Ae,x,ie);Ke+=Ze}else if(Ce)Ke=await J(Ce,{},x,ie);B=B.substring(0,ie)+Ke+B.substring(be+1),se.lastIndex=0}catch(_e){let Te=_e instanceof Error?_e.message:String(_e);B=B.substring(0,ie)+g("Each",`Error in @each: ${Te}`,k,x,ie)+B.substring(be+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,oe;while((oe=se.exec(B))!==null){let ie=oe.index,fe=ie+oe[0].length-1,ue=1,be=fe+1;while(be<B.length&&ue>0){if(B[be]==="(")ue++;else if(B[be]===")"){if(ue--,ue===0)break}be++}if(ue!==0)break;let we=B.substring(fe+1,be),Se=B.substring(ie,be+1),$e=we.match(/^\s*(\[[^\]]+\])/);if(!$e){se.lastIndex=0,B=B.replace(Se,"");continue}let Ee=$e[1],ke=we.slice($e[0].length),Re,Ce=ke.match(/^\s*,\s*\{/);if(Ce){ke=ke.slice(Ce[0].length-1);let Ke=1,Pe=1;while(Pe<ke.length&&Ke>0){if(ke[Pe]==="{")Ke++;else if(ke[Pe]==="}"){if(Ke--,Ke===0)break}Pe++}Re=ke.substring(0,Pe+1),ke=ke.slice(Pe+1)}let _e,Te=ke.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Te)_e=Te[1];try{let Ke=JSON.parse(Ee.replace(/'/g,'"')),Pe={};if(Re)try{Pe=P(Re,v)}catch(Ze){let tt=Ze instanceof Error?Ze.message:String(Ze);if(E.debug){let ot=g("Include",`Error parsing includeFirst variables: ${tt}`,k,x,ie,Se);B=B.replace(Se,()=>ot)}else B=B.replace(Se,()=>_e||"");continue}let Ae=!1;for(let Ze of Ke){let tt=F(Ze,L,k);if(!tt)continue;if(await n(tt)){let ot=await J(Ze,Pe,x,ie);B=B.replace(Se,()=>ot),Ae=!0;break}}if(!Ae)if(_e!==void 0)B=B.replace(Se,()=>_e);else if(E.debug){let Ze=g("Include",`None of the includeFirst paths exist: ${Ee}`,k,x,ie,Se);B=B.replace(Se,()=>Ze)}else B=B.replace(Se,"")}catch(Ke){let Pe=Ke instanceof Error?Ke.message:String(Ke),Ae=g("Include",`Error processing @includeFirst: ${Pe}`,k,x,ie,Se);B=B.replace(Se,()=>Ae)}se.lastIndex=0}}function F(se,oe,ie){try{let fe=se;if(!se.endsWith(".stx"))fe=`${se}.stx`;let ue=Mt.resolve(oe),be=Mt.resolve(Mt.dirname(ie)),we;if(!fe.startsWith("./")&&!fe.startsWith("../")){for(let Ce of E._layerPartialDirs??[]){let _e=Mt.resolve(Ce,fe);if(_e.startsWith(`${Mt.resolve(Ce)}${Mt.sep}`)&&$b(_e))return _e}we=Mt.resolve(oe,fe)}else we=Mt.resolve(be,fe);let Se=Mt.normalize(we),$e=Se.startsWith(ue+Mt.sep)||Se===ue,Ee=Se.startsWith(be+Mt.sep)||Se===be,ke=!1,Re=Mt.dirname(be);if(Se.startsWith(Re+Mt.sep)){if(!Mt.relative(Re,Se).split(Mt.sep).some((Ke)=>Ke.startsWith(".")&&Ke!=="."&&Ke!==".."))ke=!0}if(!$e&&!Ee&&!ke)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${ue}, ${be}`),null;return Se}catch(fe){return console.error(`Error resolving path ${se}: ${fe}`),null}}let K=Mt.resolve(k);j.add(K);function G(se,oe,ie,fe){return E.onIncludeError?.({includePath:se,templatePath:k,message:oe,partialsDir:L}),g("Include",oe,k,ie,fe)}async function J(se,oe={},ie,fe){let ue=F(se,L,k);if(!ue)return G(se,`Could not resolve path for include: ${se}`,ie,fe);let be=Mt.resolve(ue);if(j.has(be)){let we=[...j,be].map((Se)=>Mt.basename(Se)).join(" -> ");return G(se,`Circular include detected: ${we}`,ie,fe)}try{C.add(ue);let we;if(!we)try{we=await Bun.file(ue).text()}catch(at){let It=at instanceof Error?at.message:String(at);return G(se,`Error loading include file ${se}: ${It}`,ie,fe)}if(we)we=we.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(we&&we.includes("@stream")){let{processStreamDirectives:at}=await import("./chunk-fe5st320.js");we=at(we,v)}if(we&&(E.debug||!pe()&&!ln()))try{let{warnUnbalancedTags:at}=await import("./chunk-p2jbc71s.js");at(we,ue)}catch{}let Se=we;try{let{processESImports:at}=await import("./chunk-7eazcxzf.js");await at(we,v,ue,E,C)}catch(at){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${ue}:`,at instanceof Error?at.message:at)}let $e=Z(Se);if($e)Se=$e.content.trim();let ke=we.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Re="";if(ke)Re=`<style${ke[1]}>${ke[2]}</style>`;let Ce=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(at,It,ft)=>{if(!_p(It))return"";return Ce.push({attrs:It,body:ft}),`__STX_DATA_BLOCK_${Ce.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={...v};_e.__stx_signals_gate=me(we,ue);for(let[at,It]of Object.entries(oe))_e[at]=It;let Te=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ke=[...we.matchAll(Te)],Pe="",Ae=null,Ze=!1;for(let at of Ke){let It=at[1]||"",ft=at[2]||"";if(_p(It))continue;let Nt=It.includes("server"),Kn=ze(It);if(!Nt&&ft.trim()){let{interpolateScriptExpressions:Qe}=await import("./chunk-x4q2eyt0.js");ft=Qe(ft,_e,se)}let vn="";try{let{extractAndStripCssImports:Qe,renderVendorStyleTags:st}=await import("./chunk-ypfzy1mq.js"),pt=Qe(ft,{filePath:ue,projectRoot:process.cwd()});ft=pt.code,vn=st(pt.styles)}catch(Qe){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${ue}:`,Qe instanceof Error?Qe.message:Qe)}if(Kn&&ft.trim())ft=He(ft);if(!Nt){try{let{injectBrowserCoreAutoImports:st}=await import("./chunk-ypfzy1mq.js");ft=st(ft).code;let{hasUserImports:pt,bundleClientScript:Ht}=await import("./chunk-mcs7p3fy.js");if(pt(ft))ft=await Ht(ft,ue,{projectRoot:process.cwd()})}catch(st){if(E.debug)console.warn(`[stx] bundler skipped for ${ue}:`,st instanceof Error?st.message:st)}let{stripStxRuntimeImports:Qe}=await import("./chunk-pz1jc3db.js");ft=Qe(ft)}let Gn=kb(ft);if(Gn&&!Nt){Ze=!0,Ae=`stx_scope_${Mt.basename(ue,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$p}`;let Qe=R(ft),st=Sp(Qe,Ae);Pe+=`${vn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ae}">${st}</script>
|
|
2476
|
+
`;continue}if(Nt)try{let{extractVariables:Qe}=await import("./chunk-ckv4aty5.js");await Qe(ft,_e,ue)}catch(Qe){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${ue}:`,Qe)}if(!Nt&&!Gn){let Qe=It.replace(/\bclient\b/i,"").trim();Ae=`stx_scope_${Mt.basename(ue,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$p}`;let st=R(ft),pt=Sp(st,Ae);Pe+=`${vn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ae}"${Qe?` ${Qe}`:""}>${pt}</script>
|
|
2477
|
+
`}}if(Ce.length>0){let{interpolateScriptExpressions:at}=await import("./chunk-x4q2eyt0.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(It,ft)=>{let Nt=Ce[Number(ft)];return`<script${Nt.attrs}>${at(Nt.body,_e,se)}</script>`})}if(Ae){let at=Ab(Se,Ae);if(Se=at.html,at.mergedIntoExisting){let ft=Ae,Nt=at.mergedIntoExisting;Pe=Pe.split(`'${ft}'`).join(`'${Nt}'`).split(`"${ft}"`).join(`"${Nt}"`),Ae=Nt}else if(!at.stamped&&Ze&&!yl.has(ue))yl.add(ue),console.warn(`[stx] ${Mt.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 It=at.stamped&&at.root!==null&&Qt(at.root);Pe=Rb(Pe,It?Ae:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await es(Se,_e,ue,E,C,j);let{processLoops:tt,reportDeferredLoopWarnings:ot}=await import("./chunk-92xzpt6p.js"),nt=tt(Se,_e,ue,void 0,!0);nt=tr(nt,_e,ue),nt=ot(nt);let{processMetaDirectives:_t,processSeoDirective:dt,processStructuredData:$t}=await import("./chunk-4bhertga.js");if(nt=_t(nt,_e,ue,E),nt=$t(nt,_e,ue),nt=dt(nt,_e,ue,E),nt=W(nt,_e,ue),Re)nt+=`
|
|
2478
|
+
`+Re;if(Pe)nt+=`
|
|
2479
|
+
`+Pe;return nt}catch(we){let Se=we instanceof Error?we.message:String(we);return G(se,`Error processing include ${se}: ${Se}`,ie,fe)}}let ne=/@include\s*\(/g,re;while((re=ne.exec(B))!==null){let se=re.index,oe=se+re[0].length-1,ie=1,fe=oe+1;while(fe<B.length&&ie>0){if(B[fe]==="(")ie++;else if(B[fe]===")")ie--;fe++}if(ie!==0)break;let ue=B.substring(se,fe),be=B.substring(oe+1,fe-1),we=be.match(/^\s*['"]([^'"]+)['"]/);if(!we){ne.lastIndex=fe;continue}let Se=we[1],$e,Ee=be.substring(we[0].length),ke=hl(Ee,0);if(ke!==-1)$e=Ee.substring(ke+1).trim();let Re={};if($e)try{Re=P($e,v)}catch(_e){let Te=_e instanceof Error?_e.message:String(_e);B=B.replace(ue,g("Include",`Error parsing include variables for ${Se}: ${Te}`,k,x,se)),ne.lastIndex=0;continue}let Ce=await J(Se,Re,x,se);B=B.substring(0,se)+Ce+B.substring(fe),ne.lastIndex=0}return B}function ts(x,v){let k=x;function E(C,j,L,B){let z=C,F=!0;while(F){F=!1;let K=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=z.match(K);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,fe=re,ue=-1;while(ie>0&&fe<z.length){let we=z.slice(fe),Se=we.match(se),$e=we.match(oe),Ee=Se?fe+Se.index:1/0,ke=$e?fe+$e.index:1/0;if(Ee<ke)ie++,fe=Ee+(Se[0].length||1);else if(ke<1/0){if(ie--,ie===0){ue=ke;break}fe=ke+L.length+1}else break}if(ue===-1)break;let be=z.slice(re,ue);if(!v[ne])v[ne]=[];if(B)v[ne].unshift(be);else v[ne].push(be);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 ns(x,v){return x.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!v[E]||v[E].length===0)return"";return v[E].join(`
|
|
2480
|
+
`)})}import*as xl from"path";async function Ep(x,v,k=""){if(xl.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 Rp(x,v,k,"@js","@endjs")}async function Cp(x,v,k=""){if(xl.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 Rp(x,v,k,"@ts","@endts")}async function Rp(x,v,k,E,C){let j=x,L=mr(`${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:K,index:G}of B)try{let J={...v,global:v},ne=Object.keys(J),re=Object.values(J),se=K.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((Se)=>Se.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),fe=ie.length>0?`return { ${ie.join(", ")} };`:"return {};",ue=`
|
|
2481
|
+
${se}
|
|
2482
|
+
${fe}
|
|
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,`
|
|
2484
|
+
let result = '';
|
|
2485
|
+
for (${K}) {
|
|
2486
|
+
result += \`${ue}\`;
|
|
2487
|
+
}
|
|
2488
|
+
return result;
|
|
2489
|
+
`)(...fe);C=C.substring(0,B)+we+C.substring(re),j=!0}catch(se){let oe=o("For",`Error in @for(${K}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);C=C.substring(0,B)+oe+C.substring(re),j=!0}}return C}function Vb(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 K=z.indexOf("="),G=(K>=0?z.slice(0,K):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 Ub(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
|
+
for (${v}) {
|
|
2491
|
+
__pushIter([${E.join(", ")}])
|
|
2492
|
+
}
|
|
2493
|
+
`),K=[];F(...z,(ne)=>{K.push(ne)});let G=j??"inline.stx",J="";for(let ne of K){let re={...C};E.forEach((oe,ie)=>{re[oe]=ne[ie]});let se=Op(k,re,j,L);se=tr(se,re,G),se=W(se,re,G),J+=se}return J}function Hb(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),K=wo(E.slice(L),"while","endwhile");if(K.length===0)break;let G=K[0].content,J=L+K[0].end;if(!Mp(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,(fe,ue)=>`\${${ue}}`);se=Pp(se);let ie=Function(...ne,`
|
|
2494
|
+
let result = '';
|
|
2495
|
+
let maxIterations = ${k}; // Configurable safety limit
|
|
2496
|
+
let counter = 0;
|
|
2497
|
+
while (${F} && counter < maxIterations) {
|
|
2498
|
+
counter++;
|
|
2499
|
+
result += \`${se}\`;
|
|
2500
|
+
}
|
|
2501
|
+
if (counter > maxIterations) {
|
|
2502
|
+
result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
2503
|
+
}
|
|
2504
|
+
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 qb(x,v="_method"){let k=x.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${v}" value="${k}">`}function Np(x){return x.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(v,k,E,C,j)=>qb(E,j||"_method"))}async function jp(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
|
+
<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 Lp(x,v,k,E){return jp(x,v,k,E,"before")}async function Bp(x,v,k,E){return jp(x,v,k,E,"after")}function zp(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 fn(E,L,j==="true")}catch(L){return console.error(`Error processing @route directive: ${L}`),"#route-error"}})}var ei={patterns:[],exact:{}};async function Fp(x,v){let k=x.split("/").pop()?.split(".")[0]||"";if(ei.exact[x])for(let E of ei.exact[x])await Promise.resolve(E(v,x));if(ei.exact[k])for(let E of ei.exact[k])await Promise.resolve(E(v,x));for(let{pattern:E,callback:C}of ei.patterns)if(E.test(x)||E.test(k))await Promise.resolve(C(v,x))}var Kb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Xb=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 kr(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()&&Kb.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 Zb(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 _r(x,v){if(v.selfClosing)return{outerStart:v.start,outerEnd:v.end,innerHTML:""};let k=Zb(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 Wp(x,v){return new RegExp(`(?:^|\\s)${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(x)||x.includes(` ${v}=`)||x.includes(` ${v} `)||x.trimEnd().endsWith(` ${v}`)}function ti(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 pr(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 Ts(x,v,k){let E=v.selfClosing?" /":"",C=`<${v.tag}${k}${E}>`;return x.slice(0,v.start)+C+x.slice(v.end)}function Gb(x){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(x)}function Jb(x){let v=x,k=0;while(k<v.length){let E=kr(v,k);if(!E)break;let C=ti(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],fe=oe[1];z=`${B} as ${fe} => ${ie}`}else z=`${B} as ${L}`;let F=pr(E.attrs,"v-for"),K=pr(F,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=_r(v,E),J=v.slice(G.outerStart,G.outerEnd),ne=Ts(J,{...E,start:0,end:E.end-E.start},K),re=`@foreach(${z})
|
|
2508
|
+
`,se=`${re}${ne}
|
|
2509
|
+
@endforeach`;v=v.slice(0,G.outerStart)+se+v.slice(G.outerEnd),k=G.outerStart+re.length}return v}function Yb(x){let v=x,k=0;while(k<v.length){let E=kr(v,k);if(!E)break;let C=ti(E.attrs,"v-if");if(C===null){k=E.end;continue}let j=[],L=_r(v,E),B=pr(E.attrs,"v-if"),z=Ts(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,K=!0;while(K){let se=v.slice(F).match(/^\s*/),oe=se?se[0].length:0,ie=kr(v,F+oe);if(!ie){K=!1;break}let fe=ti(ie.attrs,"v-else-if"),ue=Wp(ie.attrs,"v-else");if(fe!==null){let be=_r(v,ie),we=pr(ie.attrs,"v-else-if"),Se=Ts(v.slice(be.outerStart,be.outerEnd),{...ie,start:0,end:ie.end-ie.start},we);j.push({type:"else-if",expr:fe,outerStart:F,outerEnd:be.outerEnd,element:Se,parsedTag:ie}),F=be.outerEnd}else if(ue){let be=_r(v,ie),we=pr(ie.attrs,"v-else"),Se=Ts(v.slice(be.outerStart,be.outerEnd),{...ie,start:0,end:ie.end-ie.start},we);j.push({type:"else",outerStart:F,outerEnd:be.outerEnd,element:Se,parsedTag:ie}),K=!1}else K=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
|
|
2510
|
+
${se.element}`);else if(se.type==="else-if")G.push(`@elseif(${se.expr})
|
|
2511
|
+
${se.element}`);else G.push(`@else
|
|
2512
|
+
${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 Qb(x){return x.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function ev(x){let v=x,k=0;while(k<v.length){let E=kr(v,k);if(!E)break;let C=Xb.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(B,z,F)=>{let K=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(z);if(!K||!F||!/^["']/.test(F))return B;let G=K[1]||"modelValue",J=K[2];if(C&&!K[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=K[1]?`${G}Modifiers`:"modelModifiers",ie=J.slice(1).split(".").map((fe)=>`${fe}: true`).join(", ");se+=` :${oe}="{ ${ie} }"`}return se});if(j===E.attrs){k=E.end;continue}let L=Ts(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 tv(x){return x.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function nv(x){return x.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function rv(x){let v=x,k=0;while(k<v.length){let E=kr(v,k);if(!E)break;let C=ti(E.attrs,"v-html");if(C===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=_r(v,E),L=pr(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 sv(x){let v=x,k=0;while(k<v.length){let E=kr(v,k);if(!E)break;let C=ti(E.attrs,"v-text");if(C===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=_r(v,E),L=pr(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 iv(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 ov(x){let v=x,k=0;while(k<v.length){let E=kr(v,k);if(!E)break;if(!Wp(E.attrs,"v-once")){k=E.end;continue}let C=pr(E.attrs,"v-once"),j=_r(v,E),L=v.slice(j.outerStart,j.outerEnd),z=`@once
|
|
2514
|
+
${Ts(L,{...E,start:0,end:E.end-E.start},C)}
|
|
2515
|
+
@endonce`;v=v.slice(0,j.outerStart)+z+v.slice(j.outerEnd),k=j.outerStart+z.length}return v}function av(x){return x.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function cv(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 Vp(x){if(!Gb(x))return x;let v=x;return v=Jb(v),v=Yb(v),v=ov(v),v=tv(v),v=nv(v),v=ev(v),v=Qb(v),v=cv(v),v=rv(v),v=sv(v),v=iv(v),v=av(v),v}function Uo(x){return x.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var bl=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"]),lv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Up(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 bl.has(j)?j:null}function Hp(x){let v=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(x);return v?v[1]:x}function qp(x,v,k){let E=v.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),C=E?`<${x} ${E}>`:`<${x}>`;if(lv.has(x))return E?`<${x} ${E}>`:`<${x}>`;return`${C}${k}</${x}>`}async function Kp(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 K=B[F];try{let G=Up(K.expr,v);if(!G||typeof G!=="string"){let fe=`<!-- dynamic component: could not resolve "${Uo(Hp(K.expr))}" -->`;j=j.slice(0,K.index)+fe+j.slice(K.index+K.full.length);continue}if(bl.has(G)){let fe=qp(G,K.attrs,K.slotContent);j=j.slice(0,K.index)+fe+j.slice(K.index+K.full.length);continue}let J=K.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 fe=se[1]||se[2],ue=se[3];if(se[1])try{ne[fe]=c(ue,v)}catch{ne[fe]=ue}else ne[fe]=ue}let oe=E.componentsDir||"components",ie=await Ve(G,ne,K.slotContent,oe,v,k,E,new Set,C??new Set);j=j.slice(0,K.index)+ie+j.slice(K.index+K.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Uo(J)} -->`;j=j.slice(0,K.index)+ne+j.slice(K.index+K.full.length)}}return j=await uv(j,v,k,E,C),j}async function uv(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 K=B[F];try{let G=Up(K.expr,v);if(!G||typeof G!=="string"){let re=`<!-- dynamic component: could not resolve "${Uo(Hp(K.expr))}" -->`;j=j.slice(0,K.index)+re+j.slice(K.index+K.full.length);continue}if(bl.has(G)){let re=qp(G,K.attrs,"");j=j.slice(0,K.index)+re+j.slice(K.index+K.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,K.index)+ne+j.slice(K.index+K.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Uo(J)} -->`;j=j.slice(0,K.index)+ne+j.slice(K.index+K.full.length)}}return j}function vl(){return{afterOpen:[],beforeClose:[]}}function dv(x){return x.afterOpen.length>0||x.beforeClose.length>0}function Zp(x,v){if(!dv(v))return x;let k=v.afterOpen.join(""),E=v.beforeClose.join(""),C=x.lastIndexOf("</head>"),j=k?ni(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 Xp=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function ni(x){let v=/<head\b[^>]*>/i.exec(x);if(!v)return null;let k=v.index+v[0].length;Xp.lastIndex=k;let E=Xp.exec(x);return E?k+E[0].length:k}var Sl="data-stx-color-mode-boot",fv="__STX_COLOR_MODE__",pv=new Set(["light","dark","auto","system"]),gv=new Set(["auto","system"]),mv=/^[a-z][\w:-]*$/i,hv=/^[\w-]+$/;function yv(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(!pv.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"||!hv.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"||!mv.test(C)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(C)}`);if(j!==null&&!gv.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 xv(x){return JSON.stringify(x).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $l(x={}){let v=yv(x),E=`(function(){"use strict";var c=${xv(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.${fv}={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 ${Sl}>${E}</script>`}function Nn(x,v={}){if(x.includes(Sl))return x;let k=wl(x);if(k===null)return x;let E=$l(v);return`${x.slice(0,k)}
|
|
2516
|
+
${E}${x.slice(k)}`}var wl=ni,bv=new RegExp(`<script\\b[^>]*\\b${Sl}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Gp=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Jp=/<\/head>/gi;function vv(x){let v=/<head\b[^>]*>/i.exec(x);if(!v)return x;let k=v.index+v[0].length;Jp.lastIndex=k;let E=Jp.exec(x),C=E?E.index:x.length;Gp.lastIndex=k;let j=Gp.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)}
|
|
2517
|
+
${j[0]}${x.slice(k,j.index)}${x.slice(L,C)}${x.slice(C)}`}function Yp(x){return wv(vv(x))}function wv(x){let v=bv.exec(x);if(!v)return x;let k=wl(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=wl(E);if(C===null)return x;return`${E.slice(0,C)}
|
|
2518
|
+
${v[0]}${E.slice(C)}`}var Wi="X-STX-Build",_l=Symbol.for("stx.buildId");function rs(){let x=globalThis;if(!x[_l])x[_l]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return x[_l]}function Qp(x,v=rs()){if(x.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(x))return null;return`
|
|
2519
|
+
<meta name="stx-build" content="${v}">`}function Sv(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(K){if(L.updateReady)try{K()}catch{}else j.push(K);return()=>{let G=j.indexOf(K);if(G!==-1)j.splice(G,1)}},applyUpdate(){let K=E&&E.waiting;if(!K)return!1;return C=!0,K.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=L;let B=(K)=>{if(!K.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",(K)=>{let G=K.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((K)=>{if(E=K,K.waiting)B(K),K.waiting.postMessage({type:"stx:activate-update",reason:"load"});K.addEventListener("updatefound",()=>{let G=K.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")B(K)})})}).catch(()=>{})},F=()=>{let K=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>K(z));else K(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 $v(){let x=`(${Sv.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(x).trim().replace(/;$/,"")}catch{return x}}var eg=`<script data-stx-offline>${$v()}</script>`;import{AsyncLocalStorage as _v}from"async_hooks";var tg=new _v;function en(x){return x.__stx_server_data??={pending:new Map,values:new Map}}function ng(x,v){return tg.run(en(x),v)}async function rg(x,v){let k=tg.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 Mn(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 og="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Ho="data-stx-html-attrs",qo="data-stx-html-class",ag=/^[A-Za-z_:][\w:.-]*$/;function sr(x){return String(x).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kv(x){return String(x).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function gr(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 Ev(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 As(x,v){return Object.entries(x).filter(([k])=>!v?.(k)).map(([k,E])=>`${k}="${sr(String(E))}"`).join(" ")}function Cv(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(!ag.test(F))continue;let K=F.toLowerCase();if(K==="lang"){j=String(z);continue}if(K==="class"){C=String(z).trim();continue}k.push(` ${F}="${sr(String(z))}"`),E.push(F)}let L=` lang="${sr(j)}"`;if(C)L+=` class="${sr(C)}"`;if(L+=k.join(""),C)L+=` ${qo}="${sr(C)}"`;if(E.length)L+=` ${Ho}="${sr(E.join(" "))}"`;return L}function cg(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 Ln(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 K=L[1];if(!(K in E))C.push(K);E[K]=L[2]??L[3]??L[4]??""}let B=[],z=[];for(let[K,G]of Object.entries(v)){if(G==null)continue;let J=K.trim();if(!ag.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(!(qo in E))C.push(qo);E[qo]=B.join(" ")}if(z.length){if(!(Ho in E))C.push(Ho);E[Ho]=z.join(" ")}let F=C.map((K)=>` ${K}="${sr(E[K])}"`).join("");return x.replace(k[0],()=>`<html${F}>`)}function lg(x){if(x.includes("data-stx-cloak"))return null;if(x.lastIndexOf("</head>")===-1)return null;return`${og}
|
|
2520
|
+
`}function Rv(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 K=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){v.push(K[0]),k+=K[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 Tv(x,v={},k={}){let{title:E="stx App",lang:C="en",meta:j=[],link:L=[],script:B=[],headRaw:z="",htmlAttrs:F={},bodyClass:K="",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(gr).filter(Boolean)),{body:se,hoisted:oe}=Rv(x),ie=new Set(oe.flatMap((Ce)=>{let _e=Ev(Ce);return _e?[gr(_e)].filter(Boolean):[]})),ue=[...ne.filter((Ce)=>!re.has(gr(Ce))),...j].filter((Ce)=>!ie.has(gr(Ce))).map((Ce)=>` <meta ${As(Ce)}>`).join(`
|
|
2521
|
+
`),be=L.map((Ce)=>` <link ${As(Ce)}>`).join(`
|
|
2522
|
+
`),we=B.map((Ce)=>{if(Ce.src)return` <script ${As(Ce,(_e)=>_e==="content")}></script>`;if(Ce.content)return` <script>${Ce.content}</script>`;return""}).filter(Boolean).join(`
|
|
2523
|
+
`),Se=Cv(F,C),$e=Object.entries(G).map(([Ce,_e])=>` ${Ce}="${sr(String(_e))}"`).join(""),Ee=K?` class="${sr(K)}"`:"",ke=[ue,k.colorMode?` ${$l(k.colorMode)}`:"",` <title>${k.titleIsHtml?J:kv(J)}</title>`,` ${og}`,be,we,z?` ${z}`:"",...(k.styles||[]).map((Ce)=>` ${Ce}`),...oe.map((Ce)=>` ${Ce}`),...(k.headScripts||[]).map((Ce)=>` ${Ce}`),k.headStack||""].filter(Boolean),Re=[se,...(k.bodyScripts||[]).map((Ce)=>Ce),k.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
2524
|
+
<html${Se}>
|
|
2525
|
+
<head>
|
|
2526
|
+
${ke.join(`
|
|
2527
|
+
`)}
|
|
2528
|
+
</head>
|
|
2529
|
+
<body${Ee}${$e}>
|
|
2530
|
+
${Re.join(`
|
|
2531
|
+
`)}
|
|
2532
|
+
</body>
|
|
2533
|
+
</html>`}var kl=/\s+/y,El=/<(script|style)\b[^>]*>/iy,Av=/<\/script>/gi,Iv=/<\/style>/gi,sg=/<!DOCTYPE\b/iy,ig=/<html[\s>]/iy;function tn(x){let v=0;while(v<x.length){if(kl.lastIndex=v,kl.exec(x)){v=kl.lastIndex;continue}if(x.startsWith("<!--",v)){let C=x.indexOf("-->",v);if(C===-1)return!1;v=C+3;continue}El.lastIndex=v;let E=El.exec(x);if(E){let C=E[1].toLowerCase()==="script"?Av:Iv;C.lastIndex=El.lastIndex;let j=C.exec(x);if(j===null)return!1;v=j.index+j[0].length;continue}if(sg.lastIndex=v,sg.test(x))return!0;return ig.lastIndex=v,ig.test(x)}return!1}function Cl(x){return tn(x)}function ug(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 K=gr(F);if(K&&B.includes(K))continue;z.push(` <meta ${As(F)}>`)}for(let F of C){if(F.href&&B.includes(`href="${F.href}"`))continue;z.push(` <link ${As(F)}>`)}for(let F of j)if(F.src){if(B.includes(`src="${F.src}"`))continue;z.push(` <script ${As(F,(K)=>K==="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
|
+
${x.slice(k)}`}function jn(x,v={},k={},E){if(E??Cl(x))return x;return Tv(x,v,k)}var Pv=/<\/(script)/gi;function Is(x){if(!x||x.indexOf("</")===-1)return x;return x.replace(Pv,"<\\/$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 dg from"path";function M(x,v={}){return new pn(x,v).routes}var fg=new Map;async function pg(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=dg.isAbsolute(k)?k:dg.join(E,k),j=fg.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 fg.set(C,L),L}function Mv(x){return x.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gg(x){return Mv(JSON.stringify(x))}function ae(x){return x.includes("data-stx-runtime")}function mg(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 Rl(x,v){let k=Bs(x),E=x.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return x.slice(0,k)+v+`
|
|
2536
|
+
`+x.slice(k);let C=ni(x);if(C!==null)return`${x.slice(0,C)}
|
|
2537
|
+
${v}${x.slice(C)}`;if(x.includes("</head>")){let L=x.indexOf("</head>");return x.slice(0,L)+v+`
|
|
2538
|
+
`+x.slice(L)}if(Cn(x))return Or(x,(L)=>`${L}
|
|
2539
|
+
${v}`);return`${v}
|
|
2540
|
+
${x}`}async function Ko(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-hs90en70.js"),{url:j}=await C("runtime",v.debug===!0);return Rl(x,`<script data-stx-runtime src="${j}"></script>`)}if(v.buildMode==="compile")return Rl(x,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-hs90en70.js"),E=await k(v.debug);return Rl(x,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function Ov(x){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(x)}function hg(x){if(x.includes("data-stx-tooltip-runtime")||!Ov(x))return x;let v=`<script data-stx-scoped data-stx-tooltip-runtime>${dl()}</script>`,k=x.lastIndexOf("</body>");if(k===-1)return`${x}
|
|
2541
|
+
${v}`;return`${x.slice(0,k)}${v}
|
|
2542
|
+
${x.slice(k)}`}var Nv=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function jv(x){return Nv.test(x)||x.includes("__stxRouter)return")||x.includes("__stxRouter=true")}async function q(x,v){if(!x.includes("</body>"))return x;if(jv(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 pg(v?.pagesDir,v?.root);if(F.length>0)z.ownedRoutes=F}catch{}if(Object.keys(z).length>0)E=`<script>window.__stxRouterConfig=${gg(z)};</script>
|
|
2543
|
+
`}let{getCachedRouterScript:C,getServeClientAsset:j}=await import("./chunk-hs90en70.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+`
|
|
2544
|
+
</body>`+x.slice(B+7)}var yg=Symbol.for("stx.lazy-module-promises");function Lv(){let x=globalThis;return x[yg]??=new Map,x[yg]}function lt(x,v){let k=Lv(),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 Tl=`(?:"[^"]*"|'[^']*'|[^>"'])*`,_g=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Bv=65536,zv=4,Zo=new Map;function _u(){Zo.clear()}function Fv(x){let v=[];for(let k of Ir(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 Ga(x,v={}){let k=x.length>=Bv,E=k?Zo.get(x):void 0;if(E===void 0){if(E=Fv(x),k)bi(Zo,zv),Zo.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 Kr(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}=xg(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}=xg(C);if(L)return{style:"in",iterable:j,itemVar:L,indexVar:B}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function xg(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 Gr(x,v){return mo(x,v)}function Wv(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 kg(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 Vv(x){if(!/[:@]for\s*=/.test(x)&&!/\bx-for\s*=/.test(x))return[];let v=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Tl})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=Ir(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=Kr(B?.[1]??B?.[2]??""),F=[z.itemVar,z.indexVar].filter(Boolean);if(F.length===0)continue;let K=L[1],J=/\/\s*>$/.test(j.token)||Go.has(K.toLowerCase())?j.end:Il(x,j.start,K,j.end);if(J!==-1)C.push({start:j.start,end:J,vars:new Set(F)})}return C}var bg=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 Uv(x){return x.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function vg(x,v,k,E){if(!x)return!1;let C=Uv(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(bg.has(ne))continue;if(v.has(ne)||E?.has(ne))j=!0;else if(k&&ne in k)L=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=K.exec(C))!==null){let ne=G[1];if(C.slice(0,G.index).trimEnd().endsWith("."))continue;if(bg.has(ne)||k&&ne in k)continue;B=!0}return(j||B)&&!L}function Xo(x,v,k){let E=k===void 0?` ${v}`:` ${v}="${k.replace(/"/g,""")}"`,C=x.trim(),j=C.match(_g);if(j&&Hv(j[3],j[1])){let[,L,B,z]=j;return`<${L}${B}${E}>${z}</${L}>`}return`<template${E}>${C}</template>`}function Hv(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 Li(x,v){let k=kg(x);function E(C){let j=C,L=Vv(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,K=[];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,fe=oe,ue=/@(if\s*\(|endif)/g;ue.lastIndex=oe;let be;while((be=ue.exec(j))!==null)if(be[1].startsWith("if"))ie++;else if(be[1]==="endif"){if(ie--,ie===0){fe=be.index+be[0].length;break}}if(ie!==0)continue;let we=j.substring(oe,fe-6).trim(),Se;if(Wv(we)){let $e=Us(j.substring(G,fe));if($e.length===0)continue;let Ee=$e[0].branches.filter((_e)=>_e.type!=="else"),ke=B(G);if(!(Ee.length>0&&Ee.every((_e)=>vg(_e.condition,k,v,ke))))continue;Se=$e[0].branches.map((_e)=>{let Te=E(_e.content);if(_e.type==="elseif")return Xo(Te,"@else-if",_e.condition??"");if(_e.type==="else")return Xo(Te,"@else");return Xo(Te,"@if",_e.condition??"")}).join(`
|
|
2545
|
+
`)}else{if(!vg(se,k,v,B(G)))continue;Se=Xo(E(we),"@if",se)}K.push({start:G,end:fe,replacement:Se}),z.lastIndex=fe}for(let G=K.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=K[G];j=j.substring(0,J)+re+j.substring(ne)}return j}return E(x)}function qv(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 Go=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),wg=/<(script|style)\b/iy,Kv=/<\/script/gi,Xv=/<\/style/gi;function Il(x,v,k,E){if(Go.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}wg.lastIndex=B;let F=wg.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"?Kv:Xv;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 K=/^<([a-z][\w-]*)\b/i.exec(x.slice(B,B+64));if(!K){B++;continue}let G=x.indexOf(">",B);if(G===-1)return-1;if(K[1].toLowerCase()===C){let J=x.slice(B,G+1);if(!(/\/\s*>$/.test(J)||Go.has(C)))L++}B=G+1}return-1}var Zv=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Gv(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 Zv.test(j)}function ji(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,fe=qv(se);if(fe===void 0)continue;let ue=B.index,be=ue+G.length,$e=!!ie||/\/\s*>$/.test(G)||Go.has(J.toLowerCase())?be:Il(x,ue,J,be);if($e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&Gv(x,$e)){j.lastIndex=be;continue}if(fe===!0){let ke=`<${J}${ne}${oe}${ie}>`;L.push({start:ue,end:be,replacement:ke});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 K=x;for(let G=z.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=z[G];K=K.substring(0,J)+re+K.substring(ne)}return K}var Sg=[":for","@for","x-for"];function Jr(x,v){if(!v||Object.keys(v).length===0)return x;if(!Sg.some((B)=>x.includes(`${B}=`)))return x;let k=kg(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,K=L.index,G=K+B.length,J=Sg.map((Se)=>({attr:Se,m:new RegExp(`\\s${Se}="([^"]*)"`).exec(F)})).find((Se)=>Se.m!==null);if(!J||!J.m)continue;let ne=Kr(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=Il(E,K,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),fe={...v,[ne.itemVar]:void 0};if(ne.indexVar)fe[ne.indexVar]=void 0;let ue=Jr(ie,fe),be=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:K,end:se,replacement:`@foreach(${be})${we}@endforeach`}),j.lastIndex=se}for(let B=C.length-1;B>=0;B--){let{start:z,end:F,replacement:K}=C[B];E=E.slice(0,z)+K+E.slice(F)}return E}function Yr(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,K=1,G=F;while(G<k.length&&K>0){if(k[G]==="(")K++;else if(k[G]===")")K--;G++}if(K!==0)continue;let J=k.substring(F,G-1).trim(),ne=G,re=Kr(J),se=B==="for"?"@endfor":"@endforeach",oe=1,ie=ne,fe=B==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${B}\\s*\\(|end${B})`,"g");fe.lastIndex=ne;let ue;while((ue=fe.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 be=()=>{let Re=[re.itemVar,re.indexVar].filter(Boolean);if(Re.length)L.push({start:z,end:ie,vars:Re})};if(re.iterable){let Re=re.iterable.trim();if(Re.startsWith("[")||Re.startsWith("{")||Re.startsWith("'")||Re.startsWith('"')||Re.startsWith("`")||/^-?\d/.test(Re)){be();continue}let Ce=Re.split(/[.[(]/)[0].trim(),_e=v?Ce in v:!1,Te=L.some((Ke)=>z>Ke.start&&z<Ke.end&&Ke.vars.includes(Ce));if(Ce&&(_e||Te)){be();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(),Se=v?{...v}:{};if(re.itemVar)delete Se[re.itemVar];if(re.indexVar)delete Se[re.indexVar];let $e=Yr(we,Se),Ee=$e.match(_g),ke;if(Ee){let[,Re,Ce,_e]=Ee;ke=`<${Re}${Ce} @for="${J}">${_e}</${Re}>`}else ke=`<template @for="${J}">${$e}</template>`;j.push({start:z,end:ie,replacement:ke}),E.lastIndex=ie}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:K}=j[B];k=k.substring(0,z)+K+k.substring(F)}return k}function Jv(x){let v=new Set,k=[],E=0,C=0,j=x.length,L=(K)=>{let G=E+1;while(G<j){let J=x[G];if(J==="\\"){G+=2;continue}if(J===K)return G+1;G++}return j},B=()=>{let K=E+2;while(K<j&&x[K]!==`
|
|
2546
|
+
`)K++;return K},z=()=>{let K=E+2;while(K<j-1){if(x[K]==="*"&&x[K+1]==="/")return K+2;K++}return j},F=(K)=>{let G=K,J=0;while(G<j){let ne=x[G];if(ne==="/"&&x[G+1]==="/"){let re=G+2;while(re<j&&x[re]!==`
|
|
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 K=x[E];if(K==="/"&&x[E+1]==="/"){let G=B();k.push(x.slice(E,G)),E=G;continue}if(K==="/"&&x[E+1]==="*"){let G=z();k.push(x.slice(E,G)),E=G;continue}if(K==='"'||K==="'"||K==="`"){let G=L(K);k.push(x.slice(E,G)),E=G;continue}if(K==="{"){C++,k.push(K),E++;continue}if(K==="}"){C--,k.push(K),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(K),E++}return k.join("")}var Yv=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Al(x,v,k){for(let E of k){if(E.start>=v)return!1;if(E.end>x)return!0}return!1}function Qv(x,v,k){let E=0;while(E<x.length){let C=x.indexOf(v,E);if(C===-1)return!1;if(!Al(C,C+v.length,k))return!0;E=C+v.length}return!1}function ew(x,v){if(Qv(x,"<body",v)){let C=new RegExp(`<body(${Tl})>`,"g"),j;while((j=C.exec(x))!==null)if(!Al(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(${Tl})>`,"gi"),E;while((E=k.exec(x))!==null){if(Al(E.index,E.index+E[0].length,v))continue;if(Yv.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function tw(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 Ja(x,v,k){let E=Ga(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 lt("stx/client-script-bundler",()=>import("./chunk-mcs7p3fy.js"));for(let fe of E){let ue=fe.body;if(ze(fe.attrs))ue=He(ue);if(C.test(ue)){j.push({content:ue,start:fe.start,end:fe.end});continue}if(!L(ue))continue;try{let be=await B(ht(ue).code,v||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(C.test(be))j.push({content:ue,start:fe.start,end:fe.end})}catch{}}if(j.length===0)return{output:x,setupCode:null};let z=`${v??""}\x00${j.map((fe)=>fe.content).join("\x00")}`,F=`__stx_setup_${Bun.hash(z).toString(36).slice(0,10)}`,K=[];for(let fe=0;fe<j.length;fe++){let ue=j[fe].bundled??ht(j[fe].content).code;if(!j[fe].bundled&&L(ue))ue=await B(ue,v||"",{projectRoot:process.cwd()});ue=Be(ue);let be=R(ue);K.push(`// \u2500\u2500 merged signal script #${fe+1} \u2500\u2500
|
|
2548
|
+
${be}`)}let G=K.join(`
|
|
2549
|
+
|
|
2550
|
+
`);G=Jv(G);let J=Ya(G),ne=J.split(",").map((fe)=>fe.trim()).filter(Boolean),re=zr(G,k),se=`
|
|
2551
|
+
<script data-stx-scoped>
|
|
2552
|
+
function ${F}() {
|
|
2553
|
+
${Et("const",ne)}
|
|
2554
|
+
${Is(`${re}${G}`)}
|
|
2555
|
+
return { ${J} };
|
|
2556
|
+
}
|
|
2557
|
+
window.__stx_latestSetup=${F};
|
|
2558
|
+
if(window.stx)window.stx._latestSetup=${F};
|
|
2559
|
+
</script>`,oe=ew(x,j);return{output:tw(x,j,oe,F),setupCode:se}}function Ya(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===`
|
|
2560
|
+
`)return;j++}},F=()=>{if(!B)return!0;if(/[\w)\]]/.test(B))return!1;return!0},K=(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]==='"')K(v[j]);else if(v[j]==="`")G();else j++;continue}j++}},J=()=>{if(v[j]==="/"&&v[j+1]==="/"){while(j<L&&v[j]!==`
|
|
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 be=ue.trim();if(!be)return;let we=be.indexOf(":"),$e=(we>=0?be.slice(we+1).trim():be).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 be=ue.trim().replace(/^\.\.\./,"");if(!be)return;let we=be.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 fe=v.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(fe){let ue=fe[1];if(!E.has(ue))k.push(ue),E.add(ue)}};while(j<L){if(J())continue;if(v[j]==="'"||v[j]==='"'){K(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 Bi(x,v,k,E){if(!Gr(x,k))return x;let C=x;if(v.skipSignalsRuntime)return C;let{output:j,setupCode:L}=await Ja(C,k,E);if(C=j,!L){let B=Cn(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 Ko(C,v),L){let B=Fi(C,/<\/head>/i),z=B===-1?Fi(C,/<body[^>]*>/i):-1;if(B!==-1)C=`${C.slice(0,B)}${L}
|
|
2562
|
+
${C.slice(B)}`;else if(z!==-1){let F=/<body[^>]*>/i.exec(C.slice(z))[0],K=z+F.length;C=`${C.slice(0,K)}
|
|
2563
|
+
${L}${C.slice(K)}`}else C=`${C}
|
|
2564
|
+
${L}`}return C}function Fi(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(([K,G])=>z>=K&&z<G))return z;L=z+Math.max(B[0].length,1)}return-1}var $g="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Za(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 $g;return`var ${v.join(", ")}; ${$g}`}var nw=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Be(x){return x.replace(nw,(v,k)=>Za(k))}import Ps from"path";import rw from"process";function y(x="STX_PUBLIC_"){let v={},k={};for(let[E,C]of Object.entries(rw.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 Eg(x){return x.startsWith("http://")||x.startsWith("https://")||x.startsWith("//")}async function Cg(x,v,k){try{let E;if(x.startsWith("/")){let C=v;for(let j=0;j<5;j++){let L=Ps.join(C,x);if(await Bun.file(L).exists())return L;C=Ps.dirname(C)}E=Ps.join(v,x)}else if(x.startsWith("./")||x.startsWith("../"))E=Ps.resolve(v,x);else E=Ps.resolve(v,x);if(await Bun.file(E).exists())return E;return null}catch{return null}}var Rg=Symbol.for("stx.inline-assets.import-meta");function sw(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.
|
|
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[Rg]=!0,k}async function Tg(x,v,k){let E=x,C=Ps.dirname(v),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,L;while((L=j.exec(E))!==null){let[F,K,G,J]=L;if(Eg(G))continue;let ne=await Cg(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(),sw(re,G)}let se=`<script>
|
|
2566
|
+
// Source: ${G}
|
|
2567
|
+
${re}
|
|
2568
|
+
</script>`;E=E.replace(F,se),j.lastIndex=0}catch(re){if(re?.[Rg])throw re}}let B=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,z;while((z=B.exec(E))!==null){let[F,K,G,J]=z,ne=K+J;if(Eg(G))continue;if(/rel=["']stylesheet["']/.test(ne)||G.endsWith(".css")){let se=await Cg(G,C,v);if(se)try{let oe=await Bun.file(se).text();k.add(se);let ie=`<style>
|
|
2569
|
+
/* Source: ${G} */
|
|
2570
|
+
${oe}
|
|
2571
|
+
</style>`;E=E.replace(F,ie),B.lastIndex=0}catch(oe){}}}return E}function ss(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,K=!1;while(z<k.length&&B>0){let ue=k[z];if(K){K=!1,z++;continue}if(ue==="\\"&&F){K=!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 be=G[ue];if(oe){oe=!1;continue}if(be==="\\"&&se){oe=!0;continue}if(se){if(be===se)se=null;continue}if(be==='"'||be==="'"||be==="`"){se=be;continue}if(be==="("||be==="["||be==="{")re++;else if(be===")"||be==="]"||be==="}")re--;if(be===","&&re===0){ne=ue;break}}let ie=ne>=0?G.substring(0,ne).trim():G,fe=ne>=0?G.substring(ne+1).trim():void 0;try{let ue=ie.trim(),be;if(p(ue))be=l(ue,Object.keys(v))(...Object.values(v));else be=void 0;let we;if(fe==="true")we=JSON.stringify(be,null,2);else we=JSON.stringify(be);let Se=we.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+Se+k.substring(z+1),E.lastIndex=j+Se.length}catch(ue){_.log(ue instanceof Error?ue:Error(String(ue)),{directive:"@json"},"error"),E.lastIndex=j+J.length}}return k}function is(x){return x.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Ig(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(),K=z,G=v.slice(K),J=G.indexOf("@endmemo");if(J===-1)continue;let ne=G.slice(0,J),re=K+J+8,se=ne.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=se?se[0].length:0,ie=ne.slice(oe),fe=ne.match(/(\s*)$/),ue=fe?fe[0].length:0,be=ie.slice(0,ie.length-ue),we=be.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),Se;if(we){let[$e,Ee,ke="",Re]=we,Ce=`<${Ee}${ke} data-stx-memo="${F}"${Re}>`;Se=ne.slice(0,oe)+Ce+be.slice($e.length)+ne.slice(oe+be.length)}else Se=`${ne.slice(0,oe)}<div data-stx-memo="${F}">${be}</div>${ne.slice(oe+be.length)}`;C.push({start:j,end:re,replacement:Se}),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 Pl(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 Pg(x,v){if(!/\bref\s*=/.test(x))return x;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=Ir(x,(z,F)=>{k.lastIndex=F;let K=k.exec(z);if(!K||/^(?:script|style)$/i.test(K[1]))return-1;return k.lastIndex}),C=[],j=0,L=0,B=[];for(let{start:z,end:F,token:K}of E){let G=/^<\/?([\w-]+)/.exec(K)[1].toLowerCase();if(K.startsWith("</")){let ne;while(ne=C.pop()){if(ne.scoped)j--;if(ne.name===G)break}continue}let J=/\sdata-stx-scope\s*=/.test(K);if(!j&&!J&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(K)&&!/\sdata-stx-ref-caller\s*=/.test(K))B.push(x.slice(L,z),K.replace(/\s*\/?>$/,(ne)=>` data-stx-ref-caller="${v}"${ne}`)),L=F;if(!Dg.has(G)&&!/\/>$/.test(K)){if(C.push({name:G,scoped:J}),J)j++}}return B.push(x.slice(L)),B.join("")}var Dg=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Mg=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Ag=/<\/?\s*([a-z][\w-]*)/iy,iw=/\s/;function ow(x,v){let k=v-1;while(k>=0&&iw.test(x[k]))k--;return k>=0&&x[k]==="/"}function aw(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 cw(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=aw(x,E);if(F===-1)break;Ag.lastIndex=E;let K=Ag.exec(x)?.[1]?.toLowerCase()??"";if(x[E+1]==="/"){if(k===0)break;k--}else if(!ow(x,F)&&!Dg.has(K))k++;E=F+1}return!1}function Og(x){if(x.length>=32768&&!Ou(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,K=-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===">"){K=B;break}B++}if(K===-1)continue;let G=x.slice(L,K+1);if(Mg.test(G))continue;if(G.includes("x-cloak"))continue;if(cw(x,K+1))E+=x.slice(C,K)+" x-cloak>",C=K+1}return E+=x.slice(C),E}var lw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,uw=/<\/script>/gi,dw=/<\/style>/gi;function Ng(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"?uw:dw;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,K=-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===">"){K=B;break}B++}if(K===-1)continue;let G=x.slice(j+C[0].length,K);if(Mg.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!lw.test(G))continue;let J=x[K-1]==="/",ne=J?K-1:K;k+=`${x.slice(E,ne)} x-cloak${J?" ":""}`,E=ne}return k+=x.slice(E),k}var Dl=I(256),fw=[{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"}],jg=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function pw(x){let v=Array.from(x,(C)=>C===`
|
|
2572
|
+
`?`
|
|
2573
|
+
`:" "),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 gw(x){let v=new Map,k=pw(x).split(`
|
|
2575
|
+
`),E=x.split(`
|
|
2576
|
+
`);return k.forEach((C,j)=>{jg.lastIndex=0;for(let L of C.matchAll(jg)){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 mw(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 os(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=Dl.get(j);if(L!==void 0){if(L&&C.failOnViolation)throw Error(L);return}let B=C.allowPatterns??[],z=gw(x),F=[],K=s(x.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:oe}of fw){if(B.some((fe)=>/\w/.test(fe)&&se.includes(fe)))continue;re.lastIndex=0;let ie=K.match(re);if(ie&&ie.length>0){let fe=K.split(`
|
|
2577
|
+
`),ue=x.split(`
|
|
2578
|
+
`),be=[];if(fe.forEach((Ee,ke)=>{if(re.lastIndex=0,re.test(Ee)&&!mw(z,ke+1,se))be.push(ke+1)}),be.length===0&&fe.some((Ee)=>(re.lastIndex=0,re.test(Ee))))continue;let we=be.length>0?` (script line${be.length>1?"s":""} ${be.join(", ")})`:"",Se=be.slice(0,3).map((Ee)=>` ${Ee} | ${(ue[Ee-1]??"").trim().slice(0,100)}`).join(`
|
|
2579
|
+
`),$e=Se?`
|
|
2580
|
+
${Se}`:"";F.push(` \u2717 ${se}${we}
|
|
2581
|
+
\u2192 ${oe}${$e}`)}}if(F.length===0){Dl.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
|
+
${F.join(`
|
|
2583
|
+
`)}
|
|
2584
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Dl.set(j,ne),C.failOnViolation)throw Error(ne);else console.warn(ne)}import Ml from"path";var hw=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,yw=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function xw(x,v){if(!v||!x.includes("/"))return x;let k=Ml.dirname(v);return x.replace(hw,(E,C,j,L)=>{let B=Ml.resolve(k,L);return`${C}${j}${B.split(Ml.sep).join("/")}${j}`})}function Lg(x,v){if(!v||!x.includes("<script"))return x;return x.replace(yw,(k,E,C,j)=>`${E}${xw(C,v)}${j}`)}var Er="<!--PARENT_CONTENT_PLACEHOLDER-->";function Bg(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function qg(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(`
|
|
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 K=x[z];if(K==="\\"){z+=2;continue}if(K==="[")F=!0;else if(K==="]")F=!1;else if(K==="/"&&!F){z++;break}else if(K===`
|
|
2586
|
+
`){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 Kg(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 vw=4096;async function zg(x,v,k){if(k.buildMode!=="serve"||v.length<vw)return null;let{registerServeModuleBundle:E}=await import("./chunk-hs90en70.js");return`<script ${x} src="${E(v)}"></script>`}async function Fg(x,v,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:C}=await lt("stx/client-module-registry",()=>import("./chunk-wpkxbggq.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-hs90en70.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 ww(x,v=""){let k=Kg(x,"data-stx-runtime");if(!k)return x;let E=Bs(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+`
|
|
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=Bs(j);if(L===-1)return C+v+`
|
|
2589
|
+
`+j;return j.slice(0,L)+C+v+`
|
|
2590
|
+
`+j.slice(L)}function Sw(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=me(x,k);let j=!v.__stxProcessingDepth;en(v);for(let L of E._layerGraph?.configDependencies??[])C.add(L);if(j&&E.runtimeConfig)await sn(v,k,E.runtimeConfig);if(j)tu(v),v.__stx_head_injections=vl(),v.__stx_seo_staged=!1;if(!v.__stxProcessingDepth)v.__stxProcessingDepth=0;if(v.__stxProcessingDepth++,!v.__onceStore)v.__onceStore=new Set;if((E.debug||!pe()&&!ln())&&k&&k.endsWith(".stx"))_s(x,k);try{return await U.timeAsync("template-processing",async()=>{let L=await $w(x,v,k,E,C);if(j)L=Pl(L);if(j&&E.autoShell&&E.buildMode!=="compile"){let B=E.app?.head||{},F=(v.__stx_runtime_head||null)??ws(),K=(v.__stx_head_raw||"").trim(),G,J=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(J)G=J[1].trim(),K=K.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)=>gr($e)).filter(Boolean)),fe={...B,...re&&{title:re},meta:[...(B.meta||[]).filter(($e)=>!ie.has(gr($e))),...oe],link:[...B.link||[],...F.link||[]],script:[...B.script||[],...F.script||[]],headRaw:[B.headRaw,K].filter(Boolean).join(`
|
|
2591
|
+
`),...F.htmlAttrs&&{htmlAttrs:cg(B.htmlAttrs,F.htmlAttrs)},...F.bodyAttrs&&{bodyAttrs:{...B.bodyAttrs||{},...F.bodyAttrs}}},ue=Cl(L);if(L=jn(L,fe,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},ue),ue)L=ug(L,B),L=Ln(L,fe.htmlAttrs);let be=L.match(/<!-- stx-layout: ([^ ]+) -->/);if(be&&L.includes("<head")){let $e=be[1],Ee=nr($e);L=L.replace(/<head\b[^>]*>/i,(ke)=>`${ke}
|
|
2592
|
+
<meta name="stx-layout" content="${Bg($e)}">
|
|
2593
|
+
<meta name="stx-layout-group" content="${Bg(Ee)}">`)}let we=L.match(/function (__stx_setup_\w+)\(/),Se=we?Cn(L):null;if(we&&Se&&!/\bdata-stx=/.test(Se.tag)){L=Or(L,(Ee,ke)=>`<body${ke} 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??vl(),z=lg(L);if(z!==null)B.beforeClose.push(z);let F=Qp(L);if(F!==null)B.afterOpen.push(F);if(E.offline?.enabled&&!L.includes("data-stx-offline"))B.beforeClose.push(eg);L=Zp(L,B);let K=E.app?.colorMode;if(K)L=Nn(L,K)}if(j)if(Kg(L,"data-stx-runtime")){let z=null,F=null,K=null,G=null,J=null;try{let{getStoreScript:re}=await lt("stx/store-loader",()=>import("./chunk-gtkhykc4.js")),se=E.storesDir,oe=await re(se);if(oe)K=`<script data-stx-stores>${oe}</script>`,F=await zg("data-stx-stores",oe,E)??K}catch{}z=await Fg([L,K],E,C);try{let{getFrameworkComposableScript:re}=await lt("stx/framework-composables",()=>import("./chunk-68rq2fqt.js"));J=await re(L)}catch{}try{let{getComposableScript:re}=await lt("stx/composable-loader",()=>import("./chunk-fet3hce8.js")),se=E.composablesDir,oe=[z,K,J].filter((fe)=>fe!==null),ie=await re(E._layerComposableDirs??se,L,oe);if(ie)G=await zg('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)=>`
|
|
2594
|
+
${re}`).join("");L=ww(L,ne)}else{let z=await Fg([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+`
|
|
2595
|
+
`+L.slice(F)}}if(j)L=Yp(L);if(j&&v.__stx_inject_css!==!1)L=await f(L,void 0,E.buildMode==="serve",!0);else if(j)L=js(L);if(L=L.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),L=Sw(L),j&&v.__stx_runtime_config)L=We(L,v.__stx_runtime_config);if(j&&!v.__stx_defer_server_data){let B=Mn(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 Yn)throw L;let B=L instanceof Error?L.message:String(L),z=new X(`Template processing failed: ${B}`,k,void 0,void 0,x.substring(0,200)+(x.length>200?"...":""));if(_.log(z,{filePath:k,context:v}),Ct.logDetailedError(z,{filePath:k,template:x.substring(0,500)}),E.debug)throw z;return xs.createFallbackContent("Template Processing",z)}}async function $w(x,v,k,E,C){let j=process.cwd(),L={...E,partialsDir:E.partialsDir&&!on.isAbsolute(E.partialsDir)?on.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!on.isAbsolute(E.componentsDir)?on.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!on.isAbsolute(E.layoutsDir)?on.resolve(j,E.layoutsDir):E.layoutsDir},B=L,z=x;await Ew(k,v),kw(v,B),z=await te(()=>Lp(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=$n(z,Me,(we,Se)=>`\x00STX_HTML_COMMENT_${Se}\x00`);z=F.output;let K=F.tokens,G=(we)=>K.length===0?we:we.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(Se,$e)=>K[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,Se)=>`${ne}${Se}${re}`),z=Vp(z),z=await Tg(z,k,C);let se={};z=ts(z,se);let oe={...v.__sections||{}},ie="",fe=Bd(Ne(x)),ue=/@nolayout\b/.test(z)||fe===!1;if(/@nolayout\b/.test(z))z=z.replace(/@nolayout\b\s*/g,"");let be=z.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(be)ie=be[1],z=z.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof fe==="string"){if(ie=fe,!/@section\s*\(/.test(z))z=`@section('content')
|
|
2596
|
+
${z.trim()}
|
|
2597
|
+
@endsection`}if(!ie&&!ue&&B.defaultLayout){let we=tn(z),Se=/@section\s*\(/.test(z);if(!we||Se){let $e="",Ee=on.dirname(k),ke=B.layoutsDir?on.dirname(B.layoutsDir):process.cwd();for(let Re=0;Re<20;Re++){let Ce=on.join(Ee,"_layout.stx");if(await n(Ce)){$e=Ce;break}let _e=on.dirname(Ee);if(_e===Ee||_e.length<ke.length)break;Ee=_e}if($e)ie=$e;else if(B.layoutsDir){let Re=on.isAbsolute(B.layoutsDir)?B.layoutsDir:on.resolve(process.cwd(),B.layoutsDir),Ce=on.join(Re,`${B.defaultLayout}.stx`);if(await n(Ce))ie=Ce}if(ie&&!Se)z=`@section('content')
|
|
2598
|
+
${z.trim()}
|
|
2599
|
+
@endsection`}}if(ie&&z.includes("<script")){let we=yn(z),Se=we.scripts.map(($e)=>Wg($e,k)??$e);z=Pr(we.output,Se)}if(z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(we,Se,$e)=>(oe[Se]=$e,"")),z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(we,Se,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return we;try{let Ee=c($e.trim(),v);if(Ee===void 0)return we;return oe[Se]=String(Ee??""),""}catch{return we}}),z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(we,Se,$e)=>{if($e.includes("@parent"))oe[Se]=$e.replace("@parent",Er);else oe[Se]=$e.trim();return""}),v.__sections=oe,z=z.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(we,Se,$e)=>oe[Se]||$e||""),!("slot"in v)||v.slot===void 0)z=z.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||"");if(z=ns(z,se),ie){let we=[],Se=yn(z),$e=$n(Se.output,Ar,(Ee,ke)=>`\x00STX_ORPHAN_STYLE_${ke}\x00`);if(z=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ee,ke,Re)=>{let Ce=ke==="SCRIPT"?Wg(Se.scripts[Number(Re)],k):$e.tokens[Number(Re)];if(Ce)we.push(Ce);return""}),we.length>0){let Ee=we.join(`
|
|
2600
|
+
`);oe.content=oe.content?`${oe.content}
|
|
2601
|
+
${Ee}`:Ee,v.__sections=oe}}if(ie)try{let we;if(on.isAbsolute(ie))we=ie,C.add(ie);else we=await te(()=>zn(ie,k,L,C),null,()=>{throw new X(`Failed to resolve layout path: ${ie}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!we){let Ce=(Ke)=>{if(!Ke)return[];try{let Pe=on.isAbsolute(Ke)?Ke:on.resolve(process.cwd(),Ke);return bw.readdirSync(Pe).filter((Ae)=>Ae.endsWith(".stx")).map((Ae)=>Ae.replace(/\.stx$/,""))}catch{return[]}},_e=[...Ce(L.layoutsDir),...Ce(L.fallbackLayoutsDir)].filter((Ke,Pe,Ae)=>Ae.indexOf(Ke)===Pe).sort(),Te=`Layout not found: ${ie} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:L.layoutsDir?`. No .stx layouts found in ${L.layoutsDir}`:"");if(_.log(Error(Te),{layoutPath:ie,filePath:k,available:_e},"error"),console.error(`[stx] ${Te}`),L.debug)throw new X(Te,k);return z}let Se=await te(()=>Bun.file(we).text(),"",()=>{throw new X(`Failed to read layout file: ${we}`,k,void 0,void 0,"Layout content could not be loaded")});Se=Lg(Se,we);let $e=Se.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(L.debug)console.log(`Found nested layout: ${$e[1]} in ${we}`);let Ce={},_e=Se.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ae,Ze)=>(Ce[Ae]=Ze.trim(),""));for(let[Pe,Ae]of Object.entries(Ce))if(oe[Pe]&&oe[Pe].includes(Er)){let Ze=oe[Pe].indexOf(Er);oe[Pe]=oe[Pe].slice(0,Ze)+Ae+oe[Pe].slice(Ze+Er.length)}else if(!oe[Pe])oe[Pe]=Ae;let Te={...v,__sections:oe},Ke=`@layout('${$e[1]}')${_e}`;return await r(Ke,Te,we,L,C)}let Ee=Se.replace(/\{\{--[\s\S]*?--\}\}/g,""),ke=ts(Ee,se),Re={};return ke=ke.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ce,_e,Te)=>(Re[_e]=Te.trim(),`@slot('${_e}')`)),ke=ke.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Ce,_e,Te)=>{if(oe[_e]){let Ke=oe[_e];if(Ke.includes(Er)){let Pe=Re[_e]||"",Ae=Ke.indexOf(Er);Ke=Ke.slice(0,Ae)+Pe+Ke.slice(Ae+Er.length)}return Ke}return Te||""}),ke=_w(ke,oe),ke=ke.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),ke=ns(ke,se),v.__originalFilePath=k,z=await Hg(ke,v,we,L,C),z=`<!-- stx-layout: ${ie} -->
|
|
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 Hg(z,v,k,L,C))}function _w(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 kw(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 Ew(x,v){await te(()=>Fp(x,v),void 0,(k)=>{_.log(k,{filePath:x,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${x}: ${k.message}`)})}var Ol="data-stx-source";function Wg(x,v){if(!x)return x;let k=/^<script\b([^>]*)>/i.exec(x);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Ol))return x;return`<script ${Ol}="${encodeURIComponent(v)}"${x.slice(7)}`}function Cw(x){let v=new RegExp(`${Ol}="([^"]*)"`).exec(x);return v?decodeURIComponent(v[1]):void 0}function Vg(x){return x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ug(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">${Vg(x)}</span><span style="display:block;margin-top:4px">${Vg(k)}</span></div>`}async function Rw(x,v,k,E){let{scanScriptTags:C}=await lt("stx/signal-processing",()=>import("./chunk-pz1jc3db.js")),j=[],L=!pe()&&!ln();for(let z of C(x)){let F=z.attrs;if(!/\bserver\b/.test(F))continue;let K=z.start+z.fullMatch.indexOf(">")+1,G=qg(x,K);if(G===-1)continue;let J=x.slice(K,G);if(!J.trim())continue;let ne=Cw(F)??k,re={index:z.start,length:G+9-z.start};try{let{extractVariables:se}=await lt("stx/variable-extractor",()=>import("./chunk-ckv4aty5.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:Ug(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:Ug(ne,"unknown",oe.message)})}}if(j.length===0)return x;let B=x;for(let z of j.sort((F,K)=>K.index-F.index))B=B.slice(0,z.index)+z.markup+B.slice(z.index+z.length);return B}async function Tw(x,v,k){try{let{interpolateScriptsInTemplate:E}=await lt("stx/expressions",()=>import("./chunk-x4q2eyt0.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 Hg(x,v,k,E,C){let j=x,L=E;if(j=await Rw(j,v,k,E),j=await Tw(j,v,k),j=await Ep(j,v,k),j=await Cp(j,v,k),j=await kf(j,v,k,L),me(j))j=Li(j,v),j=Yr(j,v),j=Jr(j,v);j=ji(j);let{processStreamDirectives:B}=await lt("stx/streaming",()=>import("./chunk-fe5st320.js"));j=B(j,v),j=Vi(j,v,k,L,!0),j=await Kp(j,v,k,L,C),j=await Xr(j,v,k,L,C),j=Ld(j,v,k,L);let{processDeferDirectives:z}=await lt("stx/defer",()=>import("./chunk-wtd71jsa.js"));j=z(j,v,k);let{processTeleportDirectives:F}=await lt("stx/teleport",()=>import("./chunk-x95ejws0.js"));j=F(j,v,k);let{processTransitionDirectives:K,processTransitionAttributes:G}=await lt("stx/transitions",()=>import("./chunk-2gfj59pt.js"));j=K(j,v,k),j=G(j);let{processErrorBoundaryDirectives:J,stripRenderFailedMarkers:ne}=await lt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=J(j,v,k),j=ne(j);let{processSuspenseDirectives:re}=await lt("stx/suspense",()=>import("./chunk-xket8ejt.js"));j=re(j,v,k);let{processAsyncDirectives:se}=await lt("stx/async-components",()=>import("./chunk-2hvvwhmv.js"));j=se(j,v,k);let{processKeepAliveDirectives:oe}=await lt("stx/keep-alive",()=>import("./chunk-fq7128p1.js"));j=oe(j,v,k);let{processVirtualListDirectives:ie,processVirtualGridDirectives:fe,processInfiniteListDirectives:ue}=await lt("stx/virtual-scrolling",()=>import("./chunk-2gntnw7e.js"));j=ie(j,v,k),j=fe(j,v,k),j=ue(j,v,k);let{processPartialHydrationDirectives:be,processStaticDirectives:we}=await lt("stx/partial-hydration",()=>import("./chunk-h8pkm7c5.js"));j=be(j,v,k),j=we(j);let{processComputedDirectives:Se,processWatchDirectives:$e}=await lt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=Se(j,v,k),j=$e(j,v,k);let{processFormValidationDirectives:Ee}=await lt("stx/forms-validation",()=>import("./chunk-jn3njpxs.js"));j=Ee(j,v,k);let{processHeadDirective:ke,processTitleDirective:Re,processMetaDirective:Ce,resetHead:_e}=await lt("stx/head",()=>import("./chunk-atgwc7r7.js"));if(!v.__stx_head_preset&&!v.__stx_runtime_head)_e();let Te=ke(j);if(j=Te.content,Te.headContent)v.__stx_head_raw=`${v.__stx_head_raw||""}${Te.headContent}
|
|
2603
|
+
`;if(j=Re(j,v),j=Ce(j,v,k),j=zp(j),j=Lc(j,v),j=_f(j),j=Np(j),j=await es(j,v,k,L,C),j=await Xr(j,v,k,L,C),v.__stxProcessingDepth===1)j=nu(j,v);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Pl(j),j=tr(j,v,k),j=Qr(j),j=zd(j,v,{filePath:k,buildMode:L.buildMode}),j=Bc(j,v),j=zc(j,v),j=_o(j,v),j=Pf(j,v),j=Df(j,v),j=await gf(j,v,k,L),j=await qd(j,v,k),j=await to(j,v,k,L),j=no(j,v,k,L),j=ms(j,v,k,L),j=hs(j,v,k),j=ys(j,v,k,L),j=Sf(j,v,k,L),j=ss(j,v),j=is(j),j=Ig(j),!L.skipEventDirectives)j=Yl(j,v,k);if(j=Vd(j,v,k),L.debug){let Qe=/\bx-data\s*=/.test(j),st=Gr(x);if(Qe&&st)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2604
|
+
Both work on the same page, but they manage separate scopes.
|
|
2605
|
+
Prefer signals (state/derived/effect) for new components.`)}j=mp(j,v),j=await W(j,v,k),j=Og(j),j=Ng(j),j=Td(j);let{processXElementDirectives:Ke}=await lt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Ke(j);let Pe=v.__originalFilePath||k,Ae=Oe(v);if(j=await Bi(j,L,Pe,Ae),j=Tf(j,v),j=await Bp(j,v,k,L),L.media?.image?.autoSiblings){let Qe=L.publicDir||"public",{rewriteImagesWithSiblings:st}=await lt("stx/image-optimization/auto-sibling",()=>import("./chunk-t2bfwr9v.js"));j=await st(j,{publicDir:Qe})}if(L.seo?.enabled)j=bs(j,v,L);let Ze=(Qe,st,pt=!0)=>{if(!st)return Qe;let Ht=st.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Pt=Qe.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Ht&&Pt){if(pt)Qe=Qe.replace(Pt[0],Ht[0]);if(st=st.replace(Ht[0],"").trim(),!st)return Qe}if(/<\/head>/i.test(Qe))return Qe.replace(/<\/head>/i,`${st}
|
|
2606
|
+
</head>`);if(/<head\b[^>]*>/i.test(Qe))return Qe.replace(/(<head\b[^>]*>)/i,`$1
|
|
2607
|
+
${st}`);if(/<html\b[^>]*>/i.test(Qe))return Qe.replace(/(<html\b[^>]*>)/i,`$1
|
|
2608
|
+
<head>
|
|
2609
|
+
${st}
|
|
2610
|
+
</head>`);return Qe},{renderHead:tt,getHead:ot}=await lt("stx/head",()=>import("./chunk-atgwc7r7.js")),_t=v.__stx_runtime_head??ot();if(_t.title||_t.meta?.length||_t.link?.length){let Qe=tt(_t);if(Qe)j=Ze(j,Qe)}if(Te.headContent)j=Ze(j,Te.headContent,!_t.title);if(L.csp?.enabled&&L.csp.addMetaTag)j=vf(j,L.csp,v);if(L.analytics?.enabled)j=Ad(j,L);if(L.heatmap?.enabled)j=Pd(j,L);if(L.pwa?.enabled&&L.pwa.autoInject!==!1){let{injectPwaTags:Qe}=await lt("stx/pwa/inject",()=>import("./chunk-dhqkg0ph.js"));j=Qe(j,L)}let dt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),$t=/\bSTX\.\w+/.test(j),at=/window\.STX\s*=/.test(j);if(dt&&$t&&!at){let st=`<script data-stx-scoped data-stx-run="once">
|
|
2611
|
+
${Ed()}
|
|
2612
|
+
</script>`;if(j.includes("</head>")){let pt=j.indexOf("</head>"),Pt=j.slice(0,pt).indexOf("<script");if(Pt!==-1){let hn=j.slice(0,Pt),Ot=j.slice(Pt);j=hn+st+`
|
|
2613
|
+
`+Ot}else j=j.replace("</head>",`${st}
|
|
2614
|
+
</head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
|
|
2615
|
+
${st}`);else j=st+`
|
|
2616
|
+
`+j}{let{scanScriptTags:Qe}=await lt("stx/signal-processing",()=>import("./chunk-pz1jc3db.js")),st=[];for(let pt of Qe(j)){if(!/\bserver\b/i.test(pt.attrs))continue;let Ht=pt.start+pt.fullMatch.indexOf(">")+1,Pt=qg(j,Ht);if(Pt===-1)continue;let hn=Pt+9;while(hn<j.length&&/\s/.test(j[hn]))hn++;st.push({start:pt.start,end:hn})}if(st.length>0){let pt=Array(st.length+1),Ht=0;for(let Pt=0;Pt<st.length;Pt++){let{start:hn,end:Ot}=st[Pt];pt[Pt]=j.slice(Ht,hn),Ht=Ot}pt[st.length]=j.slice(Ht),j=pt.join("")}}let It=Si(j,k);if(It.hasScoped)j=It.html;let ft=v.__stx_event_bindings||[],Nt=!1,Kn=[],vn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Gn}=await lt("stx/signal-processing",()=>import("./chunk-pz1jc3db.js"));for(let Qe of Gn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Kn.push({match:Qe.fullMatch,attrs:Qe.attrs,content:Qe.body});for(let{match:Qe,attrs:st,content:pt}of Kn){Nt=!0;let Ht=pt;os(pt,k,E.strict,v.__originalFilePath);let Pt=await ge(pt,{eventBindings:ft,attrs:st,hasColonDirectives:vn,templateContent:x,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ae});j=j.replace(Qe,()=>Pt)}if(Nt)v.__stx_event_bindings=[];if(!Nt&&v.__stxProcessingDepth===1){let Qe=v.__stx_event_bindings||[];if(Qe.length>0){let st=ua(Qe);if(st){let pt=j.lastIndexOf("</body>");j=pt===-1?j+st:j.slice(0,pt)+st+`
|
|
2617
|
+
`+j.slice(pt)}v.__stx_event_bindings=[]}}if(!ae(j)&&mg(j))j=await Ko(j,L);if(j=hg(j),L.csp?.enabled&&L.csp.useNonce&&typeof v.cspNonce==="string")j=wf(j,v.cspNonce);return j}import om from"path";import jl from"fs";import ri from"path";function Xg(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 Aw(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 Nl(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=Xg(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=Xg(k,j,"(",")");if(B>=0)return{type:L,args:Aw(x.slice(j+1,B))}}return null}var Zg=`
|
|
2618
|
+
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
|
+
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
2620
|
+
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>;
|
|
2621
|
+
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
2622
|
+
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
2623
|
+
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
|
+
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
2625
|
+
`;function Gg(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((fe)=>{let[ue,be=ue]=fe.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ue)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&ue in E)E[ue].push(be);return`import ${be} = ${ie}.${ue};`}).join(`
|
|
2626
|
+
`)}),L=Nl(x,E.defineProps),B=Nl(x,E.defineEmits),z=Nl(x,E.withDefaults);if(!L&&!B)return{declarations:"",props:null,events:null};let F=[],K=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>>;`),K=`${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
|
+
namespace ${v} {
|
|
2629
|
+
${j}
|
|
2630
|
+
${F.join(`
|
|
2631
|
+
`)}
|
|
2632
|
+
}`,props:K,events:G}}function*Iw(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 K=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(K,E),offset:K,braced:z}),F||z)E++}v.lastIndex=E,yield{name:k[1],offset:k.index,attributes:C}}}function Jg(x,v,k){let E=[],C=[Zg,"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=ri.isAbsolute(se)||se.startsWith(".")?ri.resolve(ri.dirname(k.filePath),se):Co(se,ri.dirname(k.filePath));if(!oe)continue;let ie=oe.endsWith(".stx")?oe:jl.existsSync(`${oe}.stx`)?`${oe}.stx`:void 0,fe=ie?null:Eo(oe,!1),ue=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let be of ue){let[we,Se=we]=be.trim().split(/\s+as\s+/),$e=ie||fe?.get(we)||fe?.get(we.toLowerCase());if($e)B.set(Se,$e),B.set(Se.toLowerCase(),$e),B.set(Se.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=Ro(se[1],k.filePath,k).find((ie)=>jl.statSync(ie,{throwIfNoEntry:!1})?.isFile());if(oe)B.set(ri.basename(se[1]).replace(/\.stx$/,""),oe)}let K={__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
|
+
`).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 Iw(v)){if(Qt(re.name)||re.name==="component")continue;let se=Nf(re.name,k.filePath,k,K);if(!se)continue;let oe=G.get(se);if(!oe){let fe;try{fe=k.readComponent?k.readComponent(se):jl.readFileSync(se,"utf8")}catch{continue}if(fe===void 0)continue;L.set(se,fe),oe=Gg(k.scriptCode(fe,se),`__StxComponent${G.size}`),G.set(se,oe),C.push(oe.declarations)}let ie=[];for(let fe of re.attributes){let{name:ue,offset:be}=fe,we=fe.value===!0?"true":fe.value;if(ue.startsWith("@")||ue.startsWith("v-on:")){if(oe.events&&fe.value!==!0)j.set(be,`__StxEvent<${oe.events}, ${JSON.stringify(ue.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let Se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ue);if(ue.startsWith("v-")&&!ue.startsWith("v-bind:")&&!Se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ue))continue;let $e=(Se?Se[1]||"modelValue":ue.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Re,Ce)=>Ce.toUpperCase());if(ie.push($e),!oe.props)continue;let ke=ue.startsWith(":")||ue.startsWith("v-bind:")||!!Se||fe.braced?we:fe.value!==!0?JSON.stringify(we):"true";ne(J(be,ke,ue),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify($e)}>);`)}if(oe.props){let fe=[...new Set(ie)].map((be)=>`${JSON.stringify(be)}: undefined as any`).join(", "),ue=J(re.offset,`<${re.name}>`);E.push({expression:ue,statement:{text:`;void ({ ${fe} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?C.join(`
|
|
2635
|
+
`):"",checks:E,events:j,dependencies:L}}var Yg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Pw(x){let v=(k)=>k.replace(/[^\n]/g," ");return x.replace(/<!--[\s\S]*?-->/g,v).replace(/\{\{--[\s\S]*?--\}\}/g,v)}function Fe(x){let v=[],k=Pw(x);Yg.lastIndex=0;let E;while((E=Yg.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 K=C.match(/\btype\s*=\s*["']([^"']+)["']/i);if(K&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(K[1]))continue;let G=/\bserver\b/.test(C)?"server":/\bclient\b/.test(C)?"client":"plain",J=si(x,B);v.push({kind:G,code:F,startLine:J,startColumn:ii(x,B),offset:B,attrs:C})}return v}function si(x,v){let k=1;for(let E=0;E<v&&E<x.length;E++)if(x.charCodeAt(E)===10)k++;return k}function ii(x,v){let k=x.lastIndexOf(`
|
|
2636
|
+
`,v-1)+1;return v-k+1}function Jo(x){let v=x.split(""),k=(C,j)=>{for(let L=C;L<j&&L<v.length;L++)if(v[L]!==`
|
|
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 Dw(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 am=new Set([":for","x-for","v-for"]),Yo=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ll="__stx_interpolated",Qg="__StxElement",cm="__StxTemplateValue",Mw=`type ${cm}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function em(x){return x.replace(/\{\{[\s\S]*?\}\}/g,Ll).replace(/\{!![\s\S]*?!!\}/g,Ll)}function as(x){return x.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(v)=>{let k=v.split(`
|
|
2638
|
+
`).length-1,E=v.length-k;return`0${" ".repeat(Math.max(0,E-1))}${`
|
|
2639
|
+
`.repeat(k)}`})}var Ow=["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"],Nw=new RegExp(String.raw`^[ \t]*@(?:${Ow.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function cs(x){return x.replace(Nw,(v)=>v.replace(/[^\n]/g," "))}var tm=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function ac(x){let v=Jo(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=Dw(B);if(!F.trim())continue;let K=C.index+z+(F.length-F.trimStart().length);k.push({code:F.trim(),line:si(v,K),column:ii(v,K),offset:K,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),K=F.trim();if(j.lastIndex=z+1,!K)continue;let G=L+1+(F.length-F.trimStart().length);k.push({code:K,line:si(v,G),column:ii(v,G),offset:C.index,kind:"condition"})}Yo.lastIndex=0;while((C=Yo.exec(v))!==null){let L=C[1],B=C[3]??"",z=L.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(tm.has(z)||tm.has(L))continue;if(!B.trim())continue;let F=C.index+C[0].indexOf(C[2],C[0].indexOf(L)+L.length)+1;if(am.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:em(J.trim()),line:si(v,F+ne),column:ii(v,F+ne),offset:F+ne,kind:"directive",attribute:z});continue}let K=B.length-B.trimStart().length;k.push({code:em(B.trim()),line:si(v,F+K),column:ii(v,F+K),offset:F+K,kind:"directive",attribute:z})}return k.sort((L,B)=>L.line-B.line||L.column-B.column),k}var jw=2000;function Lw(x,v){let k=0,E=Math.min(x.length,v+jw);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 Bw(x){let v=new Map,k=(B,z)=>{let F=B.split(/[,[\]{}()\s]+/).filter(Boolean);for(let K of F){let G=K.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=Lw(x,B.index+B[0].length-1);if(z===null)continue;let F=xt(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=Jo(x);Yo.lastIndex=0;let L;while((L=Yo.exec(j))!==null){let B=L[1].replace(/\..*$/,"");if(!am.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 Bl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],zw={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function qi(x=new Set){return[...Bl.filter((v)=>!x.has(v)).map((v)=>`declare var ${v}: any`),...Object.entries(zw).filter(([v])=>!x.has(v)).map(([,v])=>v)].join(`
|
|
2640
|
+
`)}function Xi(x){return new Set([...x.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((v)=>v[1]))}function lm(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 Fw(k[1])){let B=L.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(B))C.add(B)}}return E?[...C]:null}function Fw(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 Ww(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
|
+
`).map(()=>"").join(`
|
|
2642
|
+
`)));return{imports:k.join(`
|
|
2643
|
+
`),body:E}}function um(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 K=v.indexOf("{",L.index);if(K===-1)continue;let G=0;F=-1;for(let J=K;J<v.length;J++)if(v[J]==="{")G++;else if(v[J]==="}"&&--G===0){F=J+1;break}if(F===-1)continue}else{let K=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==="<")K++;else if(J==="}"||J==="]"||J===")"||J===">")K--;else if(K<=0&&(J===";"||J===`
|
|
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 Vw(x){return new Set(um(x).map((v)=>v.name))}function Ki(x,v=""){let k=lm(x),E=Vw(v),C=um(x).filter((F)=>!E.has(F.name)).map((F)=>F.text);if(!k){let F=Q(x).filter((K)=>!pi(v,K));if(F.length===0&&C.length===0)return"";return["",`// ${Hw}`,...C,...F.map((K)=>`declare var ${K}: any`)].join(`
|
|
2645
|
+
`)}if(k.length===0)return C.length>0?["",`// ${nm}`,...C].join(`
|
|
2646
|
+
`):"";let{imports:j,body:L}=Ww(x),B=L.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),z=["",`// ${nm}`];if(j)z.push(j);return z.push(...C),z.push(`async function ${rm}() {`,B,` return { ${k.join(", ")} }`,"}",`type ${sm} = Awaited<ReturnType<typeof ${rm}>>`,...k.map((F)=>`declare var ${F}: ${sm}[${JSON.stringify(F)}]`)),z.join(`
|
|
2647
|
+
`)}function Uw(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!==`
|
|
2648
|
+
`)k[C]=" "}return Q(k.join(""))}function Gi(x,v){if(lm(x)!==null)return[];let k=s(v),E=new Set(m);return Uw(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 nm="stx: types for the declared client payload (#1868)",Hw="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",rm="__stxServerScope",sm="__StxClientPayload";var im=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var qw=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Kw(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}=ye(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 K=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)&&ye(ne).balanced;v.set(K,v.has(K)||!re?null:J)}}return new Map([...v].filter((E)=>E[1]!==null))}function dm(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],K=v.get(F);if(!K||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)}(${dm(K,v,k+1,new Set([...E,F]))})`,L=z+F.length}return j+x.slice(L)}function Xw(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 K=x[z];if(K==="(")B++;else if(K===")"){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 Zw(x){let v=x.code.trim();if(!v)return null;if(x.attribute?.startsWith("@")){if(qw.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 Gw=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Bn(x,v){if(!v)return x;return x.replace(Gw,(k,E,C,j)=>{let L=om.resolve(v,j).replace(/\\/g,"/");return`${E}${C}${L}${C}`})}function ls(x){return" ".repeat(Math.max(0,(x.startColumn??1)-1))}function Jw(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 K=F.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(K&&/^[A-Z_$][\w$]*$/i.test(K))v.add(K)}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 Ji(x,v={}){let k=Fe(x),E=x.split(`
|
|
2649
|
+
`),C=Array.from({length:E.length},()=>""),j=new Map,L=v.filePath&&v.templateExpressions!==!1?Jg(x,Jo(x),{filePath:v.filePath,componentsDir:v.componentsDir,projectRoot:v.projectRoot,readComponent:v.readComponent,scriptCode:(G,J)=>Fe(G).map((ne)=>Bn(ne.code,om.dirname(J))).join(`
|
|
2650
|
+
`)}):void 0,B=new Set,z=[];for(let G of k){let J=cs(as(G.code)),ne=Bn(J,v.originDir??"").split(`
|
|
2651
|
+
`);ne.forEach((re,se)=>{let oe=G.startLine-1+se;if(oe<C.length)C[oe]=se===0?ls(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(`
|
|
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)=>Jw(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([...Bl,...H,...im])].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 Bl)J(se);for(let se of H)J(se);for(let se of im)J(se)}F(`declare var ${Ll}: any`);let re=new Set(k.flatMap((se)=>Q(se.code)));F(`type ${Qg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of Bw(x)){if(re.has(se.name))continue;let oe=se.iterable&&re.has(se.iterable)?`${Qg}<typeof ${se.iterable}>`:"any";F(`declare var ${se.name}: ${oe}`)}}if(v.templateExpressions!==!1){if(L?.declarations)for(let J of L.declarations.split(`
|
|
2653
|
+
`))F(J);let G=ac(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:Zw(J)}}).filter((J)=>J.statement!==null);if(G.push(...L?.checks||[]),G.length>0){let J=Jo(x),ne=Kw(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(Mw);for(let ie of se)F(`type __StxT_${ie} = ${cm}<typeof ${ie}>`);F(`;((${se.map((ie)=>`${ie}: __StxT_${ie}`).join(", ")}) => {`),oe=1}for(let{expression:ie,statement:fe}of G){let ue=" ".repeat(oe),be=ie.offset===void 0?[]:Xw(J,ie.offset),we=be.length>0?`${be.map(($e)=>`if (${dm($e,ne)}) `).join("")}{ `:"",Se=be.length>0?" }":"";F(ue+we+fe.text+Se,{line:ie.line,column:ie.column,expression:ie,prefixLength:fe.prefixLength+ue.length+we.length,guardPrefixLength:ue.length+we.length})}if(oe>0)F("});")}}let K=!1;if(v.reference&&C[0]!==void 0&&C[0].trim()==="")C[0]=`/// <reference path=${JSON.stringify(v.reference.replace(/\\/g,"/"))} />`,K=!0;return F("export {}"),{text:C.join(`
|
|
2654
|
+
`),lineMap:j,sourceLineCount:E.length,componentDependencies:L?.dependencies,referenced:K}}function Yi(x,v){if(!x.expression)return!1;return x.inGuard===!0||v===2774}function Zi(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 Yw=[{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"}],Qw=[{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')"}],eS=[{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 cc(x){let v=[],k=[];return tS(x,v),nS(x,v,k),rS(x,k),sS(x,v),{valid:v.length===0,errors:v,warnings:k}}function tS(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 nS(x,v,k){for(let E of Yw){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 rS(x,v){for(let k of Qw)if(k.pattern.test(x))v.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function sS(x,v){for(let k of eS)if(k.pattern.test(x))v.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function lc(x,v){let k=x.slice(0,v).split(`
|
|
2655
|
+
`);return{line:k.length,column:k[k.length-1].length+1}}function uc(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 dc(x){return/@[a-z]+/i.test(x)||/\{\{/.test(x)}function pc(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 Tn from"path";import Ds from"process";var wt=["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 fm=new Set(wt),iS=new Set(["props","$props","defineProps"]),oS=new Set(["stx","@stacksjs/stx"]),pm=I(128),gm=I(64);function aS(x){let v=[],k=0,E=x.split(`
|
|
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 Qa(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 K=E[F];if(z){if(j+=K,K===z)z=null;continue}if(K==='"'||K==="'"||K==="`"){z=K,j+=K;continue}if(K==="<")L++;else if(K===">"&&L>0)L--;else if(K==="(")B++;else if(K===")")B--;if(K===","&&L===0&&B===0){C.push(j),j="";continue}j+=K}if(j)C.push(j);return C.map((F)=>{let K=F.trim(),G=K.startsWith("..."),J=G?K.slice(3):K,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),fe=-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){fe=we;break}let be=G?"...":"";if(fe!==-1)return`${be}${oe} = ${ie.substring(fe+1).trim()}`;return`${be}${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,K=null;while(z<v.length&&B>0){let ne=v[z];if(K){if(ne===K)K=null;z++;continue}if(ne==='"'||ne==="'"||ne==="`"){K=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,`
|
|
2657
|
+
|
|
2658
|
+
`),v}function ec(x){return x.replace(/\s*imported from \S*(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])\S*/g,"")}function tc(x){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(x)}function nc(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 rc(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 mm=new Set;async function d(x,v,k,E={}){if(!x.trim())return;let C=y(),j=O(x,JSON.stringify(C)),L=pm.get(j);if(L===void 0){try{let qe=N({loader:"ts",target:"browser",define:C}),Je=x.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Je=Je.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),L=qe.transformSync(Je)}catch{L=Qa(x)}pm.set(j,L)}let B={exports:{}},z=B.exports,F=Ds.cwd(),K={},G=[...L.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((qe)=>qe[1]).filter((qe)=>!qe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(qe)),J=new Map;for(let qe of G)try{if(qe.startsWith(".")){K[qe]=await import(Tn.resolve(Tn.dirname(k),qe));continue}let Je=Tn.resolve(F,"node_modules",qe),rt=Tn.join(Je,"package.json"),gt=JSON.parse(u("fs").readFileSync(rt,"utf8")),Tt=gt.main||"index.js";if(gt.exports){let qt=typeof gt.exports==="string"?gt.exports:gt.exports["."];if(typeof qt==="string")Tt=qt;else if(qt?.bun)Tt=qt.bun;else if(qt?.import)Tt=qt.import;else if(qt?.default)Tt=qt.default}K[qe]=await import(Tn.resolve(Je,Tt))}catch(Je){if(qe.startsWith("."))J.set(qe,Je instanceof Error?Je.message:String(Je))}let ne=(qe)=>{if(K[qe])return K[qe];let Je=J.get(qe);if(Je!==void 0)throw Error(`Cannot require '${qe}' from ${k}: ${Je}`);return u(qe)},re=v.props||{},se=(qe)=>{if(!qe)return re;let Je={};for(let[rt,gt]of Object.entries(qe)){let Tt=re[rt];if(Tt!==void 0)Je[rt]=Tt;else if(typeof gt==="function")Je[rt]=gt();else Je[rt]=gt}return Je};for(let[qe,Je]of Object.entries(re))Object.defineProperty(se,qe,{value:Je,enumerable:!0,configurable:!0,writable:!0});let oe=(qe,Je=!1)=>{if(qe===void 0||qe===null)return Je;if(typeof qe==="string"){let rt=qe.trim().toLowerCase();if(rt===""||rt==="true"||rt==="1"||rt==="on"||rt==="yes")return!0;if(rt==="false"||rt==="0"||rt==="off"||rt==="no")return!1;return!0}return Boolean(qe)},ie=(qe,Je=0)=>{if(qe===void 0||qe===null)return Je;if(typeof qe==="string"){let gt=qe.trim();if(gt==="")return Je;let Tt=Number(gt);return Number.isFinite(Tt)?Tt:Je}let rt=Number(qe);return Number.isFinite(rt)?rt:Je};for(let qe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,qe))continue;try{Object.defineProperty(se,qe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let fe=(qe)=>{if(!qe)return re;let Je={...re};for(let[rt,gt]of Object.entries(qe)){let Tt=gt&&typeof gt==="object"&&!Array.isArray(gt)?gt:{type:gt};if(Je[rt]===void 0&&Tt.default!==void 0)Je[rt]=typeof Tt.default==="function"?Tt.default():Tt.default}return Je},ue=()=>v.slots||{},be=(qe,Je)=>{let rt={...qe};for(let[gt,Tt]of Object.entries(Je))if(rt[gt]===void 0)if(typeof Tt==="function")rt[gt]=Tt();else rt[gt]=Tt;return rt},we=(qe)=>{let Je=()=>qe;return Je.set=(rt)=>{},Je.update=(rt)=>{},Je},Se=(qe)=>{let Je,rt=!1;return()=>{if(!rt)try{Je=qe(),rt=!0}catch{Je=void 0}return Je}},$e=(qe)=>{},Ee=(qe)=>qe(),ke=(qe)=>{},Re=(qe)=>{},Ce=Dn(v);function _e(qe){let Je=qe||{};if(Je.title!==void 0||Je.description!==void 0)Ze({title:Je.title,description:Je.description})}function Te(qe){if(!qe||typeof qe!=="object")return;let Je=v.__stxClientPayload??{};Object.assign(Je,qe),v.__stxClientPayload=Je}let Ke=()=>{let qe=v.__stxServeContext,Je=v.__stxServeSearch??qe?.search??"",rt=qe?.path??"",gt=Object.fromEntries(new URLSearchParams(Je)),Tt=v.query,qt=Object.keys(gt).length>0?gt:Tt??{},Qn=Je||(Object.keys(qt).length>0?`?${new URLSearchParams(qt).toString()}`:"");return{params:v.params??{},query:qt,path:rt,name:"",fullPath:rt+Qn,hash:"",matched:[]}},Pe=()=>({push:(qe)=>{},replace:(qe)=>{},back:()=>{},forward:()=>{},go:(qe)=>{}}),Ae=(qe)=>{let Je=v.__stx_runtime_head||{};v.__stx_runtime_head=de(Je,qe||{})},Ze=(qe)=>{Ae(Jn(qe||{}))},tt=(qe)=>({value:qe}),ot=(qe)=>qe,nt=(qe)=>({value:typeof qe==="function"?qe():qe}),_t=(qe,Je)=>{},dt=(qe)=>{},$t=(qe)=>{},at=(qe)=>qe?qe():Promise.resolve(),It=(qe)=>(Je,...rt)=>{},ft=(qe)=>{},Nt=(qe,Je)=>{},Kn=(qe,Je)=>Je,vn=()=>({value:"light"}),Gn=()=>we(!1),Qe=(qe)=>we(!1),st=()=>we(!1),pt=()=>Qe("(prefers-color-scheme: dark)"),Ht=()=>Qe("(prefers-color-scheme: light)"),Pt=()=>Qe("(prefers-reduced-motion: reduce)"),hn=()=>Qe("(prefers-contrast: more)"),Ot={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:{}},na=new Proxy(Ot,{get(qe,Je){if(Je in qe)return qe[Je];return},set(qe,Je,rt){return qe[Je]=rt,!0}}),ra={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},sa=console;try{let qe=Zr(L,k),Je=new Set(Object.keys(re)),rt=Object.keys(v).filter((ct)=>!Je.has(ct)&&!iS.has(ct)&&Ge(ct)),gt=rt.map((ct)=>v[ct]);if(!rt.includes("__stxServeContext"))rt.push("__stxServeContext"),gt.push(void 0);let Tt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qt=[],Qn=[];for(let[ct,wn]of Object.entries(re)){if(!Ge(ct))continue;if(Tt.has(ct))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ct}\\b`).test(qe))continue;qt.push(ct),Qn.push(wn)}let ir=aS(qe).map((ct)=>`module.exports.${ct} = typeof ${ct} !== 'undefined' ? ${ct} : module.exports.${ct};`).join(`
|
|
2659
|
+
`),Xt=v.params??{},et=[],it=[];for(let ct=0;ct<rt.length;ct++){if(rt[ct]==="params")continue;et.push(rt[ct]),it.push(gt[ct])}let Rt=[...wt,...qt,...et],ut=`return (async () => {
|
|
2660
|
+
${qe}
|
|
2661
|
+
${ir}
|
|
2662
|
+
return module.exports
|
|
2663
|
+
})()`,Bt=O(ut,Rt.join("\x00")),Dt=gm.get(Bt);if(!Dt)Dt=Function(...Rt,ut),gm.set(Bt,Dt);let gn=v.__stx_options?.runtimeConfig;if(gn||/\buse(?:Server)?RuntimeConfig\b/.test(L))await sn(v,k,gn);let or=await le(v.__stx_runtime_config??kt()??S(),()=>ng(v,()=>Dt(B,z,ne,re,se,oe,ie,fe,be,Te,rg,gs,Wn,we,Se,$e,Ee,ke,Re,_e,Ke,Pe,Ae,Ze,Ce.setResponseStatus,Ce.setResponseHeader,Ce.notFound,tt,ot,nt,_t,dt,$t,at,It,ft,ue,Nt,Kn,vn,Gn,Qe,st,pt,Ht,Pt,hn,na,ra,sa,Ot.confirm,Ot.alert,Ot.fetch,Xt,...Qn,...it)));if(E.preserveExisting){for(let[ct,wn]of Object.entries(or))if(!(ct in v)||v[ct]===void 0)v[ct]=wn}else Object.assign(v,or);for(let[ct,wn]of Object.entries(re))if(!(ct in v))v[ct]=wn}catch(qe){if(v.__stx_strict_hydration)throw qe;let Je=ec(qe instanceof Error?qe.message:String(qe));if(tc(Je))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"module-resolution",message:Je,error:qe});else if(nc(qe))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"syntax",message:Je,error:qe});else if(rc(Je))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: ${Je}`),E.onFailure?.({kind:"missing-binding",message:Je,error:qe});else{let rt=`${k??"<unknown>"}\x00${Je}`;if(Ds.env.STX_DEBUG||!mm.has(rt))mm.add(rt),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: ${Je}`);E.onFailure?.({kind:"unknown",message:Je,error:qe})}try{await pS(L,v,k)}catch(rt){if(Ds.env.STX_DEBUG){let gt=rt instanceof Error?rt.message:String(rt);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${gt}`)}}}}function sc(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 cS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Zr(x,v){let k=v?Tn.dirname(v):Ds.cwd(),E=Ds.cwd(),C=x.split(`
|
|
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,K=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 fe=oe[ie];if(se){se=!1;continue}if(fe==="\\"){se=!0;continue}if(re){if(fe===re)re=null;continue}if(fe==='"'||fe==="'"||fe==="`"){re=fe;continue}if(fe==="(")z++;else if(fe===")"){if(z--,z===0){L=ne+1,F=!0;break}}}}if(!F)L=C.length;let G=C.slice(K,L).join(`
|
|
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(!sc(z)&&L+F+1<C.length)F++,z=`${z} ${C[L+F].trim()}`;L+=F;let K=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 Tn.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return Tn.resolve(E,se.slice(2));return se};if(K){let[,se,oe]=K,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),fe=[],ue=[],be=oS.has(oe);for(let we of se.split(",")){let Se=we.trim();if(!Se)continue;let $e=Se.split(/\s+as\s+/);if($e.length===2){let[Ee,ke]=[$e[0].trim(),$e[1].trim()];if(be&&fm.has(Ee)){j.push(`const ${ke} = ${Ee};`);continue}fe.push(`${Ee}: ${ke}`),ue.push(ke)}else{if(be&&fm.has(Se))continue;fe.push(Se),ue.push(Se)}}if(fe.length>0)j.push(`const { ${fe.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(cS.test(B))j.push(C[L]),L++;else if(B.startsWith("export const ")||B.startsWith("export let ")||B.startsWith("export var ")){let z=ym(C,L),{type:F,name:K,value:G}=z;j.push(`${F} ${K} = ${G};`),j.push(`module.exports.${K} = ${K};`),L=z.nextIndex}else if(B.startsWith("export function ")||B.startsWith("export async function ")){let z=zl(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=ym(C,L),{type:F,name:K,value:G}=z;j.push(`${F} ${K} = ${G};`),j.push(`module.exports.${K} = ${K};`),L=z.nextIndex}else if(B.startsWith("function ")||B.startsWith("async function ")){let z=zl(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 K=zl(F,L);if(j.push(K.functionCode),K.name)j.push(`module.exports.default = ${K.name};`);L=K.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],K=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)K+=`
|
|
2666
|
+
`+ne;if(G<=0&&J>=L)break}j.push(K),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 lS(j.join(`
|
|
2667
|
+
`),k,E)}function lS(x,v,k){let E=x.length,C="",j=0,L=null,B=!1,z=!1,F=0;while(j<E){let K=x[j],G=x[j+1];if(B){if(C+=K,K===`
|
|
2668
|
+
`)B=!1;j++;continue}if(z){if(C+=K,K==="*"&&G==="/"){C+=G,j+=2,z=!1;continue}j++;continue}if(!L&&K==="/"&&G==="/"){B=!0,C+=K,j++;continue}if(!L&&K==="/"&&G==="*"){z=!0,C+=K,j++;continue}if(L){if(C+=K,K==="\\"){C+=G,j+=2;continue}if(K===L&&L!=="`"){L=null,j++;continue}if(L==="`"){if(K==="$"&&G==="{"){F++,C+=G,j+=2;continue}if(K==="`"){L=null,j++;continue}}j++;continue}if(F>0){if(K==="{")F++;else if(K==="}")F--}if(K==='"'||K==="'"||K==="`"){L=K,C+=K,j++;continue}if(K==="a"&&x.startsWith("await",j)){let J=uS(x,j);if(J){let{quote:ne,path:re,end:se}=J;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let oe=re.startsWith(".")?Tn.resolve(v,re):Tn.resolve(k,re.slice(2));C+=`await import(${ne}${oe}${ne})`,j=se;continue}}}C+=K,j++}return C}function uS(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 wm(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 Sm(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?wm(k,E):null;if(B){v.push(...Sm(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 ic(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 hm(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 ym(x,v){let k=x[v].trim(),E=ic(k),C=E?[k,E.type,E.name,E.value]:null;if(!C){let K=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let G=k.slice(K[0].length),J=v;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",oe=hm(G,re,se,0),ie=G;for(let fe=v+1;fe<x.length&&oe>0;fe++)ie+=` ${x[fe].trim()}`,J=fe,oe=hm(x[fe],re,se,oe);if(oe>0)ie=G,J=v;G=ie}let ne=wm(G,0);if(ne){let re=K[1],se=ne.pattern,oe=G.slice(ne.endPos).trim();if(oe.startsWith("=")){let ie=oe.slice(1).trim(),fe=ie,ue=Math.max(J,v);if(xm(ie)){let $e=bm(x,ue,ie);fe=$e.value,ue=$e.nextIndex}else ue=ue+1;fe=fe.trim().replace(/;$/,"");let be=Sm(se),we=`__stx_src_${v}`,Se=be.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
|
|
2669
|
+
`);return{type:re,name:we,value:`${fe}; ${re} ${se} = ${we};
|
|
2670
|
+
${Se}`,nextIndex:ue}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,L,B]=C,z=B,F=v;if(xm(B)){let K=bm(x,v,B);z=K.value,F=K.nextIndex}else F=v+1;while(F<x.length){let K=x[F].trim();if(K.startsWith(".")||K.startsWith("?."))z+=`
|
|
2671
|
+
${x[F]}`,F++;else break}return z=z.trim().replace(/;$/,""),{type:j,name:L,value:z,nextIndex:F}}function zl(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(dS(k)){let B=fS(x,v,j);j=B.functionCode,L=B.nextIndex}else L=v+1;return{name:C,functionCode:j,nextIndex:L}}function xm(x){let v=x.trim();if(v.startsWith("{"))return w(v,"{","}",0)===-1;if(v.startsWith("["))return w(v,"[","]",0)===-1;return!$m(v)}function $m(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 _m(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 dS(x){let v=_m(x);if(v===-1)return!0;return w(x,"{","}",v)===-1}function bm(x,v,k){let E=k,C=v+1;while(C<x.length&&!$m(E)){let j=x[C];E+=`
|
|
2672
|
+
${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 fS(x,v,k){let E=k,C=v+1;while(C<x.length){let j=_m(E);if(j!==-1){if(w(E,"{","}",j)!==-1)break}let L=x[C];E+=`
|
|
2674
|
+
${L}`,C++}return{functionCode:E,nextIndex:C}}function vm(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:{...Ds.env}})},C=Object.keys(E).filter(Ge),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 pS(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=vm(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=vm(z,v);if(F!==void 0)v[L]=F}catch{}}}function zi(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 Hi(x){let v=x.trim();if(!v)return!1;return/(?:const|let|var|function)\s+\w+/.test(v)}var oi=new V(500),ea=new V(1000),Pm=33554432,Wl=Pm;function gS(x){let v=x.componentRenderCacheBytes;if(typeof v!=="number"||v<0||v===Wl)return;Wl=v,ta.setMaxBytes(v)}var ta=new V(2000,{maxBytes:Pm,sizeOf:(x)=>x.output.length});function mS(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 km(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function fc(x){return/\bjs\b/.test(x)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(x)}function ze(x){return!fc(x)}var Qo=new Map;function N(x){let v;try{v=JSON.stringify(x)}catch{return new Bun.Transpiler(x)}let k=Qo.get(v);if(k)return k;if(Qo.size>=16)Qo.clear();let E=new Bun.Transpiler(x);return Qo.set(v,E),E}var Em=new WeakMap,hS=256;function He(x){try{let v=N({loader:"ts",target:"browser",define:y()}),k=Em.get(v);if(!k)k=new Map,Em.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>=hS){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 yS(x){let v=[],k=new Set,E=0,C=0,j=x.length,L=(K)=>{C++;while(C<j){if(x[C]==="\\"){C+=2;continue}if(x[C]===K){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 K=1;while(C<j&&K>0)if(x[C]==="{")K++,C++;else if(x[C]==="}")K--,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]!==`
|
|
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 K=x.slice(C).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let re=K[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 xS(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 bS(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 vS(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 xS(B)){let F=z.trim();if(!F||F.startsWith("..."))continue;let K=bS(F);if(K===-1)continue;let G=F.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(v[G]!==void 0)continue;let J=F.slice(K+1).trim();if(!J)continue;try{let ne=Object.keys(v).filter(Ge),re=Function(...ne,`"use strict"; return (${J});`);v[G]=re(...ne.map((se)=>v[se]))}catch{}}}catch{}}var wS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function gc(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(!wS.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 Fn(x,v,k,E,C){let j=x.endsWith(".stx")?x.slice(0,-4):x,L=(ie)=>ie.split("-").map((fe)=>fe.charAt(0).toUpperCase()+fe.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`])],K=typeof C.root==="string"?Ye.resolve(C.root):void 0,G=K??Ye.dirname(E),J=[],ne=(ie)=>{if(ie&&!J.includes(ie))J.push(ie)},re=k.__originalFilePath;if(re)ne(Ye.join(Ye.dirname(re),"components"));if(ne(v),ne(C._rootComponentsDir),ne(Ye.join(Ye.dirname(E),"components")),ne(C.componentsDir),K)ne(Ye.resolve(K,"resources/views/components")),ne(Ye.resolve(K,"resources/components")),ne(Ye.resolve(K,"src/components")),ne(Ye.resolve(K,"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(Ye.resolve(Ye.dirname(E),`${j}.stx`));let oe=Cm(Ye.resolve(import.meta.dir,"components"));for(let ie of J){let fe=Ye.isAbsolute(ie)?ie:Ye.resolve(G,ie);if(Cm(fe)===oe)continue;for(let ue of F)if(await n(Ye.join(fe,ue)))return!0}return!1}function Cm(x){try{return Im.realpathSync(x)}catch{return x}}function mc(x){return x==="visible"||x==="idle"||x==="interaction"||x.startsWith("media:")}function Qi(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 SS(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 Rm=new Set;function Tm(x,v,k,E){let C=`${x}\x00${v}\x00${E??""}`;if(!process.env.STX_DEBUG&&Rm.has(C))return;Rm.add(C);let j=v?` used in ${v}`:"",L=E?` Cause: ${E}.`:"",B=k.length>0?`
|
|
2676
|
+
searched:
|
|
2677
|
+
${k.map((z)=>` - ${z}`).join(`
|
|
2678
|
+
`)}`:"";console.error(`[stx] component <${x}> could not be resolved${j}, so it rendered as nothing.${L}${B}`)}function Am(x){return`<!-- stx: component "${x.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function hc(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 lt("stx/variable-extractor",()=>import("./chunk-ckv4aty5.js")),K=B??new Set;if(K.has(x))return`[Circular component reference: ${x}]`;let G=new Set(K);G.add(x);let J=typeof v.client==="string"?v.client.trim():"";if("client"in v)delete v.client;let ne=J&&J!=="load"&&mc(J)?J:"";try{let re=(et)=>et.split("-").map((it)=>it.charAt(0).toUpperCase()+it.slice(1)).join(""),se=(et)=>et.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oe=x.endsWith(".stx")?x.slice(0,-4):x,ie=null,fe=C.__importedComponents;if(fe){let et=[oe,oe.toLowerCase(),re(oe),se(oe)];for(let it of et)if(fe.has(it)){ie=fe.get(it);break}}let ue=[];if(!ie){let et=[`${oe}.stx`,`${re(oe)}.stx`,`${se(oe)}.stx`],it=[...new Set(et)],Rt=C.__originalFilePath,ut=[];if(ut.push(...L._layerComponentDirs??[]),Rt){let Ft=Ye.join(Ye.dirname(Rt),"components");ut.push(Ft)}if(E)ut.push(E);let Bt=L._rootComponentsDir;if(typeof Bt==="string"&&!ut.includes(Bt))ut.push(Bt);let Dt=Ye.join(Ye.dirname(j),"components");if(!ut.includes(Dt))ut.push(Dt);if(L.componentsDir&&L.componentsDir!==E&&!ut.includes(L.componentsDir))ut.push(L.componentsDir);let gn=typeof L.root==="string"?Ye.resolve(L.root):void 0,or=gn??Ye.dirname(j),ct=[];if(gn)ct.push(Ye.resolve(gn,"resources/views/components")),ct.push(Ye.resolve(gn,"resources/components")),ct.push(Ye.resolve(gn,"src/components")),ct.push(Ye.resolve(gn,"components"));ct.push(Ye.resolve(import.meta.dir,"components"));for(let Ft of ct)if(!ut.includes(Ft))ut.push(Ft);let wn=L._pluginComponentDirs;if(Array.isArray(wn)){for(let Ft of wn)if(typeof Ft==="string"&&!ut.includes(Ft))ut.push(Ft)}if(L.fallbackComponentsDir&&!ut.includes(L.fallbackComponentsDir))ut.push(L.fallbackComponentsDir);let Rr=[...new Set(ut.map((Ft)=>{if(!Ft)return Ft;return Ye.isAbsolute(Ft)?Ft:Ye.resolve(or,Ft)}))];ut.length=0,ut.push(...Rr);let Tr=`${oe}\x00${j}\x00${Rr.join("\x00")}`,ia=ea.get(Tr);if(ia)if(await n(ia))ie=ia;else ea.delete(Tr);if(!ie&&(oe.startsWith("./")||oe.startsWith("../")))ie=Ye.resolve(Ye.dirname(j),`${oe}.stx`),ue.push(ie);else if(!ie)for(let Ft of ut){if(!Ft)continue;for(let li of it){let ui=Ye.join(Ft,li);if(ue.push(ui),await n(ui)){ie=ui;break}}if(ie)break;if(!ie)try{let li=await import("fs");if(!li.statSync(Ft,{throwIfNoEntry:!1})?.isDirectory())continue;let Nm=8,oa=[{path:Ft,depth:0}];while(oa.length>0&&!ie){let di=oa.pop();if(di.depth>=Nm)continue;let Ul;try{Ul=li.readdirSync(di.path,{withFileTypes:!0})}catch{continue}for(let fi of Ul){if(!fi.isDirectory())continue;if(fi.name==="node_modules"||fi.name.startsWith("."))continue;let Hl=Ye.join(di.path,fi.name);for(let jm of it){let aa=Ye.join(Hl,jm);if(ue.push(aa),await n(aa)){ie=aa;break}}if(ie)break;oa.push({path:Hl,depth:di.depth+1})}}}catch{}if(ie)break}if(ie)ea.set(Tr,ie)}if(!ie||!await n(ie))return Tm(x,j,ue),Am(x);z.add(ie);let be;if(oi.has(ie))be=oi.get(ie);else try{be=await Bun.file(ie).text(),oi.set(ie,be)}catch(et){let it=et instanceof Error?et.message:String(et);return Tm(x,j,[ie],it),Am(x)}let we=new Set(["__originalFilePath","__importedComponents",gi,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Se={};for(let[et,it]of Object.entries(C))if(!et.startsWith("__")||we.has(et))Se[et]=it;let $e=k;if(k.includes("@include")){let{processIncludes:et}=await lt("stx/includes",()=>import("./chunk-ettat5ah.js"));$e=await et(k,C,j,L,z)}if(/<[A-Z][\w.-]*[\s/>]/.test($e)){let{processComponents:et}=await lt("stx/component-renderer",()=>import("./chunk-7eazcxzf.js"));$e=await et($e,{...C,__processedComponents:K},j,L,z)}let Ee=[];if(Qi($e)){let{processExpressions:et}=await lt("stx/expressions",()=>import("./chunk-x4q2eyt0.js")),it=C.__stx_signals_gate===void 0?{...C,__stx_signals_gate:!0}:C;$e=et($e,it,j);for(let Rt of $e.matchAll(/\{\{([\s\S]*?)\}\}/g))Ee.push(Rt[1].trim())}let ke=yn($e),Re=[],Ce=ke.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(et,it)=>{let Rt=ke.scripts[Number(it)]||"",ut=Rt.match(/^<script\b([^>]*)>/i)?.[1]||"",Bt=ut.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Dt=!Bt||["module","text/javascript","application/javascript"].includes(Bt);if(!/\bserver\b/i.test(ut)&&Dt)return Re.push(Rt),"";return Rt}),{extractSlotContent:_e}=await lt("stx/slots",()=>import("./chunk-7hy29tcy.js")),Te=_e(Ce),Ke={};if(Te.defaultSlot?.trim())Ke.default=Te.defaultSlot;for(let[et,it]of Te.namedSlots)Ke[et]=it.content;let Pe=C.__stx_scope_seq??={n:0,key:Bun.hash(String(C.__filename??j)).toString(36).slice(0,6)},Ae=`stx_${oe.replace(/[^a-zA-Z0-9]/g,"_")}_${++Pe.n}_${Pe.key}`,Ze={...Se,$uid:Ae,...v,props:v,slot:Ce,$slots:Ke,__processedComponents:G,__sections:{},__stx_signals_gate:me(be)||Qi(k),__stx_preserved_client_expressions:[...Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[],...Ee]};vS(be,Ze);let tt=be,ot=Z(tt);if(ot)tt=ot.content.trim();let nt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_t=[...be.matchAll(nt)],dt=[],$t=null,at=_t.some((et)=>/\bserver\b/.test(et[1]||"")&&/\bcache\b/.test(et[1]||"")),It=null,ft=null,Nt=null,Kn=0,vn=null;if(gS(L),at&&Wl>0){let et=mS({props:v,slot:k,buildMode:L.buildMode??"",skipEventDirectives:L.skipEventDirectives===!0,layers:L._layerGraph?.layers.map((it)=>it.configFile),uid:Ae});if(et!==null){It=`${ie}\x00${O(be)}\x00${et}`;let it=ta.get(It);if(it){for(let Rt of it.dependencies)z.add(Rt);if(iu(C,it.clientFactories),Pe.n+=it.uidsConsumed,it.preservedClientExpressions.length>0){let Rt=new Set(Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[]);for(let ut of it.preservedClientExpressions)Rt.add(ut);C.__stx_preserved_client_expressions=[...Rt]}return it.output}ft=new Set(z),Nt=ru(C),Kn=Pe.n,vn=new Set(Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[])}}let Gn=new Set;for(let et of _t){let it=et[1]||"",Rt=et[2]||"",ut=it.includes("server");if(ze(it)&&Rt.trim())Rt=He(Rt);if(ut&&Rt){for(let Dt of Q(Rt))Gn.add(Dt);try{await F(Rt,Ze,ie,{onFailure:(Dt)=>{if(Dt.kind!=="unknown")$t=Dt.kind}})}catch(Dt){}}if(!ut){let Dt=Rt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),gn=Dt.includes("{{")&&Dt.includes("}}"),or=Dt.includes("{!!")&&Dt.includes("!!}");if(gn||or)Dt=Vr(Dt,Ze,ie);let ct=it.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");dt.push(`<script${ct}>${Dt}</script>`)}}let st=yn(be).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),pt=st?st[1]:"",Ht=st?st[2]:"",Pt="",hn=pt&&/\bscoped\b/i.test(pt);if(st)Pt=`<style${pt}>${SS(Ht,Ze,ie)}</style>`;let Ot=tt;if(Ot=Ot.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),st)Ot=Ot.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let et=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,it=[];if(Ot=Ot.replace(et,(Rt,ut)=>{let Bt=ut.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Bt)it.push(`<style${Bt[1]}>${Bt[2]}</style>`);return""}),Ot=Ot.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),it.length>0)Pt=`${Pt}${it.join(`
|
|
2679
|
+
`)}`}if(k&&Ot.includes("{{ text || slot }}"))Ot=Ot.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:na}=await lt("stx/slots",()=>import("./chunk-7hy29tcy.js")),{defaultSlot:ra,namedSlots:sa}=Te,qe=dt.some((et)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(et)),Je=(et)=>qe?Pg(et,Ae):et,rt=new Map([...sa].map(([et,it])=>[et,{...it,content:Je(it.content)}]));Ot=await na(Ot,Je(ra),rt,Ze);let gt=hc(dt),Tt=(Array.isArray(Ze.__stx_client_signal_names)?Ze.__stx_client_signal_names:[]).filter((et)=>!Gn.has(et));if(gt.length>0||Tt.length>0)Ze.__stx_client_signal_names=[...new Set([...Tt,...gt])];else delete Ze.__stx_client_signal_names;let qt={...L,_rootComponentsDir:L._rootComponentsDir||L.componentsDir,componentsDir:Ye.dirname(ie),skipSignalsRuntime:!0,skipEventDirectives:qe||dt.length===0,defaultLayout:void 0};Ze.__stxProcessingDepth=(C.__stxProcessingDepth||0)+1;let Qn=await r(Ot,Ze,ie,qt,z),ci=new Set(Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[]);for(let et of Qn.matchAll(/\{\{([\s\S]*?)\}\}/g))ci.add(et[1].trim());if(ci.size>0)C.__stx_preserved_client_expressions=[...ci];let ir=Ae,Xt=Qn;if(qe){let et="";if(Object.keys(v).length>0)try{et=` data-stx-props="${km(JSON.stringify(v))}"`}catch{}let it=ne?` stx-hydrate="${km(ne)}"`:"",Rt=` data-stx-scope="${ir}"${et}${it}`;Xt=gc(Qn,Rt)??`<div${Rt}>${Qn}</div>`;let ut=await Promise.all(dt.map(async(Bt)=>{let Dt=Bt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Dt)return Bt;let[,gn,or]=Dt,{vendorStyleTags:ct,factoryBody:wn}=await kS(or,ie,L.buildMode==="compile"),Rr=ne?null:da(C,wn),Tr=Rr?`window.__stxComponentFactories[${JSON.stringify(Rr)}](${JSON.stringify(ir)});`:`(${wn})(${JSON.stringify(ir)});`;if(ne)return`${ct}<script type="stx/island" data-stx-island="${ir}" data-stx-scoped data-stx-owner="${ir}"${gn}>${Tr}</script>`;return`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ir}"${gn}>${Tr}</script>`}));if(Xt=Xt+`
|
|
2680
|
+
`+ut.join(`
|
|
2681
|
+
`),Pt)Xt+=`
|
|
2682
|
+
`+Pt}else{if(Pt)Xt+=`
|
|
2683
|
+
`+Pt;if(dt.length>0){let et=Ze.__stx_event_bindings||[],it=Oe(Ze),Rt=await Promise.all(dt.map(async(ut)=>{let Bt=ut.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Bt)return ut;return await ge(Bt[1],{eventBindings:et,templateContent:Xt,filePath:ie,projectRoot:process.cwd(),serverData:it,instanceId:Ae})}));Xt+=`
|
|
2684
|
+
`+Rt.join(`
|
|
2685
|
+
`),Ze.__stx_event_bindings=[]}}if(hn){let et=Si(Xt,ie);if(et.hasScoped)Xt=et.html}if(It&&ft){let et=Array.isArray(C.__stx_preserved_client_expressions)?C.__stx_preserved_client_expressions:[];ta.set(It,{output:Xt,dependencies:[...z].filter((it)=>!ft.has(it)),clientFactories:Nt?su(C,Nt):[],uidsConsumed:Pe.n-Kn,preservedClientExpressions:vn?et.filter((it)=>!vn.has(it)):[]})}if($t)Xt=`<!--stx-render-failed:${$t}-->${Xt}`;return Re.length>0?`${Xt}
|
|
2686
|
+
${Re.join(`
|
|
2687
|
+
`)}`:Xt}catch(re){return`[Error processing component: ${re instanceof Error?re.message:String(re)}]`}finally{K.delete(x)}}async function n(x){return Bun.file(x).exists()}function Vl(x,v){let k=Ye.resolve(v),E=Ye.resolve(x),C=k.endsWith(Ye.sep)?k:k+Ye.sep;if(E===k||E.startsWith(C))return E;return null}async function $S(x,v,k,E){let C=v.startsWith("layouts/")?v.slice(8):v,j=Ye.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 zn(x,v,k,E){let C=await _S(x,v,k,E);if(C===null)return null;let j=Vl(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=Ye.isAbsolute(B)?B:Ye.resolve(process.cwd(),B);if(Vl(C,z))return Ye.resolve(C)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${C} (template: ${x}, from: ${v})`),null}async function _S(x,v,k,E){if(k.debug)console.log(`Resolving template path: ${x} from ${v}`);let C=Ye.dirname(v),j=process.cwd();if(x.startsWith("/")){let J=Ye.join(j,x),ne=Vl(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=Ye.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(Ye.isAbsolute(k.layoutsDir)?k.layoutsDir:Ye.resolve(process.cwd(),k.layoutsDir));let z=Ye.resolve(C),F=process.cwd();for(let J=0;J<10;J++){let ne=Ye.join(z,"layouts"),re=!1;try{re=Im.statSync(ne,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){B.push(ne);break}let se=Ye.dirname(z);if(se===z||se.length<F.length)break;z=se}for(let J of B){let ne=await $S(J,x,E,k.debug);if(ne)return ne}if(k.fallbackLayoutsDir){let J=Ye.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:Ye.resolve(process.cwd(),k.fallbackLayoutsDir),ne=x.startsWith("layouts/")?x.slice(8):x,re=[Ye.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=Ye.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=Ye.join(k.partialsDir,"layouts");if(await n(J)){let ne=Ye.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 K=k.partialsDir||Ye.join(process.cwd(),"views"),G=Ye.join(K,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=Ye.join(Ye.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 eo(x,v,k){let E=0,C="",j="";try{if(typeof v==="number"&&v>=0){let L=x.split(`
|
|
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),K=Math.min(L.length,z+3);j=L.slice(F,K).map((G,J)=>{let ne=F+J+1;return`${ne===E?"> ":" "}${ne}: ${G}`}).join(`
|
|
2689
|
+
`);break}}else if(k){let L=x.indexOf(k);if(L>=0)return eo(x,L)}}catch{}return{lineNumber:E,lineContent:C,context:j}}var mt={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}=eo(E,C,j),z=k.split("/").pop(),F=0;if(typeof C==="number"&&C>=0&&E){let G=E.lastIndexOf(`
|
|
2690
|
+
`,Math.max(0,C-1));F=C-(G+1)+1}let K="";if(L>0)K+=`
|
|
2691
|
+
${k}:${L}${F>0?`:${F}`:""}: ${x.toLowerCase()} error: ${v}
|
|
2692
|
+
`;if(K+=`
|
|
2693
|
+
${mt.bold}${mt.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${mt.reset}
|
|
2694
|
+
`,K+=`${mt.bold}${mt.red}\u2502${mt.reset} ${mt.bold}${mt.bgRed} ERROR ${mt.reset} ${mt.red}${x} Error${mt.reset}${" ".repeat(Math.max(0,43-x.length))}${mt.bold}${mt.red}\u2502${mt.reset}
|
|
2695
|
+
`,K+=`${mt.bold}${mt.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${mt.reset}
|
|
2696
|
+
`,K+=`
|
|
2697
|
+
${mt.cyan}${mt.bold}File:${mt.reset} ${mt.dim}${z}${mt.reset}`,L>0)K+=` ${mt.gray}(line ${L}${F>0?`, col ${F}`:""})${mt.reset}`;if(K+=`
|
|
2698
|
+
${mt.yellow}${mt.bold}Message:${mt.reset} ${v}
|
|
2699
|
+
`,B)K+=`
|
|
2700
|
+
${mt.blue}${mt.bold}Context:${mt.reset}
|
|
2701
|
+
${mt.dim}${B}${mt.reset}
|
|
2702
|
+
`;return K}function ee(){oi.clear(),ea.clear(),ta.clear()}function Pu(){return{size:oi.size,maxSize:500}}var Fl=I(128);async function kS(x,v,k){let E=O(x,v,k),C=Fl.get(E);if(C){if(Gt(C.deps))return C;Fl.delete(E)}let j=Br(x,{filePath:v,projectRoot:process.cwd()}),L=j.code,B=Fr(j.styles);L=ht(L).code;let{hasUserImports:z,bundleClientScript:F}=await lt("stx/client-script-bundler",()=>import("./chunk-mcs7p3fy.js")),K=[],G=!1;if(z(L)){let ie=L;L=await F(ie,v,{projectRoot:process.cwd(),minify:k,collectInputs:K}),G=L===ie}let{stripStxRuntimeImports:J}=await lt("stx/signal-processing",()=>import("./chunk-pz1jc3db.js"));L=J(L);let ne=R(L),re=yS(ne),se=`function(__scopeId) {
|
|
2703
|
+
${Et("const",[...fo,...re],ne)}
|
|
2704
|
+
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2705
|
+
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
2706
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
2707
|
+
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
2708
|
+
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
2709
|
+
|
|
2710
|
+
// Scope-specific lifecycle callbacks
|
|
2711
|
+
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
2712
|
+
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
2713
|
+
const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
|
|
2714
|
+
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
2715
|
+
|
|
2716
|
+
try {
|
|
2717
|
+
${ne}
|
|
2718
|
+
|
|
2719
|
+
// Register all defined signals and functions in this scope
|
|
2720
|
+
const __localVars = {};
|
|
2721
|
+
try {
|
|
2722
|
+
${re.map((ie)=>`if (typeof ${ie} !== 'undefined') __localVars['${ie}'] = ${ie};`).join(`
|
|
2723
|
+
`)}
|
|
2724
|
+
}
|
|
2725
|
+
catch (e) {}
|
|
2726
|
+
Object.assign(__scopeVars, __localVars);
|
|
2727
|
+
}
|
|
2728
|
+
finally {
|
|
2729
|
+
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2730
|
+
}
|
|
2731
|
+
}`,oe={vendorStyleTags:B,factoryBody:se,deps:Ku([...K,...j.styles.map((ie)=>ie.resolvedPath)])};if(!G&&j.unresolved.length===0)Fl.set(E,oe);return oe}var ES=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function CS(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 RS(x,v){let k=v;while(!0){let E=Cr.join(k,"node_modules",x,"package.json");if(ai.existsSync(E))return Cr.dirname(E);let C=Cr.dirname(k);if(C===k)return null;k=C}}function TS(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 AS(x,v){let k=CS(x);if(!k||!k.subpath)return null;let E=RS(k.pkg,v);if(!E)return null;let C;try{C=JSON.parse(ai.readFileSync(Cr.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,L=TS(C.exports,j);if(!L)return null;let B=Cr.resolve(E,L);return ai.existsSync(B)?B:null}function Br(x,v){let k=v.filePath?Cr.dirname(v.filePath):v.projectRoot||process.cwd(),E=v.projectRoot||process.cwd(),C=new Set,j=[],L=[];return{code:x.replace(ES,(z,F)=>{let K;try{if(F.startsWith("./")||F.startsWith("../")||F.startsWith("/")){if(K=F.startsWith("/")?F:Cr.resolve(k,F),!ai.existsSync(K))throw Error(`file not found: ${K}`)}else{let G=null;try{G=Bun.resolveSync(F,E)}catch{G=AS(F,E)}if(!G)throw Error(`could not resolve ${F} (Bun.resolveSync + exports fallback both failed)`);K=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(K))return"";C.add(K);try{let G=ai.readFileSync(K,"utf8");j.push({source:F,resolvedPath:K,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${K}: ${G?.message||G}`),L.push(F)}return""}),styles:j,unresolved:L}}function IS(x){return x.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Fr(x){if(x.length===0)return"";return`${x.map((v)=>`<style data-stx-vendor="${IS(v.source)}" data-stx-layer="vendor">
|
|
2732
|
+
@layer vendor {
|
|
2733
|
+
${v.contents}
|
|
2734
|
+
}
|
|
2735
|
+
</style>`).join(`
|
|
2736
|
+
`)}
|
|
2737
|
+
`}var Da=m;function ht(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 _i(v,B,!0)}),j=Om(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
|
+
${x}`,imports:C,models:j}}var PS=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 Om(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(!PS.has(E[1]))v.add(E[1]);return Array.from(v)}function DS(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 Ti(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 fe=ie[1],ue=ie[2]||fe;if(C.add(fe),C.add(ue),J==="stx"||J==="@stacksjs/stx")v.add(fe);else k.add(fe);if(ue!==fe)ne.push(`${ue} = ${fe}`)}let re=ne.length>0?`var ${ne.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(L[0],re)}let B=DS(E);for(let G of Da){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(_i(z,G))k.add(G)}let K=Om(E);for(let G of K)if(!C.has(G)&&!B.has(G))k.add(G);return{code:E,stxImports:Array.from(v),browserImports:Array.from(k)}}function _i(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 Ri(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
|
+
${k.join(`
|
|
2741
|
+
`)}
|
|
2742
|
+
${MS(x,v)}`;return""}function uu(x,v=[]){let{browserImports:k}=Ti(x),E=new Set(v);return Ri([],k.filter((C)=>!E.has(C)))}function MS(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
|
+
[${k.join(", ")}].forEach(function (e) {
|
|
2744
|
+
if (e[1] !== 'undefined') return;
|
|
2745
|
+
console.error(
|
|
2746
|
+
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
2747
|
+
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
2748
|
+
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2749
|
+
);
|
|
2750
|
+
});
|
|
2751
|
+
`}function Oe(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 OS(x,v){return new RegExp(`(?<![.#\\w$])${v}(?![\\w$])`).test(x)}var NS=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Dm=new Set;function jS(x,v){let k=NS.test(x),E=v.length>32768;if(!k&&!E)return;if(Dm.has(x))return;if(Dm.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 zr(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&&!OS(k,j))continue;if(pi(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;jS(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
|
+
${C.join(`
|
|
2753
|
+
`)}
|
|
2754
|
+
`}var LS={left:0,middle:1,right:2};function BS(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=LS[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 zS(x,v){let{elementId:k,event:E,modifiers:C}=x,j=la(x.handler),L=BS(C),B=[];if(C.once)B.push("once: true");if(C.capture)B.push("capture: true");if(ca(E,C))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",F="";if(L)F+=`${L}; `;let K=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
|
|
2755
|
+
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2756
|
+
};`;function J(ne){if(/\$emit\s*\(/.test(ne))return`${G}
|
|
2757
|
+
${ne}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
2758
|
+
if (scope && scope.__stx_execute) {
|
|
2759
|
+
scope.__stx_execute('${K}', $event, $el);
|
|
2760
|
+
}
|
|
2761
|
+
else {
|
|
2762
|
+
${ne}
|
|
2763
|
+
}`}if(C.debounce!==null)return` ;(function() {
|
|
2764
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
2765
|
+
var $el = document.getElementById('${k}')
|
|
2766
|
+
if (!$el) return
|
|
2767
|
+
var __timer
|
|
2768
|
+
$el.addEventListener('${E}', function($event) {
|
|
2769
|
+
${L?L+"; ":""}clearTimeout(__timer)
|
|
2770
|
+
__timer = setTimeout(function() { ${J(j)} }, ${C.debounce})
|
|
2771
|
+
}${z})
|
|
2772
|
+
})()`;if(C.throttle!==null)return` ;(function() {
|
|
2773
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
2774
|
+
var $el = document.getElementById('${k}')
|
|
2775
|
+
if (!$el) return
|
|
2776
|
+
var __last = 0
|
|
2777
|
+
$el.addEventListener('${E}', function($event) {
|
|
2778
|
+
${L?L+"; ":""}var __now = Date.now()
|
|
2779
|
+
if (__now - __last >= ${C.throttle}) {
|
|
2780
|
+
__last = __now
|
|
2781
|
+
${J(j)}
|
|
2782
|
+
}
|
|
2783
|
+
}${z})
|
|
2784
|
+
})()`;if(/\$emit\s*\(/.test(j))return` var $el = document.getElementById('${k}')
|
|
2785
|
+
if ($el) $el.addEventListener('${E}', function($event) {
|
|
2786
|
+
${F}${G}
|
|
2787
|
+
${j}
|
|
2788
|
+
}${z})`;return` var $el = document.getElementById('${k}')
|
|
2789
|
+
if ($el) $el.addEventListener('${E}', function($event) {
|
|
2790
|
+
${F}var scope = $el.closest('[data-stx-scope]');
|
|
2791
|
+
if (scope && scope.__stx_execute) {
|
|
2792
|
+
scope.__stx_execute('${K}', $event, $el);
|
|
2793
|
+
}
|
|
2794
|
+
else {
|
|
2795
|
+
${j}
|
|
2796
|
+
}
|
|
2797
|
+
}${z})`}function FS(x){if(x.length===0)return"";return`
|
|
2798
|
+
// STX: auto-generated event bindings
|
|
2799
|
+
${x.map((k,E)=>zS(k,E)).join(`
|
|
2800
|
+
`)}`}function Mm(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]!==`
|
|
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 K=z.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[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+=K[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 WS=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 VS(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(!WS.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 K=/@model\s*=\s*["']([^"']*)["']/gi;while((j=K.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 ge(x,v={}){let k=x,E="",C=!1,j=[],L=Br(k,{filePath:v.filePath,projectRoot:v.projectRoot});k=L.code;let B=Fr(L.styles),z=ht(k);k=z.code,j=[...z.imports,...z.models];let{hasUserImports:F,bundleClientScript:K}=await lt("stx/client-script-bundler",()=>import("./chunk-mcs7p3fy.js"));if(F(k))k=await K(k,v.filePath||"",{projectRoot:v.projectRoot,minify:v.production}),C=!0;if(v.autoImports!==!1){let ue=Ti(k);k=ue.code,E=Ri(ue.stxImports,ue.browserImports.filter((be)=>!j.includes(be)))}if(E=`${zr(k,v.serverData)}${E}`,k=R(k),!C&&ze(v.attrs||""))k=He(k);let G=FS(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(),be=`type="module" data-stx-scoped${re}${ue?` ${ue}`:""}`;return`${B}<script ${be}>
|
|
2802
|
+
${Is(`${E}${k}
|
|
2803
|
+
${G}`)}
|
|
2804
|
+
</script>`}let se=Cs(x),oe=/function __stx_setup_/.test(k),ie=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(x);function fe(ue){let be=ue.length>0?`
|
|
2805
|
+
return { ${ue.join(", ")} };`:"";return`${B}<script data-stx-scoped data-stx-run="always"${re}>
|
|
2806
|
+
window.stx.mount(function() {
|
|
2807
|
+
'use strict';
|
|
2808
|
+
${Is(`${E}${k}
|
|
2809
|
+
${G}${be}`)}
|
|
2810
|
+
})</script>`}if(!ie&&!oe){if(se)return fe(Mm(x));if(v.templateContent){let ue=Mm(x);if(ue.length>0){let be=VS(v.templateContent);if(ue.some((Se)=>be.has(Se)))return fe(ue)}}}return`${B}<script data-stx-scoped data-stx-run="always"${re}>
|
|
2811
|
+
;(function() {
|
|
2812
|
+
'use strict';
|
|
2813
|
+
${Is(`${E}${k}
|
|
2814
|
+
${G}`)}
|
|
2815
|
+
})()</script>`}
|
|
2816
|
+
export{Rn,Ie,H,y,De,V,U,I,O,Gt,Br,Fr,Da,ht,Ti,_i,Ri,uu,Oe,zr,ge,Ai,Pi,Ii,Hr,Y,Me,An,Oa,du,Ma,pu,Na,Pn,h,yt,me,La,Vr,ja,fu,W,Ba,gu,b,mu,Fa,hu,yu,bu,vu,za,Ha,wu,xu,Di,Su,Jt,Yt,In,e,ku,Oi,Cu,Mi,Va,Ua,bt,Zt,$u,Wa,qa,Xa,f,Ne,vt,Le,je,Ni,Dn,Z,Ur,Wr,qr,Eu,On,Tu,Qt,Ka,Xr,M,ae,q,_u,Ga,Kr,Gr,Li,ji,Jr,Yr,Ja,Ya,Bi,Fi,Za,Be,en,Mn,wt,Qa,ec,tc,nc,rc,d,sc,Zr,ic,zi,Hi,xt,Qr,Vi,oc,Ru,he,Ui,Au,es,ts,ns,Nn,Wi,rs,Ln,tn,jn,ss,is,os,r,Fe,as,cs,ac,Q,qi,Xi,Ki,Gi,Bn,ls,Ji,Yi,Zi,cc,lc,uc,dc,pc,fc,ze,N,He,gc,Fn,mc,Qi,hc,Ve,n,zn,eo,g,ee,Pu,Hn,A,yc,i,T,Iu,Du,ce};
|