@stacksjs/stx 0.2.570 → 0.2.572
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-01mxer9s.js +2 -0
- package/dist/chunk-09gtbb1w.js +2 -0
- package/dist/{chunk-v9gy8rda.js → chunk-0bt0fbs1.js} +59 -59
- package/dist/{chunk-k0shfsfx.js → chunk-0dz1b6a1.js} +3 -3
- package/dist/{chunk-3m01ym55.js → chunk-0g2ybnht.js} +2 -2
- package/dist/{chunk-jvm6agq7.js → chunk-0q6n3by0.js} +3 -3
- package/dist/chunk-15erabm6.js +2 -0
- package/dist/chunk-194qgkc9.js +2 -0
- package/dist/{chunk-fas9k7sw.js → chunk-1dg5qxg9.js} +5 -5
- package/dist/{chunk-tdv9np5t.js → chunk-1edvsndv.js} +2 -2
- package/dist/{chunk-brkq2s62.js → chunk-1n64749x.js} +3 -3
- package/dist/chunk-1z6c6dyk.js +2 -0
- package/dist/{chunk-36aj0yzt.js → chunk-232jswfm.js} +1 -1
- package/dist/chunk-279jv0yf.js +2 -0
- package/dist/chunk-2a1q5y6r.js +2 -0
- package/dist/{chunk-xfpfs9zq.js → chunk-2ads8rw5.js} +2 -2
- package/dist/chunk-2cqbyb8w.js +2 -0
- package/dist/{chunk-wjazf68a.js → chunk-2crxkm7j.js} +3 -3
- package/dist/{chunk-he2et28k.js → chunk-2jjff8kv.js} +5 -5
- package/dist/chunk-2jsnrfc8.js +2 -0
- package/dist/{chunk-ffxwsa94.js → chunk-2z0trbbm.js} +2 -2
- package/dist/{chunk-ywah1c30.js → chunk-36agnyhe.js} +7 -7
- package/dist/chunk-3gft8zng.js +2 -0
- package/dist/chunk-49gwmcrn.js +2 -0
- package/dist/{chunk-r17t24jr.js → chunk-4bgfpkwx.js} +3 -3
- package/dist/{chunk-dgr561sc.js → chunk-4easd8da.js} +11 -11
- package/dist/chunk-4wfr074d.js +2 -0
- package/dist/{chunk-cbyh8fhn.js → chunk-58tz7tmf.js} +3 -3
- package/dist/chunk-5afw7z6v.js +2 -0
- package/dist/{chunk-9d6dr0dr.js → chunk-5dmkkvs7.js} +2 -2
- package/dist/chunk-5fv4g4et.js +2 -0
- package/dist/{chunk-d8jdr1k4.js → chunk-5t1whxxt.js} +6 -6
- package/dist/{chunk-dkyqkkpj.js → chunk-5vw8493b.js} +3 -3
- package/dist/chunk-604rs9sq.js +2 -0
- package/dist/chunk-636sfxyj.js +2 -0
- package/dist/chunk-6aq3sm83.js +2 -0
- package/dist/chunk-6f4qrd0s.js +2 -0
- package/dist/chunk-6va5pe2m.js +2 -0
- package/dist/{chunk-r8h9b3f8.js → chunk-6wc2t6cd.js} +6 -6
- package/dist/{chunk-2t3bhp2j.js → chunk-707n4pbz.js} +5 -5
- package/dist/{chunk-5s555c1r.js → chunk-74xwzxwz.js} +3 -3
- package/dist/{chunk-nmy7mcbd.js → chunk-79vdkvhf.js} +5 -5
- package/dist/{chunk-mbj9dbrh.js → chunk-7bwkeake.js} +6 -6
- package/dist/chunk-7kh4p06d.js +2 -0
- package/dist/{chunk-8cs45k3f.js → chunk-7t3ykgsm.js} +2 -2
- package/dist/chunk-7xrrzqh7.js +2 -0
- package/dist/{chunk-724zsgbk.js → chunk-83fdt4yj.js} +6 -6
- package/dist/chunk-8jaw6exk.js +2 -0
- package/dist/chunk-8k61b4ae.js +2 -0
- package/dist/{chunk-chythmea.js → chunk-9k7bq97t.js} +1 -1
- package/dist/chunk-9yar9rfq.js +2 -0
- package/dist/{chunk-knpzph55.js → chunk-a6jq7hex.js} +3 -3
- package/dist/{chunk-mw2dravv.js → chunk-anjm087t.js} +5 -5
- package/dist/chunk-asbq9cgs.js +2 -0
- package/dist/{chunk-0zq4btre.js → chunk-b2q8bk8p.js} +2 -2
- package/dist/chunk-b7t8jejd.js +2 -0
- package/dist/chunk-b894fxfc.js +2 -0
- package/dist/{chunk-y3mmeywt.js → chunk-b9r88ysg.js} +2 -2
- package/dist/{chunk-0pzbg1bt.js → chunk-beqkrwt1.js} +2 -2
- package/dist/chunk-bm2q1srp.js +2 -0
- package/dist/{chunk-xjr67xvb.js → chunk-bpdsdbvg.js} +2 -2
- package/dist/{chunk-8zmahjqg.js → chunk-c4zpzxex.js} +6 -6
- package/dist/chunk-cgwyd9aq.js +2 -0
- package/dist/chunk-cvswrbzw.js +2 -0
- package/dist/{chunk-hvzznc50.js → chunk-cyg9w31a.js} +2 -2
- package/dist/chunk-d8206zbp.js +2 -0
- package/dist/chunk-dcpf6kas.js +15 -0
- package/dist/chunk-ensp20xk.js +2 -0
- package/dist/chunk-f10299sf.js +2 -0
- package/dist/chunk-f1apaqfk.js +2 -0
- package/dist/chunk-f4jh9vrj.js +2834 -0
- package/dist/{chunk-rrce2fyv.js → chunk-g66m3g2r.js} +1 -1
- package/dist/chunk-g6zeqvvb.js +2 -0
- package/dist/chunk-ghy82tsc.js +2 -0
- package/dist/{chunk-35kmebz9.js → chunk-gzgc8zk5.js} +4 -4
- package/dist/{chunk-qw4fjtt1.js → chunk-h4k3hyny.js} +2 -2
- package/dist/chunk-jqefcghh.js +31 -0
- package/dist/chunk-jw33eys8.js +2 -0
- package/dist/chunk-jwvzvapp.js +11 -0
- package/dist/{chunk-b76jbdtk.js → chunk-jze68d0z.js} +2 -2
- package/dist/chunk-k6wgh598.js +2 -0
- package/dist/{chunk-c1ys37c9.js → chunk-k7ht6tqe.js} +2 -2
- package/dist/{chunk-q94wdmdp.js → chunk-kgj852hx.js} +4 -4
- package/dist/{chunk-nebtks7j.js → chunk-kzjrgh0b.js} +10 -10
- package/dist/chunk-m2a1fxpb.js +2 -0
- package/dist/chunk-m6mxqepz.js +2 -0
- package/dist/chunk-mbmbaj0m.js +2 -0
- package/dist/{chunk-3tzkqf6e.js → chunk-mr9c2ej6.js} +2 -2
- package/dist/chunk-mzqyv7s5.js +33 -0
- package/dist/chunk-n61v7e3s.js +2 -0
- package/dist/chunk-n6qp05t9.js +2 -0
- package/dist/chunk-nn174xjh.js +2 -0
- package/dist/chunk-ntgy4e1q.js +2 -0
- package/dist/chunk-nw4axkpx.js +2 -0
- package/dist/chunk-p5chk3s9.js +2 -0
- package/dist/{chunk-w8vg3te3.js → chunk-phzs239m.js} +4 -4
- package/dist/{chunk-gwabvrc3.js → chunk-pnag11c4.js} +3 -3
- package/dist/{chunk-tc5zk2ka.js → chunk-pqcvh9pp.js} +1 -1
- package/dist/{chunk-a849hqna.js → chunk-pveafhzg.js} +2 -2
- package/dist/chunk-pw9verqx.js +2 -0
- package/dist/{chunk-rh606w0q.js → chunk-q79kmad5.js} +1 -1
- package/dist/chunk-q83w8edy.js +3 -0
- package/dist/{chunk-je0jxvmj.js → chunk-qcymqscj.js} +5 -5
- package/dist/{chunk-rtc17gy5.js → chunk-qt3x1sh3.js} +3 -3
- package/dist/chunk-qx6tr8mr.js +2 -0
- package/dist/{chunk-q8nw82pz.js → chunk-qzbzn1yf.js} +23 -23
- package/dist/{chunk-kaaxb9c5.js → chunk-r4w1cye7.js} +2 -2
- package/dist/{chunk-ebg20d8s.js → chunk-rfnr4xz6.js} +2 -2
- package/dist/{chunk-dajh1369.js → chunk-rrj5m9xv.js} +2 -2
- package/dist/{chunk-d4ybwtqt.js → chunk-s12b57m9.js} +2 -2
- package/dist/chunk-s34g3awk.js +74 -0
- package/dist/chunk-s6sf70ty.js +2 -0
- package/dist/{chunk-wemq37qe.js → chunk-sfwprq8q.js} +8 -8
- package/dist/chunk-ta8bhz27.js +2 -0
- package/dist/chunk-tc5r2vmw.js +2 -0
- package/dist/chunk-ts80ktq7.js +2 -0
- package/dist/{chunk-9k6r7f3c.js → chunk-tv784gv0.js} +4 -4
- package/dist/{chunk-3wcwtqx1.js → chunk-vp31ff54.js} +2 -2
- package/dist/{chunk-nz0krznq.js → chunk-vr36s2en.js} +2 -2
- package/dist/chunk-vyg8bvkt.js +2 -0
- package/dist/{chunk-9zf49tqg.js → chunk-wwhxgvr8.js} +4 -4
- package/dist/{chunk-ncq5n15k.js → chunk-xckzvbvn.js} +1 -1
- package/dist/chunk-xq2ck69k.js +2 -0
- package/dist/chunk-y4ajd836.js +2 -0
- package/dist/{chunk-j3vwyzvb.js → chunk-ydx3mfpp.js} +7 -7
- package/dist/{chunk-z3smaz4z.js → chunk-yk3wh2xv.js} +3 -3
- package/dist/{chunk-5hxsdkvp.js → chunk-ymawe0y5.js} +2 -2
- package/dist/{chunk-zckbg2vb.js → chunk-zd01r00t.js} +1 -1
- package/dist/chunk-zddzjd60.js +2 -0
- package/dist/chunk-zgxj1q7w.js +2 -0
- package/dist/chunk-zs7qhh40.js +2 -0
- package/dist/{chunk-qh0es7mk.js → chunk-zyk12484.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/client-script-bundler.js +1 -1
- package/dist/composable-loader.js +3 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/env.d.ts +16 -0
- package/dist/env.js +12 -0
- package/dist/native/compiler/bundle.d.ts +2 -0
- package/dist/native/compiler/bundle.js +51 -12
- package/dist/process.js +3 -3
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +8 -8
- package/dist/store-loader.js +4 -3
- package/package.json +5 -5
- package/dist/chunk-0mw3d5fc.js +0 -2
- package/dist/chunk-1sh80b1c.js +0 -2
- package/dist/chunk-1xyhdpbn.js +0 -2
- package/dist/chunk-20nrvpps.js +0 -2
- package/dist/chunk-2j7tr8wj.js +0 -2
- package/dist/chunk-2mxhp1yy.js +0 -2
- package/dist/chunk-32yj7sbw.js +0 -2
- package/dist/chunk-3ss3vfad.js +0 -2
- package/dist/chunk-4zp2zzch.js +0 -2
- package/dist/chunk-503w9dn3.js +0 -2
- package/dist/chunk-6m406xsn.js +0 -63
- package/dist/chunk-6yja1c8e.js +0 -2
- package/dist/chunk-74va4kza.js +0 -2
- package/dist/chunk-74w81h3v.js +0 -2
- package/dist/chunk-85j8cxfd.js +0 -2
- package/dist/chunk-8bwp2m95.js +0 -2
- package/dist/chunk-8rj08x1d.js +0 -2
- package/dist/chunk-8yn9wxzt.js +0 -31
- package/dist/chunk-98xp5rfe.js +0 -2
- package/dist/chunk-9ah35e2w.js +0 -2
- package/dist/chunk-9d1bs55s.js +0 -2
- package/dist/chunk-9rts16ta.js +0 -2
- package/dist/chunk-a2mztbta.js +0 -33
- package/dist/chunk-ajezxt0s.js +0 -2
- package/dist/chunk-bf572npc.js +0 -2
- package/dist/chunk-cqeccn7x.js +0 -2
- package/dist/chunk-dkyjw3hc.js +0 -3
- package/dist/chunk-dsdxa5x1.js +0 -2
- package/dist/chunk-ectcp21m.js +0 -2
- package/dist/chunk-ewcnyvcd.js +0 -2
- package/dist/chunk-ez7r18ef.js +0 -2
- package/dist/chunk-ffgsaf9e.js +0 -2
- package/dist/chunk-fnnhekdc.js +0 -2
- package/dist/chunk-g8b74qvn.js +0 -2
- package/dist/chunk-ge87hcgb.js +0 -2
- package/dist/chunk-gra2v7xz.js +0 -2
- package/dist/chunk-jg9fydw8.js +0 -2
- package/dist/chunk-k50k9zbw.js +0 -2
- package/dist/chunk-kz131809.js +0 -2834
- package/dist/chunk-mg8yjzkr.js +0 -2
- package/dist/chunk-mjkw1esn.js +0 -2
- package/dist/chunk-n0ra4mv3.js +0 -2
- package/dist/chunk-nspfk500.js +0 -2
- package/dist/chunk-nwyp2xaf.js +0 -2
- package/dist/chunk-pdk87hhe.js +0 -2
- package/dist/chunk-pxcmv1xz.js +0 -2
- package/dist/chunk-re030f77.js +0 -2
- package/dist/chunk-rn80ctkd.js +0 -2
- package/dist/chunk-s7dzs6yg.js +0 -2
- package/dist/chunk-t1tqn3xx.js +0 -2
- package/dist/chunk-tgwdk0gt.js +0 -15
- package/dist/chunk-tma2vac1.js +0 -2
- package/dist/chunk-v0chatw1.js +0 -2
- package/dist/chunk-v9mkambt.js +0 -2
- package/dist/chunk-vwjqbn5y.js +0 -2
- package/dist/chunk-wrvksj26.js +0 -2
- package/dist/chunk-wvjpvs89.js +0 -11
- package/dist/chunk-xkxwg6d4.js +0 -2
- package/dist/chunk-xspkz804.js +0 -2
- package/dist/chunk-xwqyw7zt.js +0 -2
- package/dist/chunk-y3kp87w1.js +0 -2
- package/dist/chunk-ya39wk58.js +0 -2
- package/dist/chunk-ygbdfzqn.js +0 -2
- package/dist/chunk-ypswj8sv.js +0 -2
- package/dist/chunk-yqzhev40.js +0 -2
- package/dist/chunk-z1tnn2pm.js +0 -2
package/dist/chunk-kz131809.js
DELETED
|
@@ -1,2834 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{kn,y,ji,Dt,zs,Bi,Fi,zi,Hi}from"./chunk-c1ys37c9.js";import{I}from"./chunk-d4ybwtqt.js";import{t,J,lr,i,re,Bs,P,It,xn,Fs,l,p,Li,O,Ce,tt,c,ur}from"./chunk-j3vwyzvb.js";import{_n,En,hr,Ee}from"./chunk-w8vg3te3.js";import{S,Ms,Qe,Ns,Pi,gn,mn,Ii,ke,Oi,hn,Di,Pt,Ls,Mi,yn,wn,ar,ge,js,me,cr}from"./chunk-wemq37qe.js";import{Ps,Is,Os,Ds,rr,sr}from"./chunk-ywah1c30.js";import{$i,$s,er,tr}from"./chunk-9k6r7f3c.js";import{pe,At,nr,As,C,Ye}from"./chunk-ebg20d8s.js";import{fn}from"./chunk-dajh1369.js";import{qs}from"./chunk-tdv9np5t.js";import{xi,Si,Ci,_i}from"./chunk-gwabvrc3.js";import{Je}from"./chunk-r47cs92n.js";import{s,xe}from"./chunk-5s555c1r.js";import{Rt,Ai,un,a,pn}from"./chunk-3m01ym55.js";import{u}from"./chunk-cg8hg6cs.js";import{he,D,Sn}from"./chunk-dkyjw3hc.js";import{yr}from"./chunk-qw4fjtt1.js";import zr from"path";import po from"fs";var Ch=new Set(["touchstart","touchmove","wheel","mousewheel"]);function La(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Ch.has(v.toLowerCase())}var Ru=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"]),Au={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"},Rh=new Set(["ctrl","alt","shift","meta"]),Pu={left:0,middle:1,right:2};function Tu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let E=k.toLowerCase();if(E==="prevent")_.prevent=!0;else if(E==="stop")_.stop=!0;else if(E==="once")_.once=!0;else if(E==="capture")_.capture=!0;else if(E==="self")_.self=!0;else if(E==="passive")_.passive=!0;else if(E==="nonpassive")_.nonpassive=!0;else if(Rh.has(E))_.systemKeys.push(E);else if(E in Pu)_.mouse=E;else if(E in Au||/^[a-z]$/.test(E))_.keys.push(Au[E]||E.toUpperCase());else if(E.startsWith("debounce")){let T=E.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(E.startsWith("throttle")){let T=E.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Du(v,_=""){let k=[],E=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,j;while((j=T.exec(v))!==null){let[B,z,W]=j,F=j.index,V=F+B.length,U=`__stx_evt_${_}${E++}`,Y=[],Z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,se;while((se=Z.exec(W))!==null){let[,oe,ae]=se,le=oe.split("."),ce=le[0];if(!Ru.has(ce))continue;Y.push({attribute:`@${oe}`,event:ce,handler:ae,modifiers:Tu(le.slice(1)),elementId:U})}let ie=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((se=ie.exec(W))!==null){let[,oe,ae]=se,le=oe.split("."),ce=le[0];if(!Ru.has(ce))continue;Y.push({attribute:`@${oe}`,event:ce,handler:ae,modifiers:Tu(le.slice(1)),elementId:U})}if(Y.length>0)k.push({originalTag:B,elementId:U,events:Y,startIndex:F,endIndex:V})}return k}function Ah(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let E of k.systemKeys)_.push(`if (!$event.${E}Key) return`);if(k.keys.length>0){let E=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${E})) return`)}if(k.mouse!==null){let E=Pu[k.mouse];_.push(`if ($event.button !== ${E}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Th(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function Ba(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Ih(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=Ah(v),T=Th(Ba(v.handler),_),j=[];if(_.once)j.push("once: true");if(_.capture)j.push("capture: true");if(La(v.event,_))j.push("passive: true");let B=j.length>0?`, { ${j.join(", ")} }`:"",z=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.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('${z}', null, $el);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
__stx_runHandler('${z}', null, $el);
|
|
13
|
-
}
|
|
14
|
-
})();`;if(v.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('${z}', null, $el);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
__stx_runHandler('${z}', 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('${v.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('${z}', $event, $el);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
-
__stx_runHandler('${z}', $event, $el);
|
|
54
|
-
}
|
|
55
|
-
}${B});
|
|
56
|
-
})();`}function za(v){if(v.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
|
-
${v.map(Ih).join(`
|
|
112
|
-
`)}
|
|
113
|
-
})();
|
|
114
|
-
</script>`}function Ph(v,_=""){let k=Du(v,_);if(k.length===0)return{template:v,bindings:[]};let E=v,T=[];for(let j=k.length-1;j>=0;j--){let B=k[j],z=B.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${B.elementId}"`);else{let W=z.match(/id=["']([^"']+)["']/);if(W)for(let F of B.events)F.elementId=W[1]}for(let W of B.events){let F=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(`\\s*${F}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${F}\\s*=\\s*'[^']*'`,"g");z=z.replace(V,""),z=z.replace(U,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function Iu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Mu(v,_,k){if(Bi(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:W}=Ph(v,Iu(_)),F=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...F,...W],z}let E=Du(v,Iu(_));if(E.length===0)return v;let T=v;for(let z=E.length-1;z>=0;z--){let W=E[z],F=W.originalTag;if(!F.includes(" id="))F=F.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let V=F.match(/id=["']([^"']+)["']/);if(V)for(let U of W.events)U.elementId=V[1]}for(let V of W.events){let U=V.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),Z=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");F=F.replace(Y,""),F=F.replace(Z,"")}T=T.slice(0,W.startIndex)+F+T.slice(W.endIndex)}let j=za(E.flatMap((z)=>z.events)),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
|
|
115
|
-
`+T.slice(B);else T+=j;return T}function Ou(v,_){let k=new Set;for(let E of v.split(",")){let T=E.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let j=T.lastIndexOf(":");if(j!==-1)T=T.slice(j+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function So(v,_){let k=s(v),{depths:E,balanced:T}=xe(k),j=(z)=>!T||E[z]===0,B=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let z of k.matchAll(B)){let W=(z.index??0)+z[0].length-z[1].length;if(j(W))return!0}for(let z of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(z.index??0)&&Ou(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&Ou(z[1],!1).has(_))return!0;return!1}var Nu="",$o,gr=/^[A-Za-z_$][\w$]*$/,Dh=new Set(["if","for","while","switch","with"]),ju=["(","[","{"],Lu=[")","]","}"],Mh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Oh(v){let _=s(v),k=[];for(let E of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=E.index??0;k.push({text:E[0],start:T,end:T+E[0].length})}return{code:_,tokens:k}}function Wa(v){if($o&&v===Nu)return $o;let{code:_,tokens:k}=Oh(v),E=new Map,T=[];for(let Z=0;Z<k.length;Z++){let se=k[Z].text;if(["(","[","{"].includes(se))T.push(Z);else if([")","]","}"].includes(se)){let ie=T.at(-1);if(ie!==void 0&&["()","[]","{}"].includes(k[ie].text+se))T.pop(),E.set(ie,Z),E.set(Z,ie)}}function j(Z,se){let ie=[],oe=Z;for(let ae=Z;ae<se;ae++){if(["(","[","{"].includes(k[ae].text)&&(E.get(ae)??se)<se){ae=E.get(ae);continue}if(k[ae].text===",")ie.push([oe,ae]),oe=ae+1}return ie.push([oe,se]),ie}let B=[];function z(Z,se,ie){if(k[Z]?.text==="...")Z++;if(Z>=se)return;let oe=k[Z].text;if(gr.test(oe)){if(ie.add(oe),ie===V)B.push({name:oe,token:Z});return}if(oe!=="{"&&oe!=="[")return;let ae=E.get(Z);if(ae===void 0||ae>=se)return;for(let[le,ce]of j(Z+1,ae)){let fe=le;if(oe==="{")for(let ye=le;ye<ce;ye++){if(k[ye].text===":"){fe=ye+1;break}if(k[ye].text==="=")break;if(["(","[","{"].includes(k[ye].text)&&E.has(ye))ye=E.get(ye)}z(fe,ce,ie)}}function W(Z,se){let ie=new Set;for(let[oe,ae]of j(Z,se))z(oe,ae,ie);return ie}function F(Z){let se=Z;for(;se<k.length;se++){let ie=k[se].text;if(["(","[","{"].includes(ie)&&E.has(se)){se=E.get(se);continue}if([",",";",")","]","}"].includes(ie))break}return k[Math.max(Z,se-1)]?.end??_.length}let V=new Set,U=[];for(let Z=0;Z<k.length;Z++)if(k[Z].text==="=>"){let se=Z-1,ie=se,oe;if(k[se]?.text===")"&&E.has(se))ie=E.get(se),oe=W(ie+1,se);else if(k[se]&&gr.test(k[se].text))oe=new Set([k[se].text]);else continue;let ae=Z+1,le=k[ae]?.text==="{"&&E.has(ae)?k[E.get(ae)].end:F(ae);U.push({start:k[ie].start,end:le,names:oe})}else if(k[Z].text==="("&&E.has(Z)){let se=k[Z-1]?.text;if(!se||Dh.has(se)||!gr.test(se)&&se!=="*"&&se!=="]")continue;let ie=E.get(Z),oe=ie+1;if(k[oe]?.text===":"){oe++;while(oe<k.length&&!["{","=>",";","="].includes(k[oe].text))oe++}if(k[oe]?.text!=="{"||!E.has(oe))continue;U.push({start:k[Z].start,end:k[E.get(oe)].end,names:W(Z+1,ie)})}function Y(Z){let se=Z;for(;se<k.length;se++){let ie=k[se].text;if(ju.includes(ie)&&E.has(se)){se=E.get(se);continue}if(ie===";"||Lu.includes(ie))break;let oe=k[se-1];if(se>Z&&Mh.has(ie)&&oe.text!==".")break;if(se>Z&&/[\n\r]/.test(_.slice(oe.end,k[se].start))&&(/^[\w$]+$/.test(oe.text)||Lu.includes(oe.text)||['"',"'","`"].includes(oe.text))&&gr.test(ie)&&!["in","of","instanceof"].includes(ie))break}return se}for(let Z=0;Z<k.length;Z++){let se=k[Z].text,ie=k[Z-1]?.text;if(ie==="."||k[Z+1]?.text===":")continue;if(ie==="as"||ie==="<")continue;if(se==="const"||se==="let"||se==="var"){let oe=Y(Z+1),ae=Z+1,le=!1,ce=!1,fe=0;for(let ye=Z+1;ye<=oe;ye++){let Se=k[ye]?.text;if(ye<oe&&ju.includes(Se)&&E.has(ye)&&E.get(ye)<oe){ye=E.get(ye);continue}if(ye<oe&&Se===":"&&!ce)le=!0;else if(ye<oe&&Se==="="&&fe===0)le=!1,ce=!0;else if(ye<oe&&le&&Se==="<")fe++;else if(ye<oe&&le&&Se===">"&&fe>0)fe--;else if(ye===oe||Se===","&&fe===0)z(ae,ye,V),ae=ye+1,le=!1,ce=!1}}else if(se==="function"||se==="class"){let oe=Z+1;if(k[oe]?.text==="*")oe++;if(k[oe]&&gr.test(k[oe].text)&&k[oe].text!=="extends")V.add(k[oe].text),B.push({name:k[oe].text,token:oe})}else if(se==="import"){let oe=Z+1;if(k[oe]?.text==="*"&&k[oe+1]?.text==="as")oe+=2;let ae=k[oe]?.text;if(ae&&gr.test(ae)&&ae!=="type"&&k[oe+1]?.text!=="("&&k[oe+1]?.text!==".")V.add(ae),B.push({name:ae,token:oe,file:!0});let le=k[oe]?.text==="{"?oe:k[oe+1]?.text===","&&k[oe+2]?.text==="{"?oe+2:-1;if(le!==-1&&E.has(le)){let ce=E.get(le);for(let[fe,ye]of j(le+1,ce)){let Se=ye-1;while(Se>=fe&&!gr.test(k[Se].text))Se--;if(Se>=fe&&k[Se].text!=="type")B.push({name:k[Se].text,token:Se,file:!0})}}}}return Nu=v,$o={code:_,scopes:U,declarations:V,sites:B,tokens:k,pairs:E},$o}function Fa(v){let _=Wa(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}function _o(v){return new Set(Wa(v).declarations)}function Go(v,_){let{scopes:k,sites:E,tokens:T,pairs:j}=Wa(v),B=Array.from({length:T.length},()=>-1),z=[];for(let Y=0;Y<T.length;Y++){B[Y]=z.length?z[z.length-1]:-1;let Z=T[Y].text;if(Z==="{"&&j.has(Y))z.push(Y);else if(Z==="}"&&z.length&&j.get(Y)===z[z.length-1])z.pop()}let W=new Set,F=new Map;for(let Y of E){if(!_.has(Y.name))continue;W.add(Y.token);let Z=Y.file?-1:B[Y.token],se=Z===-1?[0,Number.POSITIVE_INFINITY]:[T[Z].start,T[j.get(Z)].end],ie=F.get(Y.name);if(ie)ie.push(se);else F.set(Y.name,[se])}let V=new Set;for(let Y=0;Y<T.length;Y++){if(T[Y].text!=="import"||T[Y-1]?.text===".")continue;let Z=Y+1;if(T[Z]?.text==="type")Z++;if(T[Z]&&gr.test(T[Z].text)&&T[Z+1]?.text===",")Z+=2;if(T[Z]?.text==="{"&&j.has(Z))for(let se=Z+1;se<j.get(Z);se++)V.add(se)}let U=new Set;for(let Y=0;Y<T.length;Y++){let Z=T[Y].text;if(!_.has(Z)||U.has(Z)||W.has(Y)||V.has(Y))continue;let se=T[Y-1]?.text;if(se==="."&&T[Y-2]?.text!=="..")continue;if(T[Y+1]?.text===":"&&(se==="{"||se===","))continue;let ie=T[Y].start;if(F.get(Z)?.some(([oe,ae])=>ie>=oe&&ie<ae))continue;if(k.some((oe)=>ie>=oe.start&&ie<oe.end&&oe.names.has(Z)))continue;U.add(Z)}return U}import ko from"fs";import Wt from"path";function nn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Bu=new Map;function Eo(v,_=!0){let k=Bu.get(v);if(_&&k)return k;let E=new Map,T=[Wt.join(v,"src"),Wt.join(v,"dist"),v];function j(B,z){if(z>6)return;let W;try{W=ko.readdirSync(B,{withFileTypes:!0})}catch{return}for(let F of W){let V=Wt.join(B,F.name);if(F.isDirectory()){if(F.name==="node_modules"||F.name.startsWith("."))continue;j(V,z+1)}else if(F.isFile()&&F.name.endsWith(".stx")){let U=F.name.slice(0,-4);if(!E.has(U))E.set(U,V);let Y=U.toLowerCase();if(!E.has(Y))E.set(Y,V);let Z=nn(U);if(!E.has(Z))E.set(Z,V)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)Bu.set(v,E);return E}function Co(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=Wt.join(k,"node_modules",v);try{if(ko.statSync(E).isDirectory())return E}catch{}let T=Wt.dirname(k);if(T===k)return null;k=T}}function Ro(v,_,k={}){return[Wt.resolve(Wt.dirname(_),`${v}.stx`),Wt.resolve(Wt.dirname(_),v),Wt.resolve(k.componentsDir||"components",`${v}.stx`),Wt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function zu(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=nn(_);return[_,k,E]}function Va(v,_){let[k,E,T]=zu(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*Ua(v,_,k={},E){let T=zu(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Wt.resolve(Wt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((W)=>`${W}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[Wt.join(Wt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Wt.join(Wt.dirname(_),"components"),Wt.resolve(B,"src/components"),Wt.resolve(B,"components"),...import.meta.dir?[Wt.resolve(import.meta.dir,"components")]:[]];for(let W of new Set(z)){for(let F of j)yield Wt.join(W,F);try{for(let F of ko.readdirSync(W,{withFileTypes:!0}))if(F.isDirectory())for(let V of j)yield Wt.join(W,F.name,V)}catch{}}}function Wu(v,_,k={},E){let T=Va(v,E);if(T!==void 0)return T;for(let j of Ua(v,_,k,E))try{if(ko.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}import xh from"fs";import rt from"path";import{createHash as Nh}from"crypto";var Ao="__stx_component_client_factories";function To(v){let _=v[Ao];return _ instanceof Map?_:null}function Vu(v){v[Ao]=new Map}function Ha(v,_){let k=To(v);if(!k)return null;let E=Nh("sha256").update(_).digest("hex").slice(0,16),T=k.get(E);if(T)T.instances++;else k.set(E,{body:_,instances:1});return E}function Uu(v,_){let k=To(_);if(!k?.size)return v;let E=new Map;for(let[V,U]of k)if(U.instances===1)E.set(V,U.body);let T=[];if(E.size>0){let V=[...E.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),U=new RegExp(`window\\.__stxComponentFactories\\[(${V})\\]\\(("[^"]+")\\);`,"g"),Y=U.exec(v);while(Y!==null){let Z=E.get(JSON.parse(Y[1]));if(Z!==void 0)T.push({start:Y.index,end:Y.index+Y[0].length,replacement:`(${Z})(${Y[2]});`});Y=U.exec(v)}}let j=[...k].filter(([,V])=>V.instances>1);if(j.length===0)return Fu(v,T);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
|
-
(function() {
|
|
117
|
-
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
|
-
${j.map(([V,U])=>` try { factories[${JSON.stringify(V)}] = factories[${JSON.stringify(V)}] || ${U.body}; }
|
|
119
|
-
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(V)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
120
|
-
`)}
|
|
121
|
-
})();
|
|
122
|
-
</script>`,W=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),F=W<0?0:W;return T.push({start:F,end:F,replacement:`${z}
|
|
123
|
-
`}),Fu(v,T)}function Fu(v,_){if(_.length===0)return v;_.sort((j,B)=>j.start-B.start||j.end-B.end);let k=Array(_.length*2+1),E=0,T=0;for(let j of _)k[T++]=v.slice(E,j.start),k[T++]=j.replacement,E=j.end;return k[T]=v.slice(E),k.join("")}function Hu(v){let _=To(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function qu(v,_){let k=To(v);if(!k)return[];let E=[];for(let[T,j]of k){let B=j.instances-(_.get(T)??0);if(B>0)E.push({body:j.body,count:B})}return E}function Ku(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Ha(v,k)}import od from"fs";var Xu=0,qa=new Map;function Jo(){Xu=0,qa.clear()}function Io(v,_){let k=Xu++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return qa.set(E,{type:v,expression:_}),E}function Yo(){let v={};for(let[_,k]of qa)v[_]={type:k.type,expression:k.expression};return v}function Zo(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function rs(v){return v.includes("<!--__STX_")}var jh=/@(?=[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 Lh(v){return Array.from({length:v},()=>"{").join("⁠")}function Zu(v){return v.replace(/\{{2,}/g,(_)=>Lh(_.length)).replace(/\{(?=!)/g,"{⁠").replace(jh,"@")}function Gu(v,_,k=!1){let E=v.slice(0,_),T=E.lastIndexOf("<"),j=E.lastIndexOf(">");if(T>=0&&j>T)return null;if(T<0&&!k)return null;let B=T>=0?E.slice(T+1):E;if(T>=0&&/^\s*[!/?]/.test(B))return/^\s*\/?\s*$/.test(B)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(B))return{kind:"tag-name"};let z=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(B);if(z)return{kind:"attribute",name:z[1],quote:'"',valuePrefix:z[2]};let W=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(B);if(W)return{kind:"attribute",name:W[1],quote:"'",valuePrefix:W[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(B);if(F)return{kind:"attribute",name:F[1],quote:null,valuePrefix:F[2]};return T>=0||/^\s*[^<>]*$/.test(B)?{kind:"tag"}:null}class ir extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var Ju="unsafe:";var Bh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,zh=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Wh=/^data:(?:text\/html|application\/xhtml\+xml)/,Fh=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Vh(v){return v.replace(Fh,"").toLowerCase()}function Ka(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function Po(v,_="navigable"){let k=Vh(v);if(Bh.test(k))return!0;return _==="navigable"?zh.test(k):Wh.test(k)}function ki(v,_="navigable"){return Po(v,_)?"unsafe:"+v:v}function Uh(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return Ka(_[1])}function Yu(v,_,k=256){if(_<=k)return v.slice(0,_);let E=v.slice(_-k,_),T=E.search(/[\s"'`/]/);return T===-1?"":E.slice(T)}function Qu(v,_,k=_){let E=Uh(v);return E&&Po(_,E)?"unsafe:"+k:k}var Do=/<script\b[^>]*>/iy,Ja=/<\/script\s*>/ig,Mo=/<style\b[^>]*>/iy,Ya=/<\/style\s*>/ig;function ed(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function H(v,_){return ed(v,_,Do,Ja)}function Xr(v,_){return ed(v,_,Mo,Ya)}function ze(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function td(v,_){if(v.startsWith("<!--",_)){let T=ze(v,_);return T===-1?v.length:T}if(Do.lastIndex=_,Do.exec(v)?.index===_){Ja.lastIndex=Do.lastIndex;let T=Ja.exec(v);return T?T.index+T[0].length:v.length}if(Mo.lastIndex=_,Mo.exec(v)?.index===_){Ya.lastIndex=Mo.lastIndex;let T=Ya.exec(v);return T?T.index+T[0].length:v.length}return-1}function Q(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let U=v.indexOf("<",E+1);if(U===-1)break;E=U;continue}let W=_(v,E);if(W>E){k.push({start:E,end:W,token:v.slice(E,W)}),E=W;continue}let F=td(v,E);if(F>E){E=F;continue}let V=v.charCodeAt(E+1);if(V>=65&&V<=90||V>=97&&V<=122)j=!0;E++}return k}function nd(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let U=v[E];if(j){if(U===j)j=null}else if(U==='"'||U==="'")j=U;else if(U===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let U=v[E++];if(U==="{")_++;else if(U==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let W=td(v,B);if(W>B){E=W;continue}let F=v.charCodeAt(B+1),V=F===47?v.charCodeAt(B+2):F;if(V>=65&&V<=90||V>=97&&V<=122)T=!0;E=B+1}return!1}function rd(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var Hh=1024,qh=16777216,qr=new Map,Xa=0;function Kh(v,_){qr.set(v,_),Xa+=v.length+_.output.length;for(let[k,E]of qr){if(Xa<=qh)break;qr.delete(k),Xa-=k.length+E.output.length}}function Dn(v,_,k,E){let T=E!==void 0&&v.length>=Hh,j=T?`${E}\x00${v}`:"";if(T){let V=qr.get(j);if(V)return qr.delete(j),qr.set(j,V),{output:V.output,tokens:V.tokens.slice()}}let B=Q(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((V)=>V.token),W="",F=0;for(let V=0;V<B.length;V++){let U=B[V];W+=v.slice(F,U.start),W+=k(U.token,V),F=U.end}if(W+=v.slice(F),T)return Kh(j,{output:W,tokens:z}),{output:W,tokens:z.slice()};return{output:W,tokens:z}}var Xh=1024,Zh=16777216,Kr=new Map,Za=0;function Gh(v,_){Kr.set(v,_),Za+=v.length+_.output.length;for(let[k,E]of Kr){if(Za<=Zh)break;Kr.delete(k),Za-=k.length+E.output.length}}function Ga(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Zr(E,k)}}function $n(v){let _=v.length>=Xh;if(_){let T=Kr.get(v);if(T)return Kr.delete(v),Kr.set(v,T),Ga(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=Dn(v,H,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return Gh(v,{output:k,scripts:E}),Ga(v,k,E.slice());return Ga(v,k,E)}function Zr(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function Ct(v){let _=v.indexOf(" as ");if(_!==-1){let j=v.slice(0,_).trim(),B=v.slice(_+4).trim();return j&&B?{arrayExpr:j,itemVar:B}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return E&&T?{arrayExpr:T,itemVar:E}:null}function Oo(v){let _=[],k=0,E="",T=0;for(let j=0;j<v.length;j++){let B=v[j];if(E){if(B==="\\")j++;else if(B===E)E="";continue}if(B==="'"||B==='"'||B==="`")E=B;else if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(T,j)),T=j+1}return _.push(v.slice(T)),_}function sd(v,_){let k=0;for(let E=0;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return E}return-1}function id(v){let _=0;for(let k=0;k<v.length;k++){let E=v[k];if(E==="("||E==="["||E==="{")_++;else if((E===")"||E==="]"||E==="}")&&--_===0)return k}return-1}function Rr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=sd(k,"=");if(E!==-1&&k[E+1]!==">")k=k.slice(0,E).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of Oo(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Rr(j,_);continue}let B=sd(j,":");Rr(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Oo(k.slice(1,-1)))Rr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Gr(v){let _=v.trim(),k=[],E=0;for(let j=0;j<_.length;j++){let B=_[j];if(B==="("||B==="["||B==="{")E++;else if(B===")"||B==="]"||B==="}")E--;else if(E===0&&/\s/.test(B)){if(!/^\s+(?:in|of)\s/.exec(_.slice(j)))continue;let W=_.slice(0,j).trim();if(W.startsWith("(")&&id(W)===W.length-1)W=W.slice(1,-1);for(let F of Oo(W))Rr(F,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let j=T[1].trim();if(j.startsWith("(")&&id(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Rr(B[2],k),Rr(B[1],k);else for(let z of Oo(j))Rr(z,k)}return k}function Ar(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let B=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let z of B.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(z))return!0;return!1}var No="__stx_client_loop_names";function mr(v){let _=v?.[No];return Array.isArray(_)?_:[]}var Ri={},ad=new Map;function Jh(v){let _=ad.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),ad.set(v,_)}return _.lastIndex=0,_}var Hn={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let E=Number(v);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let E=Number(v);if(Number.isNaN(E))return String(v);return E.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return _t(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let E=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,j=String(v).split("."),B=E;for(let W of j){if(B===void 0||B===null)break;B=B[W]}if(B===void 0||B===null)return T?v:"";let z=String(B);return Object.entries(k).forEach(([W,F])=>{z=z.replace(Jh(W),String(F))}),z},t:(v,_,k={})=>Hn.translate(v,_,k),truncate:(v,_,k=50,E="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=E.length)return E.substring(0,k);return T.substring(0,k-E.length)+E},date:(v,_,k="short",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let 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 T.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,E)=>{let T=Number(v);if(Number.isNaN(T))return k;let j=E||`${k}s`;return T===1?k:j},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,E)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,E);return v},replace:(v,_,k,E="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>E)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let E=Number(v);if(Number.isNaN(E))return 0;let T=10**k;return Math.round(E*T)/T}};function ic(v,_){if(v in Hn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Ri[v]=_}function Nd(v){for(let[_,k]of Object.entries(v))ic(_,k)}function ac(){return{...Hn,...Ri}}function Ld(){for(let v of Object.keys(Ri))delete Ri[v]}function cc(v,_,k=2){let E=0,T=null;for(let j=_+k;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="{"){E++;continue}if(B==="}"){if(E>0){E--;continue}let z=0;while(v[j+z]==="}")z++;if(z>=k)return j}}return-1}function Un(v,_,k=2){let E="{".repeat(k);if(!v.includes(E))return v;let T="",j=0;for(;;){let B=v.indexOf(E,j);if(B===-1)break;let z=cc(v,B,k);if(z===-1)break;T+=v.slice(j,B)+_(v.slice(B,z+k),v.slice(B+k,z),B),j=z+k}return j===0?v:T+v.slice(j)}function b(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function _t(v){return Zu(b(v))}function Yh(v){return v.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function Qh(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ey(v,_){let k=Qh(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new ir(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let E=/url\(([^)]*)\)/g,T;while((T=E.exec(k))!==null){let j=T[1].replace(/^["']|["']$/g,""),B=j.startsWith("/")&&!j.startsWith("//")||j.startsWith("./")||j.startsWith("../")||j.startsWith("#"),z=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(j);if(!B&&!z)throw new ir(_,"CSS URLs must be local paths or base64 raster images")}}function fd(v,_,k,E=!1,T=0){let j=Gu(v,_,E),B=_t(k);if(!j)return B;if(j.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new ir("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(j.kind==="tag"){let F=v.slice(_+T).trimStart(),V=k.trim();if(!F.startsWith("=")&&(V===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(V)))return V;throw new ir("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let z=j.name.toLowerCase();if(/^on[a-z]/.test(z))throw new ir(j.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(z==="srcdoc")B=_t(B);if(z==="style")ey(k,j.name);if(j.quote===null)B=Yh(B);let W=Ka(z);if(W&&j.valuePrefix.trim()===""&&Po(k,W))return Ju+B;return Qu(Yu(v,_),k,B)}function we(v,_){let{scripts:k}=$n(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(kn(j,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function lc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(v);E;E=k.exec(v)){let T=E[1].toLowerCase(),j=new Set(Gr(E[3]));if(j.size===0)continue;let B=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:B,names:j});continue}let z=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let W=1,F=v.length;for(let V=z.exec(v);V;V=z.exec(v)){if(V[2]==="/")continue;if(W+=V[1]==="/"?-1:1,W===0){F=V.index+V[0].length;break}}_.push({start:E.index,end:F,names:j})}return _}function ty(v,_,k){let E=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let j of T.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function cd(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=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let F=0;F<E.length;F++){let V=E[F];if(!j&&V==="`"){j=!0,B=0;continue}if(j){if(V==="`"&&B===0){j=!1;continue}if(V==="$"&&E[F+1]==="{"){B++,F++,T+=" ";continue}if(V==="}"&&B>0){B--;continue}if(B>0){T+=V;continue}continue}T+=V}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=z.exec(E))!==null){let F=W[1];if(!E.substring(0,W.index).trimEnd().endsWith(".")){if(!k.includes(F)&&!(F in _))return!1}}return!0}function ny(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(E))return!0;return!1}var ld=new Set;function ud(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function dd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!ld.has(k))ld.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function ss(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return ud(j)?dd(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Un(E,(T,j,B)=>{let z=j.trim();if(/^__[A-Z_]+__$/.test(z))return T;try{let W=x(j,_);if(W===void 0)return ud(z)?dd(z,k):T;return JSON.stringify(W).replace(/</g,"\\u003c")}catch{return T}}),E}function dc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,T)=>{try{let j=x(T,_);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Un(k,(E,T,j)=>{let B=T.trim();if(/^__[A-Z_]+__$/.test(B))return E;try{let z=x(T,_);if(z===void 0)return E;if(z===null)return"";let W=String(z);return fd(k,j,W,!0,E.length)}catch(z){if(z instanceof ir)throw z;return E}}),k}function jd(v,_,k={}){let{output:E,scripts:T}=$n(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=B.match(/^<script\b[^>]*>/i),F=B.search(/<\/script\s*>$/i);if(!z||!W||F===-1)return B;let V=z[1],U=z[2];if(/\bdata-raw\b/.test(V))return B;if(k.skipServer&&/\bserver\b/.test(V))return B;let Z=`<script${dc(V,_)}>`;if(/\bsrc\s*=/.test(V)||/\btype\s*=\s*["']application\/json["']/.test(V))return Z+U+B.slice(F);return Z+ss(U,_)+B.slice(F)});return Zr(E,j)}function K(v,_,k){let E=v,T=(Z,se)=>{let ie=Xr(Z,se);if(ie===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(se,ie))?-1:ie},j=(Z,se,ie,oe)=>{let ae=ie.length,{output:le,tokens:ce}=Dn(Z,se,(fe,ye)=>oe(ae+ye));return ie.push(...ce),le},B=[];E=j(E,T,B,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let z=[];E=j(E,H,z,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let W=_?.__stx_signals_gate===!0||we(v),F=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),V=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Un(E,(Z,se,ie)=>{try{let oe=x(se,_,!1,(ae)=>Qa(ae,Z,k,v));return oe!==void 0&&oe!==null?String(oe):""}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);return g("Expression",`Error evaluating: {{{ ${se.trim()}}}}: ${ae}`,k,v,ie,Z)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(Z,se,ie)=>{try{let oe=x(se,_,!1,(ae)=>Qa(ae,Z,k,v));if(oe===void 0&&_.__stx_buildMode==="compile")return Io("raw",se.trim());return oe!==void 0&&oe!==null?String(oe):""}catch(oe){if(_.__stx_buildMode==="compile")return Io("raw",se.trim());let ae=oe instanceof Error?oe.message:String(oe);return g("Expression",`Error evaluating: {!! ${se.trim()} !!}: ${ae}`,k,v,ie,Z)}}),E=j(E,H,z,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),E=j(E,T,B,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let U=W?lc(E):[],Y=new Set(mr(_));if(E=Un(E,(Z,se,ie)=>{let oe=se.trim();if(Ar(oe,Y))return Z;if(U.length>0&&ty(U,ie,oe))return Z;if(V.has(oe))return Z;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,fe=oe.match(le)?.[1],ye=fe&&((fe in _)||ae.includes(fe)),Se=Boolean(fe&&F.has(fe)),$e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=oe.match($e),Ae=Re&&!ae.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(oe))return"";let Te;try{let Ie=x(se,_,!1,(De)=>{Te=De});if(Se)return Z;if(W&&!cd(oe,_))return Z;if(Te)Qa(Te,Z,k,v);if(_.__stx_buildMode==="compile"&&!W&&(Ie===void 0||ny(oe,_)))return Io("expr",oe);if(Ie===void 0||Ie===null)return"";let _e=String(Ie);return fd(E,ie,_e,!1,Z.length)}catch(Ie){if(Ie instanceof ir)throw Ie;if(Se)return Z;if(W&&!cd(oe,_))return Z;if(Ae)return Z;let _e=Ie instanceof Error?Ie.message:String(Ie);return g("Expression",`Error evaluating: {{ ${oe} }}: ${_e}`,k,v,ie,Z)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,se)=>z[Number(se)]??Z);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,se)=>B[Number(se)]??Z);return E}function uc(v,_,k){if(!_.trim())return v;let E=v,T=_.trim();while(T.length>0){let j=T.match(/^(\w+)/);if(!j)break;let B=j[1];T=T.substring(B.length).trim();let z=Ri[B]||Hn[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(ac()).join(", ")}`);let W=[];if(T.startsWith(":")){let F=T.match(/^:([^|\s]+)/);if(F){let V=F[1].trim();try{let U=Number(V);W=[Number.isNaN(U)?V:U]}catch{W=[V]}T=T.substring(F[0].length).trim()}}else if(T.startsWith("(")){let F=1,V=1;while(F>0&&V<T.length){if(T[V]==="(")F++;if(T[V]===")")F--;V++}if(F===0){let U=T.substring(1,V-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[x(`(${U})`,k,!0)];else{let Y=[],Z="",se=null,ie=0,oe=0,ae=0,le=!1;for(let ce=0;ce<U.length;ce++){let fe=U[ce];if(le){Z+=fe,le=!1;continue}if(fe==="\\"){Z+=fe,le=!0;continue}if(se){if(Z+=fe,fe===se)se=null;continue}if(fe==='"'||fe==="'"||fe==="`"){se=fe,Z+=fe;continue}if(fe==="(")ie++;else if(fe===")")ie--;else if(fe==="[")oe++;else if(fe==="]")oe--;else if(fe==="{")ae++;else if(fe==="}")ae--;if(fe===","&&ie===0&&oe===0&&ae===0){Y.push(Z),Z="";continue}Z+=fe}if(Z)Y.push(Z);W=Y.map((ce)=>{let fe=ce.trim();return x(fe,k,!0)})}}catch{W=[U]}T=T.substring(V).trim()}}try{E=z(E,k,...W)}catch(F){let V=F instanceof Error?F.message:String(F);throw Error(`Error applying filter '${B}': ${V}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function ry(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let W=v[z],F=v[z+1];if(_&&B){B=!1;continue}if(_&&W==="\\"){B=!0;continue}if(B=!1,(W==='"'||W==="'"||W==="`")&&!B){if(!_)_=!0,k=W;else if(W===k)_=!1,k="";continue}if(_&&k==="`"&&W==="$"&&F==="{"){let V=1;z+=2;while(z<v.length&&V>0){if(v[z]==="{")V++;else if(v[z]==="}")V--;if(V>0)z++}continue}if(_)continue;if(W==="(")E++;else if(W===")")E--;else if(W==="[")T++;else if(W==="]")T--;else if(W==="{")j++;else if(W==="}")j--;if(W==="|"&&E===0&&T===0&&j===0){if(F==="|"){z++;continue}if(F==="="){z++;continue}return z}}return-1}var Ei=new Set,sy=1000;function Bd(){Ei.clear()}function Qa(v,_,k,E){if(!D())return;let T=`${k}\x00${v.expression}`;if(Ei.has(T))return;if(Ei.size>=sy)Ei.clear();Ei.add(T);let j=k,B=E;try{if(k&&od.existsSync(k))B=od.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
|
|
124
|
-
`).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=ry(T);if(j>0){let z=T.substring(0,j).trim(),W=T.substring(j+1).trim(),F=x(z,_,!0,E);return uc(F,W,_)}let B=xn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),W=Object.values(_);return c(T,z)(...W)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=iy(B,Object.keys(_));if(z&&z!==B)T.message=`${T.message} \u2014 did you mean '${z}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function iy(v,_){let k=null;for(let T of _){if(T===v)continue;let j=oy(v,T);if(k===null||j<k.dist)k={key:T,dist:j}}if(!k)return null;let E=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/E<=0.35)return k.key;return null}function oy(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,E]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),j=Array(k.length+1);for(let B=0;B<=k.length;B++)T[B]=B;for(let B=1;B<=E.length;B++){j[0]=B;for(let z=1;z<=k.length;z++){let W=k[z-1]===E[B-1]?0:1;j[z]=Math.min(j[z-1]+1,T[z]+1,T[z-1]+W)}for(let z=0;z<=k.length;z++)T[z]=j[z]}return T[k.length]}function Fd(v){if(!v)return"";return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import md from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let E=this.cache.keys().next().value;if(E===void 0)break;this.delete(E)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var Jr=new Map,ay=500;function Tr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Jr.has(k)){if(Jr.size>=ay){let E=Jr.keys().next().value;if(E)Jr.delete(E)}Jr.set(k,new RegExp(v,_))}return Jr.get(k)}class pd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),E=this.pool.find((z)=>z.context.join(",")===k);if(E)return E.func;let T=this.fnCache,j=this.fnCacheMaxSize,B=(...z)=>(W)=>{try{let F=`${k}:${W}`,V=T.get(F);if(!V){if(T.size>=j){let U=T.keys().next().value;if(U)T.delete(U)}V=Function(..._,`
|
|
125
|
-
'use strict';
|
|
126
|
-
try {
|
|
127
|
-
return ${W};
|
|
128
|
-
}
|
|
129
|
-
catch (e) {
|
|
130
|
-
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
throw e;
|
|
134
|
-
}
|
|
135
|
-
`),T.set(F,V)}return V(...z)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:B,context:_.slice()});return B}clear(){this.pool.length=0,this.fnCache.clear()}}var f$=new pd;class gd{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),E=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),E=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let E=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,j=_>=k.maxTime;if(!T&&!j)return;let B={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:E,timestamp:new Date,isWarning:T};this.violations.push(B);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(B)}catch{}let z=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${E.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(E-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(z);break;case"warn":console.warn(z);break;case"error":console.error(z);break;case"throw":if(j)throw Error(z);else console.warn(z);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let E=this.budgets.get(v);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 _={};for(let[k,E]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:E.count,avgTime:E.totalTime/E.count,totalTime:E.totalTime,maxTime:E.maxTime,minTime:E.minTime,budget:T?.maxTime,budgetUtilization:T?E.totalTime/E.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let E of this.violations)if(v[E.label]=(v[E.label]||0)+1,E.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ec=null;function cy(){if(!ec)ec=new gd;return ec}var q=new Proxy({},{get(v,_){return cy()[_]}});var hd=[];function m(v){let _=new M(v);return hd.push(_),_}function yd(){for(let v of hd)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function xd(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:md.statSync(k).mtimeMs})}catch{}return _}function sn(v){for(let _ of v)try{if(md.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import AS from"fs";import en from"path";import Wi from"fs";import Ot from"path";import{hasLocalConfig as df}from"bunfig";import Mn from"fs";import Ir from"path";import tc from"fs";import bd from"path";import{fileURLToPath as ly}from"url";var nc;function Be(){if(nc)return nc;let v="unknown";try{v=String(JSON.parse(tc.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=bd.dirname(ly(import.meta.url)),k=0;for(let E of tc.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,tc.statSync(bd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return nc=v,v}var pc=new Map,Pr=new Map;async function zd(v){let k;for(let E=0;E<3;E++)try{let j=(await Mn.promises.stat(v)).mtime.getTime(),B=Pr.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),F=(await Mn.promises.stat(v)).mtime.getTime();if(F!==j)continue;return Pr.set(v,{content:z,mtime:F}),z}catch(T){k=T;break}throw Pr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function Hd(v){Pr.delete(v)}function Ud(v){for(let _ of Pr.keys())if(_.startsWith(v))Pr.delete(_)}var Lo=null,uy=null,wd=null;function Vd(v){wd=v}async function fc(v=!1){let _=wd??await import("./chunk-ajezxt0s.js");if(v)return _.generateSignalsRuntimeDev();if(Lo===null)Lo=_.generateSignalsRuntime();return Lo}var Bo=null;async function gc(){if(Bo===null){let{getRouterScript:v}=await import("./chunk-v9mkambt.js");Bo=v()}return Bo}var vd={};async function Wd(v,_=!1){let k=v==="runtime"?await fc(_):await gc(),E=v==="runtime"&&_?"runtime-debug":v,T=vd[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},vd[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var dy=500,fy=33554432,or=new Map,jo=0;function Sd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function qd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=or.get(_),E=k!==void 0;if(E)or.delete(_),jo-=k.length*2;or.set(_,v),jo+=v.length*2;while(or.size>1&&(or.size>dy||jo>fy)){let T=or.keys().next().value;jo-=or.get(T).length*2,or.delete(T)}if(!E)try{let T=Sd(_);if(!Mn.existsSync(T))Mn.mkdirSync(Ir.dirname(T),{recursive:!0}),Mn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function Qo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=or.get(v);if(_!==void 0)return _;try{return Mn.readFileSync(Sd(v),"utf8")}catch{return}}function Gd(){Pr.clear(),ne(),yd(),Lo=null,uy=null,Bo=null}function $d(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function on(v,_){try{if(!_.cachePath)return null;let k=Ir.resolve(_.cachePath),E=Ir.join(k,`${Vn(v)}.html`),T=Ir.join(k,`${Vn(v)}.meta.json`);if(!await r(E)||!await r(T))return null;let j=await Bun.file(T).text(),B=JSON.parse(j);if(B.cacheVersion!==_.cacheVersion)return null;if(B.engine!==Be())return null;if(B.optionsSignature!==$d(_))return null;if((await Mn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let W of B.dependencies)if(await r(W)){if((await Mn.promises.stat(W)).mtime.getTime()>B.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function an(v,_,k,E){try{if(!E.cachePath)return;let T=Ir.resolve(E.cachePath);await Mn.promises.mkdir(T,{recursive:!0});let j=Ir.join(T,`${Vn(v)}.html`),B=Ir.join(T,`${Vn(v)}.meta.json`),z=await Mn.promises.stat(v);await Bun.write(j,_);let W={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Be(),optionsSignature:$d(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(W,null,2)),pc.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var py=16;function Vn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,py)}var Wn={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 rc(v){return`--stx-${v}`}function sc(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let E=v[_.slice(0,k)];if(!E||typeof E!=="object")return;let T=E[_.slice(k+1)];return typeof T==="string"?T:void 0}function _d(v){let _={};for(let[k,E]of Object.entries(Wn)){let T=sc(v,E.light);if(T===void 0)continue;_[k]=`var(${rc(k)}, ${T})`}return _}function kd(v){let _=[],k=[];for(let[E,T]of Object.entries(Wn)){let j=sc(v,T.light),B=sc(v,T.dark);if(j===void 0)continue;if(_.push(` ${rc(E)}: ${j};`),B!==void 0)k.push(` ${rc(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
|
|
136
|
-
`)}var Ed={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 Cd(v){return`--stx-radius-${v}`}function Rd(){let v={};for(let[_,k]of Object.entries(Ed))v[_]=`var(${Cd(_)}, ${k.value})`;return v}function Ad(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Ed).map(([v,_])=>` ${Cd(v)}: ${_.value};`),"}",""].join(`
|
|
137
|
-
`)}var Td={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},gy={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},my={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Id(v){return`--stx-${v}`}function Wc(v){let _=Td[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${Id(v)}, ${_.value})`}function Pd(){let v={};for(let[_,k]of Object.entries(gy))v[_]=Wc(k);return v}function Dd(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(my))v[_]=[Wc(k),{lineHeight:Wc(E)}];return v}function Od(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Td).map(([v,_])=>` ${Id(v)}: ${_.value};`),"}",""].join(`
|
|
138
|
-
`)}function ef(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function Vc(v,_){let k={...v};for(let[E,T]of Object.entries(_))k[E]=ef(T)&&ef(k[E])?Vc(k[E],T):T;return k}function tf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
|
|
139
|
-
`:k}function nf(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,W=z.colors||{};z.colors={...W,..._d(W)};let F=z.borderRadius||{};z.borderRadius={...F,...Rd()};let V=z.spacing||{};z.spacing={...V,...Pd()};let U=z.fontSize||{};z.fontSize={...U,...Dd()};let Y=Vc(z,j),Z=Vc(B||{},T||{});if(Object.keys(Z).length>0)Y.extend=Z;let se=[...v.safelist||[],..._.safelist||[]],ie={...v.shortcuts||{},..._.shortcuts||{}},oe=[...v.preflights||[],..._.preflights||[]],{fonts:ae,...le}=v,{fonts:ce,...fe}=_,ye=ce??ae;return{config:{...le,...fe,theme:Y,safelist:se,shortcuts:ie,...oe.length>0?{preflights:oe}:{},content:[],output:""},safelist:se,shortcuts:ie,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:kd(W)+Ad()+Od(),...ye?{fonts:ye}:{}}}function rf(v,_=""){let k=`${v}${_}`,E=0;for(let T=0;T<k.length;T++){let j=k.charCodeAt(T);E=(E<<5)-E+j,E=E&E}return`stx-${Math.abs(E).toString(36)}`}function sf(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=Uc(v),W=[],F=new Map;if(j)for(let V of z){let U=V.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let Y=U[1],Z=`${_}_${Y}`;F.set(Y,Z)}}for(let V of z){let U=of(V,_,E,T,F,B);W.push(U)}return W.join(`
|
|
140
|
-
|
|
141
|
-
`)}function Uc(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),E=0,T="",j=!1,B="";for(let z=0;z<k.length;z++){let W=k[z];if(W==="@"&&E===0)j=!0;if(W==="{")E++;else if(W==="}"){if(E--,E===0){if(j){B+=W;let F=B.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(F){let[,V,U,Y]=F;if(V==="keyframes")_.push({selector:`@keyframes ${U.trim()}`,declarations:Y.trim()});else if(V==="media"||V==="supports"||V==="container"){let Z=Uc(Y);_.push({selector:`@${V} ${U.trim()}`,declarations:Z.map((se)=>`${se.selector} { ${se.declarations} }`).join(`
|
|
142
|
-
`)})}else _.push({selector:`@${V} ${U.trim()}`,declarations:Y.trim()})}B="",j=!1}else if(T.trim()){T+=W;let F=T.match(/([^{]+)\{([^}]*)\}/);if(F)_.push({selector:F[1].trim(),declarations:F[2].trim()});T=""}continue}}if(j)B+=W;else T+=W}return _}function of(v,_,k,E,T,j){let{selector:B,declarations:z}=v;if(B.startsWith("@")){if(B.startsWith("@keyframes")){let V=B.replace("@keyframes ","").trim();return`@keyframes ${T.get(V)||V} { ${z} }`}if(B.startsWith("@media")||B.startsWith("@supports")||B.startsWith("@container")){let U=Uc(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((Y)=>of(Y,_,k,E,T,j)).join(`
|
|
143
|
-
`);return`${B} {
|
|
144
|
-
${U}
|
|
145
|
-
}`}return`${B} { ${z} }`}let W=hy(B,_,k,E),F=z;for(let[V,U]of T)F=F.replace(new RegExp(`\\b${V}\\b`,"g"),U);if(j)F=F.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${W} { ${F} }`}function hy(v,_,k,E){let T=v.split(",").map((B)=>B.trim()),j=[];for(let B of T){if(B.startsWith(":host")){if(E)j.push(B);else{let F=B.replace(/:host(\([^)]*\))?/,`.${_}$1`);j.push(F)}continue}if(B.includes("::slotted")){j.push(B);continue}if(B===":root"){j.push(`:root .${_}`);continue}let z=k?`${k} .${_}`:`.${_}`;j.push(`${z} ${B}`);let W=yy(B,_);if(W)j.push(k?`${k} ${W}`:W)}return j.join(", ")}function yy(v,_){let k=0,E=v.length;for(let W=0;W<v.length;W++){let F=v[W];if(F==="["||F==="(")k++;else if(F==="]"||F===")")k--;else if(k===0&&(F===" "||F===">"||F==="+"||F==="~")){E=W;break}}let T=v.slice(0,E),j=v.slice(E);if(!T)return"";let B=T.length,z=0;for(let W=0;W<T.length;W++){let F=T[W];if(F==="["||F==="(")z++;else if(F==="]"||F===")")z--;else if(k===0&&z===0&&F===":"){B=W;break}}return`${T.slice(0,B)}.${_}${T.slice(B)}${j}`}var lf=String.raw`(?<![\w-])scoped(?![\w-])`,qc=/<style\s+([^>]*)>/gi,af=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,uf=new RegExp(lf,"i"),xy=new RegExp(lf,"gi"),Kc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function by(v){qc.lastIndex=0;let _=qc.exec(v);while(_!==null){if(uf.test(_[1]))return!0;_=qc.exec(v)}return!1}function Xc(v){let _=new Set,k=[];Kc.lastIndex=0;let E=Kc.exec(v);while(E!==null){let T=E[0].trim();if(_.has(T))k.push({start:E.index,end:E.index+E[0].length});else _.add(T);E=Kc.exec(v)}return k}function Ti(v){let _=Xc(v);if(_.length===0)return v;let k=Array(_.length+1),E=0;for(let T=0;T<_.length;T++){let j=_[T];k[T]=v.slice(E,j.start),E=j.end}return k[_.length]=v.slice(E),k.join("")}function zo(v,_){if(!by(v))return{html:v,hasScoped:!1};let k=rf(_),E=`data-v-${k}`,T=v,j=!1;if(af.lastIndex=0,T=T.replace(af,(B,z,W)=>{if(!uf.test(z))return B;j=!0;let F=vy(W,E),V=z.replace(xy,"").trim(),U=V?` ${V}`:"";return`<style data-stx-scoped="${k}"${U}>${F}</style>`}),!j)return{html:v,hasScoped:!1};return T=Sy(T,E),{html:T,hasScoped:!0}}function vy(v,_){return sf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var wy=(v)=>`\x00stx-scope-mask-${v}\x00`,cf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Sy(v,_){let k=Dn(v,(T,j)=>{let B=H(T,j);return B>j?B:Xr(T,j)},(T,j)=>wy(j)),E=$y(k.output,_);return cf.lastIndex=0,E.replace(cf,(T,j)=>k.tokens[Number(j)])}function $y(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(E,T,j)=>{if(k.has(T.toLowerCase()))return E;if(E.includes(_))return E;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return E;if(j)return E.replace(`<${T}${j}`,`<${T} ${_}${j}`);if(E.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var On=null,Wo="";function ff(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;Wo=`${_}@${Math.trunc(Wi.statSync(_).mtimeMs)}`}catch{Wo=v}}var Gc=!1,Dr=null,Ni="",Yr=!1,mf=256,xr=new Map,Nn=new Map,Fo=null,hf=null,Vo=new Map;function Uo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Zc(v,_){if(xr.has(v))xr.delete(v);else if(xr.size>=mf)xr.delete(xr.keys().next().value);xr.set(v,_)}function _y(v){let _=Uo(v);if(Nn.has(_))Nn.delete(_);else if(Nn.size>=mf)Nn.delete(Nn.keys().next().value);return Nn.set(_,v),_}function Kd(v){let _=Nn.get(v);if(_===void 0)return;return Nn.delete(v),Nn.set(v,_),_}async function ky(v,_=Fo){if(!_)return null;try{let k=Bun.file(Ot.join(_,`cw-${Uo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Ey(v,_,k=Fo){if(!k)return;try{if(!Wi.existsSync(k))Wi.mkdirSync(k,{recursive:!0});await Bun.write(Ot.join(k,`cw-${Uo(v)}.css`),_)}catch{}}async function pf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Cy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ry=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ay(){let v=[],_=process.cwd();while(_!==Ot.dirname(_)){for(let k of["node_modules","pantry"])for(let E of Cy)v.push(Ot.join(_,k,...E));_=Ot.dirname(_)}return v}function Ty(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ot.join(_,"Code","Tools","ts-css"),_&&Ot.join(_,"Code","Tools","crosswind"),_&&Ot.join(_,"repos","stacks-org","ts-css"),_&&Ot.join(_,"repos","stacks-org","crosswind"),Ot.join(process.cwd(),"..","ts-css"),Ot.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(Ot.join(E,"packages","toolkit","dist","engine","index.js")),v.push(Ot.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ot.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function ei(){if(Gc)return On;Gc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await pf(j);if(B){if(ff(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ot.dirname(Ot.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=Ot.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return On=j,On}let _=await v(Ay());if(_)return On=_,On;let k=Ry;for(let T of k){let j=await pf(T);if(j){On=j;try{ff(import.meta.resolve(T))}catch{Wo=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return On}}let E=await v(Ty());if(E)return On=E,On;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 Xd(){Jc.clear(),On=null,Gc=!1,Dr=null,Ni="",xr.clear(),Nn.clear(),hf=null,Vo.clear()}var gf=!1;async function ti(v){try{let _=df({name:"css",cwd:v})?"css":df({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!gf)gf=!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:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!E?.path||!E.config||Object.keys(E.config).length===0)return null;let T=Ot.relative(v,E.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||E.path}`);return E.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function mc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-ya39wk58.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=Ot.isAbsolute(E.css)?E.css:Ot.resolve(v,E.css);if(await Bun.file(T).exists()){let j=await import(T);_=j.default||j,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${E.css}`)}}else{if(_={...E.css,content:E.css.content||[],preflight:E.css.preflight??!0,minify:E.css.minify??!1},E.css.config){let T=Ot.isAbsolute(E.css.config)?E.css.config:Ot.resolve(v,E.css.config);if(await Bun.file(T).exists()){let j=await import(T);_={...j.default||j,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await ti(v)}function hc(v){try{let _=new WeakSet;return Uo(JSON.stringify(v??{},(k,E)=>{if(typeof E==="function")return`[fn]${String(E)}`;if(typeof E==="object"&&E!==null){if(_.has(E))return"[circular]";_.add(E)}return E})??"")}catch{return"unhashable"}}async function Et(v){if(Yr)return Ni;Yr=!0;try{let _=await ei();if(!_||!_.build)return Yr=!1,"";if(!Dr)Dr=await ti(v);if(!Dr)return Yr=!1,"";let k=_.defaultConfig?.theme||{},E=Dr.theme||{},T={..._.defaultConfig,...Dr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(Ni=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let W=Ot.isAbsolute(T.output)?T.output:Ot.join(v,T.output),F=Ot.dirname(W);if(!Wi.existsSync(F))Wi.mkdirSync(F,{recursive:!0});await Bun.write(W,B.css)}return Yr=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Yr=!1,Ni}}async function cn(v){Dr=null,await Et(v)}function Jd(){return Ni}function yc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,E=k.exec(v);while(E!==null){for(let B of E[1].split(/\s+/))if(B.trim())_.add(B.trim());E=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=T.exec(v);while(j!==null){let B=j[1].match(/'([^']+)'/g);if(B){for(let z of B)for(let W of z.slice(1,-1).split(/\s+/))if(W.trim())_.add(W.trim())}j=T.exec(v)}return _}var Jc=m(64);async function bc(v,_){let k=()=>Vo.get(_?Ot.resolve(_):process.cwd())?.fingerprint??null,E=Jc.get(h(v,_,k()));if(E!==void 0)return E;let T=await Iy(v,_);if(T)Jc.set(h(v,_,k()),T);return T}function*yf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=k[1];if(_.has(E))continue;_.add(E);let T=Qo(E);if(T)yield T}}function Yd(v){return[...yf(v)].join(`
|
|
146
|
-
`)}async function Iy(v,_){try{let k=await ei();if(!k)return"";let E=new Set;for(let Re of yf(v)){let Ae=typeof k.extractClasses==="function"?k.extractClasses(Re):yc(Re);for(let Te of Ae)E.add(Te)}if(E.size===0)return"";let T=_?Ot.resolve(_):process.cwd(),j=a(T,"cache");if(!Fo)Fo=j;let B=Vo.get(T);if(!B){let Re=await mc(T);B={config:Re,fingerprint:hc(Re)},Vo.set(T,B),hf=B.fingerprint}let z=[...E].sort().join(" "),W=`${Wo}::${B.fingerprint||"default"}::${z}`,F=xr.get(W);if(F!==void 0)return Zc(W,F),F;let V=await ky(W,j);if(V!==null)return Zc(W,V),V;let U=k.defaultConfig||k.config,Y=B.config||{},Z=nf(U,Y),{safelist:se,includePreflight:ie,minify:oe,tokenCSS:ae}=Z,le=Z.config,ce=new k.CSSGenerator(le),fe=le.shortcuts||Y.shortcuts||{},ye=Object.keys(fe).filter((Re)=>E.has(Re)||se.includes(Re));for(let Re of se)if(!fe[Re])ce.generate(Re);for(let Re of E)if(!fe[Re])ce.generate(Re);let Se="";if(ye.length>0){let Re=new k.CSSGenerator(le);for(let Ae of ye)Re.generate(Ae);if(Se=Re.toCSS(!1,oe),Se&&!Se.endsWith(`
|
|
147
|
-
`))Se+=`
|
|
148
|
-
`}let $e=Se+ce.toCSS(ie,oe);return $e=tf(k.CSSGenerator,Z)+ae+$e,Zc(W,$e),Ey(W,$e,j),$e}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,E=!1){let T=await bc(v,_);if(!T)return E?Ti(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${_y(T)}.css">`:`<style data-css="generated">
|
|
149
|
-
${T}
|
|
150
|
-
</style>`;if(E)return Py(v,j);let B=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(B.test(v)){let z=!1;return v.replace(B,()=>{if(z)return"";return z=!0,j})}if(v.includes("</head>"))return v.replace("</head>",`${j}
|
|
151
|
-
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
152
|
-
${j}`);return j+v}function Py(v,_){let k=Xc(v).map((W)=>({...W,replacement:""})),E=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=E.exec(v);if(T!==null){let W=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:W?_:""}),W=!1,T=E.exec(v)}else{let W=v.indexOf("</head>");if(W!==-1)k.push({start:W,end:W,replacement:`${_}
|
|
153
|
-
`});else{let F=v.match(/<body([^>]*)>/);if(F?.index!==void 0)k.push({start:F.index,end:F.index+F[0].length,replacement:`${F[0]}
|
|
154
|
-
${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((W,F)=>W.start-F.start||W.end-F.end);for(let W=1;W<k.length;W++)if(k[W].start<k[W-1].end)return Dy(Ti(v),_);let j=Array(k.length*2+1),B=0,z=0;for(let W of k)j[z++]=v.slice(B,W.start),j[z++]=W.replacement,B=W.end;return j[z]=v.slice(B),j.join("")}function Dy(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let E=!1;return v.replace(k,()=>{if(E)return"";return E=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
|
|
155
|
-
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
156
|
-
${_}`);return _+v}var Yc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],xf=/<body\b([^>]*)>/gi;function jn(v){let _=0,k,E=Yc.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)xf.lastIndex=_,k=xf.exec(v);if(!k)return null;let T=k.index,j=-1,B=null;for(let W=0;W<Yc.length;W++){let F=Yc[W],V=E[W];if(V===void 0||V!==null&&V.index<_)F.open.lastIndex=_,V=F.open.exec(v),E[W]=V;if(!V)continue;if(V.index<T&&(j===-1||V.index<j))j=V.index,B=F.close}if(j===-1||!B)return{index:T,tag:k[0],attrs:k[1]??""};B.lastIndex=j;let z=B.exec(v);if(!z)return null;_=z.index+z[0].length}return null}function fs(v,_){let k=jn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var bf=/<style\b[^>]*>/iy,vf=/<\/style>/gi,wf=/<script\b[^>]*>/iy,Sf=/<template(?=[\s>/])[^>]*>/iy,$f=/<\/template\s*>/iy;function Vi(v){let _=0,k=0,E=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let W=v.indexOf("-->",T+4);_=W===-1?v.length:W+3;continue}bf.lastIndex=T;let j=bf.exec(v);if(j){vf.lastIndex=T+j[0].length;let W=vf.exec(v);_=W===null?v.length:W.index+8;continue}Sf.lastIndex=T;let B=Sf.exec(v);if(B){if(k===0)E=T;k++,_=T+B[0].length;continue}$f.lastIndex=T;let z=$f.exec(v);if(z){if(k>0)k--;_=T+z[0].length;continue}if(wf.lastIndex=T,wf.test(v))return k>0?E:T;_=T+1}return-1}function _f(){return`
|
|
157
|
-
// STX Lifecycle Runtime
|
|
158
|
-
(function() {
|
|
159
|
-
if (typeof window === 'undefined') return;
|
|
160
|
-
|
|
161
|
-
const instances = new Map();
|
|
162
|
-
let currentInstance = null;
|
|
163
|
-
let idCounter = 0;
|
|
164
|
-
|
|
165
|
-
function generateId() {
|
|
166
|
-
return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function createInstance(element) {
|
|
170
|
-
const instance = {
|
|
171
|
-
id: generateId(),
|
|
172
|
-
element: element,
|
|
173
|
-
mountHooks: [],
|
|
174
|
-
destroyHooks: [],
|
|
175
|
-
updateHooks: [],
|
|
176
|
-
refs: new Map(),
|
|
177
|
-
watchers: [],
|
|
178
|
-
isMounted: false
|
|
179
|
-
};
|
|
180
|
-
instances.set(instance.id, instance);
|
|
181
|
-
return instance;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
window.STX = window.STX || {};
|
|
185
|
-
|
|
186
|
-
// Lifecycle hooks
|
|
187
|
-
window.STX.onMount = function(hook) {
|
|
188
|
-
if (currentInstance) currentInstance.mountHooks.push(hook);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
window.STX.onDestroy = function(hook) {
|
|
192
|
-
if (currentInstance) currentInstance.destroyHooks.push(hook);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
window.STX.onUpdate = function(hook) {
|
|
196
|
-
if (currentInstance) currentInstance.updateHooks.push(hook);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// Aliases
|
|
200
|
-
window.STX.onMounted = window.STX.onMount;
|
|
201
|
-
window.STX.onUnmounted = window.STX.onDestroy;
|
|
202
|
-
window.STX.onUpdated = window.STX.onUpdate;
|
|
203
|
-
|
|
204
|
-
// Refs
|
|
205
|
-
window.STX.ref = function(initialValue) {
|
|
206
|
-
const r = { value: initialValue || null };
|
|
207
|
-
Object.defineProperty(r, 'current', {
|
|
208
|
-
get: function() { return this.value; }
|
|
209
|
-
});
|
|
210
|
-
if (currentInstance) {
|
|
211
|
-
currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
|
|
212
|
-
}
|
|
213
|
-
return r;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// Watch
|
|
217
|
-
window.STX.watch = function(source, callback, options) {
|
|
218
|
-
options = options || {};
|
|
219
|
-
let oldValue;
|
|
220
|
-
let cleanup;
|
|
221
|
-
let isActive = true;
|
|
222
|
-
|
|
223
|
-
function run() {
|
|
224
|
-
if (!isActive) return;
|
|
225
|
-
const newValue = source();
|
|
226
|
-
if (oldValue !== newValue || options.immediate) {
|
|
227
|
-
if (cleanup) cleanup();
|
|
228
|
-
cleanup = callback(newValue, oldValue);
|
|
229
|
-
oldValue = newValue;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (options.immediate) {
|
|
234
|
-
run();
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
oldValue = source();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
const intervalId = setInterval(run, 16);
|
|
241
|
-
|
|
242
|
-
function stop() {
|
|
243
|
-
isActive = false;
|
|
244
|
-
clearInterval(intervalId);
|
|
245
|
-
if (cleanup) cleanup();
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (currentInstance) {
|
|
249
|
-
currentInstance.watchers.push({ stop: stop });
|
|
250
|
-
currentInstance.destroyHooks.push(stop);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return stop;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// Computed
|
|
257
|
-
window.STX.computed = function(getter) {
|
|
258
|
-
let cached;
|
|
259
|
-
let dirty = true;
|
|
260
|
-
return {
|
|
261
|
-
get value() {
|
|
262
|
-
if (dirty) {
|
|
263
|
-
cached = getter();
|
|
264
|
-
dirty = false;
|
|
265
|
-
queueMicrotask(function() { dirty = true; });
|
|
266
|
-
}
|
|
267
|
-
return cached;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// Component management
|
|
273
|
-
window.STX.setupComponent = function(element, setup) {
|
|
274
|
-
const instance = createInstance(element);
|
|
275
|
-
currentInstance = instance;
|
|
276
|
-
try {
|
|
277
|
-
setup();
|
|
278
|
-
}
|
|
279
|
-
finally {
|
|
280
|
-
currentInstance = null;
|
|
281
|
-
}
|
|
282
|
-
return instance;
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
window.STX.mountComponent = function(instance) {
|
|
286
|
-
if (instance.isMounted) return;
|
|
287
|
-
instance.isMounted = true;
|
|
288
|
-
instance.mountHooks.forEach(function(hook) {
|
|
289
|
-
try {
|
|
290
|
-
const cleanup = hook();
|
|
291
|
-
if (typeof cleanup === 'function') {
|
|
292
|
-
instance.destroyHooks.push(cleanup);
|
|
293
|
-
}
|
|
294
|
-
else if (cleanup && typeof cleanup.then === 'function') {
|
|
295
|
-
cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
catch (e) {
|
|
299
|
-
console.error('[stx] onMount error:', e);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
window.STX.destroyComponent = function(instance) {
|
|
305
|
-
if (!instance.isMounted) return;
|
|
306
|
-
instance.watchers.forEach(function(w) { w.stop(); });
|
|
307
|
-
instance.destroyHooks.forEach(function(hook) {
|
|
308
|
-
try { hook(); }
|
|
309
|
-
catch (e) { console.error('[stx] onDestroy error:', e); }
|
|
310
|
-
});
|
|
311
|
-
instance.refs.forEach(function(ref) { ref.value = null; });
|
|
312
|
-
instance.isMounted = false;
|
|
313
|
-
instances.delete(instance.id);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
// ==========================================================================
|
|
317
|
-
// Vue-Style Refs System - No document.** required!
|
|
318
|
-
// ==========================================================================
|
|
319
|
-
|
|
320
|
-
// Internal: Query for ref elements without exposing document API
|
|
321
|
-
function queryRef(name, root) {
|
|
322
|
-
return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function queryAllRefs(root) {
|
|
326
|
-
return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Auto-bind refs from ref attributes (Vue-style)
|
|
330
|
-
window.STX.bindRefs = function(root, refs) {
|
|
331
|
-
if (!root) return;
|
|
332
|
-
queryAllRefs(root).forEach(function(el) {
|
|
333
|
-
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
334
|
-
if (refs[refName]) {
|
|
335
|
-
refs[refName].value = el;
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
// Vue-style useRefs() - returns object with all refs as direct elements
|
|
341
|
-
// Usage: const { input, button, container } = STX.useRefs()
|
|
342
|
-
window.STX.useRefs = function(root) {
|
|
343
|
-
var refs = {};
|
|
344
|
-
queryAllRefs(root).forEach(function(el) {
|
|
345
|
-
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
346
|
-
if (refName) {
|
|
347
|
-
refs[refName] = el;
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
return refs;
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
// Get a single ref by name - Vue's useTemplateRef equivalent
|
|
354
|
-
// Usage: const input = STX.useRef('input')
|
|
355
|
-
window.STX.useRef = function(name, root) {
|
|
356
|
-
return queryRef(name, root);
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// Two-way binding helper for form elements
|
|
360
|
-
// Usage: STX.model(inputEl, state, 'username')
|
|
361
|
-
window.STX.model = function(el, state, key) {
|
|
362
|
-
if (!el || !state) return;
|
|
363
|
-
|
|
364
|
-
var isCheckbox = el.type === 'checkbox';
|
|
365
|
-
var isRadio = el.type === 'radio';
|
|
366
|
-
var isSelect = el.tagName === 'SELECT';
|
|
367
|
-
|
|
368
|
-
// Set initial value
|
|
369
|
-
if (isCheckbox) {
|
|
370
|
-
el.checked = !!state[key];
|
|
371
|
-
}
|
|
372
|
-
else if (isRadio) {
|
|
373
|
-
el.checked = el.value === state[key];
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
el.value = state[key] || '';
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Listen for changes
|
|
380
|
-
var eventType = isCheckbox || isRadio ? 'change' : 'input';
|
|
381
|
-
el.addEventListener(eventType, function() {
|
|
382
|
-
if (isCheckbox) {
|
|
383
|
-
state[key] = el.checked;
|
|
384
|
-
}
|
|
385
|
-
else if (isRadio) {
|
|
386
|
-
if (el.checked) state[key] = el.value;
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
state[key] = el.value;
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
// Return cleanup function
|
|
394
|
-
return function() {
|
|
395
|
-
el.removeEventListener(eventType, arguments.callee);
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
// Batch event binding helper - cleaner than manual addEventListener
|
|
400
|
-
// Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
|
|
401
|
-
window.STX.on = function(el, event, handler) {
|
|
402
|
-
if (!el) return function() {};
|
|
403
|
-
el.addEventListener(event, handler);
|
|
404
|
-
return function() { el.removeEventListener(event, handler); };
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
// Bind multiple events at once
|
|
408
|
-
// Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
|
|
409
|
-
window.STX.events = function(el, eventMap) {
|
|
410
|
-
if (!el) return function() {};
|
|
411
|
-
var cleanups = [];
|
|
412
|
-
Object.keys(eventMap).forEach(function(event) {
|
|
413
|
-
el.addEventListener(event, eventMap[event]);
|
|
414
|
-
cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
|
|
415
|
-
});
|
|
416
|
-
return function() { cleanups.forEach(function(c) { c(); }); };
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
// ==========================================================================
|
|
420
|
-
// DOM Helpers - Eliminate document.* usage
|
|
421
|
-
// ==========================================================================
|
|
422
|
-
|
|
423
|
-
// Global keyboard event listener
|
|
424
|
-
// Usage: STX.onKey('Escape', () => closeModal())
|
|
425
|
-
window.STX.onKey = function(key, handler, options) {
|
|
426
|
-
var listener = function(e) {
|
|
427
|
-
if (e.key === key) {
|
|
428
|
-
handler(e);
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
document.addEventListener('keydown', listener, options);
|
|
432
|
-
return function() { document.removeEventListener('keydown', listener, options); };
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
// Create element helper
|
|
436
|
-
// Usage: STX.el('div', { class: 'foo' }, 'text content')
|
|
437
|
-
window.STX.el = function(tag, attrs, content) {
|
|
438
|
-
var el = document.createElement(tag);
|
|
439
|
-
if (attrs) {
|
|
440
|
-
Object.keys(attrs).forEach(function(key) {
|
|
441
|
-
if (key === 'class') {
|
|
442
|
-
el.className = attrs[key];
|
|
443
|
-
}
|
|
444
|
-
else if (key.startsWith('on')) {
|
|
445
|
-
el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
el.setAttribute(key, attrs[key]);
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
if (content) {
|
|
453
|
-
if (typeof content === 'string') {
|
|
454
|
-
el.textContent = content;
|
|
455
|
-
}
|
|
456
|
-
else if (Array.isArray(content)) {
|
|
457
|
-
content.forEach(function(child) { el.appendChild(child); });
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
el.appendChild(content);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
return el;
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
// Get currently focused element
|
|
467
|
-
// Usage: const focused = STX.activeElement()
|
|
468
|
-
window.STX.activeElement = function() {
|
|
469
|
-
return document.activeElement;
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
// Escape HTML helper
|
|
473
|
-
// Usage: const safe = STX.escapeHtml(userInput)
|
|
474
|
-
window.STX.escapeHtml = function(text) {
|
|
475
|
-
var div = document.createElement('div');
|
|
476
|
-
div.textContent = text;
|
|
477
|
-
return div.innerHTML;
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
// MutationObserver for automatic lifecycle management
|
|
481
|
-
const observer = new MutationObserver(function(mutations) {
|
|
482
|
-
mutations.forEach(function(mutation) {
|
|
483
|
-
// Handle removed nodes
|
|
484
|
-
mutation.removedNodes.forEach(function(node) {
|
|
485
|
-
if (node.nodeType === 1 && node.__stx_instance__) {
|
|
486
|
-
window.STX.destroyComponent(node.__stx_instance__);
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
// Start observing when DOM is ready
|
|
493
|
-
if (document.readyState === 'loading') {
|
|
494
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
495
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
else {
|
|
499
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
console.log('[stx] Lifecycle runtime initialized');
|
|
503
|
-
})();
|
|
504
|
-
`}function Qc(v){return Symbol(v)}var Z$=Qc("theme"),G$=Qc("router"),J$=Qc("i18n");import*as Ef from"crypto";function kf(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function My(){return`stx-${Ef.randomBytes(4).toString("hex")}`}function Oy(v){return/\$\w+\./.test(v)}function Ny(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(E,(j,B,z,W)=>{if(["script","style","template"].includes(B.toLowerCase()))return j;let F=[],V=!1,U=z,Y=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,Z=[...z.matchAll(Y)];for(let oe of Z){let ae=oe[0],le=oe[1],ce=oe[2];if(Oy(ce)){V=!0;let fe=ce.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(fe){let ye=fe[1];if(F.push({attr:le,expr:ye,fullMatch:ae,originalAttr:le}),kf(ye).forEach(($e)=>k.add($e)),le==="text")U=U.replace(ae,"");else if(le==="class")U=U.replace(ae,'class=""');else if(le==="disabled"||le==="hidden")U=U.replace(ae,"");else U=U.replace(ae,`${le}=""`)}}}if(!V)return j;let se=U.match(/\bid\s*=\s*"([^"]+)"/),ie;if(se)ie=se[1];else ie=My(),U=` id="${ie}"${U}`;for(let oe of F)_.push({elementId:ie,attribute:oe.attr,expression:oe.expr,stores:kf(oe.expr)});return`<${B}${U}${W}`}),{html:T,bindings:_,stores:k}}function jy(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
|
|
505
|
-
<script>
|
|
506
|
-
(function() {
|
|
507
|
-
'use strict';
|
|
508
|
-
|
|
509
|
-
// Wait for stores to be available
|
|
510
|
-
function initBindings() {
|
|
511
|
-
var stores = window.VoideStores;
|
|
512
|
-
if (!stores) {
|
|
513
|
-
setTimeout(initBindings, 10);
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
// Store references for expressions
|
|
518
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
519
|
-
var $state = {};
|
|
520
|
-
`;for(let T of k)E+=` $state.${T} = stores.${T} ? stores.${T}.get() : {};
|
|
521
|
-
`;E+=`
|
|
522
|
-
// Binding update functions
|
|
523
|
-
function updateBindings() {
|
|
524
|
-
`;for(let T of v){let{elementId:j,attribute:B,expression:z}=T,W=z.replace(/\$(\w+)\./g,"$state.$1.");if(B==="text")E+=` (function() {
|
|
525
|
-
var el = document.getElementById('${j}');
|
|
526
|
-
if (el) {
|
|
527
|
-
try {
|
|
528
|
-
el.textContent = ${W};
|
|
529
|
-
}
|
|
530
|
-
catch (e) { console.error('Binding error:', e); }
|
|
531
|
-
}
|
|
532
|
-
})();
|
|
533
|
-
`;else if(B==="html")E+=` (function() {
|
|
534
|
-
var el = document.getElementById('${j}');
|
|
535
|
-
if (el) {
|
|
536
|
-
try {
|
|
537
|
-
el.innerHTML = ${W};
|
|
538
|
-
}
|
|
539
|
-
catch (e) { console.error('Binding error:', e); }
|
|
540
|
-
}
|
|
541
|
-
})();
|
|
542
|
-
`;else if(B==="class")E+=` (function() {
|
|
543
|
-
var el = document.getElementById('${j}');
|
|
544
|
-
if (el) {
|
|
545
|
-
try {
|
|
546
|
-
var value = ${W};
|
|
547
|
-
if (typeof value === 'string') {
|
|
548
|
-
// Dynamic class string - merge with existing static classes
|
|
549
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
550
|
-
var staticClasses = el.getAttribute('data-static-class') || el.className;
|
|
551
|
-
if (!el.hasAttribute('data-static-class')) {
|
|
552
|
-
el.setAttribute('data-static-class', el.className);
|
|
553
|
-
}
|
|
554
|
-
el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
|
|
555
|
-
}
|
|
556
|
-
else if (typeof value === 'object') {
|
|
557
|
-
// Object syntax: { 'class-name': condition }
|
|
558
|
-
for (var cls in value) {
|
|
559
|
-
if (value[cls]) {
|
|
560
|
-
el.classList.add(cls);
|
|
561
|
-
}
|
|
562
|
-
else {
|
|
563
|
-
el.classList.remove(cls);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
catch (e) { console.error('Binding error:', e); }
|
|
569
|
-
}
|
|
570
|
-
})();
|
|
571
|
-
`;else if(B==="show")E+=` (function() {
|
|
572
|
-
var el = document.getElementById('${j}');
|
|
573
|
-
if (el) {
|
|
574
|
-
try {
|
|
575
|
-
el.style.display = (${W}) ? '' : 'none';
|
|
576
|
-
}
|
|
577
|
-
catch (e) { console.error('Binding error:', e); }
|
|
578
|
-
}
|
|
579
|
-
})();
|
|
580
|
-
`;else if(B==="if")E+=` (function() {
|
|
581
|
-
var el = document.getElementById('${j}');
|
|
582
|
-
if (el) {
|
|
583
|
-
try {
|
|
584
|
-
el.style.visibility = (${W}) ? 'visible' : 'hidden';
|
|
585
|
-
}
|
|
586
|
-
catch (e) { console.error('Binding error:', e); }
|
|
587
|
-
}
|
|
588
|
-
})();
|
|
589
|
-
`;else E+=` (function() {
|
|
590
|
-
var el = document.getElementById('${j}');
|
|
591
|
-
if (el) {
|
|
592
|
-
try {
|
|
593
|
-
var value = ${W};
|
|
594
|
-
if (value === false || value === null || value === undefined) {
|
|
595
|
-
el.removeAttribute('${B}');
|
|
596
|
-
}
|
|
597
|
-
else if (value === true) {
|
|
598
|
-
el.setAttribute('${B}', '');
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
el.setAttribute('${B}', value);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
catch (e) { console.error('Binding error:', e); }
|
|
605
|
-
}
|
|
606
|
-
})();
|
|
607
|
-
`}E+=` }
|
|
608
|
-
|
|
609
|
-
// Subscribe to stores and update on changes. Capture the disposers so
|
|
610
|
-
// SPA fragment swaps can tear down old bindings before the next page's
|
|
611
|
-
// runtime takes over \u2014 without this, every navigation between pages
|
|
612
|
-
// using reactive-bindings stacked another subscription on every store,
|
|
613
|
-
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
614
|
-
var _disposers = [];
|
|
615
|
-
`;for(let T of k)E+=` if (stores.${T}) {
|
|
616
|
-
var _unsub_${T} = stores.${T}.subscribe(function(state) {
|
|
617
|
-
$state.${T} = state;
|
|
618
|
-
updateBindings();
|
|
619
|
-
});
|
|
620
|
-
// store.subscribe() may return the disposer (preferred) or void; both
|
|
621
|
-
// are tolerated here.
|
|
622
|
-
if (typeof _unsub_${T} === 'function') _disposers.push(_unsub_${T});
|
|
623
|
-
}
|
|
624
|
-
`;return E+=`
|
|
625
|
-
// Initial update
|
|
626
|
-
updateBindings();
|
|
627
|
-
|
|
628
|
-
// Register this runtime's cleanup so SPA navigation can run it before
|
|
629
|
-
// swapping pages. The router (and any code) can call
|
|
630
|
-
// window.__stxCleanupBindings() to dispose subscriptions; we also wire
|
|
631
|
-
// 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
|
|
632
|
-
function _cleanup() {
|
|
633
|
-
for (var i = 0; i < _disposers.length; i++) {
|
|
634
|
-
try { _disposers[i](); } catch (e) { /* swallow */ }
|
|
635
|
-
}
|
|
636
|
-
_disposers.length = 0;
|
|
637
|
-
}
|
|
638
|
-
if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
|
|
639
|
-
window.__stxBindingsCleanups.push(_cleanup);
|
|
640
|
-
if (!window.__stxCleanupBindings) {
|
|
641
|
-
window.__stxCleanupBindings = function() {
|
|
642
|
-
var fns = window.__stxBindingsCleanups || [];
|
|
643
|
-
for (var i = 0; i < fns.length; i++) {
|
|
644
|
-
try { fns[i](); } catch (e) { /* swallow */ }
|
|
645
|
-
}
|
|
646
|
-
window.__stxBindingsCleanups = [];
|
|
647
|
-
};
|
|
648
|
-
window.addEventListener('popstate', window.__stxCleanupBindings);
|
|
649
|
-
window.addEventListener('beforeunload', window.__stxCleanupBindings);
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// Start when DOM is ready
|
|
654
|
-
if (document.readyState === 'loading') {
|
|
655
|
-
document.addEventListener('DOMContentLoaded', initBindings);
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
initBindings();
|
|
659
|
-
}
|
|
660
|
-
})();
|
|
661
|
-
</script>
|
|
662
|
-
`,E}function Cf(v){let{html:_,bindings:k,stores:E}=Ny(v);if(k.length===0)return v;let T=jy(k,E),j=_.lastIndexOf("</body>");if(j!==-1)return _.slice(0,j)+T+_.slice(j);return _+T}function Ly(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return By(_);case"google-analytics":return zy(_);case"plausible":return Wy(_);case"self-hosted":return Fy(_);case"custom":return Vy(_);default:return""}}function By(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",E=_.defer!==!1?" defer":"",T=[`data-site="${bn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${bn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
|
|
663
|
-
<!-- Fathom Analytics -->
|
|
664
|
-
<script src="${bn(k)}" ${T.join(" ")}${E}></script>
|
|
665
|
-
`}function zy(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=bn(_.measurementId),E=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
|
|
666
|
-
<!-- Google Analytics -->
|
|
667
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
|
|
668
|
-
<script>
|
|
669
|
-
window.dataLayer = window.dataLayer || [];
|
|
670
|
-
function gtag(){dataLayer.push(arguments);}
|
|
671
|
-
gtag('js', new Date());
|
|
672
|
-
gtag('config', '${k}');
|
|
673
|
-
${E}
|
|
674
|
-
</script>
|
|
675
|
-
`}function Wy(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${bn(_.domain)}"`],T=k,j=[];if(_.trackLocalhost)j.push("local");if(_.hashMode)j.push("hash");if(j.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${j.join(".")}.js`;return`
|
|
676
|
-
<!-- Plausible Analytics -->
|
|
677
|
-
<script defer data-domain="${bn(_.domain)}" src="${bn(T)}"></script>
|
|
678
|
-
`}function Fy(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=bn(_.siteId),E=bn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",j=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",B=_.trackOutboundLinks?`
|
|
679
|
-
d.addEventListener('click',function(e){
|
|
680
|
-
var a=e.target.closest('a');
|
|
681
|
-
if(a&&a.hostname!==location.hostname){
|
|
682
|
-
t('outbound',{url:a.href});
|
|
683
|
-
}
|
|
684
|
-
});`:"";return`
|
|
685
|
-
<!-- Self-Hosted Analytics -->
|
|
686
|
-
<script data-site="${k}" data-api="${E}" defer>
|
|
687
|
-
(function(){
|
|
688
|
-
'use strict';
|
|
689
|
-
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
690
|
-
var site=s.dataset.site,api=s.dataset.api;
|
|
691
|
-
${T}
|
|
692
|
-
var q=[],sid=Math.random().toString(36).slice(2);
|
|
693
|
-
function t(e,p){
|
|
694
|
-
var x=new XMLHttpRequest();
|
|
695
|
-
x.open('POST',api+'/collect',true);
|
|
696
|
-
x.setRequestHeader('Content-Type','application/json');
|
|
697
|
-
x.send(JSON.stringify({
|
|
698
|
-
s:site,sid:sid,e:e,p:p||{},
|
|
699
|
-
u:location.href,r:d.referrer,t:d.title,
|
|
700
|
-
sw:screen.width,sh:screen.height
|
|
701
|
-
}));
|
|
702
|
-
}
|
|
703
|
-
function pv(){t('pageview');}
|
|
704
|
-
${j}
|
|
705
|
-
${B}
|
|
706
|
-
if(d.readyState==='complete')pv();
|
|
707
|
-
else w.addEventListener('load',pv);
|
|
708
|
-
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
709
|
-
})();
|
|
710
|
-
</script>
|
|
711
|
-
`}function Vy(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
|
|
712
|
-
<!-- Custom Analytics -->
|
|
713
|
-
<script>
|
|
714
|
-
${_.inlineScript}
|
|
715
|
-
</script>
|
|
716
|
-
`;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${bn(_.scriptId)}"`);if(_.attributes)for(let[T,j]of Object.entries(_.attributes))k.push(`${bn(T)}="${bn(j)}"`);return`
|
|
717
|
-
<!-- Custom Analytics -->
|
|
718
|
-
<script${k.length>0?` ${k.join(" ")}`:""} src="${bn(_.scriptUrl)}" defer></script>
|
|
719
|
-
`}function Rf(v,_){let k=Ly(_);if(!k)return v;if(!v.includes("</head>")){let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}return v.replace("</head>",`${k}</head>`)}function bn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Uy={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 Af(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...Uy,..._};return`
|
|
720
|
-
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
721
|
-
<script>
|
|
722
|
-
(function() {
|
|
723
|
-
'use strict';
|
|
724
|
-
|
|
725
|
-
// Configuration
|
|
726
|
-
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})};
|
|
727
|
-
|
|
728
|
-
// Check Do Not Track
|
|
729
|
-
if (config.honorDnt && navigator.doNotTrack === '1') {
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
// Check viewport constraints
|
|
734
|
-
var vw = window.innerWidth;
|
|
735
|
-
if (config.minViewportWidth && vw < config.minViewportWidth) return;
|
|
736
|
-
if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
|
|
737
|
-
|
|
738
|
-
// Session management (anonymous, no cookies)
|
|
739
|
-
var session = {
|
|
740
|
-
sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
|
|
741
|
-
page: location.pathname,
|
|
742
|
-
vw: window.innerWidth,
|
|
743
|
-
vh: window.innerHeight,
|
|
744
|
-
points: [],
|
|
745
|
-
started: Date.now(),
|
|
746
|
-
lastActivity: Date.now()
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
// Throttle helper
|
|
750
|
-
var lastMove = 0;
|
|
751
|
-
function throttle(fn, wait) {
|
|
752
|
-
return function() {
|
|
753
|
-
var now = Date.now();
|
|
754
|
-
if (now - lastMove >= wait) {
|
|
755
|
-
lastMove = now;
|
|
756
|
-
fn.apply(this, arguments);
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
// Get relative coordinates (percentage)
|
|
762
|
-
function getRelativeCoords(e) {
|
|
763
|
-
return {
|
|
764
|
-
x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
|
|
765
|
-
y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// Check if element should be ignored
|
|
770
|
-
function shouldIgnore(el) {
|
|
771
|
-
if (!el || !config.ignoreSelectors) return false;
|
|
772
|
-
for (var i = 0; i < config.ignoreSelectors.length; i++) {
|
|
773
|
-
if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
|
|
774
|
-
if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
|
|
775
|
-
}
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
// Get element selector (simplified, no IDs to preserve privacy)
|
|
780
|
-
function getSelector(el) {
|
|
781
|
-
if (!el || !el.tagName) return null;
|
|
782
|
-
var tag = el.tagName.toLowerCase();
|
|
783
|
-
var classes = el.className && typeof el.className === 'string'
|
|
784
|
-
? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
|
|
785
|
-
: '';
|
|
786
|
-
return tag + classes;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// Find zone for element
|
|
790
|
-
function findZone(el) {
|
|
791
|
-
if (!config.zones || !el) return null;
|
|
792
|
-
for (var i = 0; i < config.zones.length; i++) {
|
|
793
|
-
var zone = config.zones[i];
|
|
794
|
-
if (el.closest && el.closest(zone.selector)) {
|
|
795
|
-
return zone.id;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
return null;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
// Capture custom attributes
|
|
802
|
-
function captureAttributes(el) {
|
|
803
|
-
if (!config.captureAttributes || !el) return null;
|
|
804
|
-
var attrs = {};
|
|
805
|
-
var hasAttrs = false;
|
|
806
|
-
for (var i = 0; i < config.captureAttributes.length; i++) {
|
|
807
|
-
var attr = config.captureAttributes[i];
|
|
808
|
-
var value = el.getAttribute && el.getAttribute(attr);
|
|
809
|
-
if (value) {
|
|
810
|
-
attrs[attr] = value;
|
|
811
|
-
hasAttrs = true;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
return hasAttrs ? attrs : null;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
// Add data point
|
|
818
|
-
function addPoint(point) {
|
|
819
|
-
session.lastActivity = Date.now();
|
|
820
|
-
if (session.points.length >= config.maxDataPoints) {
|
|
821
|
-
session.points.shift();
|
|
822
|
-
}
|
|
823
|
-
session.points.push(point);
|
|
824
|
-
|
|
825
|
-
// Send batch if threshold reached
|
|
826
|
-
if (config.endpoint && session.points.length >= config.batchSize) {
|
|
827
|
-
sendData();
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
// Send data to endpoint
|
|
832
|
-
function sendData() {
|
|
833
|
-
if (!config.endpoint || session.points.length === 0) return;
|
|
834
|
-
|
|
835
|
-
var data = {
|
|
836
|
-
sid: session.sid,
|
|
837
|
-
page: session.page,
|
|
838
|
-
vw: session.vw,
|
|
839
|
-
vh: session.vh,
|
|
840
|
-
points: session.points.splice(0, config.batchSize)
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
// Use sendBeacon for reliability
|
|
844
|
-
if (navigator.sendBeacon) {
|
|
845
|
-
navigator.sendBeacon(config.endpoint, JSON.stringify(data));
|
|
846
|
-
}
|
|
847
|
-
else {
|
|
848
|
-
var xhr = new XMLHttpRequest();
|
|
849
|
-
xhr.open('POST', config.endpoint, true);
|
|
850
|
-
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
851
|
-
xhr.send(JSON.stringify(data));
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
// Mouse move handler
|
|
856
|
-
if (config.trackMouse) {
|
|
857
|
-
document.addEventListener('mousemove', throttle(function(e) {
|
|
858
|
-
if (shouldIgnore(e.target)) return;
|
|
859
|
-
var coords = getRelativeCoords(e);
|
|
860
|
-
addPoint({
|
|
861
|
-
x: coords.x,
|
|
862
|
-
y: coords.y,
|
|
863
|
-
type: 'move',
|
|
864
|
-
t: Date.now(),
|
|
865
|
-
zone: findZone(e.target)
|
|
866
|
-
});
|
|
867
|
-
}, config.samplingRate), { passive: true });
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
// Click handler
|
|
871
|
-
if (config.trackClicks) {
|
|
872
|
-
document.addEventListener('click', function(e) {
|
|
873
|
-
if (shouldIgnore(e.target)) return;
|
|
874
|
-
var coords = getRelativeCoords(e);
|
|
875
|
-
var point = {
|
|
876
|
-
x: coords.x,
|
|
877
|
-
y: coords.y,
|
|
878
|
-
type: 'click',
|
|
879
|
-
t: Date.now(),
|
|
880
|
-
el: getSelector(e.target),
|
|
881
|
-
zone: findZone(e.target)
|
|
882
|
-
};
|
|
883
|
-
var attrs = captureAttributes(e.target);
|
|
884
|
-
if (attrs) point.attrs = attrs;
|
|
885
|
-
addPoint(point);
|
|
886
|
-
}, { passive: true });
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
// Scroll handler
|
|
890
|
-
if (config.trackScroll) {
|
|
891
|
-
var lastScrollDepth = 0;
|
|
892
|
-
document.addEventListener('scroll', throttle(function() {
|
|
893
|
-
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
894
|
-
var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
|
|
895
|
-
var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
|
|
896
|
-
|
|
897
|
-
// Only track significant scroll changes (every 10%)
|
|
898
|
-
if (Math.abs(depth - lastScrollDepth) >= 10) {
|
|
899
|
-
lastScrollDepth = depth;
|
|
900
|
-
addPoint({
|
|
901
|
-
x: 50,
|
|
902
|
-
y: depth,
|
|
903
|
-
type: 'scroll',
|
|
904
|
-
t: Date.now(),
|
|
905
|
-
depth: depth
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
}, config.samplingRate * 2), { passive: true });
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
// Send remaining data on page unload
|
|
912
|
-
window.addEventListener('beforeunload', sendData);
|
|
913
|
-
window.addEventListener('visibilitychange', function() {
|
|
914
|
-
if (document.visibilityState === 'hidden') {
|
|
915
|
-
sendData();
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
// Persist data to localStorage if enabled
|
|
920
|
-
if (config.persistData) {
|
|
921
|
-
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
922
|
-
|
|
923
|
-
// Load existing data
|
|
924
|
-
try {
|
|
925
|
-
var stored = localStorage.getItem(storageKey);
|
|
926
|
-
if (stored) {
|
|
927
|
-
var parsed = JSON.parse(stored);
|
|
928
|
-
if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
|
|
929
|
-
session.points = parsed.points || [];
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
catch (e) {}
|
|
934
|
-
|
|
935
|
-
// Save periodically
|
|
936
|
-
setInterval(function() {
|
|
937
|
-
try {
|
|
938
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
939
|
-
points: session.points,
|
|
940
|
-
lastActivity: session.lastActivity
|
|
941
|
-
}));
|
|
942
|
-
}
|
|
943
|
-
catch (e) {}
|
|
944
|
-
}, 5000);
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// Debug overlay
|
|
948
|
-
if (config.debugOverlay) {
|
|
949
|
-
var overlay = document.createElement('div');
|
|
950
|
-
overlay.id = 'stx-heatmap-overlay';
|
|
951
|
-
overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
|
|
952
|
-
document.body.appendChild(overlay);
|
|
953
|
-
|
|
954
|
-
var canvas = document.createElement('canvas');
|
|
955
|
-
canvas.width = window.innerWidth;
|
|
956
|
-
canvas.height = window.innerHeight;
|
|
957
|
-
canvas.style.cssText = 'width:100%;height:100%;';
|
|
958
|
-
overlay.appendChild(canvas);
|
|
959
|
-
var ctx = canvas.getContext('2d');
|
|
960
|
-
|
|
961
|
-
function renderOverlay() {
|
|
962
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
963
|
-
session.points.forEach(function(p) {
|
|
964
|
-
var x = (p.x / 100) * canvas.width;
|
|
965
|
-
var y = (p.y / 100) * canvas.height;
|
|
966
|
-
ctx.beginPath();
|
|
967
|
-
ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
|
|
968
|
-
ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
|
|
969
|
-
ctx.fill();
|
|
970
|
-
});
|
|
971
|
-
requestAnimationFrame(renderOverlay);
|
|
972
|
-
}
|
|
973
|
-
renderOverlay();
|
|
974
|
-
|
|
975
|
-
window.addEventListener('resize', function() {
|
|
976
|
-
canvas.width = window.innerWidth;
|
|
977
|
-
canvas.height = window.innerHeight;
|
|
978
|
-
});
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
// Expose API for manual tracking and data export
|
|
982
|
-
window.stxHeatmap = {
|
|
983
|
-
// Get current session data
|
|
984
|
-
getData: function() {
|
|
985
|
-
return {
|
|
986
|
-
sid: session.sid,
|
|
987
|
-
page: session.page,
|
|
988
|
-
vw: session.vw,
|
|
989
|
-
vh: session.vh,
|
|
990
|
-
points: session.points.slice(),
|
|
991
|
-
started: session.started,
|
|
992
|
-
lastActivity: session.lastActivity
|
|
993
|
-
};
|
|
994
|
-
},
|
|
995
|
-
// Export data as JSON
|
|
996
|
-
exportJSON: function() {
|
|
997
|
-
return JSON.stringify(this.getData(), null, 2);
|
|
998
|
-
},
|
|
999
|
-
// Export data as CSV
|
|
1000
|
-
exportCSV: function() {
|
|
1001
|
-
var data = this.getData();
|
|
1002
|
-
var lines = ['x,y,type,timestamp,element,zone,depth'];
|
|
1003
|
-
data.points.forEach(function(p) {
|
|
1004
|
-
lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
|
|
1005
|
-
});
|
|
1006
|
-
return lines.join('\\n');
|
|
1007
|
-
},
|
|
1008
|
-
// Manual data send
|
|
1009
|
-
flush: function() {
|
|
1010
|
-
sendData();
|
|
1011
|
-
},
|
|
1012
|
-
// Clear data
|
|
1013
|
-
clear: function() {
|
|
1014
|
-
session.points = [];
|
|
1015
|
-
if (config.persistData) {
|
|
1016
|
-
var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
|
|
1017
|
-
try { localStorage.removeItem(storageKey); }
|
|
1018
|
-
catch (e) {}
|
|
1019
|
-
}
|
|
1020
|
-
},
|
|
1021
|
-
// Add custom event
|
|
1022
|
-
track: function(type, data) {
|
|
1023
|
-
addPoint({
|
|
1024
|
-
x: data && data.x || 0,
|
|
1025
|
-
y: data && data.y || 0,
|
|
1026
|
-
type: type,
|
|
1027
|
-
t: Date.now(),
|
|
1028
|
-
attrs: data
|
|
1029
|
-
});
|
|
1030
|
-
},
|
|
1031
|
-
// Generate heatmap visualization
|
|
1032
|
-
visualize: function(options) {
|
|
1033
|
-
options = options || {};
|
|
1034
|
-
var data = this.getData();
|
|
1035
|
-
var width = options.width || data.vw;
|
|
1036
|
-
var height = options.height || data.vh;
|
|
1037
|
-
var radius = options.radius || 20;
|
|
1038
|
-
var blur = options.blur || 15;
|
|
1039
|
-
var maxOpacity = options.maxOpacity || 0.6;
|
|
1040
|
-
|
|
1041
|
-
var canvas = document.createElement('canvas');
|
|
1042
|
-
canvas.width = width;
|
|
1043
|
-
canvas.height = height;
|
|
1044
|
-
var ctx = canvas.getContext('2d');
|
|
1045
|
-
|
|
1046
|
-
// Create heat points
|
|
1047
|
-
data.points.forEach(function(p) {
|
|
1048
|
-
var x = (p.x / 100) * width;
|
|
1049
|
-
var y = (p.y / 100) * height;
|
|
1050
|
-
var intensity = p.type === 'click' ? 1 : 0.3;
|
|
1051
|
-
|
|
1052
|
-
var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
|
|
1053
|
-
gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
|
|
1054
|
-
gradient.addColorStop(1, 'rgba(255,0,0,0)');
|
|
1055
|
-
ctx.fillStyle = gradient;
|
|
1056
|
-
ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
// Apply blur
|
|
1060
|
-
ctx.filter = 'blur(' + blur + 'px)';
|
|
1061
|
-
ctx.drawImage(canvas, 0, 0);
|
|
1062
|
-
ctx.filter = 'none';
|
|
1063
|
-
|
|
1064
|
-
// Colorize
|
|
1065
|
-
var imageData = ctx.getImageData(0, 0, width, height);
|
|
1066
|
-
var pixels = imageData.data;
|
|
1067
|
-
for (var i = 0; i < pixels.length; i += 4) {
|
|
1068
|
-
var alpha = pixels[i + 3];
|
|
1069
|
-
if (alpha > 0) {
|
|
1070
|
-
var ratio = alpha / 255;
|
|
1071
|
-
// Gradient: blue -> cyan -> green -> yellow -> red
|
|
1072
|
-
if (ratio < 0.25) {
|
|
1073
|
-
pixels[i] = 0;
|
|
1074
|
-
pixels[i + 1] = Math.round(ratio * 4 * 255);
|
|
1075
|
-
pixels[i + 2] = 255;
|
|
1076
|
-
}
|
|
1077
|
-
else if (ratio < 0.5) {
|
|
1078
|
-
pixels[i] = 0;
|
|
1079
|
-
pixels[i + 1] = 255;
|
|
1080
|
-
pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
|
|
1081
|
-
}
|
|
1082
|
-
else if (ratio < 0.75) {
|
|
1083
|
-
pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
|
|
1084
|
-
pixels[i + 1] = 255;
|
|
1085
|
-
pixels[i + 2] = 0;
|
|
1086
|
-
}
|
|
1087
|
-
else {
|
|
1088
|
-
pixels[i] = 255;
|
|
1089
|
-
pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
|
|
1090
|
-
pixels[i + 2] = 0;
|
|
1091
|
-
}
|
|
1092
|
-
pixels[i + 3] = Math.round(alpha * maxOpacity);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
ctx.putImageData(imageData, 0, 0);
|
|
1096
|
-
|
|
1097
|
-
return canvas;
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1100
|
-
})();
|
|
1101
|
-
</script>
|
|
1102
|
-
`}function Tf(v,_){let k=Af(_);if(!k)return v;let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}var If={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,E)=>{let T=k.__stx_config||{};if(_.length>0){let j=Hy(_.join(" "));T.heatmap={...T.heatmap,...j,enabled:!0}}return Af(T)}};function Hy(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let E of k){let[T,j]=E.split("="),B=j?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=B;break;case"samplingRate":_.samplingRate=Number.parseInt(B,10);break;case"batchSize":_.batchSize=Number.parseInt(B,10);break;case"trackMouse":_.trackMouse=B==="true";break;case"trackClicks":_.trackClicks=B==="true";break;case"trackScroll":_.trackScroll=B==="true";break;case"honorDnt":_.honorDnt=B==="true";break;case"debugOverlay":_.debugOverlay=B==="true";break}}return _}var dr={duration:300,delay:0,ease:"ease",direction:"both"};function qy(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...dr,..._};if(v==="custom"&&B)return B;switch(v){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);"}
|
|
1103
|
-
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1104
|
-
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${j==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1105
|
-
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
1106
|
-
@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);"}
|
|
1107
|
-
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
|
|
1108
|
-
@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);"}
|
|
1109
|
-
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1110
|
-
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${j==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1111
|
-
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1112
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function Ky(){return`
|
|
1113
|
-
<script data-stx-scoped data-stx-run="once">
|
|
1114
|
-
// Motion preferences handling
|
|
1115
|
-
(function() {
|
|
1116
|
-
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
1117
|
-
|
|
1118
|
-
if (prefersReducedMotion) {
|
|
1119
|
-
// Apply reduced motion settings
|
|
1120
|
-
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1121
|
-
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1122
|
-
}
|
|
1123
|
-
else {
|
|
1124
|
-
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
// Listen for changes in preference
|
|
1128
|
-
window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
|
|
1129
|
-
if (e.matches) {
|
|
1130
|
-
document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
|
|
1131
|
-
document.documentElement.setAttribute('data-reduced-motion', 'true');
|
|
1132
|
-
}
|
|
1133
|
-
else {
|
|
1134
|
-
document.documentElement.style.setProperty('--stx-transition-duration', '');
|
|
1135
|
-
document.documentElement.setAttribute('data-reduced-motion', 'false');
|
|
1136
|
-
}
|
|
1137
|
-
});
|
|
1138
|
-
})();
|
|
1139
|
-
</script>
|
|
1140
|
-
`}function Xy(v){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(v))}function Zy(v=0.1,_="0px"){return`
|
|
1141
|
-
<script data-stx-scoped data-stx-run="always">
|
|
1142
|
-
// Intersection Observer for scroll animations
|
|
1143
|
-
(function() {
|
|
1144
|
-
const initObserver = () => {
|
|
1145
|
-
if (!('IntersectionObserver' in window)) {
|
|
1146
|
-
// For browsers that don't support IntersectionObserver, show all elements immediately
|
|
1147
|
-
const elements = document.querySelectorAll('.stx-observe');
|
|
1148
|
-
elements.forEach(el => el.classList.remove('stx-out'));
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
// Create the observer
|
|
1153
|
-
const options = {
|
|
1154
|
-
root: null, // Use viewport
|
|
1155
|
-
rootMargin: '${_}',
|
|
1156
|
-
threshold: ${v}
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
const observer = new IntersectionObserver((entries) => {
|
|
1160
|
-
entries.forEach(entry => {
|
|
1161
|
-
if (entry.isIntersecting) {
|
|
1162
|
-
entry.target.classList.remove('stx-out');
|
|
1163
|
-
// Stop observing after animation is triggered
|
|
1164
|
-
observer.unobserve(entry.target);
|
|
1165
|
-
}
|
|
1166
|
-
});
|
|
1167
|
-
}, options);
|
|
1168
|
-
|
|
1169
|
-
// Start observing elements
|
|
1170
|
-
const elements = document.querySelectorAll('.stx-observe');
|
|
1171
|
-
elements.forEach(el => observer.observe(el));
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
// Initialize observer when DOM is ready
|
|
1175
|
-
if (document.readyState === 'loading') {
|
|
1176
|
-
document.addEventListener('DOMContentLoaded', initObserver);
|
|
1177
|
-
}
|
|
1178
|
-
else {
|
|
1179
|
-
initObserver();
|
|
1180
|
-
}
|
|
1181
|
-
})();
|
|
1182
|
-
</script>
|
|
1183
|
-
`}function Gy(){return`
|
|
1184
|
-
<style id="stx-animation-base">
|
|
1185
|
-
:root {
|
|
1186
|
-
--stx-transition-duration: 300ms;
|
|
1187
|
-
--stx-transition-delay: 0ms;
|
|
1188
|
-
--stx-transition-ease: ease;
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
@media (prefers-reduced-motion: reduce) {
|
|
1192
|
-
:root {
|
|
1193
|
-
--stx-transition-duration: 0ms;
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
[data-animate="false"] * {
|
|
1198
|
-
--stx-transition-duration: 0ms !important;
|
|
1199
|
-
animation-duration: 0ms !important;
|
|
1200
|
-
transition-duration: 0ms !important;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
/* Base transition classes */
|
|
1204
|
-
.stx-transition {
|
|
1205
|
-
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1206
|
-
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1207
|
-
backface-visibility: hidden; /* Improve animation performance */
|
|
1208
|
-
transform-style: preserve-3d; /* Better 3D transforms */
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
/* Fade animations */
|
|
1212
|
-
.stx-fade {
|
|
1213
|
-
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
.stx-fade.stx-out {
|
|
1217
|
-
opacity: 0 !important;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
/* Scale animations */
|
|
1221
|
-
.stx-scale {
|
|
1222
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1223
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
.stx-scale.stx-out {
|
|
1227
|
-
transform: scale(0.85) !important;
|
|
1228
|
-
opacity: 0 !important;
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
/* Flip animations */
|
|
1232
|
-
.stx-flip {
|
|
1233
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1234
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1235
|
-
perspective: 600px;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
.stx-flip.stx-out {
|
|
1239
|
-
transform: perspective(600px) rotateX(-90deg) !important;
|
|
1240
|
-
opacity: 0 !important;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
/* Rotate animations */
|
|
1244
|
-
.stx-rotate {
|
|
1245
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1246
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
.stx-rotate.stx-out {
|
|
1250
|
-
transform: rotate(-90deg) !important;
|
|
1251
|
-
opacity: 0 !important;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/* Direction-based animations */
|
|
1255
|
-
.stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
|
|
1256
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1257
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
.stx-from-left.stx-out {
|
|
1261
|
-
transform: translateX(-30px) !important;
|
|
1262
|
-
opacity: 0 !important;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
.stx-from-right.stx-out {
|
|
1266
|
-
transform: translateX(30px) !important;
|
|
1267
|
-
opacity: 0 !important;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
.stx-from-top.stx-out {
|
|
1271
|
-
transform: translateY(-30px) !important;
|
|
1272
|
-
opacity: 0 !important;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
.stx-from-bottom.stx-out {
|
|
1276
|
-
transform: translateY(30px) !important;
|
|
1277
|
-
opacity: 0 !important;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
/* Generic slide animations */
|
|
1281
|
-
.stx-slide {
|
|
1282
|
-
transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1283
|
-
opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
.stx-slide.stx-out {
|
|
1287
|
-
transform: translateY(30px) !important;
|
|
1288
|
-
opacity: 0 !important;
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
/* Scroll animation observer class */
|
|
1292
|
-
.stx-observe {
|
|
1293
|
-
will-change: opacity, transform;
|
|
1294
|
-
transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
|
|
1295
|
-
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1296
|
-
}
|
|
1297
|
-
</style>
|
|
1298
|
-
`}function Jy(v,_,k={}){let{staggerDelay:E=50,sequence:T=!1}=k;return`
|
|
1299
|
-
<script data-stx-scoped data-stx-run="always">
|
|
1300
|
-
// Animation Group: ${v}
|
|
1301
|
-
(function() {
|
|
1302
|
-
const elements = ${JSON.stringify(_)};
|
|
1303
|
-
const staggerDelay = ${E};
|
|
1304
|
-
const sequence = ${T};
|
|
1305
|
-
|
|
1306
|
-
function animateGroup() {
|
|
1307
|
-
elements.forEach((selector, index) => {
|
|
1308
|
-
const element = document.querySelector(selector);
|
|
1309
|
-
if (!element) return;
|
|
1310
|
-
|
|
1311
|
-
const delay = sequence ? index * staggerDelay : 0;
|
|
1312
|
-
element.style.setProperty('--stx-transition-delay', delay + 'ms');
|
|
1313
|
-
|
|
1314
|
-
// For elements using animation keyframes
|
|
1315
|
-
element.style.animationDelay = delay + 'ms';
|
|
1316
|
-
|
|
1317
|
-
// If the element is initially hidden, show it
|
|
1318
|
-
if (element.classList.contains('stx-out')) {
|
|
1319
|
-
setTimeout(() => {
|
|
1320
|
-
element.classList.remove('stx-out');
|
|
1321
|
-
}, 10); // Small delay to ensure styles are applied
|
|
1322
|
-
}
|
|
1323
|
-
});
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
// Run when DOM is fully loaded
|
|
1327
|
-
if (document.readyState === 'loading') {
|
|
1328
|
-
document.addEventListener('DOMContentLoaded', animateGroup);
|
|
1329
|
-
}
|
|
1330
|
-
else {
|
|
1331
|
-
animateGroup();
|
|
1332
|
-
}
|
|
1333
|
-
})();
|
|
1334
|
-
</script>
|
|
1335
|
-
`}var Pf={name:"transition",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||dr.duration:dr.duration,B=_.length>2?_[2]||dr.ease:dr.ease,z=_.length>3?Number.parseInt(_[3],10)||dr.delay:dr.delay,W=_.length>4?_[4]||dr.direction:dr.direction,F=`stx-transition-${Math.random().toString(36).substr(2,9)}`,V=qy(T,{duration:j,delay:z,ease:B,direction:W}),U="stx-transition",Y="";if(T==="fade")Y="stx-fade";else if(T==="slide")Y="stx-slide";else if(T==="scale")Y="stx-scale";else if(T==="flip")Y="stx-flip";else if(T==="rotate")Y="stx-rotate";return`<div id="${F}" class="${U} ${Y} ${W==="out"?"stx-out":""}"
|
|
1336
|
-
style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${z}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Df={name:"scrollAnimate",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||300:300,B=_.length>2?_[2]||"ease":"ease",z=_.length>3?Number.parseFloat(_[3])||0.2:0.2,W=_.length>4?Number.parseInt(_[4],10)||0:0,F=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,V=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(T==="fade")U+=" stx-fade";else if(T==="slide-up"||T==="slide")U+=" stx-from-bottom";else if(T==="slide-down")U+=" stx-from-top";else if(T==="slide-left")U+=" stx-from-right";else if(T==="slide-right")U+=" stx-from-left";else if(T==="scale")U+=" stx-scale";else if(T.includes("-"))U+=` stx-${T}`;else U+=` stx-${T}`;return`<div id="${F}" class="${U}" style="${V}" data-threshold="${z}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Mf={name:"animationGroup",handler:(v,_,k,E)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],j=_.slice(1).map((F)=>F.startsWith("#")||F.startsWith(".")?F:`#${F}`),B=k.staggerDelay||50,z=k.sequence||!0,W=Jy(T,j,{staggerDelay:B,sequence:z});return`${v}
|
|
1337
|
-
${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Of={name:"motion",handler:(v,_,k,E)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,j=Ky();return`<div data-animate="${T?"auto":"true"}">${v}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Nf(v,_,k,E){let T=v;if(E.animation?.enabled===!1)return T;let j=k.includes("test")&&k.includes("animation");if(!Xy(T)&&!j)return T;if(!T.includes('<style id="stx-animation-base">')){let z=Gy();T=T.replace("</head>",`${z}
|
|
1338
|
-
</head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let W=Zy(),F=T.lastIndexOf("</body>");if(F!==-1)T=T.slice(0,F)+W+`
|
|
1339
|
-
`+T.slice(F)}}return T}function He(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function jf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var Yy=100,Qy=599,tl="__stxResponseStatus",Ui="__stxResponseHeaders";function Ho(v){return typeof v==="number"&&Number.isInteger(v)&&v>=Yy&&v<=Qy}function Tt(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let E=Number(k[1]);if(Ho(E))return E}return}function el(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!Ho(k))return!1;return v[tl]=k,!0}function ex(v,_,k){if(!v||typeof v!=="object")return;let E=String(_??"").trim();if(!E)return;v[Ui]={...v[Ui],[E]:String(k)}}function Ue(v){let _=v?.[tl];return Ho(_)?_:void 0}function Ve(v){let _=v?.[Ui];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([E,T])=>[E,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function ni(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Ue(v);if(k!==void 0)_[tl]=k;let E=Ve(v);if(E)_[Ui]={..._[Ui],...E}}function qn(v){return{setResponseStatus:(_)=>{el(v,_)},notFound:(_=404)=>{let k=Ho(_)&&_>=400?_:404;el(v,k)},setResponseHeader:(_,k)=>{ex(v,_,k)}}}function Lf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:E,buildMode:T}=k,j=T==="compile",B="",z=0,W=/@status\s*\(/g,F;while((F=W.exec(v))!==null){let V=tx(v,F.index+F[0].length-1);if(V<0)break;let U=v.slice(F.index+F[0].length,V).trim(),Y=/^\d+$/.test(U)?Number(U):l(U,_),Z=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${U})${Z} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${U}) from <script server> instead \u2014 that runs per request.`);else if(!el(_,Y))console.warn(`[stx] @status(${U})${Z} is not an HTTP status (100-599) \u2014 ignoring it.`);B+=v.slice(z,F.index),z=V+1+(v.slice(V+1).match(/^[^\S\n]*\n?/)?.[0].length??0),W.lastIndex=z}return z===0?v:B+v.slice(z)}function tx(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}var nx=0,rx=0;function Bf(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let E=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(E)return E[1];return null}function sx(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,E;while((E=k.exec(v))!==null){let[T,j,B]=E,z=E.index,W=Bf(B,"x-data");if(!W)continue;let F=`__stx_scope_${nx++}`,V=Bf(B,"x-init"),U=ix(v,j,z+T.length),Y=v.slice(z,U.endIndex),Z=ox(Y);_.push({id:F,selector:`[data-stx-scope="${F}"]`,stateExpr:W,initExpr:V,bindings:[],refs:Z})}return _}function ix(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s|>)`,"gi"),B=new RegExp(`</${_}>`,"gi"),z=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T,z.lastIndex=T;let W=j.exec(v),F=B.exec(v),V=z.exec(v);if(V&&V.index<(W?.index??1/0)){T=V.index+V[0].length;continue}if(!F)return{endIndex:v.length};if(W&&W.index<F.index)E++,T=W.index+W[0].length;else{if(E--,E===0)return{endIndex:F.index+F[0].length};T=F.index+F[0].length}}return{endIndex:v.length}}function ox(v){let _=new Map,k=v.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,T;while((T=E.exec(k))!==null){let[,j,B]=T,z=ax(j);_.set(B,z)}return _}function ax(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${rx++}`}function cx(){return`
|
|
1340
|
-
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1341
|
-
(function() {
|
|
1342
|
-
var style = document.createElement('style');
|
|
1343
|
-
style.textContent = [
|
|
1344
|
-
'[x-cloak] { display: none !important; }',
|
|
1345
|
-
// Default transition classes
|
|
1346
|
-
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
1347
|
-
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
1348
|
-
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
1349
|
-
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
1350
|
-
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
1351
|
-
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
1352
|
-
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
1353
|
-
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
1354
|
-
].join('\\n');
|
|
1355
|
-
document.head.appendChild(style);
|
|
1356
|
-
})();
|
|
1357
|
-
|
|
1358
|
-
// STX Reactive Runtime
|
|
1359
|
-
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
1360
|
-
window.__stx_reactive = (function() {
|
|
1361
|
-
'use strict';
|
|
1362
|
-
|
|
1363
|
-
// Deep reactive proxy that triggers onChange for any mutation
|
|
1364
|
-
function reactive(obj, onChange) {
|
|
1365
|
-
if (!obj || typeof obj !== 'object') return obj;
|
|
1366
|
-
return new Proxy(obj, {
|
|
1367
|
-
get(target, prop) {
|
|
1368
|
-
const value = target[prop];
|
|
1369
|
-
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
1370
|
-
return reactive(value, onChange);
|
|
1371
|
-
}
|
|
1372
|
-
return value;
|
|
1373
|
-
},
|
|
1374
|
-
set(target, prop, value) {
|
|
1375
|
-
target[prop] = value;
|
|
1376
|
-
onChange(prop, value);
|
|
1377
|
-
return true;
|
|
1378
|
-
}
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
1383
|
-
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
1384
|
-
function initScope(scopeEl, initialState, bindings, refs, initExpr) {
|
|
1385
|
-
// Parse initial state (may contain methods including async init())
|
|
1386
|
-
var state;
|
|
1387
|
-
try {
|
|
1388
|
-
state = new Function('return (' + initialState + ')')();
|
|
1389
|
-
} catch (e) {
|
|
1390
|
-
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
1391
|
-
return;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
// Build $refs object
|
|
1395
|
-
var $refs = {};
|
|
1396
|
-
for (var name in refs) {
|
|
1397
|
-
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
1398
|
-
(function(refName, refId) {
|
|
1399
|
-
Object.defineProperty($refs, refName, {
|
|
1400
|
-
get: function() { return document.getElementById(refId); }
|
|
1401
|
-
});
|
|
1402
|
-
})(name, refs[name]);
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
// Extract init method from state if present (Alpine.js convention)
|
|
1407
|
-
var initMethod = state.init;
|
|
1408
|
-
if (typeof initMethod === 'function') {
|
|
1409
|
-
delete state.init;
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
1413
|
-
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
1414
|
-
var stx = window.stx;
|
|
1415
|
-
|
|
1416
|
-
// Create signals for each state property so the signals runtime can track dependencies
|
|
1417
|
-
var signalState = {};
|
|
1418
|
-
var rawState = {};
|
|
1419
|
-
var derivedState = {};
|
|
1420
|
-
var accessors = {};
|
|
1421
|
-
// A getter must NOT be read here. Reading one calls it, and the old loop did
|
|
1422
|
-
// exactly that: the returned value is not a function, so it was wrapped as a
|
|
1423
|
-
// plain state() -- a snapshot of the answer at construction time, frozen
|
|
1424
|
-
// forever while plain properties beside it updated (#2053). A getter is a
|
|
1425
|
-
// derived value, so it is registered as one below, once ctxProxy exists for
|
|
1426
|
-
// it to read through.
|
|
1427
|
-
var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
|
|
1428
|
-
for (var key in state) {
|
|
1429
|
-
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
1430
|
-
var descriptor = ownDescriptors[key];
|
|
1431
|
-
if (descriptor && typeof descriptor.get === 'function') {
|
|
1432
|
-
accessors[key] = descriptor;
|
|
1433
|
-
continue;
|
|
1434
|
-
}
|
|
1435
|
-
if (typeof state[key] === 'function') {
|
|
1436
|
-
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
1437
|
-
signalState[key] = state[key];
|
|
1438
|
-
} else {
|
|
1439
|
-
// Data properties \u2014 wrap in signals for reactivity
|
|
1440
|
-
signalState[key] = stx.state(state[key]);
|
|
1441
|
-
rawState[key] = true;
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
1447
|
-
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
1448
|
-
var ctx = {};
|
|
1449
|
-
var ctxProxy = new Proxy(ctx, {
|
|
1450
|
-
get: function(target, prop) {
|
|
1451
|
-
if (prop === '$refs') return $refs;
|
|
1452
|
-
if (prop === '$el') return scopeEl;
|
|
1453
|
-
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
1454
|
-
var s = signalState[prop];
|
|
1455
|
-
if (!s) return undefined;
|
|
1456
|
-
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
1457
|
-
return s.value; // unwrap signal
|
|
1458
|
-
}
|
|
1459
|
-
if (typeof s === 'function' && !rawState[prop]) {
|
|
1460
|
-
return s.bind(ctxProxy); // bind methods to proxy
|
|
1461
|
-
}
|
|
1462
|
-
return s;
|
|
1463
|
-
},
|
|
1464
|
-
set: function(target, prop, value) {
|
|
1465
|
-
var accessor = derivedState[prop];
|
|
1466
|
-
if (accessor) {
|
|
1467
|
-
// A getter/setter pair writes through its setter. A getter alone has
|
|
1468
|
-
// nowhere to put the value: a derived has no .value setter, so the
|
|
1469
|
-
// assignment would be a silent no-op, which is the same class of
|
|
1470
|
-
// failure as the stale read this replaces.
|
|
1471
|
-
if (typeof accessor.set === 'function') {
|
|
1472
|
-
accessor.set.call(ctxProxy, value);
|
|
1473
|
-
return true;
|
|
1474
|
-
}
|
|
1475
|
-
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.');
|
|
1476
|
-
return true;
|
|
1477
|
-
}
|
|
1478
|
-
var s = signalState[prop];
|
|
1479
|
-
if (rawState[prop] && s && typeof s === 'function') {
|
|
1480
|
-
s.value = value; // write through signal \u2014 triggers effects
|
|
1481
|
-
} else {
|
|
1482
|
-
signalState[prop] = value;
|
|
1483
|
-
}
|
|
1484
|
-
return true;
|
|
1485
|
-
},
|
|
1486
|
-
has: function(target, prop) {
|
|
1487
|
-
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
|
|
1488
|
-
},
|
|
1489
|
-
ownKeys: function() {
|
|
1490
|
-
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
1491
|
-
},
|
|
1492
|
-
getOwnPropertyDescriptor: function(target, prop) {
|
|
1493
|
-
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
1494
|
-
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
1495
|
-
}
|
|
1496
|
-
return undefined;
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
// Now that ctxProxy exists, a getter becomes a derived that reads through it,
|
|
1501
|
-
// so it tracks whatever it touches and recomputes when that changes. derived()
|
|
1502
|
-
// is lazy, so nothing is evaluated until a binding actually reads it.
|
|
1503
|
-
//
|
|
1504
|
-
// Marked rawState as well: that is what makes the proxy unwrap it and what
|
|
1505
|
-
// exposes the signal itself to the runtime below, which is where dependency
|
|
1506
|
-
// tracking comes from. A getter needs both, exactly like a data property.
|
|
1507
|
-
for (var accessorKey in accessors) {
|
|
1508
|
-
if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
|
|
1509
|
-
(function(name, descriptor) {
|
|
1510
|
-
signalState[name] = stx.derived(function() {
|
|
1511
|
-
return descriptor.get.call(ctxProxy);
|
|
1512
|
-
});
|
|
1513
|
-
rawState[name] = true;
|
|
1514
|
-
derivedState[name] = descriptor;
|
|
1515
|
-
})(accessorKey, accessors[accessorKey]);
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
1520
|
-
// We need to provide getter/setter descriptors so signals track properly.
|
|
1521
|
-
var scopeVars = {};
|
|
1522
|
-
for (var k in signalState) {
|
|
1523
|
-
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
1524
|
-
if (rawState[k]) {
|
|
1525
|
-
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
1526
|
-
scopeVars[k] = signalState[k];
|
|
1527
|
-
} else {
|
|
1528
|
-
// Method: bind to ctxProxy so 'this' works
|
|
1529
|
-
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
scopeVars.$refs = $refs;
|
|
1534
|
-
scopeVars.$el = scopeEl;
|
|
1535
|
-
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
1536
|
-
|
|
1537
|
-
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
1538
|
-
if (!stx._scopes) stx._scopes = {};
|
|
1539
|
-
stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
1540
|
-
|
|
1541
|
-
// Store on element for findElementScope
|
|
1542
|
-
scopeEl.__stx_scope = scopeVars;
|
|
1543
|
-
|
|
1544
|
-
// Run init() if present (supports async)
|
|
1545
|
-
function runInit() {
|
|
1546
|
-
var maybePromise;
|
|
1547
|
-
if (initMethod) {
|
|
1548
|
-
maybePromise = initMethod.call(ctxProxy);
|
|
1549
|
-
}
|
|
1550
|
-
if (initExpr) {
|
|
1551
|
-
try {
|
|
1552
|
-
var keys = Object.keys(scopeVars);
|
|
1553
|
-
var vals = keys.map(function(k) { return scopeVars[k]; });
|
|
1554
|
-
var fn = new Function(keys.join(','), initExpr);
|
|
1555
|
-
var result = fn.apply(ctxProxy, vals);
|
|
1556
|
-
if (result && typeof result.then === 'function') maybePromise = result;
|
|
1557
|
-
} catch (e) {
|
|
1558
|
-
console.warn('[stx-reactive] init expression error:', e);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
// If init is async, signal updates will trigger effects automatically
|
|
1562
|
-
// when init() resolves and sets this.prop = value (writes through signal)
|
|
1563
|
-
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
1564
|
-
maybePromise.catch(function(e) {
|
|
1565
|
-
console.error('[stx-reactive] async init() error:', e);
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
// Run init before the signals runtime processes this scope
|
|
1571
|
-
runInit();
|
|
1572
|
-
|
|
1573
|
-
// Expose for debugging
|
|
1574
|
-
scopeEl.__stx_state = ctxProxy;
|
|
1575
|
-
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
1576
|
-
try {
|
|
1577
|
-
// Run the statement with the reactive proxy as the lexical scope.
|
|
1578
|
-
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
1579
|
-
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
1580
|
-
// each state key as a local function parameter \u2014 bare assignments
|
|
1581
|
-
// would otherwise just rebind the local and never reach the signal.
|
|
1582
|
-
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
1583
|
-
fn.call(ctxProxy, $event, $el);
|
|
1584
|
-
} catch (e) {
|
|
1585
|
-
console.warn('[stx-reactive] execute error:', e);
|
|
1586
|
-
}
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
return { initScope: initScope, reactive: reactive };
|
|
1591
|
-
})();
|
|
1592
|
-
`}function zf(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(z,W)=>{try{let F=x(W,_,!0);if(F===void 0)return z;return String(F)}catch{return z}}),E="",T=0,j=null;while(T<k.length){let z=k[T];if(j&&z==="\\"){E+=z+(k[T+1]??""),T+=2;continue}if(z==="{"&&k[T+1]==="{"){let W=k.indexOf("}}",T+2);if(W!==-1){let F=k.slice(T,W+2);E+=B(k.slice(T+2,W),F,j),T=W+2;continue}}if(j){if(z===j)j=null}else if(z==="'"||z==='"'||z==="`")j=z;E+=z,T++}return E;function B(z,W,F){let V;try{V=x(z,_,!0)}catch{return W}if(V===void 0)return W;if(F){let U=String(V).replace(/\\/g,"\\\\").replace(new RegExp(F==="`"?"`":F,"g"),`\\${F}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return F==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof V==="string"){let U=V.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(V)}}function lx(v,_){if(v.length===0)return"";let k=v.map((E)=>{let T=JSON.stringify(Object.fromEntries(E.refs)),j=zf(E.stateExpr,_),B=E.initExpr?zf(E.initExpr,_):null,z=JSON.stringify(j),W=B?JSON.stringify(B):"null";return`
|
|
1593
|
-
(function() {
|
|
1594
|
-
var scopeEl = document.querySelector('${E.selector}');
|
|
1595
|
-
if (!scopeEl) return;
|
|
1596
|
-
var refs = ${T};
|
|
1597
|
-
__stx_reactive.initScope(scopeEl, ${z}, [], refs, ${W});
|
|
1598
|
-
})();`}).join(`
|
|
1599
|
-
`);return`
|
|
1600
|
-
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1601
|
-
${cx()}
|
|
1602
|
-
${k}
|
|
1603
|
-
</script>`}function Wf(v,_,k){if(!dx(v))return v;let E=sx(v);if(E.length===0)return v;let T=ux(v,E),j=lx(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
|
|
1604
|
-
`+T.slice(B);else T+=j;return T}function ux(v,_){let k=0,E=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,j,B)=>{let z=_[k++];if(!z)return T;let W=/data-stx-scope="([^"]*)"/.exec(B);if(W)return z.id=W[1],z.selector=`[data-stx-scope="${z.id}"]`,T;return`<${j} data-stx-scope="${z.id}"${B}>`});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 dx(v){return/x-data\s*=\s*["']/.test(v)}import Zx from"fs";import gl from"path";import{createHighlighter as Gx}from"ts-syntax-highlighter";import Ts from"fs";import Zt from"path";import{loadConfigWithResult as Vx}from"bunfig";async function fx(v,_,k,E){let T=_[0]?.replace(/['"]/g,"")||"main",j=Ee();if(T!=="main")j=j.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${j}</script>`}var Ff={name:"stxRouter",handler:fx,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function br(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Vf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function zn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let E=k[1],T=v.slice(k[0].length),j={};for(let B of E.split(`
|
|
1605
|
-
`)){let z=B.trim();if(!z||z.startsWith("#"))continue;let W=z.indexOf(":");if(W===-1)continue;let F=z.slice(0,W).trim(),V=z.slice(W+1).trim();if(typeof V==="string"){if(V.startsWith('"')&&V.endsWith('"')||V.startsWith("'")&&V.endsWith("'"))V=V.slice(1,-1);else if(V.startsWith("[")&&V.endsWith("]"))try{V=JSON.parse(V)}catch{}else if(V==="true")V=!0;else if(V==="false")V=!1;else if(/^-?\d+(?:\.\d+)?$/.test(V))V=Number(V)}j[F]=V}return{data:j,content:T.trim()}}function je(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(V,U,Y)=>{let Z=j.length,se=U?` class="language-${br(U)}"`:"";return j.push(`<pre><code${se}>${br(Y.trim())}</code></pre>`),`\x00CODEBLOCK${Z}\x00`}),T=T.replace(/`([^`]*)`/g,(V,U)=>`<code>${br(U)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(V,U,Y)=>`<img src="${Vf(Y)?br(Y):""}" alt="${br(U)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(V,U,Y)=>`<a href="${Vf(Y)?br(Y):""}">${U}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1606
|
-
`),T=T.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),T=T.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),T=T.replace(/<\/ul>\n<ul>/g,""),T=T.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),T=T.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),T=T.replace(/<\/ol>\n<ol>/g,""),T=T.replace(/<li data-ul>/g,"<li>"),T=T.replace(/<li data-ol>/g,"<li>"),k)T=T.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(V,U,Y)=>{let se=`<tr>${U.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${br(oe)}</th>`).join("")}</tr>`,ie=Y.trim().split(`
|
|
1607
|
-
`).map((oe)=>`<tr>${oe.split("|").map((le)=>le.trim()).filter(Boolean).map((le)=>`<td>${br(le)}</td>`).join("")}</tr>`).join(`
|
|
1608
|
-
`);return`<table>
|
|
1609
|
-
<thead>
|
|
1610
|
-
${se}
|
|
1611
|
-
</thead>
|
|
1612
|
-
<tbody>
|
|
1613
|
-
${ie}
|
|
1614
|
-
</tbody>
|
|
1615
|
-
</table>`});if(k)T=T.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),T=T.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let B=T.split(`
|
|
1616
|
-
`),z=[],W=!1,F=[];for(let V of B){let U=V.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(W&&F.length>0)z.push(`<p>${F.join(E?`<br />
|
|
1617
|
-
`:`
|
|
1618
|
-
`)}</p>`),F=[],W=!1;z.push(V)}else W=!0,F.push(U)}if(W&&F.length>0)z.push(`<p>${F.join(E?`<br />
|
|
1619
|
-
`:`
|
|
1620
|
-
`)}</p>`);if(T=z.join(`
|
|
1621
|
-
`),E)T=T.replace(/\n/g,`<br />
|
|
1622
|
-
`);for(let V=0;V<j.length;V++)T=T.replace(`\x00CODEBLOCK${V}\x00`,j[V]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function Uf(v,_,k=""){let E=v,T=[],j=/@markdown(?:\([^)]*\))?/g,B;while((B=j.exec(v))!==null){let z=B.index,W=B[0].match(/@markdown\(([^)]*)\)/),F=W?W[1]:"",V=z+B[0].length,U=1,Y=V,Z=-1;while(U>0&&Y<v.length){let oe=v.indexOf("@markdown",Y),ae=v.indexOf("@endmarkdown",Y);if(ae===-1)break;if(oe!==-1&&oe<ae&&oe!==z){let le=v[oe+9];if(le==="("||le===`
|
|
1623
|
-
`||le==="\r"||le===" "||le===void 0)U++;Y=oe+9}else{if(U--,U===0){Z=ae;break}Y=ae+12}}if(Z===-1)continue;let se=v.slice(V,Z),ie=v.slice(z,Z+12);T.push({fullMatch:ie,options:F,content:se,index:z}),j.lastIndex=Z+12}for(let{fullMatch:z,options:W,content:F,index:V}of T)try{let U={};if(W)W.split(",").forEach((se)=>{let ie=se.trim();if(ie)U[ie]=!0});let Y={gfm:U.gfm??!0,breaks:U.breaks??!1},Z=je(F.trim(),Y);E=E.split(z).join(Z)}catch(U){let Y=U instanceof Error?U.message:String(U),Z=g("Markdown Directive",`Error processing markdown: ${Y}`,k,v,V,z);E=E.split(z).join(Z)}return E}async function Hf(v,_,k,E){let T={gfm:!0,breaks:!1};return _.forEach((j)=>{let B=j.trim().replace(/['"]/g,"");if(B==="breaks")T.breaks=!0;if(B==="no-gfm")T.gfm=!1}),je(v.trim(),T)}var Rs=[320,480,640,768,1024,1280,1536,1920,2560],px=[1,1.5,2,3],qi=["avif","webp","jpeg"],gx={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function nl(v,_=Rs,k={},E){return _.sort((T,j)=>T-j).map((T)=>`${Ki(v,{...k,w:T,fm:E})} ${T}w`).join(", ")}function qf(v,_,k=px,E={},T){return k.sort((j,B)=>j-B).map((j)=>{let B=Math.round(_*j);return`${Ki(v,{...E,w:B,dpr:j,fm:T})} ${j}x`}).join(", ")}function rl(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let E=Object.entries(v).map(([T,j])=>{let B=/^\d+$/.test(T)?`${T}px`:T;return{bp:B,size:j,numericBp:Number.parseInt(B)||0}}).sort((T,j)=>T.numericBp-j.numericBp).map(({bp:T,size:j})=>`(max-width: ${T}) ${j}`);return E.push(_),E.join(", ")}function Ki(v,_={}){let k=Object.entries(_).filter(([,j])=>j!==void 0&&j!==null).map(([j,B])=>{if(Array.isArray(B))return[j,B.join(",")];return[j,String(B)]});if(k.length===0)return v;let E=k.map(([j,B])=>`${j}=${encodeURIComponent(B)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${E}`}function sl(v){return gx[v]||"application/octet-stream"}var mx={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},ol=`
|
|
1624
|
-
.stx-img-placeholder {
|
|
1625
|
-
position: relative;
|
|
1626
|
-
overflow: hidden;
|
|
1627
|
-
background-size: cover;
|
|
1628
|
-
background-position: center;
|
|
1629
|
-
background-repeat: no-repeat;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
.stx-img-placeholder img {
|
|
1633
|
-
opacity: 0;
|
|
1634
|
-
transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
.stx-img-placeholder.stx-img-loaded img {
|
|
1638
|
-
opacity: 1;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
.stx-img-blur {
|
|
1642
|
-
filter: blur(20px);
|
|
1643
|
-
transform: scale(1.1);
|
|
1644
|
-
transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
|
|
1645
|
-
transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
.stx-img-loaded .stx-img-blur {
|
|
1649
|
-
filter: blur(0);
|
|
1650
|
-
transform: scale(1);
|
|
1651
|
-
}
|
|
1652
|
-
`.trim();async function hx(){try{return await import("ts-images")}catch{return null}}async function yx(v,_={}){let k={...mx,..._},E=await hx();if(E)try{return await xx(v,k,E)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return bx(v,k)}async function xx(v,_,k){let{generatePlaceholder:E,generateThumbHash:T}=k,B={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await E(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:B,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:_.strategy,dominantColor:z.dominantColor,css:z.css}}function bx(v,_){let k=_.width||20,E=_.height||k,T="#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:_.strategy,dominantColor:"#e5e7eb"}}function Kf(v,_,k={}){let E=k.transitionDuration||300,T=k.easing||"ease-out";return`
|
|
1653
|
-
#${v} {
|
|
1654
|
-
--stx-img-transition-duration: ${E}ms;
|
|
1655
|
-
--stx-img-transition-easing: ${T};
|
|
1656
|
-
background-image: url('${_.dataURL}');
|
|
1657
|
-
background-size: cover;
|
|
1658
|
-
background-position: center;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
#${v} img {
|
|
1662
|
-
opacity: 0;
|
|
1663
|
-
transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
#${v}.stx-img-loaded img {
|
|
1667
|
-
opacity: 1;
|
|
1668
|
-
}
|
|
1669
|
-
`.trim()}var il=new Map;async function Xf(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(il.has(k))return il.get(k);let E=await yx(v,_);return il.set(k,E),E}async function vx(){try{return await import("./chunk-xkxwg6d4.js")}catch(v){if(!Zf)console.warn("[stx-media] Image processor not available, some features disabled:",v),Zf=!0;return null}}var Zf=!1,al=80,ea="async",ta="lazy",Gf=!1;async function qo(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return _x(E,k)}if(k.processedResult?.processed)return ul(v,k.processedResult,_);if(k.responsiveVariants)return Qf(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:W,widths:F=Rs,dpr:V,formats:U=qi,quality:Y=al,params:Z={},placeholder:se="none",placeholderOptions:ie={},lazy:oe=!0,priority:ae=!1,loading:le=ae?"eager":ta,decoding:ce=ea,fetchpriority:fe,objectFit:ye,objectPosition:Se,crossorigin:$e,referrerpolicy:Re}=v,{class:Ae,style:Te,id:Ie}=v,_e=v.data||{},{isDev:De=!1,baseUrl:Ne=""}=_;if(De&&!_.optimize)return $x(v);let Oe,Pe,Le=Ie||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(se!=="none"&&!ae)try{Oe=await Xf(T,{strategy:se,...ie}),Pe=Kf(Le,Oe,ie)}catch{}let ct=V!==void 0&&B!==void 0,yt;if(ct)yt=Sx(v,Le,Oe,_);else yt=await wx(v,Le,Oe,_);let ft;if(ae){let lt=U.includes("webp")?"webp":U[0],wt=nl(T,F,{...Z,q:Y},lt),dt=typeof W==="object"?rl(W):W||"100vw";ft=`<link rel="preload" as="image" imagesrcset="${wt}" imagesizes="${dt}" />`}let st=[];if(!Gf&&se!=="none")st.push(ol),Gf=!0;if(Pe)st.push(Pe);let pt=oe?Yf(Le):void 0;return{html:yt,preloadLink:ft,css:st.length>0?st.join(`
|
|
1670
|
-
`):void 0,script:pt}}async function wx(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:W,widths:F=Rs,formats:V=qi,quality:U=al,params:Y={},lazy:Z=!0,priority:se=!1,loading:ie=se?"eager":ta,decoding:oe=ea,fetchpriority:ae,objectFit:le,objectPosition:ce,crossorigin:fe,referrerpolicy:ye}=v,{class:Se,style:$e}=v,Re=v.data||{},Ae=typeof W==="object"?rl(W):W||"100vw",Te=[];for(let De of V){let Ne=nl(T,F,{...Y,q:U},De),Oe=sl(De);if(Z&&!se)Te.push(` <source type="${Oe}" data-srcset="${Ne}" data-sizes="${Ae}" />`);else Te.push(` <source type="${Oe}" srcset="${Ne}" sizes="${Ae}" />`)}let Ie=cl({src:Ki(T,{...Y,q:U}),alt:j,width:B,height:z,loading:se?void 0:ie,decoding:oe,fetchpriority:se?"high":ae,objectFit:le,objectPosition:ce,crossorigin:fe,referrerpolicy:ye,className:Jf(Se,k),style:ll($e,le,ce,k),lazy:Z&&!se,data:Re}),_e;if(k){let De=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${De}">
|
|
1671
|
-
<picture>
|
|
1672
|
-
${Te.join(`
|
|
1673
|
-
`)}
|
|
1674
|
-
<img ${Ie} />
|
|
1675
|
-
</picture>
|
|
1676
|
-
</div>`}else _e=`<picture${_?` id="${_}"`:""}>
|
|
1677
|
-
${Te.join(`
|
|
1678
|
-
`)}
|
|
1679
|
-
<img ${Ie} />
|
|
1680
|
-
</picture>`;return _e}function Sx(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:W=[1,2,3],quality:F=al,params:V={},lazy:U=!0,priority:Y=!1,loading:Z=Y?"eager":ta,decoding:se=ea,fetchpriority:ie,objectFit:oe,objectPosition:ae,crossorigin:le,referrerpolicy:ce}=v,{class:fe,style:ye}=v,Se=v.data||{},$e=typeof B==="number"?B:Number.parseInt(String(B),10),Re=qf(T,$e,W,{...V,q:F}),Ae=cl({src:Ki(T,{...V,w:$e,q:F}),alt:j,width:B,height:z,loading:Y?void 0:Z,decoding:se,fetchpriority:Y?"high":ie,objectFit:oe,objectPosition:ae,crossorigin:le,referrerpolicy:ce,className:Jf(fe,k),style:ll(ye,oe,ae,k),lazy:U&&!Y,data:Se}),Te=U&&!Y?`data-srcset="${Re}"`:`srcset="${Re}"`;if(k){let Ie=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Ie}">
|
|
1681
|
-
<img ${Ae} ${Te} />
|
|
1682
|
-
</div>`}return`<img ${_?`id="${_}" `:""}${Ae} ${Te} />`}function $x(v){let{src:_,alt:k,width:E,height:T,loading:j=ta,decoding:B=ea,fetchpriority:z,objectFit:W,objectPosition:F,crossorigin:V,referrerpolicy:U,priority:Y=!1}=v,{class:Z,style:se,id:ie}=v,oe=v.data||{};return{html:`<img ${cl({src:_,alt:k,width:E,height:T,loading:Y?"eager":j,decoding:B,fetchpriority:Y?"high":z,objectFit:W,objectPosition:F,crossorigin:V,referrerpolicy:U,className:Z,style:ll(se,W,F),id:ie,data:oe})} />`}}function cl(v){let _=[];if(v.lazy)_.push(`data-src="${In(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${In(v.src)}"`);if(_.push(`alt="${In(v.alt)}"`),v.width)_.push(`width="${v.width}"`);if(v.height)_.push(`height="${v.height}"`);if(v.loading)_.push(`loading="${v.loading}"`);if(v.decoding)_.push(`decoding="${v.decoding}"`);if(v.fetchpriority)_.push(`fetchpriority="${v.fetchpriority}"`);if(v.crossorigin)_.push(`crossorigin="${v.crossorigin}"`);if(v.referrerpolicy)_.push(`referrerpolicy="${v.referrerpolicy}"`);if(v.className)_.push(`class="${In(v.className)}"`);if(v.style)_.push(`style="${In(v.style)}"`);if(v.id)_.push(`id="${In(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${In(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function Jf(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function ll(v,_,k,E){let T=[];if(_)T.push(`object-fit: ${_}`);if(k)T.push(`object-position: ${k}`);if(E)T.push("opacity: 0; transition: opacity 300ms ease-out");if(v)T.push(v);return T.join("; ")}function In(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Yf(v){return`
|
|
1683
|
-
(function() {
|
|
1684
|
-
const container = document.getElementById('${v}');
|
|
1685
|
-
if (!container) return;
|
|
1686
|
-
|
|
1687
|
-
const img = container.querySelector('img[data-stx-lazy]') || container;
|
|
1688
|
-
if (!img.dataset.src && !img.dataset.srcset) return;
|
|
1689
|
-
|
|
1690
|
-
const observer = new IntersectionObserver((entries) => {
|
|
1691
|
-
entries.forEach(entry => {
|
|
1692
|
-
if (entry.isIntersecting) {
|
|
1693
|
-
// Load image
|
|
1694
|
-
if (img.dataset.src) img.src = img.dataset.src;
|
|
1695
|
-
if (img.dataset.srcset) img.srcset = img.dataset.srcset;
|
|
1696
|
-
|
|
1697
|
-
// Load sources
|
|
1698
|
-
const sources = container.querySelectorAll('source[data-srcset]');
|
|
1699
|
-
sources.forEach(source => {
|
|
1700
|
-
if (source.dataset.srcset) source.srcset = source.dataset.srcset;
|
|
1701
|
-
if (source.dataset.sizes) source.sizes = source.dataset.sizes;
|
|
1702
|
-
});
|
|
1703
|
-
|
|
1704
|
-
// Handle load completion
|
|
1705
|
-
img.onload = () => {
|
|
1706
|
-
img.style.opacity = '1';
|
|
1707
|
-
if (container.classList.contains('stx-img-placeholder')) {
|
|
1708
|
-
container.classList.add('stx-img-loaded');
|
|
1709
|
-
}
|
|
1710
|
-
};
|
|
1711
|
-
|
|
1712
|
-
observer.disconnect();
|
|
1713
|
-
}
|
|
1714
|
-
});
|
|
1715
|
-
}, { rootMargin: '50px' });
|
|
1716
|
-
|
|
1717
|
-
observer.observe(container);
|
|
1718
|
-
})();
|
|
1719
|
-
`.trim()}async function _x(v,_){let k=await vx();if(!k)return qo({...v,process:!1},_);let E=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let j=await k.generateResponsiveVariants(v.src,v,E);if(j)return Qf(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return ul(v,j,_)}return qo({...v,process:!1},_)}async function ul(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:W,objectPosition:F,crossorigin:V,referrerpolicy:U}=v,{class:Y,style:Z}=v,se=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,ie=v.data||{},oe=_.variants||[],ae=oe.find((Pe)=>Pe.format==="jpeg")||oe.find((Pe)=>Pe.format==="webp")||oe[0],le=ae?.url||v.src,ce=oe.filter((Pe)=>Pe.format===(ae?.format||"jpeg")).map((Pe)=>`${Pe.url} ${Pe.width}w`).join(", "),fe=new Map;for(let Pe of oe){if(!fe.has(Pe.format))fe.set(Pe.format,[]);fe.get(Pe.format).push(Pe)}let ye=[],Se=["avif","webp","jpeg","png"];for(let Pe of Se){let Le=fe.get(Pe);if(Le&&Le.length>0){let ct=Le.map((ft)=>`${ft.url} ${ft.width}w`).join(", "),yt=sl(Pe);if(B&&!z)ye.push(` <source type="${yt}" data-srcset="${ct}" />`);else ye.push(` <source type="${yt}" srcset="${ct}" />`)}}let $e=[];if(B&&!z){if($e.push(`data-src="${In(le)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ce)$e.push(`data-srcset="${ce}"`)}else if($e.push(`src="${In(le)}"`),ce)$e.push(`srcset="${ce}"`);$e.push(`alt="${In(E)}"`);let Re=T||_.originalWidth,Ae=j||_.originalHeight;if(Re)$e.push(`width="${Re}"`);if(Ae)$e.push(`height="${Ae}"`);if(!z)$e.push(`loading="${B?"lazy":"eager"}"`);if($e.push('decoding="async"'),z)$e.push('fetchpriority="high"');if(V)$e.push(`crossorigin="${V}"`);if(U)$e.push(`referrerpolicy="${U}"`);let Te=[];if(W)Te.push(`object-fit: ${W}`);if(F)Te.push(`object-position: ${F}`);if(_.placeholder&&B)Te.push("opacity: 0; transition: opacity 300ms ease-out");if(Z)Te.push(Z);if(Te.length>0)$e.push(`style="${Te.join("; ")}"`);let Ie=[];if(Y)Ie.push(Y);if(_.placeholder)Ie.push("stx-img-blur");if(Ie.length>0)$e.push(`class="${Ie.join(" ")}"`);if(B&&!z)$e.push("data-stx-lazy");for(let[Pe,Le]of Object.entries(ie))$e.push(`data-${Pe}="${In(Le)}"`);let _e;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Pe=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;_e=`<div id="${se}" class="stx-img-placeholder" style="${Pe}">
|
|
1720
|
-
<picture>
|
|
1721
|
-
${ye.join(`
|
|
1722
|
-
`)}
|
|
1723
|
-
<img ${$e.join(" ")} />
|
|
1724
|
-
</picture>
|
|
1725
|
-
</div>`}else _e=`<picture${se?` id="${se}"`:""}>
|
|
1726
|
-
${ye.join(`
|
|
1727
|
-
`)}
|
|
1728
|
-
<img ${$e.join(" ")} />
|
|
1729
|
-
</picture>`;let De=[];if(_.placeholder)De.push(ol);let Ne=B?Yf(se):void 0,Oe;if(z&&ce)Oe=`<link rel="preload" as="image" imagesrcset="${ce}" />`;return{html:_e,preloadLink:Oe,css:De.length>0?De.join(`
|
|
1730
|
-
`):void 0,script:Ne}}async function Qf(v,_,k){let E={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,j]of Object.entries(_.byFormat))if(j)E.variants.push(...j);return ul(v,E,k)}function kx(){return Je({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,E)=>{let{src:T,alt:j,options:B}=Ex(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:T,alt:j||"",widths:B.widths||Rs,formats:B.formats||qi,quality:B.quality,sizes:B.sizes,dpr:B.dpr,params:B.params,placeholder:B.placeholder,placeholderOptions:B.placeholderOptions,lazy:B.lazy!==!1,priority:B.priority||!1,loading:B.loading,decoding:B.decoding,fetchpriority:B.fetchpriority,objectFit:B.objectFit,objectPosition:B.objectPosition,class:B.class,style:B.style,id:B.id,width:B.width,height:B.height},W=k.__isDev||!1,F=await qo(z,{isDev:W}),V=F.html;if(F.preloadLink)V=F.preloadLink+`
|
|
1731
|
-
`+V;if(F.css)V+=`
|
|
1732
|
-
<style>${F.css}</style>`;if(F.script)V+=`
|
|
1733
|
-
<script>${F.script}</script>`;return V},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Ex(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let E=v.trim();if(E.startsWith("@img(")||E.startsWith("("))E=E.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Cx(E),j=dl(T[0],k)||"",B=dl(T[1],k)||"",z={};if(T[2]){let W=dl(T[2],k);if(typeof W==="object"&&W!==null)z=W;else if(typeof T[2]==="string")try{z=JSON.parse(T[2])}catch{}}return{src:j,alt:B,options:z}}function Cx(v){let _=[],k="",E=!1,T="",j=0,B=0;for(let z=0;z<v.length;z++){let W=v[z],F=z>0?v[z-1]:"";if((W==='"'||W==="'"||W==="`")&&F!=="\\"){if(!E)E=!0,T=W;else if(W===T)E=!1,T="";else k+=W;continue}if(!E){if(W==="{")j++;if(W==="}")j--;if(W==="[")B++;if(W==="]")B--;if(W===","&&j===0&&B===0){_.push(k.trim()),k="";continue}}k+=W}if(k.trim())_.push(k.trim());return _}function dl(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let E=_[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var ep=kx();async function np(){try{return await import("./chunk-9rts16ta.js")}catch(v){if(!tp)console.warn("[stx-media] Video processor not available, some features disabled:",v),tp=!0;return null}}var tp=!1,rp=!0,sp="metadata",Rx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function na(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Dx(E,k)}if(k.processedResult?.processed)return op(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await Mx(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:W,controls:F=rp,autoplay:V=!1,muted:U=!1,loop:Y=!1,preload:Z=sp,playsinline:se=!0,lazy:ie=!0,player:oe="native",type:ae,width:le,height:ce,crossorigin:fe,disablePictureInPicture:ye=!1,disableRemotePlayback:Se=!1}=v,$e=T||z,{class:Re,style:Ae}=v,Te=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return Tx(v,_);if(ae&&ae!=="video")return Ax(j||"",ae,v);let Ie=B.length>0?B:j?[{src:j,type:ip(j)}]:[],_e=[`id="${Te}"`];if(F)_e.push("controls");if(V)_e.push("autoplay");if(U)_e.push("muted");if(Y)_e.push("loop");if(se)_e.push("playsinline");if(ye)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(fe)_e.push(`crossorigin="${fe}"`);if(ie){if(_e.push(`data-preload="${Z}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Xt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${Z}"`),$e)_e.push(`poster="${Xt($e)}"`);if(le)_e.push(`width="${le}"`);if(ce)_e.push(`height="${ce}"`);if(Re)_e.push(`class="${Xt(Re)}"`);if(Ae)_e.push(`style="${Xt(Ae)}"`);let De=Ie.map((Pe)=>` <source ${ie?`data-src="${Xt(Pe.src)}"`:`src="${Xt(Pe.src)}"`} type="${Pe.type}"${Pe.media?` media="${Pe.media}"`:""} />`).join(`
|
|
1734
|
-
`),Ne=`<video ${_e.join(" ")}>
|
|
1735
|
-
${De}
|
|
1736
|
-
Your browser does not support the video tag.
|
|
1737
|
-
</video>`,Oe;if(ie)Oe=`
|
|
1738
|
-
(function() {
|
|
1739
|
-
var video = document.getElementById('${Te}');
|
|
1740
|
-
if (!video) return;
|
|
1741
|
-
|
|
1742
|
-
var observer = new IntersectionObserver(function(entries) {
|
|
1743
|
-
entries.forEach(function(entry) {
|
|
1744
|
-
if (entry.isIntersecting) {
|
|
1745
|
-
// Load poster
|
|
1746
|
-
if (video.dataset.poster) {
|
|
1747
|
-
video.poster = video.dataset.poster;
|
|
1748
|
-
delete video.dataset.poster;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
// Load sources
|
|
1752
|
-
var sources = video.querySelectorAll('source[data-src]');
|
|
1753
|
-
sources.forEach(function(source) {
|
|
1754
|
-
source.src = source.dataset.src;
|
|
1755
|
-
delete source.dataset.src;
|
|
1756
|
-
});
|
|
1757
|
-
|
|
1758
|
-
// Set preload
|
|
1759
|
-
if (video.dataset.preload) {
|
|
1760
|
-
video.preload = video.dataset.preload;
|
|
1761
|
-
delete video.dataset.preload;
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
video.load();
|
|
1765
|
-
observer.disconnect();
|
|
1766
|
-
}
|
|
1767
|
-
});
|
|
1768
|
-
}, { rootMargin: '50px' });
|
|
1769
|
-
|
|
1770
|
-
observer.observe(video);
|
|
1771
|
-
})();
|
|
1772
|
-
`.trim();return{html:Ne,script:Oe}}function Ax(v,_,k){let{width:E=640,height:T=360}=k,{class:j,style:B}=k,z=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,F=null;switch(_){case"youtube":F=Ix(v),W=F?`https://www.youtube-nocookie.com/embed/${F}`:v;break;case"vimeo":F=Px(v),W=F?`https://player.vimeo.com/video/${F}`:v;break;case"dailymotion":F=v.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${F}`;break;case"twitch":F=v.split("/").pop()||"",W=`https://player.twitch.tv/?video=${F}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=v}let V=[`id="${z}"`,`src="${Xt(W)}"`,`width="${E}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)V.push(`class="${Xt(j)}"`);if(B)V.push(`style="${Xt(B)}"`);if(k.lazy)V.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1773
|
-
<iframe ${V.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1774
|
-
</div>`}}function Tx(v,_={}){let{src:k,sources:E=[],poster:T,controls:j=!0,autoplay:B=!1,muted:z=!1,loop:W=!1,preload:F="metadata",playsinline:V=!0,lazy:U=!0,width:Y,height:Z}=v,{class:se,style:ie}=v,oe=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ae={src:E.length>0?E:k,autoplay:B,loop:W,muted:z,playsinline:V,preload:F,poster:T,controls:j,title:v.title},le=["position: relative",Y?`width: ${typeof Y==="number"?Y+"px":Y}`:"width: 100%",Z?`height: ${typeof Z==="number"?Z+"px":Z}`:"",ie||""].filter(Boolean).join("; "),ce=`
|
|
1775
|
-
<div
|
|
1776
|
-
id="${oe}"
|
|
1777
|
-
class="ts-video-player${se?" "+Xt(se):""}"
|
|
1778
|
-
style="${le}"
|
|
1779
|
-
data-ts-video-player
|
|
1780
|
-
data-config='${JSON.stringify(ae)}'
|
|
1781
|
-
${U?"data-lazy":""}
|
|
1782
|
-
>
|
|
1783
|
-
<div class="ts-video-player__container">
|
|
1784
|
-
${T?`
|
|
1785
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${Xt(T)}');">
|
|
1786
|
-
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1787
|
-
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1788
|
-
<path d="M8 5v14l11-7z"/>
|
|
1789
|
-
</svg>
|
|
1790
|
-
</button>
|
|
1791
|
-
</div>
|
|
1792
|
-
`:""}
|
|
1793
|
-
</div>
|
|
1794
|
-
</div>
|
|
1795
|
-
`.trim(),fe=`
|
|
1796
|
-
(function() {
|
|
1797
|
-
var container = document.getElementById('${oe}');
|
|
1798
|
-
if (!container) return;
|
|
1799
|
-
|
|
1800
|
-
var config = JSON.parse(container.dataset.config || '{}');
|
|
1801
|
-
var isLazy = container.hasAttribute('data-lazy');
|
|
1802
|
-
|
|
1803
|
-
function loadPlayer() {
|
|
1804
|
-
if (typeof TSVideoPlayer !== 'undefined') {
|
|
1805
|
-
initPlayer();
|
|
1806
|
-
return;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
// Load ts-video-player from CDN
|
|
1810
|
-
var script = document.createElement('script');
|
|
1811
|
-
script.src = '${Rx}';
|
|
1812
|
-
script.onload = initPlayer;
|
|
1813
|
-
script.onerror = function() {
|
|
1814
|
-
console.error('[stx] Failed to load ts-video-player');
|
|
1815
|
-
fallbackToNative();
|
|
1816
|
-
};
|
|
1817
|
-
document.head.appendChild(script);
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
function initPlayer() {
|
|
1821
|
-
var player = TSVideoPlayer.createPlayer(container, config);
|
|
1822
|
-
if (config.src) {
|
|
1823
|
-
player.setSrc(config.src);
|
|
1824
|
-
}
|
|
1825
|
-
container.__tsVideoPlayer = player;
|
|
1826
|
-
|
|
1827
|
-
// Remove placeholder
|
|
1828
|
-
var placeholder = container.querySelector('.ts-video-player__placeholder');
|
|
1829
|
-
if (placeholder) {
|
|
1830
|
-
placeholder.style.display = 'none';
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
function fallbackToNative() {
|
|
1835
|
-
// Fallback to native video element
|
|
1836
|
-
var video = document.createElement('video');
|
|
1837
|
-
video.controls = config.controls !== false;
|
|
1838
|
-
video.autoplay = config.autoplay;
|
|
1839
|
-
video.muted = config.muted;
|
|
1840
|
-
video.loop = config.loop;
|
|
1841
|
-
video.playsInline = config.playsinline;
|
|
1842
|
-
video.preload = config.preload || 'metadata';
|
|
1843
|
-
if (config.poster) video.poster = config.poster;
|
|
1844
|
-
if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
|
|
1845
|
-
video.style.width = '100%';
|
|
1846
|
-
video.style.height = '100%';
|
|
1847
|
-
|
|
1848
|
-
var containerEl = container.querySelector('.ts-video-player__container');
|
|
1849
|
-
if (containerEl) {
|
|
1850
|
-
containerEl.innerHTML = '';
|
|
1851
|
-
containerEl.appendChild(video);
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
if (isLazy) {
|
|
1856
|
-
var observer = new IntersectionObserver(function(entries) {
|
|
1857
|
-
entries.forEach(function(entry) {
|
|
1858
|
-
if (entry.isIntersecting) {
|
|
1859
|
-
loadPlayer();
|
|
1860
|
-
observer.disconnect();
|
|
1861
|
-
}
|
|
1862
|
-
});
|
|
1863
|
-
}, { rootMargin: '50px' });
|
|
1864
|
-
observer.observe(container);
|
|
1865
|
-
}
|
|
1866
|
-
else {
|
|
1867
|
-
if (document.readyState === 'loading') {
|
|
1868
|
-
document.addEventListener('DOMContentLoaded', loadPlayer);
|
|
1869
|
-
}
|
|
1870
|
-
else {
|
|
1871
|
-
loadPlayer();
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
// Handle play button click
|
|
1876
|
-
var playButton = container.querySelector('.ts-video-player__play-button');
|
|
1877
|
-
if (playButton) {
|
|
1878
|
-
playButton.addEventListener('click', function() {
|
|
1879
|
-
loadPlayer();
|
|
1880
|
-
var check = setInterval(function() {
|
|
1881
|
-
if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
|
|
1882
|
-
container.__tsVideoPlayer.play();
|
|
1883
|
-
clearInterval(check);
|
|
1884
|
-
}
|
|
1885
|
-
}, 100);
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
})();
|
|
1889
|
-
`.trim(),ye=`
|
|
1890
|
-
.ts-video-player {
|
|
1891
|
-
position: relative;
|
|
1892
|
-
background: #000;
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
.ts-video-player__container {
|
|
1896
|
-
position: relative;
|
|
1897
|
-
width: 100%;
|
|
1898
|
-
padding-bottom: 56.25%;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
.ts-video-player__container > * {
|
|
1902
|
-
position: absolute;
|
|
1903
|
-
top: 0;
|
|
1904
|
-
left: 0;
|
|
1905
|
-
width: 100%;
|
|
1906
|
-
height: 100%;
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
.ts-video-player__placeholder {
|
|
1910
|
-
display: flex;
|
|
1911
|
-
align-items: center;
|
|
1912
|
-
justify-content: center;
|
|
1913
|
-
background-color: #1a1a1a;
|
|
1914
|
-
background-size: cover;
|
|
1915
|
-
background-position: center;
|
|
1916
|
-
cursor: pointer;
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
.ts-video-player__play-button {
|
|
1920
|
-
display: flex;
|
|
1921
|
-
align-items: center;
|
|
1922
|
-
justify-content: center;
|
|
1923
|
-
width: 80px;
|
|
1924
|
-
height: 80px;
|
|
1925
|
-
background: rgba(0, 0, 0, 0.7);
|
|
1926
|
-
border: none;
|
|
1927
|
-
border-radius: 50%;
|
|
1928
|
-
color: white;
|
|
1929
|
-
cursor: pointer;
|
|
1930
|
-
transition: transform 0.2s, background 0.2s;
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
.ts-video-player__play-button:hover {
|
|
1934
|
-
transform: scale(1.1);
|
|
1935
|
-
background: rgba(0, 0, 0, 0.9);
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
.ts-video-player__play-button svg {
|
|
1939
|
-
margin-left: 4px;
|
|
1940
|
-
}
|
|
1941
|
-
`.trim();return{html:ce,script:fe,css:ye}}function ip(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Ix(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let E=v.match(k);if(E)return E[1]}return null}function Px(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Xt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function Dx(v,_){let k=await np();if(!k)return na({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return op(v,T,_);return na({...v,process:!1},_)}async function Mx(v,_){let k=await np();if(!k||!v.src)return;let E=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,E,T.outputDir,T.baseUrl||"/videos"))?.url}function op(v,_,k){let{controls:E=rp,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=sp,playsinline:W=!0,lazy:F=!0,width:V,height:U,crossorigin:Y,disablePictureInPicture:Z=!1,disableRemotePlayback:se=!1}=v,{class:ie,style:oe}=v,ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,le=v.src,ce=ip(le);if(_.transcoded)le=_.transcoded.url,ce="video/mp4";let fe=_.streaming?.hls||_.streaming?.dash;if(fe){if(_.streaming?.hls)le=_.streaming.hls.manifestUrl,ce="application/x-mpegURL";else if(_.streaming?.dash)le=_.streaming.dash.manifestUrl,ce="application/dash+xml"}let ye=_.poster?.url||v.poster,Se=[`id="${ae}"`];if(E)Se.push("controls");if(T)Se.push("autoplay");if(j)Se.push("muted");if(B)Se.push("loop");if(W)Se.push("playsinline");if(Z)Se.push("disablepictureinpicture");if(se)Se.push("disableremoteplayback");if(Y)Se.push(`crossorigin="${Y}"`);if(F){if(Se.push(`data-preload="${z}"`),Se.push('preload="none"'),ye)Se.push(`data-poster="${Xt(ye)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${z}"`),ye)Se.push(`poster="${Xt(ye)}"`);let $e=V||_.metadata?.width,Re=U||_.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Re)Se.push(`height="${Re}"`);if(ie)Se.push(`class="${Xt(ie)}"`);if(oe)Se.push(`style="${Xt(oe)}"`);let Te=` <source ${F?`data-src="${Xt(le)}"`:`src="${Xt(le)}"`} type="${ce}" />`,Ie=`<video ${Se.join(" ")}>
|
|
1942
|
-
${Te}
|
|
1943
|
-
Your browser does not support the video tag.
|
|
1944
|
-
</video>`;if(_.spriteSheet)Ie=`<div class="stx-video-wrapper" data-sprite-sheet="${Xt(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
|
|
1945
|
-
${Ie}
|
|
1946
|
-
</div>`;let _e;if(F)_e=`
|
|
1947
|
-
(function() {
|
|
1948
|
-
var video = document.getElementById('${ae}');
|
|
1949
|
-
if (!video) return;
|
|
1950
|
-
|
|
1951
|
-
var observer = new IntersectionObserver(function(entries) {
|
|
1952
|
-
entries.forEach(function(entry) {
|
|
1953
|
-
if (entry.isIntersecting) {
|
|
1954
|
-
// Load poster
|
|
1955
|
-
if (video.dataset.poster) {
|
|
1956
|
-
video.poster = video.dataset.poster;
|
|
1957
|
-
delete video.dataset.poster;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
// Load sources
|
|
1961
|
-
var sources = video.querySelectorAll('source[data-src]');
|
|
1962
|
-
sources.forEach(function(source) {
|
|
1963
|
-
source.src = source.dataset.src;
|
|
1964
|
-
delete source.dataset.src;
|
|
1965
|
-
});
|
|
1966
|
-
|
|
1967
|
-
// Set preload
|
|
1968
|
-
if (video.dataset.preload) {
|
|
1969
|
-
video.preload = video.dataset.preload;
|
|
1970
|
-
delete video.dataset.preload;
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
video.load();
|
|
1974
|
-
observer.disconnect();
|
|
1975
|
-
}
|
|
1976
|
-
});
|
|
1977
|
-
}, { rootMargin: '50px' });
|
|
1978
|
-
|
|
1979
|
-
observer.observe(video);
|
|
1980
|
-
})();
|
|
1981
|
-
`.trim();let De;if(fe)De=`
|
|
1982
|
-
.stx-video-wrapper {
|
|
1983
|
-
position: relative;
|
|
1984
|
-
width: 100%;
|
|
1985
|
-
}
|
|
1986
|
-
.stx-video-wrapper video {
|
|
1987
|
-
width: 100%;
|
|
1988
|
-
height: auto;
|
|
1989
|
-
}
|
|
1990
|
-
`.trim();return{html:Ie,script:_e,css:De}}function ap(){return Je({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,E)=>{let{src:T,options:j}=Ox(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let B={src:T,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},W={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},F=await na(B,W),V=F.html;if(F.css)V+=`
|
|
1991
|
-
<style>${F.css}</style>`;if(F.script)V+=`
|
|
1992
|
-
<script>${F.script}</script>`;return V},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Ox(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let E=v.trim();if(E.startsWith("@video(")||E.startsWith("("))E=E.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Nx(E),j=cp(T[0],k)||"",B={};if(T[1]){let z=cp(T[1],k);if(typeof z==="object"&&z!==null)B=z;else if(typeof T[1]==="string")try{B=JSON.parse(T[1])}catch{}}return{src:j,options:B}}function Nx(v){let _=[],k="",E=!1,T="",j=0,B=0;for(let z=0;z<v.length;z++){let W=v[z],F=z>0?v[z-1]:"";if((W==='"'||W==="'"||W==="`")&&F!=="\\"){if(!E)E=!0,T=W;else if(W===T)E=!1,T="";else k+=W;continue}if(!E){if(W==="{")j++;if(W==="}")j--;if(W==="[")B++;if(W==="]")B--;if(W===","&&j===0&&B===0){_.push(k.trim()),k="";continue}}k+=W}if(k.trim())_.push(k.trim());return _}function cp(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let E=_[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var fl=ap();import jx from"fs";import Cn from"path";async function Qn(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],E=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let j=await Lx(T,v,_);if(j)E.push(j)}catch(j){if(console.error(`Error building web component ${T.name}:`,j),v.debug)throw j}}return E}async function Lx(v,_,k){let{name:E,file:T,tag:j,extends:B}=v;if(!E||!T||!j)return console.error("Invalid web component configuration, missing required fields:",v),null;let z=null;if(Cn.isAbsolute(T)&&await r(T))z=T;else if(_.componentsDir){let ie=Cn.join(_.componentsDir,T);if(await r(ie))z=ie}if(!z)z=await Zn(T,process.cwd(),_,k);if(!z)return console.error(`Web component source file not found: ${T}`),null;let W=await Bun.file(z).text();k.add(z);let V=(v.outputFormat||"js")==="ts",U=V?zx({name:E,tag:j,baseElement:B,source:W,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):Bx({name:E,tag:j,baseElement:B,source:W,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),Y=_.webComponents?.outputDir||"dist/web-components";await jx.promises.mkdir(Y,{recursive:!0});let Z=V?"ts":"js",se=Cn.join(Y,`${j}.${Z}`);if(await Bun.write(se,U),_.debug)console.log(`Built web component ${E} -> ${se}`);return se}function Bx(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:W=[]}=v,F=T.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 V="";if(z)V=`<link rel="stylesheet" href="${z}">`;return`/**
|
|
1993
|
-
* ${_} Web Component
|
|
1994
|
-
* Auto-generated from stx component
|
|
1995
|
-
*/
|
|
1996
|
-
class ${_.replace(/\W/g,"")} extends ${E} {
|
|
1997
|
-
constructor() {
|
|
1998
|
-
super()
|
|
1999
|
-
this._initialized = false
|
|
2000
|
-
${j?"":"this._slotContent = []"}
|
|
2001
|
-
${j?'this.attachShadow({ mode: "open" })':""}
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
${B?`
|
|
2005
|
-
_createTemplate() {
|
|
2006
|
-
const template = document.createElement('template')
|
|
2007
|
-
template.innerHTML = \`${V}${F}\`
|
|
2008
|
-
${j?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2009
|
-
this._processSlots()
|
|
2010
|
-
}
|
|
2011
|
-
`:`
|
|
2012
|
-
_render() {
|
|
2013
|
-
${j?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${V}${F}\`
|
|
2014
|
-
this._processSlots()
|
|
2015
|
-
}
|
|
2016
|
-
`}
|
|
2017
|
-
|
|
2018
|
-
_processSlots() {
|
|
2019
|
-
${j?`// Shadow DOM handles slot assignment automatically
|
|
2020
|
-
// Listen for slot changes if needed
|
|
2021
|
-
const slots = this.shadowRoot.querySelectorAll('slot')
|
|
2022
|
-
slots.forEach(slot => {
|
|
2023
|
-
slot.addEventListener('slotchange', (e) => {
|
|
2024
|
-
const assignedNodes = slot.assignedNodes()
|
|
2025
|
-
this.dispatchEvent(new CustomEvent('slot-changed', {
|
|
2026
|
-
detail: { slotName: slot.name || 'default', assignedNodes }
|
|
2027
|
-
}))
|
|
2028
|
-
})
|
|
2029
|
-
})`:`// Manual slot processing for non-shadow DOM mode
|
|
2030
|
-
const slots = this.querySelectorAll('[data-slot]')
|
|
2031
|
-
|
|
2032
|
-
// Process named slots
|
|
2033
|
-
slots.forEach(slotEl => {
|
|
2034
|
-
const slotName = slotEl.getAttribute('data-slot')
|
|
2035
|
-
const slottedContent = this._slotContent.filter(
|
|
2036
|
-
node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
|
|
2037
|
-
)
|
|
2038
|
-
if (slottedContent.length > 0) {
|
|
2039
|
-
slotEl.innerHTML = ''
|
|
2040
|
-
slottedContent.forEach(content => slotEl.appendChild(content))
|
|
2041
|
-
}
|
|
2042
|
-
})
|
|
2043
|
-
|
|
2044
|
-
// Process default slot
|
|
2045
|
-
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
|
|
2046
|
-
if (defaultSlot) {
|
|
2047
|
-
const unslottedContent = this._slotContent.filter(
|
|
2048
|
-
node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
|
|
2049
|
-
)
|
|
2050
|
-
if (unslottedContent.length > 0) {
|
|
2051
|
-
defaultSlot.innerHTML = ''
|
|
2052
|
-
unslottedContent.forEach(content => defaultSlot.appendChild(content))
|
|
2053
|
-
}
|
|
2054
|
-
}`}
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
${W.length>0?`
|
|
2058
|
-
static get observedAttributes() {
|
|
2059
|
-
return [${W.map((U)=>`'${U}'`).join(", ")}]
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2063
|
-
if (oldValue !== newValue) {
|
|
2064
|
-
this[name] = newValue
|
|
2065
|
-
${B?"":"if (this._initialized) this._render()"}
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
`:""}
|
|
2069
|
-
|
|
2070
|
-
connectedCallback() {
|
|
2071
|
-
if (this._initialized) return
|
|
2072
|
-
${j?"":"this._slotContent = Array.from(this.childNodes)"}
|
|
2073
|
-
this._initialized = true
|
|
2074
|
-
${B?"this._createTemplate()":"this._render()"}
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
disconnectedCallback() {
|
|
2078
|
-
// Component removed from the DOM
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
// Register the web component
|
|
2083
|
-
customElements.define('${k}', ${_.replace(/\W/g,"")})
|
|
2084
|
-
`}function zx(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:W=[],attributeTypes:F={}}=v,V=_.replace(/\W/g,""),U=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");U=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let Y=z?`<link rel="stylesheet" href="${z}">`:"",Z=(ye)=>{switch(F[ye]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},se=(ye)=>ye.replace(/-([a-z])/g,(Se,$e)=>$e.toUpperCase()),ie=W.map((ye)=>` private _${se(ye)}: ${Z(ye)} | null = null;`).join(`
|
|
2085
|
-
`),oe=W.map((ye)=>{let Se=Z(ye),$e=se(ye);return`
|
|
2086
|
-
get ${$e}(): ${Se} | null {
|
|
2087
|
-
return this._${$e};
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
set ${$e}(value: ${Se} | null) {
|
|
2091
|
-
this._${$e} = value;
|
|
2092
|
-
if (value !== null) {
|
|
2093
|
-
this.setAttribute('${ye}', String(value));
|
|
2094
|
-
}
|
|
2095
|
-
else {
|
|
2096
|
-
this.removeAttribute('${ye}');
|
|
2097
|
-
}
|
|
2098
|
-
}`}).join(`
|
|
2099
|
-
`),ae=W.length>0?`/**
|
|
2100
|
-
* Props interface for ${_}
|
|
2101
|
-
*/
|
|
2102
|
-
export interface ${V}Props {
|
|
2103
|
-
${W.map((ye)=>{let Se=Z(ye);return` ${se(ye)}?: ${Se};`}).join(`
|
|
2104
|
-
`)}
|
|
2105
|
-
}
|
|
2106
|
-
`:"",le=W.length>0?`
|
|
2107
|
-
static get observedAttributes(): string[] {
|
|
2108
|
-
return [${W.map((ye)=>`'${ye}'`).join(", ")}];
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
|
|
2112
|
-
if (oldValue !== newValue) {
|
|
2113
|
-
const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
|
|
2114
|
-
(this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
|
|
2115
|
-
${B?"":"if (this._initialized) this._render();"}
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
private _parseAttributeValue(name: string, value: string | null): unknown {
|
|
2120
|
-
if (value === null) return null;
|
|
2121
|
-
const typeMap: Record<string, string> = ${JSON.stringify(F)};
|
|
2122
|
-
const type = typeMap[name] || 'string';
|
|
2123
|
-
switch (type) {
|
|
2124
|
-
case 'number': return Number(value);
|
|
2125
|
-
case 'boolean': return value !== 'false' && value !== '0';
|
|
2126
|
-
case 'object': try { return JSON.parse(value); }
|
|
2127
|
-
catch { return value; }
|
|
2128
|
-
default: return value;
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
`:"",ce=B?`
|
|
2132
|
-
private _createTemplate(): void {
|
|
2133
|
-
const template = document.createElement('template');
|
|
2134
|
-
template.innerHTML = \`${Y}${U}\`;
|
|
2135
|
-
${j?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
|
|
2136
|
-
this._processSlots();
|
|
2137
|
-
}`:`
|
|
2138
|
-
private _render(): void {
|
|
2139
|
-
${j?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${Y}${U}\`;
|
|
2140
|
-
this._processSlots();
|
|
2141
|
-
}`;return`/**
|
|
2142
|
-
* ${_} Web Component
|
|
2143
|
-
* Auto-generated from stx component (TypeScript)
|
|
2144
|
-
*
|
|
2145
|
-
* @example
|
|
2146
|
-
* \`\`\`html
|
|
2147
|
-
* <${k}></${k}>
|
|
2148
|
-
* \`\`\`
|
|
2149
|
-
*/
|
|
2150
|
-
|
|
2151
|
-
/**
|
|
2152
|
-
* Detail type for slot-changed event
|
|
2153
|
-
*/
|
|
2154
|
-
interface SlotChangeDetail {
|
|
2155
|
-
slotName: string;
|
|
2156
|
-
assignedNodes: Node[];
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
|
-
${ae}
|
|
2160
|
-
/**
|
|
2161
|
-
* ${_} custom element class
|
|
2162
|
-
* @customElement ${k}
|
|
2163
|
-
*/
|
|
2164
|
-
export class ${V} extends ${E} {
|
|
2165
|
-
${ie}
|
|
2166
|
-
private _initialized = false;
|
|
2167
|
-
${j?"":"private _slotContent: Node[] = [];"}
|
|
2168
|
-
|
|
2169
|
-
constructor() {
|
|
2170
|
-
super();
|
|
2171
|
-
${j?'this.attachShadow({ mode: "open" });':""}
|
|
2172
|
-
}
|
|
2173
|
-
${ce}
|
|
2174
|
-
${j?`
|
|
2175
|
-
private _processSlots(): void {
|
|
2176
|
-
const slots = this.shadowRoot!.querySelectorAll('slot');
|
|
2177
|
-
slots.forEach((slot) => {
|
|
2178
|
-
slot.addEventListener('slotchange', () => {
|
|
2179
|
-
const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
|
|
2180
|
-
this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
|
|
2181
|
-
detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
|
|
2182
|
-
}));
|
|
2183
|
-
});
|
|
2184
|
-
});
|
|
2185
|
-
}`:`
|
|
2186
|
-
private _processSlots(): void {
|
|
2187
|
-
const slots = this.querySelectorAll('[data-slot]');
|
|
2188
|
-
slots.forEach((slotEl) => {
|
|
2189
|
-
const slotName = slotEl.getAttribute('data-slot');
|
|
2190
|
-
if (slotName) {
|
|
2191
|
-
const slottedContent = this._slotContent.filter(
|
|
2192
|
-
node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
|
|
2193
|
-
);
|
|
2194
|
-
if (slottedContent.length > 0) {
|
|
2195
|
-
slotEl.innerHTML = '';
|
|
2196
|
-
slottedContent.forEach(content => slotEl.appendChild(content));
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
|
|
2201
|
-
if (defaultSlot) {
|
|
2202
|
-
const unslottedContent = this._slotContent.filter(
|
|
2203
|
-
node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
|
|
2204
|
-
);
|
|
2205
|
-
if (unslottedContent.length > 0) {
|
|
2206
|
-
defaultSlot.innerHTML = '';
|
|
2207
|
-
unslottedContent.forEach(content => defaultSlot.appendChild(content));
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
|
-
}`}
|
|
2211
|
-
${le}
|
|
2212
|
-
${oe}
|
|
2213
|
-
|
|
2214
|
-
connectedCallback(): void {
|
|
2215
|
-
if (this._initialized) return;
|
|
2216
|
-
${j?"":"this._slotContent = Array.from(this.childNodes);"}
|
|
2217
|
-
this._initialized = true;
|
|
2218
|
-
${B?"this._createTemplate();":"this._render();"}
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
disconnectedCallback(): void {
|
|
2222
|
-
// Component removed from the DOM
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
adoptedCallback(): void {
|
|
2226
|
-
// Component moved to a new document
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2230
|
-
// Type augmentation for HTMLElementTagNameMap
|
|
2231
|
-
declare global {
|
|
2232
|
-
interface HTMLElementTagNameMap {
|
|
2233
|
-
'${k}': ${V};
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
// Register the web component
|
|
2238
|
-
customElements.define('${k}', ${V});
|
|
2239
|
-
`}function Wx(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),E=k?k[1].trim():"",T=_,j=[],B=!0;if(E){let U=E.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let Y=U[1],Z=Y.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(Z)T=Z[1];let se=Y.match(/props\s*:\s*\[([\s\S]*?)\]/);if(se)j=se[1].split(",").map((oe)=>oe.trim().replace(/['"`]/g,"")).filter((oe)=>oe.length>0);let ie=Y.match(/shadowDOM\s*:\s*(true|false)/);if(ie)B=ie[1]==="true"}catch{}}let z=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=z?z[1].trim():"",F=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),V=F?F[1].trim():"";return{tag:T,props:j,template:W,styles:V,script:E,shadowDOM:B}}function Fx(v){let{tag:_,props:k,template:E,styles:T,shadowDOM:j}=v,B=_.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),z=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),F=k.map((U)=>`'${U}'`).join(", "),V=k.map((U)=>`
|
|
2240
|
-
get ${U}() {
|
|
2241
|
-
return this.getAttribute('${U}') || '';
|
|
2242
|
-
}
|
|
2243
|
-
set ${U}(value) {
|
|
2244
|
-
if (value) {
|
|
2245
|
-
this.setAttribute('${U}', value);
|
|
2246
|
-
}
|
|
2247
|
-
else {
|
|
2248
|
-
this.removeAttribute('${U}');
|
|
2249
|
-
}
|
|
2250
|
-
}`).join(`
|
|
2251
|
-
`);return`/**
|
|
2252
|
-
* ${B} Web Component
|
|
2253
|
-
* Auto-generated from SFC
|
|
2254
|
-
*/
|
|
2255
|
-
class ${B} extends HTMLElement {
|
|
2256
|
-
constructor() {
|
|
2257
|
-
super();
|
|
2258
|
-
${j?"this.attachShadow({ mode: 'open' });":""}
|
|
2259
|
-
this._render();
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
static get observedAttributes() {
|
|
2263
|
-
return [${F}];
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2267
|
-
if (oldValue !== newValue) {
|
|
2268
|
-
this._render();
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
${V}
|
|
2272
|
-
|
|
2273
|
-
_render() {
|
|
2274
|
-
const template = \`${W?`<style>${W}</style>`:""}${z}\`;
|
|
2275
|
-
|
|
2276
|
-
// Interpolate {{ prop }} with attribute values
|
|
2277
|
-
const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
|
|
2278
|
-
return this.getAttribute(prop) || '';
|
|
2279
|
-
});
|
|
2280
|
-
|
|
2281
|
-
${j?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
connectedCallback() {
|
|
2285
|
-
this._render();
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
customElements.define('${_}', ${B});
|
|
2290
|
-
`}async function lp(v,_,k,E){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),B=(k.__stx_options||{}).componentsDir||"components",z=Cn.isAbsolute(B)?[Cn.join(B,`${T}.stx`),Cn.join(Cn.dirname(E),`${T}.stx`)]:[Cn.join(Cn.dirname(E),B,`${T}.stx`),Cn.join(process.cwd(),B,`${T}.stx`),Cn.join(Cn.dirname(E),`${T}.stx`)],W=null;for(let U of z)if(await r(U)){W=await Bun.file(U).text();break}if(!W)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let F=Wx(W,T);return`<script type="module">
|
|
2291
|
-
${Fx(F)}
|
|
2292
|
-
</script>`}var R={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Rt,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:Hf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:lp,hasEndTag:!1,description:"Include a web component in the template"},Ci,_i,rr,sr,Pf,Mf,Of,Df,Ff,If,ep,fl,...yr],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 Ux(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=Zt.join(T,"resources","views"),B=Zt.join(T,"resources","layouts");if(Ts.existsSync(j)&&Ts.existsSync(B))return{root:"resources",pagesDir:"views"};let z=Zt.join(T,"resources","views","pages");if(Ts.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var up=new Set,sa=["partialsDir","componentsDir","layoutsDir"],pl=new WeakMap;function Hx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return E===T||E.startsWith(`${T}/`)}function Hc(v,_){let k=!v.root,E=Ux(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!up.has(T))up.add(T),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(!pl.has(v)){let T={};for(let j of sa){let B=v[j];if(typeof B==="string"&&B)T[j]=B}pl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of sa){let B=v[j];if(typeof B!=="string"||!B)continue;if(Zt.isAbsolute(B)||Hx(B,T))continue;v[j]=Zt.join(T,B)}}for(let T of sa){let j=v[T];if(typeof j!=="string"||!j||Zt.isAbsolute(j))continue;v[T]=Zt.resolve(_,j)}return v}function qx(v,_){let k=pl.get(v);for(let E of sa){let T=v[E];if(typeof T!=="string"||!T)continue;let j=Zt.isAbsolute(T)?T:Zt.join(_,T);if(Ts.existsSync(j))continue;let B=k?.[E]??T,z=v.root,W=!!z&&z!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${B}"`+(W?`, resolved under root "${z}".`:"."))}}function Kx(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function Xx(v){if(Ai(v.stateDir),v.stateDir=un(),v.cachePath=pn(v.cachePath),v.build)v.build.cacheDir=pn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=pn(v.media.cache.directory);if(v.story)v.story.outDir=pn(v.story.outDir)}var vr=null,Mr=new Map,ra=new Map,Xi=null;async function Es(v,_=Vx){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?Zt.resolve(v):process.cwd(),k=ra.get(_);if(k&&k.signature!==er(k.graph)){let j=Mr.get(_);if(Mr.delete(_),ra.delete(_),!v)vr=null,Xi=null;let{clearComponentCache:B}=await import("./chunk-pdk87hhe.js"),{partialsCache:z}=await import("./chunk-2mxhp1yy.js");if(B(),z.clear(),j&&k.configSignature===tr(k.graph)){let W=j.then(async(F)=>{let V={...k.graph};await $s(V,_),ra.set(_,{graph:V,signature:er(V),configSignature:tr(V)});let U={...F,_layerGraph:V};if(!v)vr=U;return U});return Mr.set(_,W),W}}if(!v){if(vr)return vr;if(Xi)return Xi}let E=Mr.get(_);if(E)return E;let T=(async()=>{let j=[".ts",".js",".mjs",".cjs",".json"],B=j.some((Y)=>Ts.existsSync(Zt.join(_,`stx.config${Y}`))),z=j.some((Y)=>Ts.existsSync(Zt.join(_,"config",`ui${Y}`))),W;if(B&&z){let Y=await Es({name:"ui",cwd:Zt.join(_,"config"),defaultConfig:R,verbose:!1});W=(await Es({name:"stx",alias:"ui",cwd:_,defaultConfig:Y.config,verbose:!1})).config}else W=(await Es({name:"stx",alias:"ui",cwd:_,defaultConfig:R,verbose:!1})).config;if(W.extends!==void 0||k){let Y=await $i(_,R);W=Y.config,ra.set(_,{graph:Y.graph,signature:er(Y.graph),configSignature:tr(Y.graph)})}if(W.runtimeConfig){let{resolveRuntimeConfig:Y}=await import("./chunk-fnnhekdc.js");Y(W.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-6yja1c8e.js");await Z(_,W.runtimeConfig)}Kx(W),Xx(W),Hc(W,_),qx(W,_);let F=[],V=new Set((W.plugins??[]).map((Y)=>typeof Y==="string"?Y:Y[0]));for(let Y of W.componentPackages??["@stacksjs/components"]){let Z=`${Y}/stx-plugin`;if(V.has(Z)||V.has(Y))continue;try{u.resolve(Z,{paths:[_]}),F.push(Z)}catch{}}let U=[...W.plugins??[],...F];if(U.length>0){let{pluginManager:Y}=await import("./chunk-8bwp2m95.js"),Z=[],se=[];for(let ie of U){let oe=typeof ie==="string"?ie:ie[0],ae=typeof ie==="string"?{}:ie[1]||{};try{let le,ce;try{let ye=u.resolve(oe,{paths:[_]});le=await import(ye),ce=Zt.dirname(ye)}catch{let ye=Zt.resolve(_,oe);le=await import(ye),ce=Zt.dirname(ye)}let fe=le.default||le;if(!Y.has(fe.name))await Y.register(fe,W);if(fe.components){let ye=Array.isArray(fe.components)?fe.components:[fe.components];for(let Se of ye)Z.push(Zt.resolve(ce,Se))}if(fe.pages){let ye=Zt.resolve(ce,fe.pages),Se=ae.path||"/";se.push({dir:ye,prefix:Se})}if(fe.setup){let ye={addDirective:(Se)=>{W.customDirectives=W.customDirectives||[],W.customDirectives.push(Se)},addRoute:(Se,$e)=>{W.apiRoutes=W.apiRoutes||{},W.apiRoutes[Se]=$e},addMiddleware:(Se)=>{W.middleware=W.middleware||[],W.middleware.push(Se)},pluginDir:ce,config:W};await fe.setup(ae,ye)}process.stderr.write(`[stx] Plugin loaded: ${fe.name||oe}
|
|
2293
|
-
`)}catch(le){console.warn(`[stx] Failed to load plugin ${oe}:`,le.message)}}W._pluginComponentDirs=Z,W._pluginPageDirs=se}return W})();if(Mr.set(_,T),T.catch(()=>{if(Mr.get(_)===T)Mr.delete(_)}),!v)Xi=T,T.then((j)=>{vr=j}).catch(()=>{});return T}var A=new Proxy(R,{get(v,_){if(vr&&_ in vr)return vr[_];if(!Xi)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function su(v){return v}function ou(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let E=["auto","manual","sections"];if(!E.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let E=["json","yaml","yml","js"];if(!E.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let E=["AA","AAA"];if(!E.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let E=["progressive","islands"];if(!E.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${E.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let E=["none","eager","lazy"];if(!E.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!E.timing||!["before","after"].includes(E.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let E=["fullscreen","standalone","minimal-ui","browser"];if(!E.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let E=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!E.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.routes){let E=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,j)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${j}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!E.includes(T.strategy))_.push({path:`pwa.routes[${j}].strategy`,message:`PWA route strategy must be one of: ${E.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${j}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${j}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let E=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((j)=>!E.includes(j)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var ml=new Map;async function ue(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await Zx.promises.stat(v)).mtime.getTime();if(_.cache&&ml.has(v)){let U=ml.get(v);if(U.updatedAt>=E)return{content:U.content,data:U.data}}let T=await Bun.file(v).text(),{data:j,content:B}=zn(T),z=_.markdown||A.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},F=je(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)F=await Jx(F,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let V={content:F,data:j||{}};if(_.cache)ml.set(v,{...V,updatedAt:E});return V}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,v,"",0,""),data:{}}}}var ia=null;async function Jx(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ia)try{ia=await Gx({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,W,F,V)=>{let U=V.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),Y=F||(k?"text":"");if(!Y)return z;try{if(!ia.getSupportedLanguages().includes(Y))return z;return(await ia.highlight(U,Y,{theme:_})).html}catch(Z){console.error(`Error highlighting code block with language ${F}:`,Z)}return z},j=v,B=v.matchAll(E);for(let z of B){let[W,F,V,U]=z,Y=await T(W,F,V,U);j=j.replace(W,Y)}return j}async function dp(v,_,k="",E={}){return await Yx(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,W,F)=>{try{let V=z;if(!gl.isAbsolute(z))V=gl.resolve(gl.dirname(k),z);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let le=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ce of le){let fe=ce.indexOf(":");if(fe>0){let ye=ce.substring(0,fe).trim(),Se=ce.substring(fe+1).trim(),$e=Se.startsWith('"')&&Se.endsWith('"'),Re=Se.startsWith("'")&&Se.endsWith("'");if($e||Re)Se=Se.substring(1,Se.length-1);U[ye]=Se}}}}catch(ae){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:Y,data:Z}=await ue(V,E),se={..._,...Z,...U},ie=Y,oe=/\{\{([^}]+)\}\}/g;return ie=ie.replace(oe,(ae,le)=>{let ce=le.trim();return se[ce]!==void 0?String(se[ce]):ae}),ie}catch(V){let U=V instanceof Error?V.message:String(V);return g("Markdown File",`Error including markdown file: ${U}`,k,v,F,B)}})}async function Yx(v,_,k){let E=[],T;while((T=_.exec(v))!==null){let z=T[0],W=T.index,F=T;E.push(k(...F).then((V)=>({match:z,replacement:V,index:W})))}let j=await Promise.all(E);j.sort((z,W)=>W.index-z.index);let B=v;for(let{match:z,replacement:W}of j)B=B.replace(z,()=>W);return B}function wr(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Sr(v,_){let k=Qx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function Qx(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=S(v,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,E),endPos:E+1}}function eb(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Or(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let W=B.exec(v),F=z.exec(v),V=W?W.index:1/0,U=F?F.index:1/0;if(V<U)T++,j=V+W[0].length;else if(U<1/0){if(T--,T===0)return U;j=U+F[0].length}else break}return-1}function fp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=Sr(v,E);if(!T)return null;let j=T.endPos,B=Or(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),W=[],F=0,V="if",U=T.expression,Y=0,Z=0;while(F<z.length){let se=z.indexOf("@",F);if(se===-1)break;F=se;let ie=z.substring(se);if(eb(z,se)){F++;continue}if(/^@if\s*\(/.test(ie)){Z++,F++;continue}if(/^@endif(?![a-z])/.test(ie)){Z--,F+=6;continue}if(Z===0){let oe=ie.match(/^@elseif\s*/);if(oe){W.push({type:V,condition:U,content:z.substring(Y,F),start:j+Y,end:j+F});let ae=F+oe[0].length,le=Sr(z,ae);if(!le){F++;continue}V="elseif",U=le.expression,F=le.endPos,Y=F;continue}else if(/^@else(?![a-z])/.test(ie)){W.push({type:V,condition:U,content:z.substring(Y,F),start:j+Y,end:j+F}),V="else",U=void 0,F+=5,Y=F;continue}}F++}return W.push({type:V,condition:U,content:z.slice(Y),start:j+Y,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:W,start:_,end:B+6}}function Zi(v){let _=[],k=/@if\s*\(/g,E=k.exec(v);while(E!==null){if(_.some((B)=>E.index>B.start&&E.index<B.end)){E=k.exec(v);continue}let j=fp(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function oa(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((ie)=>j.index>ie.start&&j.index<ie.end)){j=T.exec(v);continue}let z=j.index,W=z+j[0].length-1,F=S(v,"(",")",W);if(F===-1){j=T.exec(v);continue}let V=v.slice(W+1,F),U=F+1,Y=Or(v,_,k,U);if(Y===-1){j=T.exec(v);continue}let Z=v.slice(U,Y),se=Y+`@${k}`.length;E.push({fullMatch:v.slice(z,se),name:_,params:V,content:Z,start:z,end:se}),T.lastIndex=se,j=T.exec(v)}return E}function hl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=Sr(v,E);if(!T)return null;let j=T.endPos,B=Or(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),W=[],F=0,V=null,U=0;while(F<z.length){let Y=z.slice(F),Z=Y.match(/^@switch\s*\(/),se=Y.match(/^@endswitch(?![a-z])/);if(Z){if(U++,V)V.content+=Z[0];F+=Z[0].length;continue}if(se){if(U--,V)V.content+=se[0];F+=se[0].length;continue}if(U>0){if(V)V.content+=z[F];F++;continue}let ie=Y.match(/^@case\s*/),oe=Y.match(/^@default(?![a-z])/),ae=Y.match(/^@break(?![a-z])/);if(ie&&Y.startsWith("@case")){if(V)W.push(V);let le=F+ie[0].length,ce=Sr(z,le);if(!ce){F++;continue}V={type:"case",value:ce.expression,content:""},F=ce.endPos}else if(oe&&Y.startsWith("@default")){if(V)W.push(V);V={type:"default",content:""},F+=oe[0].length}else if(ae&&Y.startsWith("@break"))F+=ae[0].length;else{if(V)V.content+=z[F];F++}}if(V)W.push(V);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:W,start:_,end:B+10}}function sb(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=hl(E,B);if(!z)break;try{let W;if(p(z.expression))W=c(z.expression,Object.keys(_))(...Object.values(_));else W=l(z.expression,_);let F="",V=!1;for(let U of z.cases)if(U.type==="default"){if(!V)F=U.content.trim()}else try{let Y;if(U.value&&p(U.value))Y=c(U.value,Object.keys(_))(...Object.values(_));else if(U.value)Y=l(U.value,_);if(W===Y){F=U.content.trim(),V=!0;break}}catch{continue}E=E.substring(0,B)+F+E.substring(z.end),T=!0}catch(W){let F=W instanceof Error?W.message:String(W),V=i("Switch",`Error evaluating @switch expression: ${F}`,t.EVALUATION_ERROR);E=E.substring(0,B)+V+E.substring(z.end);break}}return E}function ib(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function ob(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function fr(v,_,k){let{masked:E,scripts:T}=ib(v);return ob(ab(E,_,k),T)}function ab(v,_,k){let E=v;E=sb(E,_,k);{let j=!0;while(j){j=!1;let B=E.match(/@unless\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=Sr(E,z+7);if(!W)break;let F=W.endPos,V=Or(E,"unless","endunless",F);if(V===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=E.slice(F,V),Y=W.expression,Z=-1;{let ie=0,oe=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,le=/@else(?![a-z])/g,ce=[],fe;while((fe=oe.exec(U))!==null)ce.push({pos:fe.index,type:"open"});while((fe=ae.exec(U))!==null)ce.push({pos:fe.index,type:"close"});while((fe=le.exec(U))!==null)ce.push({pos:fe.index,type:"else"});ce.sort((ye,Se)=>ye.pos-Se.pos);for(let ye of ce)if(ye.type==="open")ie++;else if(ye.type==="close")ie--;else if(ye.type==="else"&&ie===0){Z=ye.pos;break}}let se;if(Z!==-1){let ie=U.slice(0,Z),oe=U.slice(Z+5);se=`@if (${Y})${oe}@else ${ie}@endif`}else se=`@if (!(${Y}))${U}@endif`;E=E.substring(0,z)+se+E.substring(V+10),j=!0}}E=xl(E,_,k),E=bl(E,_,k),E=yl(E,_);let T=()=>{let j=Zi(E);if(j.length===0)return!1;let B=Array(j.length);for(let F=j.length-1;F>=0;F--){let V=j[F];try{let U="",Y=!1;for(let Z of V.branches){if(Y)break;if(Z.type==="else")U=Z.content,Y=!0;else try{if(Z.condition?Li(Z.condition,_):!1)U=Z.content,Y=!0}catch(se){U=i(Z.type==="if"?"If":"Elseif",`Error in @${Z.type}(${Z.condition}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR),Y=!0}}B[F]=U}catch(U){let Y=U instanceof Error?U.message:String(U);B[F]=i("If",`Error processing @if block: ${Y}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),W=0;for(let F=0;F<j.length;F++){let V=j[F];z[F*2]=E.slice(W,V.start),z[F*2+1]=B[F],W=V.end}return z[j.length*2]=E.slice(W),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function pp(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let E=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){E.push(v[_+1]),_+=2;continue}if(T===k){_++;break}E.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:E.join(""),consumed:_}}function yl(v,_){let k=v;function E(z,W,F,V){let U=1,Y=V,Z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),se=new RegExp(`@${F}(?![a-z])`,"g");while(Y<z.length&&U>0){Z.lastIndex=Y,se.lastIndex=Y;let ie=Z.exec(z),oe=se.exec(z),ae=ie?ie.index:1/0,le=oe?oe.index:1/0;if(ae<le)U++,Y=ae+ie[0].length;else if(le<1/0){if(U--,U===0)return le;Y=le+oe[0].length}else break}return-1}function T(z,W,F){let V=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),Y=new RegExp(`@${F}(?![a-z])`,"g"),Z=/@else(?![a-z])/g,se=[],ie;while((ie=U.exec(z))!==null)se.push({pos:ie.index,type:"open"});while((ie=Y.exec(z))!==null)se.push({pos:ie.index,type:"close"});while((ie=Z.exec(z))!==null)se.push({pos:ie.index,type:"else"});se.sort((oe,ae)=>oe.pos-ae.pos);for(let oe of se)if(oe.type==="open")V++;else if(oe.type==="close")V--;else if(oe.type==="else"&&V===0)return oe.pos;return-1}{let z=!0;while(z){z=!1;let W=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let F=W.index,V,U,Y=k.slice(F+5),Z=pp(Y);if(Z)V=Z.value,U=F+5+Z.consumed;else U=F+5;let se=E(k,"auth","endauth",U);if(se===-1){console.warn(`[stx] @auth directive at position ${F} has no matching @endauth \u2014 the block was skipped.`);break}let ie=k.slice(U,se),oe=T(ie,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=V?wr(`auth?.check && auth?.user?.[${V}]`,_):wr("auth?.check",_);let le;if(oe!==-1){let ce=ie.slice(0,oe),fe=ie.slice(oe+5);le=ae?ce:fe}else le=ae?ie:"";k=k.substring(0,F)+le+k.substring(se+8),z=!0}}{let z=!0;while(z){z=!1;let W=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let F=W.index,V,U,Y=k.slice(F+6),Z=pp(Y);if(Z)V=Z.value,U=F+6+Z.consumed;else U=F+6;let se=E(k,"guest","endguest",U);if(se===-1){console.warn(`[stx] @guest directive at position ${F} has no matching @endguest \u2014 the block was skipped.`);break}let ie=k.slice(U,se),oe=T(ie,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=V?wr(`!auth?.check || !auth?.user?.[${V}]`,_):wr("!auth?.check",_);let le;if(oe!==-1){let ce=ie.slice(0,oe),fe=ie.slice(oe+5);le=ae?ce:fe}else le=ae?ie:"";k=k.substring(0,F)+le+k.substring(se+9),z=!0}}function j(z,W,F){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let V=[z];if(W)V.push(W);if(F){let U=wr(F,_);V.push(U)}return _.permissions.check(...V)}catch{return!1}return!1}function B(z){let W=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let z of["can","cannot"]){let W=`end${z}`,F=z==="can"?"elsecan":"elsecannot",V=!0;while(V){V=!1;let U=k.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let Y=U.index,Z=k.slice(Y+`@${z}`.length),se=B(Z);if(!se)break;let ie=Y+`@${z}`.length+se.paramsEnd,oe=E(k,z,W,ie);if(oe===-1){console.warn(`[stx] @${z} directive at position ${Y} has no matching @${W} \u2014 the block was skipped.`);break}let ae=k.slice(ie,oe),le=[],ce=0,fe=new RegExp(`@${z}\\s*\\(`,"g"),ye=new RegExp(`@${W}(?![a-z])`,"g"),Se=new RegExp(`@${F}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Re=[],Ae;while((Ae=fe.exec(ae))!==null)Re.push({pos:Ae.index,type:"open"});while((Ae=ye.exec(ae))!==null)Re.push({pos:Ae.index,type:"close"});while((Ae=Se.exec(ae))!==null)Re.push({pos:Ae.index,type:"elseDirective"});while((Ae=$e.exec(ae))!==null)Re.push({pos:Ae.index,type:"else"});Re.sort((Oe,Pe)=>Oe.pos-Pe.pos);for(let Oe of Re){if(Oe.type==="open"){ce++;continue}if(Oe.type==="close"){ce--;continue}if(ce===0)le.push(Oe)}let Te=[],Ie=0;for(let Oe=0;Oe<le.length;Oe++){let Pe=le[Oe];if(Te.push({content:ae.slice(Ie,Pe.pos),ability:void 0}),Pe.type==="elseDirective"){let Le=ae.slice(Pe.pos+`@${F}`.length),ct=B(Le);if(ct){Te[Te.length-1]={content:ae.slice(Ie,Pe.pos)},Ie=Pe.pos+`@${F}`.length+ct.paramsEnd,Te.push({content:"",ability:ct.ability,type:ct.type,id:ct.id}),Te.pop();let yt=le[Oe+1],ft=yt?yt.pos:ae.length;Te.push({content:ae.slice(Ie,ft),ability:ct.ability,type:ct.type,id:ct.id}),Ie=ft}}else Ie=Pe.pos+5}if(Ie<ae.length){let Oe=Te[Te.length-1];if(le.length>0&&le[le.length-1].type==="else")Te.push({content:ae.slice(Ie),isFinalElse:!0});else if(Te.length===0)Te.push({content:ae.slice(Ie)})}let _e=j(se.ability,se.type,se.id),De=z==="can"?_e:!_e,Ne="";if(De)Ne=Te[0]?.content||"";else{let Oe=!1;for(let Pe=1;Pe<Te.length;Pe++){let Le=Te[Pe];if(Le.isFinalElse){Ne=Le.content,Oe=!0;break}if(Le.ability){let ct=j(Le.ability,Le.type,Le.id);if(z==="can"?ct:!ct){Ne=Le.content,Oe=!0;break}}}if(!Oe&&Te.length>0){let Pe=Te[Te.length-1];if(Pe.isFinalElse)Ne=Pe.content}}k=k.substring(0,Y)+Ne+k.substring(oe+`@${W}`.length),V=!0}}return k}function xl(v,_,k){let E=v;function T(j,B,z,W,F){let V=!0;while(V){V=!1;let U=new RegExp(`@${B}\\s*\\(`),Y=j.match(U);if(!Y||Y.index===void 0)break;let Z=Y.index,se=Sr(j,Z+`@${B}`.length);if(!se)break;let ie=se.endPos,oe=Or(j,B,z,ie);if(oe===-1){console.warn(`[stx] @${B} directive at position ${Z} has no matching @${z} \u2014 the block was skipped.`);break}let ae=j.slice(ie,oe),le=se.expression,ce=-1,fe=0,ye=0;while(ye<ae.length){let Se=ae.indexOf("@",ye);if(Se===-1)break;let $e=ae.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){fe++,ye=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){fe--,ye=Se+1;continue}if(fe===0&&/^@else(?![a-z])/.test($e)){ce=Se;break}ye=Se+1}try{let Se=W(le.trim()),$e;if(ce!==-1){let Re=ae.slice(0,ce),Ae=ae.slice(ce+5);$e=Se?Re:Ae}else $e=Se?ae:"";j=j.substring(0,Z)+$e+j.substring(oe+`@${z}`.length),V=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Re=i(F,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,Z)+Re+j.substring(oe+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=wr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=wr(j,_);return B===void 0||B===null||B===""||B===0||B===!1||Array.isArray(B)&&B.length===0||typeof B==="object"&&B!==null&&Object.keys(B).length===0},"Empty"),E}function bl(v,_,k){let E=v,T="development";function j(B,z,W,F){let V=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),Y=new RegExp(`^@${z}(?![a-z])`),Z=new RegExp(`^@${W}(?![a-z])`),se=B,ie=!0;while(ie){ie=!1,V.lastIndex=0;let oe=V.exec(se);if(!oe)break;let ae=oe.index,le=ae+oe[0].length;if(z==="env"){let _e=se.substring(le).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;le+=_e[0].length,F=T===_e[2]}let ce=1,fe=le,ye=-1;while(ce>0&&fe<se.length){V.lastIndex=fe,U.lastIndex=fe;let _e=V.exec(se),De=U.exec(se),Ne=_e?_e.index:1/0,Oe=De?De.index:1/0;if(Ne<Oe)ce++,fe=Ne+_e[0].length;else if(Oe<1/0){if(ce--,ce===0){ye=Oe;break}fe=Oe+De[0].length}else break}if(ye===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${W} \u2014 the block was skipped.`);break}let Se=se.substring(le,ye),$e=-1,Re=0,Ae=0;while(Ae<Se.length){let _e=Se.indexOf("@",Ae);if(_e===-1)break;let De=Se.substring(_e);if(Y.test(De)){Re++,Ae=_e+1;continue}if(Z.test(De)){Re--,Ae=_e+1;continue}if(Re===0&&/^@else(?![a-z])/.test(De)){$e=_e;break}Ae=_e+1}let Te;if($e!==-1){let _e=Se.slice(0,$e),De=Se.slice($e+5);Te=F?_e:De}else Te=F?Se:"";let Ie=`@${W}`.length;se=se.substring(0,ae)+Te+se.substring(ye+Ie),ie=!0}return se}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",T==="production"),E=j(E,"development","enddevelopment",T==="development"),E=j(E,"staging","endstaging",T==="staging"),E=j(E,"testing","endtesting",T==="testing"),E}var gp=new WeakMap;function mp(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function aa(v,_){if(!v)return _?.nonceGenerator?.()??mp();let k=gp.get(v);if(!k)k=_?.nonceGenerator?.()??mp(),gp.set(v,k);return k}function cb(v,_){let k=[];for(let[E,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(E);continue}if(Array.isArray(T)){let j=[...T];if(_&&(E==="script-src"||E==="style-src"))j=j.filter((B)=>!B.startsWith("'nonce-")),j.push(`'nonce-${_}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function hp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${cb(v,_).replace(/&/g,"&").replace(/"/g,""")}">`}function yp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let E=_.useNonce?aa(k,_):void 0,T=hp(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
|
|
2294
|
-
${T}`)}function xp(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<style nonce="${_}"${T}>`}),k}function bp(v,_,k,E){let T=v,j=E.csp;if(T=T.replace(/@csp\b/g,()=>{if(!j?.enabled||!j.directives)return"<!-- CSP not configured -->";let B=j.useNonce?aa(_,j):void 0;return hp(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return aa(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=aa(_,j);return T}import lb from"crypto";var ub=40,vp="_token",vl=null;function db(v=ub){let _=lb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return vl=_,_}function fb(){if(!vl)db();return vl}function pb(v=vp){let _=fb();return`<input type="hidden" name="${v}" value="${_}">`}function wp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>pb(E||vp))}async function Sp(v,_,k,E){if(!E.customDirectives||E.customDirectives.length===0)return v;let T=v;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)T=await gb(T,j,_,k,E);else T=await mb(T,j,_,k,E)}return T}async function gb(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,W=`@end${j}`,F=v,V=Tr(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],Y=V.exec(F);while(Y!==null){let[Z,se="",ie=""]=Y,oe=Y.index||0;try{let ae=se?$p(_,se):[],le=ie.trim(),ce=await B(le,ae,k,E);U.push({original:Z,processed:ce,startIndex:oe})}catch(ae){let le=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${j}:`,ae);U.push({original:Z,processed:i("CustomDirective",`Error in @${j}${se?`(${se})`:""}: ${le}`,t.EVALUATION_ERROR),startIndex:oe})}Y=V.exec(F)}for(let Z=U.length-1;Z>=0;Z--){let{original:se,processed:ie}=U[Z];F=F.replace(se,ie)}return F}async function mb(v,_,k,E,T){let{name:j,handler:B}=_,z=v,W=[],F=[];if(_.rawParams){for(let Y of Ms(z,Tr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(Y.end!==-1)F.push({fullMatch:Y.call,paramString:Y.args,startIndex:Y.start})}else{let Y=Tr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Y.lastIndex=0;let Z=Y.exec(z);while(Z!==null)F.push({fullMatch:Z[0],paramString:Z[1]??"",startIndex:Z.index||0}),Z=Y.exec(z)}for(let{fullMatch:Y,paramString:Z,startIndex:se}of F)try{let ie=$p(_,Z),oe=await B("",ie,k,E);W.push({original:Y,processed:oe,startIndex:se})}catch(ie){let oe=ie instanceof Error?ie.message:String(ie);if(T.debug)console.error(`Error processing custom directive @${j}:`,ie);W.push({original:Y,processed:i("CustomDirective",`Error in @${j}(${Z}): ${oe}`,t.EVALUATION_ERROR),startIndex:se})}let V=Tr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),U=V.exec(z);while(U!==null){let[Y]=U,Z=U.index||0;try{let se=await B("",[],k,E);W.push({original:Y,processed:se,startIndex:Z})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${j}:`,se);W.push({original:Y,processed:i("CustomDirective",`Error in @${j}: ${ie}`,t.EVALUATION_ERROR),startIndex:Z})}U=V.exec(z)}for(let Y=W.length-1;Y>=0;Y--){let{original:Z,processed:se}=W[Y];z=z.replace(Z,se)}return z}function $p(v,_){return v.rawParams?Qe(_):hb(_)}function hb(v){if(!v.trim())return[];let _=[],k="",E=!1,T="";for(let j=0;j<v.length;j++){let B=v[j];if((B==='"'||B==="'")&&(j===0||v[j-1]!=="\\"))if(!E)E=!0,T=B;else if(B===T)E=!1;else k+=B;else if(B===","&&!E)_.push(k.trim()),k="";else k+=B}if(k.trim())_.push(k.trim());return _.map((j)=>{let B=j.trim();if(B.startsWith('"')&&B.endsWith('"')||B.startsWith("'")&&B.endsWith("'"))return B.substring(1,B.length-1);return B})}var _p=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,kp=/^[A-Za-z_$][\w$]*$/,yb=new Set(["light","dark","system"]);function Nr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function xb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Nr(_.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(Nr(E.key,"colorMode.key"),Nr(E.attribute,"colorMode.attribute"),Nr(E.default,"colorMode.default"),!kp.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!_p.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!yb.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Nr(k.key,"appearance.key"),Nr(k.attribute,"appearance.attribute"),Nr(k.default,"appearance.default"),!kp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!_p.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");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:E.key,attribute:E.attribute,default:E.default},respectExisting:_.respectExisting===!0}}function bb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function vb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${bb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function wb(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}function Ep(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=wb(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),W=l(`(${z})`,_),F=vb(xb(W));k=k.slice(0,T.index)+F+k.slice(B+1),E.lastIndex=T.index+F.length}return k}import Sb from"crypto";function qt(v){return String(v??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Rp={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function ca(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function Rn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ws(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${qt(_)}"`}function wl(v,_,k){if(!_)return"";let E="";if(!/\baria-invalid\s*=/i.test(k))E+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))E+=` aria-describedby="${qt(`${Rn(v)}-error`)}"`;return E}function $b(){return Sb.randomUUID()}function la(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=$b();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${qt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(E,T)=>{let j=T.toUpperCase();if(T&&!["GET","POST"].includes(j))return`<input type="hidden" name="_method" value="${qt(j)}">`;return E}),k}function Ap(v,_,k=Rp){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,W,F="")=>{let V=j||B||"POST",U=z||W||"",Y=$r(F),Z=V.toUpperCase(),se=["GET","POST"].includes(Z)?Z:"POST",ie=`<form method="${qt(se)}" action="${qt(U)}"${Y?` ${Y}`:""}>`;if(ie+=`
|
|
2295
|
-
${la("@csrf",_)}`,!["GET","POST"].includes(Z))ie+=`
|
|
2296
|
-
${la(`@method('${Z}')`,_)}`;return ie}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,W,F="")=>{let V=j||B||"",U=z||W||"",Y=$r(F),Z=Gi(V,_),se=Z!==void 0&&Z!==null?Z:U||"",ie=Y.match(/type=['"]([^'"]+)['"]/i),oe=ie?ie[1]:"text",ae=Ji(V,_),le=Y.match(/class=['"]([^'"]+)['"]/i),ce=ca(le?le[1]:"",k.input,ae,k.inputError),fe=Y.replace(/class=['"][^'"]+['"]/i,"");return fe=fe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${qt(oe)}" name="${qt(V)}"${Ws(Y,Rn(V))} value="${qt(se)}" class="${ce}"${wl(V,ae,Y)}${fe?` ${fe}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let W=$r(B),F=Gi(j,_)||z.trim(),V=Ji(j,_),U=W.match(/class=['"]([^'"]+)['"]/i),Y=ca(U?U[1]:"",k.input,V,k.inputError),Z=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${qt(j)}"${Ws(W,Rn(j))} class="${Y}"${wl(j,V,W)}${Z?` ${Z}`:""}>${qt(F)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let W=$r(B),F=Gi(j,_),V=Ji(j,_),U=W.match(/class=['"]([^'"]+)['"]/i),Y=ca(U?U[1]:"",k.input,V,k.inputError),Z=W.replace(/class=['"][^'"]+['"]/i,""),se=z;if(F!==void 0)se=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(ie,oe,ae)=>{if((Array.isArray(F)?F.some((ce)=>String(ce)===ae):String(F)===ae)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return ie});return`<select name="${qt(j)}"${Ws(W,Rn(j))} class="${Y}"${wl(j,V,W)}${Z?` ${Z}`:""}>${se}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let W=B===void 0?"1":B,F=B===void 0?Rn(j):`${Rn(j)}-${Rn(W)}`,V=$r(z),U=Gi(j,_),Y=U!==void 0&&(Array.isArray(U)?U.some((oe)=>String(oe)===W):U===!0||String(U)===W),Z=V.match(/class=['"]([^'"]+)['"]/i),se=Z?Z[1]:k.checkInput,ie=V.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${qt(j)}"${Ws(V,F)} value="${qt(W)}" class="${se}"${Y?" checked":""}${ie?` ${ie}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let W=$r(z),F=Gi(j,_),V=F!==void 0&&F===B,U=W.match(/class=['"]([^'"]+)['"]/i),Y=U?U[1]:k.checkInput,Z=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${qt(j)}"${Ws(W,`${Rn(j)}-${Rn(B)}`)} value="${qt(B)}" class="${Y}"${V?" checked":""}${Z?` ${Z}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=$r(B),W=z.match(/accept=['"]([^'"]+)['"]/i),F=W?W[1]:"",V=z.includes("multiple"),U=Ji(j,_),Y=z.match(/class=['"]([^'"]+)['"]/i),Z=ca(Y?Y[1]:"",k.input,U,k.inputError),se=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),ie=[`<input type="file" name="${qt(j)}"${Ws(z,Rn(j))}`,`class="${Z}"`];if(F)ie.push(`accept="${qt(F)}"`);if(V)ie.push("multiple");if(se)ie.push(se);return`${ie.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let W=$r(B),F=W.match(/class=['"]([^'"]+)['"]/i),V=F?F[1]:k.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${qt(Rn(j))}" class="${V}"${U?` ${U}`:""}>${z}</label>`}),E}function Tp(v,_,k=Rp){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Ji(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return Cp(T,_);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Cp(T,_)}let F=W.trim();if(p(F)){let V=l(F,_);return V!==void 0?String(V):F}return F}catch{return W}});return`<div id="${qt(`${Rn(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Ji(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Cp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function Gi(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let E=v.slice(0,-2);if(k=_[E],k!==void 0)return k}return _[v]}function $r(v){if(!v.trim())return"";let _=[],k=v.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=E.exec(k))!==null){let[,j,,B]=T;_.push(`${j}="${B.trim()}"`)}return _.join(" ")}var Yi=/<\/?template\b[^>]*>/gi,_b=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function kb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return _b.test(_)}function ee(v){Yi.lastIndex=0;let _;while((_=Yi.exec(v))!==null){if(_[0].startsWith("</")||kb(_[0]))continue;let k=_.index,E=Yi.lastIndex,T=1,j;while((j=Yi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Yi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import zt from"path";import{existsSync as Zv}from"fs";class Ip{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,E){let T=Va(v,E);if(T!==void 0)return T;for(let j of Ua(v,_,k,E))if(await r(j))return j;return null}}var Vs=new Ip;function Bt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var _r="\x00stx-boolean-attribute";function Sl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Eb=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function $l(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Eb.has(_)}function kr(v,_){let k=[];for(let[E,T]of Object.entries(v.static)){if(_.has(E))continue;let j=v.staticNames?.[E]??E;if(typeof T==="boolean"){if(T)k.push(Bt(j));continue}if(T===_r){k.push(Bt(j));continue}k.push(`${Bt(j)}="${Bt(Sl(String(T)))}"`)}return k}function Er(v,_){let k=[];for(let[E,T]of Object.entries(v.serverDynamic??{})){if(_.has(E))continue;if(T===null||T===void 0||T===!1)continue;let j=v.serverDynamicNames?.[E]??E;if(T===!0){k.push(Bt(j));continue}if(typeof T==="object")continue;k.push(`${Bt(j)}="${Bt(Sl(String(T)))}"`)}return k}function Us(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cb(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var _l={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=Cb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),j=typeof v.static.activeClass==="string"?v.static.activeClass:"active",B=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",z=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,W=[];if(E.reactive)W.push(`:href="${Us(E.value)}"`);else W.push(`href="${Us(ki(E.value,"navigable"))}"`);if(T)W.push(`class="${Us(T)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${Us(j)}"`),W.push(`data-stx-exact-active-class="${Us(B)}"`),z)W.push("data-stx-prefetch");let F=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(F)W.push(`data-stx-active-match="${Us(F)}"`);let V=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return W.push(...kr(v,V)),W.push(...Er(v,V)),`<a ${W.join(" ")}>${_}</a>`}};import{createHash as Up}from"crypto";import tn from"fs";import Gt from"path";import{decode as Ob,generateThumbHash as Nb}from"ts-images";import{createImageDeliveryCatalog as jp}from"ts-images/delivery";import kl from"fs";function ua(v,_,k){let E=Buffer.alloc(k),T=kl.readSync(v,E,0,k,_);return E.subarray(0,T)}function El(v){if(v.length<25)return!1;let _=(E,T)=>String.fromCharCode(...v.subarray(E,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Cl(v){let _;try{_=kl.openSync(v,"r");let k=ua(_,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 T=8;for(let j=0;j<64;j++){let B=ua(_,T,8);if(B.length<8)return"unknown";let z=B.toString("latin1",4,8);if(z==="tRNS")return"possible";if(z==="IDAT"||z==="IEND")return"none";T+=12+B.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(El(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)kl.closeSync(_)}}import Rb from"fs";import da from"os";import{join as Pp}from"path";import{fileURLToPath as Dp}from"url";import{Worker as Mp}from"worker_threads";var pa=Symbol("stx.image-worker.unavailable");function Ab(v=typeof da.availableParallelism==="function"?da.availableParallelism():da.cpus().length){return Math.max(1,Math.min(2,v-1))}var fa=0,Np=[];async function Tb(){if(fa<Ab()){fa++;return}await new Promise((v)=>Np.push(v)),fa++}function Ib(){fa--,Np.shift()?.()}var Pb="@stacksjs/stx/builtins/image-warmup-worker";function Db(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Rb.existsSync(Dp(k)))return Dp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Pb,v):void 0;return k&&Mb(k)?k:void 0}catch{return}}function Mb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Pp(_.BUN_INSTALL||Pp(da.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Op=!1;function Qi(v){if(!Op)Op=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return pa}function Rl(v){return v instanceof Error?v.message:String(v)}async function Al(v,_){if(typeof Mp!=="function")return Qi("node:worker_threads has no Worker in this runtime");let k=Db();if(!k)return Qi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Tb();try{return await new Promise((E,T)=>{let j;try{j=new Mp(k)}catch(F){E(Qi(`could not start ${k}: ${Rl(F)}`));return}let B=!1,z=!1,W=(F)=>{if(z)return;z=!0,F(),j.terminate()};j.on("message",(F)=>{if(F.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(F.type==="result"){W(()=>E(F.value));return}let V=Error(F.error?.message??"image worker failed");if(F.error?.name)V.name=F.error.name;if(F.error?.stack)V.stack=F.error.stack;W(()=>T(V))}),j.on("error",(F)=>{W(()=>B?T(F instanceof Error?F:Error(Rl(F)||"image worker crashed")):E(Qi(`the worker failed before it was ready: ${Rl(F)}`)))}),j.on("exit",(F)=>{W(()=>B?T(Error("image worker exited before it finished")):E(Qi(`the worker exited with code ${F} before it was ready`)))})})}finally{Ib()}}var jb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Lb=[320,640,960,1280,1920],eo="/_stx/images",Bb=`stx:${eo}:alpha-1`,zb=`stx:${eo}:opaque-1`,Wb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],ga;function Fb(v,_){let k=Gt.dirname(Bun.resolveSync(v,_));while(k!==Gt.dirname(k)){let E=Gt.join(k,"package.json");if(tn.existsSync(E)){let T=JSON.parse(tn.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Gt.dirname(k)}return}function Lp(){if(ga!==void 0)return ga;let v;try{v=Gt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return ga=Wb.map((_)=>{let k;try{k=v?Fb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),ga}var Bp=Symbol.for("stx.image-delivery");function to(){let v=globalThis;return v[Bp]??={catalog:new Map,transparent:new Set},v[Bp]}var zp=new Set;function Vb(v){return`/${v.split(Gt.sep).map(encodeURIComponent).join("/")}`}function Ub(v){let _=Gt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=Up("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function Wp(v,_=`stx:${eo}`){let k=(E)=>`${eo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Gt.join(v,E);try{let j=await tn.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Gt.join(v,E);await tn.promises.mkdir(Gt.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await tn.promises.writeFile(B,T),await tn.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function Hp(v,_=v){let k=await tn.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Gt.join(_,T.name);if(T.isDirectory()){E.push(...await Hp(v,j));continue}if(!T.isFile()||!jb.has(Gt.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Gt.relative(v,j)})}return E}function Fp(v,_){return v.map((k)=>({key:Vb(k.relativePath),input:k.absolutePath,name:Ub(k.relativePath),...Hb(k.absolutePath)?{options:{storage:_}}:{}}))}function Hb(v){return Cl(v)==="possible"}function qb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Kb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,E=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([j,B])=>{let z=B.variants.filter((W)=>W.format==="png").sort((W,F)=>W.width-F.width)[0];try{let W=await Ob(new Uint8Array(await tn.promises.readFile(z?.path??B.fallback.path)));if(qb(W.data))k.add(j)}catch{k.add(j)}}));return k}function Xb(v,_){let k=[];for(let E of _){let T=v[E],j=T?.variants.filter((z)=>z.format==="webp")??[];if(!T||j.length===0)continue;if(!j.some((z)=>{let W;try{return W=tn.openSync(z.path,"r"),!El(ua(W,0,32))}catch{return!0}finally{if(W!==void 0)tn.closeSync(W)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!zp.has(E))zp.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 Zb(v){let _=[],k=8;for(let E=0;E<v.length;E+=8){let T=v.slice(E,E+8),j=await Promise.all(T.map(async(B)=>{try{return await Nb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function Tl(v){return Gt.join(v,"undecodable.json")}function Gb(v){try{let _=tn.readFileSync(Tl(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Jb(v,_){try{tn.mkdirSync(Gt.dirname(Tl(v)),{recursive:!0}),tn.writeFileSync(Tl(v),JSON.stringify(_))}catch{}}function Vp(v){try{let _=tn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function qp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function os(v){let _=qp(v);return _?to().catalog.get(_):void 0}function is(v){let _=qp(v);return _?to().transparent.has(_):!1}function as(v){let _=(E)=>v.variants.filter((T)=>T.format===E).reduce((T,j)=>T+j.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:v.sources[E]||"",bytes:_(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,T)=>E.bytes-T.bytes).map(({format:E,srcset:T})=>({format:E,srcset:T}))}function Zd(v){let _=os(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:as(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:is(v)?void 0:_.placeholder?.dataUrl}}function Gn(){let v=to();v.catalog=new Map,v.transparent=new Set}function Yb(v){let _=to();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Qd(v,_,k={}){if(!v||!tn.existsSync(v))return Gn(),{count:0,fingerprint:""};if(k.offThread){let se=await Al("delivery",{publicDir:v,outputDir:_});if(se!==pa)return Yb(se.state),se.result}let E=await Hp(v);if(E.length===0)return Gn(),{count:0,fingerprint:""};let T=Gb(_),j=E.filter((se)=>{let ie=T[se.relativePath];if(!ie)return!0;let oe=Vp(se.absolutePath);return!oe||oe.mtimeMs!==ie.mtimeMs||oe.size!==ie.size});if(j.length===0)return Gn(),{count:0,fingerprint:""};let B=Wp(Gt.join(_,"_stx","images"),`${Bb}:${Lp()}`),z={outDir:Gt.join(_,"_stx","images"),storage:Wp(Gt.join(_,"_stx","images"),`${zb}:${Lp()}`),baseUrl:eo,widths:Lb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},W=j,F;try{F=await jp({...z,entries:Fp(j,B)})}catch(se){if(W=await Zb(j),W.length===j.length)throw se;let ie=new Set(W.map((ae)=>ae.relativePath)),oe=!1;for(let ae of j){if(ie.has(ae.relativePath))continue;let le=Vp(ae.absolutePath);if(!le)continue;T[ae.relativePath]=le,oe=!0}if(oe)Jb(_,T);if(W.length===0)return Gn(),{count:0,fingerprint:""};F=await jp({...z,entries:Fp(W,B)})}let V=await Kb(F.entries),U=Xb(F.entries,V),Y=to();Y.catalog=new Map(Object.entries(F.entries)),Y.transparent=V;let Z=V.size===0&&U.length===0?F.fingerprint:Up("sha256").update(F.fingerprint).update(JSON.stringify({transparent:[...V].sort(),droppedWebp:U.sort()})).digest("hex");return{count:W.length,fingerprint:Z}}var Qb=new Map;function Il(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return Qb.get(_)}var ev={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Pl=[320,640,768,1024,1280,1536,1920];function Ht(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ma(v,_,k=!1){let E=v.serverDynamic[_];if(E!==void 0)return E!==!1&&E!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Dl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let E of _)if(E.includes(":")){let[T,j]=E.split(":"),B=ev[T];if(B)k.push(`(max-width: ${B}px) ${j}`);else{let z=Number.parseInt(T);if(!Number.isNaN(z))k.push(`(max-width: ${z}px) ${j}`)}}else k.push(E);return k.join(", ")}function Ml(v,_,k,E){return _.map((T)=>`${no(v,T,void 0,k,E)} ${T}w`).join(", ")}function tv(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${no(v,B,void 0,E,T)} ${j}x`}).join(", ")}function no(v,_,k,E,T){if(!E||E==="local"||E==="static")return v;if(E==="cloudinary"){let j=[];if(_)j.push(`w_${_}`);if(k)j.push(`h_${k}`);if(T)j.push(`f_${T}`);j.push("q_auto");let B=j.join(",");return v.replace("/upload/",`/upload/${B}/`)}if(E==="imgix"){let j=new URLSearchParams;if(_)j.set("w",String(_));if(k)j.set("h",String(k));if(T)j.set("fm",T);j.set("auto","format");let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(_)j.set("width",String(_));if(k)j.set("height",String(k));if(T)j.set("format",T);let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}return v}function nv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function rv(v,_,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var Ol={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Qt(v,"src")||"",T=os(E),j=Qt(v,"alt")||"",B=Qt(v,"width")||(T?String(T.source.width):void 0),z=Qt(v,"height")||(T?String(T.source.height):void 0),W=Qt(v,"sizes"),F=Qt(v,"srcset"),V=Qt(v,"densities"),U=Qt(v,"format"),Y=is(E)||Il(E)?.transparent===!0,Z=Qt(v,"placeholder")||(T&&!Y?"thumbhash":void 0),se=Qt(v,"placeholderColor")||"#e5e7eb",ie=Qt(v,"provider"),oe=Qt(v,"class")||Qt(v,"className")||"",ae=Qt(v,"style")||"",le=Qt(v,"quality"),ce=ma(v,"lazy",!0),fe=ma(v,"preload",!1),ye=ma(v,"priority",!1),Se=Qt(v,"loading"),$e=Qt(v,"decoding")||"async",Re=!!T||ma(v,"picture",!1)||!!U,Ae=B?Number.parseInt(B):void 0,Te=z?Number.parseInt(z):void 0,Ie=F||"",_e="";if(T)Ie=T.sources[T.fallback.format]||"",_e=W?Dl(W):"100vw";else if(!Ie&&W&&ie&&ie!=="local"&&ie!=="static")Ie=Ml(E,Pl,ie,U),_e=Dl(W);else if(!Ie&&V){let pt=V.split(/\s+/).map((lt)=>Number.parseFloat(lt.replace("x","")));Ie=tv(E,pt,Ae,ie,U)}else if(W)_e=Dl(W);let De=[];if(ae)De.push(ae);if(Ae&&Te)De.push(`aspect-ratio:${Ae}/${Te}`);let Ne=[],Oe=Z==="blur"||Z==="color"||Z==="thumbhash";if(Oe&&!Y){let pt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:se}:Il(E);if(pt&&Z==="color")De.push(`background-color:${pt.color}`),Ne.push("backgroundColor");else if(pt)De.push(`background-color:${pt.color}`),De.push(`background-image:url(${pt.dataUrl})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundColor","backgroundImage");else{let lt=rv(Ae||16,Te||9,se);De.push(`background-image:url(${lt})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundImage")}}else if(!Oe&&Z&&Z!=="empty"&&Z!=="none")De.push(`background-image:url(${Ht(Z)})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundImage");let Pe=T?.fallback.url||no(E,Ae,Te,ie,U),Le=[];if(Le.push(`src="${Ht(ki(Pe,"fetched"))}"`),Le.push(`alt="${Ht(j)}"`),B)Le.push(`width="${Ht(B)}"`);if(z)Le.push(`height="${Ht(z)}"`);let ct=Se||(ye||fe?"eager":ce?"lazy":"");if(ct)Le.push(`loading="${Ht(ct)}"`);if(ye)Le.push('fetchpriority="high"');if(Le.push(`decoding="${Ht($e)}"`),oe)Le.push(`class="${Ht(oe)}"`);if(De.length>0)Le.push(`style="${Ht(De.join(";"))}"`);if(Ie)Le.push(`srcset="${Ht(ki(Ie,"fetched"))}"`);if(_e)Le.push(`sizes="${Ht(_e)}"`);let yt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ne.length>0){let pt=typeof v.static.onload==="string"?v.static.onload:"",lt=nv(Ne)+(pt?`;${pt}`:"");Le.push(`onload="${Ht(lt)}"`),yt.add("onload")}Le.push(...kr(v,yt)),Le.push(...Er(v,yt));let ft=`<img ${Le.join(" ")} />`,st="";if(fe){let lt=U==="webp"?"image/webp":U==="avif"?"image/avif":"";st=`<link rel="preload" as="image" href="${Ht(Pe)}"${lt?` type="${lt}"`:""}${Ie?` imagesrcset="${Ht(Ie)}"`:""}${_e?` imagesizes="${Ht(_e)}"`:""} />
|
|
2297
|
-
`}if(Re){let pt=[];if(T)for(let lt of as(T))pt.push(`<source type="image/${lt.format}" srcset="${Ht(lt.srcset)}"${_e?` sizes="${Ht(_e)}"`:""} />`);if(!T&&(U==="avif"||U==="auto")){let lt=no(E,Ae,Te,ie,"avif"),wt=Ie?Ml(E,Pl,ie,"avif"):`${lt}`;pt.push(`<source type="image/avif" srcset="${Ht(wt)}"${_e?` sizes="${Ht(_e)}"`:""} />`)}if(!T&&(U==="webp"||U==="auto")){let lt=no(E,Ae,Te,ie,"webp"),wt=Ie?Ml(E,Pl,ie,"webp"):`${lt}`;pt.push(`<source type="image/webp" srcset="${Ht(wt)}"${_e?` sizes="${Ht(_e)}"`:""} />`)}return`${st}<picture>
|
|
2298
|
-
${pt.join(`
|
|
2299
|
-
`)}
|
|
2300
|
-
${ft}
|
|
2301
|
-
</picture>`}return`${st}${ft}`}};var Kp="/images/safe-image-default.svg";function ro(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Hs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var sv=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Kp}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Nl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let E=Hs(v,"src")||"",T=Hs(v,"alt")||"",j=Hs(v,"fallback")||Kp,B=Hs(v,"class")||Hs(v,"className")||"",z=Hs(v,"fallbackClassName")||"",W=[];if(W.push(`src="${ro(E)}"`),W.push(`alt="${ro(T)}"`),B)W.push(`class="${ro(B)}"`);if(W.push(`data-fallback="${ro(j)}"`),z)W.push(`data-fallback-class="${ro(z)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let F=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...kr(v,F)),W.push(...Er(v,F));let V=`<img ${W.join(" ")} />`,U=k.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${sv}${V}`;return V}};function jl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function so(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ha(v,_,k){let E=so(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var Ll={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let E=jl(so(v,"color")||"#6366f1"),T=jl(so(v,"initialColor")||so(v,"initial-color")||""),j=jl(so(v,"height")||"3px"),B=ha(v,"duration",2000),z=ha(v,"throttle",200),W=ha(v,"zIndex",999999)||ha(v,"z-index",999999),F=T?`linear-gradient(to right, ${T}, ${E})`:E;return`
|
|
2302
|
-
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${j};background:${F};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
2303
|
-
<div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
|
|
2304
|
-
</div>
|
|
2305
|
-
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
2306
|
-
<script>
|
|
2307
|
-
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
2308
|
-
</script>`}};function Zp(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function iv(v,_,k){let E=Zp(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var Xp={"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%)"},Bl={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let E=Bt(Zp(v,"position")||"top-right"),T=iv(v,"max",5),j=Xp[E]||Xp["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${E}" data-stx-toast-max="${T}" style="position:fixed;${j};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
2309
|
-
<style>
|
|
2310
|
-
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
2311
|
-
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
2312
|
-
@keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
|
|
2313
|
-
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
2314
|
-
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
2315
|
-
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
2316
|
-
</style>`}};function ya(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Gp={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},zl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let E=ya(v,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Bt(E),j=ya(v,"size")||"md",B=ya(v,"closeOnBackdrop")!=="false",z=ya(v,"closeOnEscape")!=="false",W=Gp[j]||Gp.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${B}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
2317
|
-
<div class="stx-modal-panel" style="${W};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
2318
|
-
<div style="padding:1.5rem">${_}</div>
|
|
2319
|
-
</div>
|
|
2320
|
-
</div>
|
|
2321
|
-
<style>
|
|
2322
|
-
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2323
|
-
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2324
|
-
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2325
|
-
</style>`}};function Ks(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Jp={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Wl={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let E=Ks(v,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Bt(E),j=Ks(v,"side")||"right",B=Ks(v,"size")||"md",z=Ks(v,"closeOnBackdrop")!=="false",W=Ks(v,"closeOnEscape")!=="false",F=Ks(v,"overlay")!=="false",V=Jp[B]||Jp.md,U=j==="left",Y=U?"left:0":"right:0",Z=U?"translateX(-100%)":"translateX(100%)",se=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${z}" data-close-escape="${W}" 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">
|
|
2326
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${Y};width:${V};max-width:100vw;transform:${Z};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
2327
|
-
<div style="padding:1.5rem">${_}</div>
|
|
2328
|
-
</div>
|
|
2329
|
-
</div>
|
|
2330
|
-
<style>
|
|
2331
|
-
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2332
|
-
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2333
|
-
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2334
|
-
</style>`}};import{existsSync as ov,readFileSync as av}from"fs";var xa=new Map,Yp=new Set;function cv(v){if(Yp.has(v))return;Yp.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function lv(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(ov(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return u.resolve(k)}catch{}return null}function uv(v){if(xa.has(v))return xa.get(v);let _=lv(v);if(!_)return cv(v),null;try{let k=JSON.parse(av(_,"utf8"));return xa.set(v,k.icons),k.icons}catch{return null}}function Xs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var Fl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let E=Xs(v,"name")??Xs(v,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let T="lucide",j=E;if(E.includes(":")){let le=E.split(":");T=le[0],j=le[1]}let B=Bt(Xs(v,"size")||"24"),z=Bt(Xs(v,"color")||"currentColor"),W=Bt(Xs(v,"class")||""),F=Bt(Xs(v,"style")||""),V=xa.get(T)??uv(T);if(!V)return`<!-- Icon: collection "${T}" not loaded -->`;let U=V[j];if(!U)return`<!-- Icon: "${j}" not found in ${T} -->`;let Y=U.width||24,Z=U.height||24,se=`0 0 ${Y} ${Z}`,ie=U.body;if(z!=="currentColor")ie=ie.replace(/currentColor/g,z);let oe=W?` class="${W}"`:"",ae=F?` style="${F}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${B}" height="${B}" viewBox="${se}" fill="none"${oe}${ae}>${ie}</svg>`}};function Vl(){return`
|
|
2335
|
-
(function(){
|
|
2336
|
-
var tip=null,hideTimer=null,currentEl=null;
|
|
2337
|
-
|
|
2338
|
-
function createTip(){
|
|
2339
|
-
tip=document.createElement("div");
|
|
2340
|
-
tip.id="stx-tooltip";
|
|
2341
|
-
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)";
|
|
2342
|
-
var arrow=document.createElement("div");
|
|
2343
|
-
arrow.className="stx-tip-arrow";
|
|
2344
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
|
|
2345
|
-
tip.appendChild(arrow);
|
|
2346
|
-
var text=document.createElement("span");
|
|
2347
|
-
text.className="stx-tip-text";
|
|
2348
|
-
tip.appendChild(text);
|
|
2349
|
-
document.body.appendChild(tip);
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
function position(el){
|
|
2353
|
-
var pos=el.getAttribute("x-tooltip-position")||"top";
|
|
2354
|
-
var r=el.getBoundingClientRect();
|
|
2355
|
-
var sy=window.scrollY,sx=window.scrollX;
|
|
2356
|
-
tip.style.display="block";
|
|
2357
|
-
tip.style.opacity="0";
|
|
2358
|
-
// Force layout so we can measure
|
|
2359
|
-
var tw=tip.offsetWidth,th=tip.offsetHeight;
|
|
2360
|
-
var arrow=tip.querySelector(".stx-tip-arrow");
|
|
2361
|
-
var left,top;
|
|
2362
|
-
|
|
2363
|
-
if(pos==="top"){
|
|
2364
|
-
left=r.left+r.width/2-tw/2+sx;
|
|
2365
|
-
top=r.top-th-8+sy;
|
|
2366
|
-
if(top-sy<0){pos="bottom";}
|
|
2367
|
-
}
|
|
2368
|
-
if(pos==="bottom"){
|
|
2369
|
-
left=r.left+r.width/2-tw/2+sx;
|
|
2370
|
-
top=r.bottom+8+sy;
|
|
2371
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
|
|
2372
|
-
}
|
|
2373
|
-
if(pos==="left"){
|
|
2374
|
-
left=r.left-tw-8+sx;
|
|
2375
|
-
top=r.top+r.height/2-th/2+sy;
|
|
2376
|
-
if(left-sx<0){pos="right";}
|
|
2377
|
-
}
|
|
2378
|
-
if(pos==="right"){
|
|
2379
|
-
left=r.right+8+sx;
|
|
2380
|
-
top=r.top+r.height/2-th/2+sy;
|
|
2381
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
|
|
2382
|
-
}
|
|
2383
|
-
|
|
2384
|
-
// Set arrow for top/left after potential flips
|
|
2385
|
-
if(pos==="top"){
|
|
2386
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
|
|
2387
|
-
}
|
|
2388
|
-
if(pos==="left"){
|
|
2389
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
// Clamp horizontal
|
|
2393
|
-
if(left<sx+4) left=sx+4;
|
|
2394
|
-
if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
|
|
2395
|
-
|
|
2396
|
-
tip.style.left=left+"px";
|
|
2397
|
-
tip.style.top=top+"px";
|
|
2398
|
-
tip.style.opacity="1";
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
|
-
function showTip(el){
|
|
2402
|
-
if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
|
|
2403
|
-
if(!tip) createTip();
|
|
2404
|
-
var text=el.getAttribute("x-tooltip");
|
|
2405
|
-
if(!text) return;
|
|
2406
|
-
tip.querySelector(".stx-tip-text").textContent=text;
|
|
2407
|
-
currentEl=el;
|
|
2408
|
-
position(el);
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
function hideTip(){
|
|
2412
|
-
if(!tip) return;
|
|
2413
|
-
tip.style.opacity="0";
|
|
2414
|
-
hideTimer=setTimeout(function(){
|
|
2415
|
-
if(tip) tip.style.display="none";
|
|
2416
|
-
currentEl=null;
|
|
2417
|
-
},150);
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
document.addEventListener("mouseover",function(e){
|
|
2421
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2422
|
-
if(el) showTip(el);
|
|
2423
|
-
});
|
|
2424
|
-
document.addEventListener("mouseout",function(e){
|
|
2425
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2426
|
-
if(el&&el===currentEl) hideTip();
|
|
2427
|
-
});
|
|
2428
|
-
document.addEventListener("focusin",function(e){
|
|
2429
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2430
|
-
if(el) showTip(el);
|
|
2431
|
-
});
|
|
2432
|
-
document.addEventListener("focusout",function(e){
|
|
2433
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2434
|
-
if(el) hideTip();
|
|
2435
|
-
});
|
|
2436
|
-
})();
|
|
2437
|
-
`}function Qp(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let E=v.static[k];if(typeof E==="string")return E}return}function eg(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),E=v.match(k);if(!E)return{region:null,rest:v};return{region:E[2],rest:v.replace(E[0],"")}}var Ul={name:"Suspense",aliases:["suspense"],render(v,_,k){let E=eg(_,"fallback"),T=E.rest,j=eg(T,"error"),B=j.rest,z=E.region??Qp(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=j.region??Qp(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${B}</div></div>`}};function ba(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let E=v.static[k];if(typeof E==="string")return E}return}var Hl={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=(ba(v,"name")||"v").replace(/["'<>]/g,""),T=(ba(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=ba(v,"class"),B=ba(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function tg(v=Vs){v.registerBuiltin(_l),v.registerBuiltin(Ol),v.registerBuiltin(Nl),v.registerBuiltin(Ll),v.registerBuiltin(Bl),v.registerBuiltin(zl),v.registerBuiltin(Wl),v.registerBuiltin(Fl),v.registerBuiltin(Ul),v.registerBuiltin(Hl)}var ng=new Map;function dv(v){let _=ng.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),ng.set(v.source,_);return _}var rg=new WeakMap;function sg(v){let _=rg.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),rg.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function fv(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function ig(v,_,k){let E=[],T=0,j=typeof k==="function"?k:k?(B)=>k.has(B.toLowerCase()):void 0;while(T<v.length){let B=v.indexOf("<",T);if(B===-1)break;let z=dv(_);z.lastIndex=B+1;let W=z.exec(v);if(!W){T=B+1;continue}let F=W[1];if(j&&j(F)){let oe=B+1+F.length;while(oe<v.length&&v[oe]!==">")oe++;T=oe+1;continue}let V=B+1+F.length,U=null,Y=V,Z=-1,se=!1;while(V<v.length){let oe=v[V];if(U){if(oe==="\\"&&V+1<v.length){V+=2;continue}if(oe===U)U=null;V++;continue}if(oe==='"'||oe==="'"){U=oe,V++;continue}if(oe==="/"&&V+1<v.length&&v[V+1]===">"){Z=V+2,se=!0;break}if(oe===">"){Z=V+1;break}V++}if(Z===-1){T=B+1;continue}let ie=v.slice(Y,se?Z-2:Z-1).trim();if(se)E.push({fullMatch:v.slice(B,Z),tagName:F,attributes:ie,content:"",startIndex:B,endIndex:Z,isSelfClosing:!0}),T=Z;else{let oe=`<${F}`,ae=`</${F}>`,le=1,ce=Z,fe=-1;while(le>0&&ce<v.length){let $e=v.indexOf(oe,ce),Re=v.indexOf(ae,ce);if(Re===-1)break;if($e!==-1&&$e<Re){let Ae=v[$e+oe.length];if(Ae===" "||Ae===">"||Ae==="/"||Ae===`
|
|
2438
|
-
`||Ae==="\t"){let Te=fv(v,$e+oe.length);if(v[Te-1]!=="/")le++;ce=Te+1}else ce=$e+oe.length}else{if(le--,le===0){fe=Re;break}ce=Re+ae.length}}if(fe===-1){T=Z;continue}let ye=v.slice(Z,fe),Se=fe+ae.length;E.push({fullMatch:v.slice(B,Se),tagName:F,attributes:ie,content:ye,startIndex:B,endIndex:Se,isSelfClosing:!1}),T=Se}}return E}function og(v){return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function ag(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function ql(v,_){let k=0,E="",T=_;while(T<v.length){let j=v[T];if(E){if(j==="\\")T++;else if(j===E)E=""}else if(j==='"'||j==="'"||j==="`")E=j;else if(j==="{")k++;else if(j==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function cg(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(ql(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var pv=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),gv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function mv(v){return Kl(v).map((_)=>[_.start,_.end])}function Kl(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(v))!==null){let T=E[2]||"",j=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!j)continue;let B=Gr(j[1]??j[2]??j[3]??""),z=E.index,W=z+E[0].length,F=E[1].toLowerCase();if(E[0].endsWith("/>")||gv.has(F)){_.push({start:z,end:W,names:B});continue}let V=F.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`<\\/?${V}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");U.lastIndex=W;let Y=1,Z=W,se;while((se=U.exec(v))!==null)if(se[0].startsWith("</")){if(Y--,Y===0){Z=se.index+se[0].length;break}}else if(!se[0].endsWith("/>"))Y++;_.push({start:z,end:Z,names:B})}return _}function lg(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>lg(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function ug(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,E=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],j;while((j=E.exec(v))!==null)T.push([j.index,j.index+j[0].length]);T.push(...mv(v));let B=new Set(mr(_));function z(Y){return T.some(([Z,se])=>Y>=Z&&Y<se)}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,F=[],V=new Map,U=256;while((j=W.exec(k))!==null){if(z(j.index))continue;let Y=j[0],Z=j[2];if(!Z||!Z.includes(":"))continue;let se=/(?:^|\s)data-native(?:\s|=|$)/i.test(Z.replace(/"[^"]*"|'[^']*'/g,"")),ie=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,oe,ae=Z,le=!1;while((oe=ie.exec(Z))!==null){let ce=oe[1],fe=oe[2];if(zi(ce))continue;if(Ar(fe,B))continue;if(fe.includes("()")&&!fe.includes(".get(")||fe.includes("$store")||fe.includes("$ref"))continue;try{let ye=Object.keys(_),Se=Object.values(_),$e=fe.match(/^([a-zA-Z_$][\w$]*)/);if($e&&!ye.includes($e[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes($e[1]))continue;let Re=JSON.stringify([ye,fe]),Ae=V.get(Re);if(!Ae){if(Ae=Function(...ye,`return (${fe})`),V.size>=U)V.clear();V.set(Re,Ae)}let Te=Ae(...Se);if(ce==="class"){let Ie=lg(Te);if(Ie){let _e=ae.match(/\sclass="([^"]*)"/);if(_e)ae=ae.replace(_e[0],` class="${_e[1]} ${Ie}"`);else ae=ae.replace(oe[0],` class="${Ie}"`)}else ae=ae.replace(oe[0],"");le=!0;continue}if(pv.has(ce)){if(Te)ae=ae.replace(oe[0],` ${ce}`);else ae=ae.replace(oe[0],"");le=!0;continue}if(Te===null||Te===void 0||Te===!1)ae=ae.replace(oe[0],"");else{let _e=(se&&typeof Te==="object"?JSON.stringify(Te):String(Te)).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");ae=ae.replace(oe[0],` ${ce}="${_e}"`)}le=!0}catch{continue}}if(le){let ce=j[3]?" /":"",ye=`<${j[1]}${ae}${ce}>`;F.push({start:j.index,end:j.index+Y.length,replacement:ye})}}if(F.length>0){let Y=Array(F.length*2+1),Z=0;for(let se=0;se<F.length;se++){let{start:ie,end:oe,replacement:ae}=F[se];Y[se*2]=k.slice(Z,ie),Y[se*2+1]=ae,Z=oe}Y[F.length*2]=k.slice(Z),k=Y.join("")}return k}var G=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];import $g from"path";import Zl from"fs";import oo from"path";function dg(v,_,k,E){let T=0;for(let j=_;j<v.length;j++)if(v[j]===k)T++;else if(v[j]===E&&!(E===">"&&v[j-1]==="=")){if(--T===0)return j}return-1}function hv(v){let _=s(v),k=0,E=0,T=[];for(let j=0;j<_.length;j++)if("([{".includes(_[j]))k++;else if(")]}".includes(_[j]))k--;else if(_[j]===","&&k===0)T.push(v.slice(E,j).trim()),E=j+1;return T.push(v.slice(E).trim()),T}function Xl(v,_){let k=s(v),E=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(E)){let j=T.index+T[0].length,B="";if(k[j]==="<"){let W=dg(k,j,"<",">");if(W<0)continue;B=v.slice(j+1,W),j=W+1;while(/\s/.test(k[j]||"")&&j<k.length)j++}if(k[j]!=="(")continue;let z=dg(k,j,"(",")");if(z>=0)return{type:B,args:hv(v.slice(j+1,z))}}return null}var fg=`
|
|
2439
|
-
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
2440
|
-
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
2441
|
-
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
2442
|
-
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
2443
|
-
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
2444
|
-
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
2445
|
-
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
2446
|
-
`;function pg(v,_){let k=[],E={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),j=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(Y,Z,se,ie,oe)=>{if(T.slice(oe,oe+6)!=="import")return Y;if(ie.endsWith(".stx"))return"";let ae=`${_}Import${k.length}`;if(k.push(`import * as ${ae} from ${JSON.stringify(ie)};`),Z.startsWith("*"))return`import ${Z.replace(/^\*\s+as\s+/,"")} = ${ae};`;if(!Z.startsWith("{"))return`import ${Z} = ${ae}.default;`;return Z.slice(1,-1).split(",").map((le)=>{let[ce,fe=ce]=le.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ce)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(ie)&&ce in E)E[ce].push(fe);return`import ${fe} = ${ae}.${ce};`}).join(`
|
|
2447
|
-
`)}),B=Xl(v,E.defineProps),z=Xl(v,E.defineEmits),W=Xl(v,E.withDefaults);if(!B&&!z)return{declarations:"",props:null,events:null};let F=[],V=null,U=null;if(B){F.push(`const __options = (${B.args[0]||"{}"}) as const;`),F.push(`const __defaults = (${W?.args[1]||"{}"});`);let Y=B.type||"__StxOptions<typeof __options>";F.push(`export type __StxProps = __StxDefaults<${Y}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),V=`${_}.__StxProps`}if(z)F.push(`const __events = (${z.args[0]||"[]"}) as const;`),F.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),U=`${_}.__StxEvents`;return{declarations:`${k.join(`
|
|
2448
|
-
`)}
|
|
2449
|
-
namespace ${_} {
|
|
2450
|
-
${j}
|
|
2451
|
-
${F.join(`
|
|
2452
|
-
`)}
|
|
2453
|
-
}`,props:V,events:U}}var io=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 ln(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...io].some((_)=>_.toLowerCase()===v.toLowerCase());return io.has(v)||/[A-Z]/.test(v)}function*yv(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let E=_.lastIndex,T=[];while(E<v.length){while(/\s/.test(v[E]||""))E++;if(v[E]===">"||v.slice(E,E+2)==="/>"){E+=v[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(v.slice(E))?.[0];if(!j){E++;continue}let B=E;E+=j.length;while(/\s/.test(v[E]||""))E++;if(v[E]!=="="){T.push({name:j,value:!0,offset:B,braced:!1});continue}E++;while(/\s/.test(v[E]||""))E++;let z=v[E],W=z==="{",F=z==='"'||z==="'";if(F||W)E++;let V=E;if(W){let U=s(v.slice(E)),Y=1,Z=0;for(;Z<U.length;Z++){if(U[Z]==="{")Y++;if(U[Z]==="}"&&--Y===0)break}E+=Z}else if(F)while(E<v.length&&v[E]!==z)E++;else while(E<v.length&&!/[\s/>]/.test(v[E]))E++;if(T.push({name:j,value:v.slice(V,E),offset:V,braced:W}),F||W)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function gg(v,_,k){let E=[],T=[fg,"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,B=new Map,z=new Map,W=k.scriptCode(v,k.filePath),F=s(W);for(let se of W.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(F.slice(se.index,se.index+6)!=="import")continue;let ie=se[2],oe=oo.isAbsolute(ie)||ie.startsWith(".")?oo.resolve(oo.dirname(k.filePath),ie):Co(ie,oo.dirname(k.filePath));if(!oe)continue;let ae=oe.endsWith(".stx")?oe:Zl.existsSync(`${oe}.stx`)?`${oe}.stx`:void 0,le=ae?null:Eo(oe,!1),ce=se[1].startsWith("{")?se[1].slice(1,-1).split(","):[se[1]];for(let fe of ce){let[ye,Se=ye]=fe.trim().split(/\s+as\s+/),$e=ae||le?.get(ye)||le?.get(ye.toLowerCase());if($e)z.set(Se,$e),z.set(Se.toLowerCase(),$e),z.set(Se.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$e)}}for(let se of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let ie of se[1].matchAll(/['"]([^'"]+)['"]/g)){let oe=Ro(ie[1],k.filePath,k).find((ae)=>Zl.statSync(ae,{throwIfNoEntry:!1})?.isFile());if(oe)z.set(oo.basename(ie[1]).replace(/\.stx$/,""),oe)}let V={__importedComponents:z},U=new Map,Y=(se,ie,oe)=>{let ae=v.slice(0,se);return{code:ie,offset:se,attribute:oe,anchor:!0,kind:"directive",line:ae.split(`
|
|
2454
|
-
`).length,column:se-ae.lastIndexOf(`
|
|
2455
|
-
`)}},Z=(se,ie,oe)=>E.push({expression:se,statement:{text:ie+se.code+oe,prefixLength:ie.length}});for(let se of yv(_)){if(ln(se.name)||se.name==="component")continue;let ie=Wu(se.name,k.filePath,k,V);if(!ie)continue;let oe=U.get(ie);if(!oe){let le;try{le=k.readComponent?k.readComponent(ie):Zl.readFileSync(ie,"utf8")}catch{continue}if(le===void 0)continue;B.set(ie,le),oe=pg(k.scriptCode(le,ie),`__StxComponent${U.size}`),U.set(ie,oe),T.push(oe.declarations)}let ae=[];for(let le of se.attributes){let{name:ce,offset:fe}=le,ye=le.value===!0?"true":le.value;if(ce.startsWith("@")||ce.startsWith("v-on:")){if(oe.events&&le.value!==!0)j.set(fe,`__StxEvent<${oe.events}, ${JSON.stringify(ce.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let Se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ce);if(ce.startsWith("v-")&&!ce.startsWith("v-bind:")&&!Se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ce))continue;let $e=(Se?Se[1]||"modelValue":ce.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,Ie)=>Ie.toUpperCase());if(ae.push($e),!oe.props)continue;let Ae=ce.startsWith(":")||ce.startsWith("v-bind:")||!!Se||le.braced?ye:le.value!==!0?JSON.stringify(ye):"true";Z(Y(fe,Ae,ce),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify($e)}>);`)}if(oe.props){let le=[...new Set(ae)].map((fe)=>`${JSON.stringify(fe)}: undefined as any`).join(", "),ce=Y(se.offset,`<${se.name}>`);E.push({expression:ce,statement:{text:`;void ({ ${le} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:U.size?T.join(`
|
|
2456
|
-
`):"",checks:E,events:j,dependencies:B}}var mg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function xv(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function We(v){let _=[],k=xv(v);mg.lastIndex=0;let E;while((E=mg.exec(k))!==null){let T=(E[1]||"").trim(),j=(E[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,B=(E[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=E.index+j,W=E.index+E[0].length-B,F=v.slice(z,W);if(/\bsrc\s*=/.test(T))continue;let V=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(V&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(V[1]))continue;let U=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",Y=ao(v,z);_.push({kind:U,code:F,startLine:Y,startColumn:co(v,z),offset:z,attrs:T})}return _}function ao(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function co(v,_){let k=v.lastIndexOf(`
|
|
2457
|
-
`,_-1)+1;return _-k+1}function va(v){let _=v.split(""),k=(T,j)=>{for(let B=T;B<j&&B<_.length;B++)if(_[B]!==`
|
|
2458
|
-
`)_[B]=" "},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 T of E){T.lastIndex=0;let j;while((j=T.exec(v))!==null)k(j.index,j.index+j[0].length)}return _.join("")}function bv(v){let _=0,k="";for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k="";continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{"){_++;continue}if(T===")"||T==="]"||T==="}"){_--;continue}if(T==="|"&&_===0){if(v[E+1]==="|"){E++;continue}if(v[E-1]==="|")continue;return v.slice(0,E)}}return v}var _g=new Set([":for","x-for","v-for"]),wa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Gl="__stx_interpolated",hg="__StxElement",kg="__StxTemplateValue",vv=`type ${kg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function yg(v){return v.replace(/\{\{[\s\S]*?\}\}/g,Gl).replace(/\{!![\s\S]*?!!\}/g,Gl)}function cs(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
|
|
2459
|
-
`).length-1,E=_.length-k;return`0${" ".repeat(Math.max(0,E-1))}${`
|
|
2460
|
-
`.repeat(k)}`})}var wv=["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"],Sv=new RegExp(String.raw`^[ \t]*@(?:${wv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function ls(v){return v.replace(Sv,(_)=>_.replace(/[^\n]/g," "))}var xg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function wc(v){let _=va(v),k=[],E=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=E.exec(_))!==null){if(T[1]||T[3])continue;let z=T[2]??T[4]??"",W=T[2]!==void 0?2:3,F=bv(z);if(!F.trim())continue;let V=T.index+W+(F.length-F.trimStart().length);k.push({code:F.trim(),line:ao(_,V),column:co(_,V),offset:V,kind:"interpolation"})}let j=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=j.exec(_))!==null){let B=T.index+T[0].length-1,z=0,W=B;for(;W<_.length;W++){let Y=_[W];if(Y==="(")z++;else if(Y===")"){if(z--,z===0)break}}if(z!==0)continue;let F=_.slice(B+1,W),V=F.trim();if(j.lastIndex=W+1,!V)continue;let U=B+1+(F.length-F.trimStart().length);k.push({code:V,line:ao(_,U),column:co(_,U),offset:T.index,kind:"condition"})}wa.lastIndex=0;while((T=wa.exec(_))!==null){let B=T[1],z=T[3]??"",W=B.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(xg.has(W)||xg.has(B))continue;if(!z.trim())continue;let F=T.index+T[0].indexOf(T[2],T[0].indexOf(B)+B.length)+1;if(_g.has(W)){let U=z.match(/\s+(?:in|of)\s+/);if(!U||U.index===void 0)continue;let Y=z.slice(U.index+U[0].length),Z=U.index+U[0].length+(Y.length-Y.trimStart().length);k.push({code:yg(Y.trim()),line:ao(_,F+Z),column:co(_,F+Z),offset:F+Z,kind:"directive",attribute:W});continue}let V=z.length-z.trimStart().length;k.push({code:yg(z.trim()),line:ao(_,F+V),column:co(_,F+V),offset:F+V,kind:"directive",attribute:W})}return k.sort((B,z)=>B.line-z.line||B.column-z.column),k}var $v=2000;function _v(v,_){let k=0,E=Math.min(v.length,_+$v);for(let T=_;T<E;T++){let j=v[T];if(j==="(")k++;else if(j===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function kv(v){let _=new Map,k=(z,W)=>{let F=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let V of F){let U=V.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(U))continue;let Y=F.length===1?W:void 0,Z=_.get(U);if(!Z)_.set(U,{name:U,iterable:Y});else if(Z.iterable!==Y)Z.iterable=void 0}},E=/^\$?[A-Z_$][\w$]*$/i,T=(z)=>{let W=z.trim();return E.test(W)?W:void 0};for(let z of v.matchAll(/@for(?:each|else)\s*\(/g)){let W=_v(v,z.index+z[0].length-1);if(W===null)continue;let F=Ct(W);if(!F)continue;k(F.itemVar.replace(/=>/g," "),T(F.arrayExpr))}for(let z of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(z[1],z[2]==="of"?T(z[3]):void 0);for(let z of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(z[1]);let j=va(v);wa.lastIndex=0;let B;while((B=wa.exec(j))!==null){let z=B[1].replace(/\..*$/,"");if(!_g.has(z))continue;let W=B[3].match(/\s+(?:in|of)\s+/);if(!W||W.index===void 0)continue;k(B[3].slice(0,W.index),T(B[3].slice(W.index+W[0].length)))}for(let z of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let W of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(W[1]);return[..._.values()].sort((z,W)=>z.name.localeCompare(W.name))}function te(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let E of k[1].split(",")){let T=E.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var Jl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Ev={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function ri(v=new Set){return[...Jl.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Ev).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
|
|
2461
|
-
`)}function si(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Eg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,E=!1,T=new Set,j=s(v);while((k=_.exec(j))!==null){E=!0;for(let B of Cv(k[1])){let z=B.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))T.add(z)}}return E?[...T]:null}function Cv(v){let _=[],k=0,E="";for(let T of v){if(T===","&&k===0){_.push(E),E="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;E+=T}return _.push(E),_.filter((T)=>T.trim().length>0)}function Rv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
|
|
2462
|
-
`).map(()=>"").join(`
|
|
2463
|
-
`)));return{imports:k.join(`
|
|
2464
|
-
`),body:E}}function Cg(v){let _=s(v),k=Array(_.length),E=0;for(let z=0;z<_.length;z++){let W=_[z];if(W==="}"||W===")"||W==="]")E=Math.max(0,E-1);if(k[z]=E,W==="{"||W==="("||W==="[")E++}let T=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,B;while((B=j.exec(_))!==null){if(k[B.index]!==0)continue;let z=B[1],W=B[2],F;if(z==="interface"){let V=_.indexOf("{",B.index);if(V===-1)continue;let U=0;F=-1;for(let Y=V;Y<_.length;Y++)if(_[Y]==="{")U++;else if(_[Y]==="}"&&--U===0){F=Y+1;break}if(F===-1)continue}else{let V=0;F=_.length;for(let U=_.indexOf("=",B.index)+1;U<_.length;U++){let Y=_[U];if(Y==="{"||Y==="["||Y==="("||Y==="<")V++;else if(Y==="}"||Y==="]"||Y===")"||Y===">")V--;else if(V<=0&&(Y===";"||Y===`
|
|
2465
|
-
`&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,U-40),U)))){F=Y===";"?U+1:U;break}}}T.push({name:W,text:v.slice(B.index,F).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=F}return T}function Av(v){return new Set(Cg(v).map((_)=>_.name))}function oi(v,_=""){let k=Eg(v),E=Av(_),T=Cg(v).filter((F)=>!E.has(F.name)).map((F)=>F.text);if(!k){let F=te(v).filter((V)=>!So(_,V));if(F.length===0&&T.length===0)return"";return["",`// ${Tv}`,...T,...F.map((V)=>`declare var ${V}: any`)].join(`
|
|
2466
|
-
`)}if(k.length===0)return T.length>0?["",`// ${bg}`,...T].join(`
|
|
2467
|
-
`):"";let{imports:j,body:B}=Rv(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),W=["",`// ${bg}`];if(j)W.push(j);return W.push(...T),W.push(`async function ${vg}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${wg} = Awaited<ReturnType<typeof ${vg}>>`,...k.map((F)=>`declare var ${F}: ${wg}[${JSON.stringify(F)}]`)),W.join(`
|
|
2468
|
-
`)}function Yl(v){let k=s(v).split(""),E=0;for(let T=0;T<k.length;T++){let j=k[T];if(j==="{"||j==="("||j==="["){E++;continue}if(j==="}"||j===")"||j==="]"){E=Math.max(0,E-1);continue}if(E>0&&j!==`
|
|
2469
|
-
`)k[T]=" "}return te(k.join(""))}function ii(v,_){if(Eg(v)!==null)return[];let k=s(_),E=new Set(y);return Yl(v).filter((T)=>{if(E.has(T))return!1;if(te(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var bg="stx: types for the declared client payload (#1868)",Tv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",vg="__stxServerScope",wg="__StxClientPayload";var Sg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Iv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Pv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of v){let T=s(E),{depths:j,balanced:B}=xe(T);if(!B)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let W of T.matchAll(z)){let F=W.index??0;if(j[F+W[1].length]!==0)continue;let V=W[2],U=F+W[0].length-W[3].length,Y=E.slice(U,F+W[0].length).trim().replace(/;$/,"").trim(),Z=W[3],se=k.test(Z)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(Z)&&!/[,+\-*/%&|?:=]$/.test(Y)&&xe(Z).balanced;_.set(V,_.has(V)||!se?null:Y)}}return new Map([..._].filter((E)=>E[1]!==null))}function Rg(v,_,k=0,E=new Set){if(_.size===0||k>=5)return v;let T=s(v),j="",B=0;for(let z of T.matchAll(/[A-Za-z_$][\w$]*/g)){let W=z.index??0,F=z[0],V=_.get(F);if(!V||E.has(F))continue;let U=T.slice(0,W).trimEnd(),Y=T.slice(W+F.length).trimStart();if(U.endsWith(".")||/^:(?!:)/.test(Y)&&/[{,]$/.test(U))continue;if(W>0&&/[\w$]/.test(T[W-1]))continue;j+=`${v.slice(B,W)}(${Rg(V,_,k+1,new Set([...E,F]))})`,B=W+F.length}return j+v.slice(B)}function Dv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let j=T[1];if(T.index===_){if(j==="elseif"){let z=E[E.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let B="";if(T[2]==="("){let z=0,W=T.index+T[0].length-1,F=W+1;for(;W<v.length;W++){let V=v[W];if(V==="(")z++;else if(V===")"){if(z--,z===0)break}}B=v.slice(F,W).trim(),k.lastIndex=W+1}if(j==="if")E.push({seen:[],current:B});else if(j==="unless")E.push({seen:[],current:`!(${B})`});else if(j==="elseif"||j==="else"){let z=E[E.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=j==="elseif"?B:null}}return E.flatMap((j)=>[...j.seen.map((B)=>`!(${B})`),...j.current?[j.current]:[]]).filter(Boolean)}function Mv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Iv.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Ov=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Kn(v,_){if(!_)return v;return v.replace(Ov,(k,E,T,j)=>{let B=$g.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function ds(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function Nv(v){let _=new Set,k=s(v);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=E[1],j=/\{([^}]*)\}/.exec(T);for(let F of j?.[1].split(",")??[]){let V=F.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(V&&/^[A-Z_$][\w$]*$/i.test(V))_.add(V)}let B=T.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(B);if(z)_.add(z[1]);let W=/^\s*([A-Z_$][\w$]*)/i.exec(B);if(W&&W[1]!=="type")_.add(W[1])}return[..._].sort()}function ai(v,_={}){let k=We(v),E=v.split(`
|
|
2470
|
-
`),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?gg(v,va(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(U,Y)=>We(U).map((Z)=>Kn(Z.code,$g.dirname(Y))).join(`
|
|
2471
|
-
`)}):void 0,z=new Set,W=[];for(let U of k){let Y=ls(cs(U.code)),Z=Kn(Y,_.originDir??"").split(`
|
|
2472
|
-
`);Z.forEach((se,ie)=>{let oe=U.startLine-1+ie;if(oe<T.length)T[oe]=ie===0?ds(U)+se:se,z.add(oe)}),W.push(U.startLine-1+Z.length-1)}for(let U of W){let Y=T[U]?.trim()===""?U:U+1;if(Y<T.length&&T[Y].trim()===""&&(Y===U||!z.has(Y)))T[Y]=";"}let F=(U,Y)=>{for(let[Z,se]of U.split(`
|
|
2473
|
-
`).entries())if(T.push(se),Y)j.set(T.length,Z===0?Y:{...Y,line:Y.line+Z,column:1,prefixLength:0})};if(_.globals!==!1){F("");let U=new Set([...k.flatMap((ie)=>te(ie.code)),...k.flatMap((ie)=>Nv(ie.code))]),Y=(ie)=>{if(!U.has(ie))F(`declare var ${ie}: any`)};if(_.runtimeGlobals!==!1){if(!U.has("window"))F("declare var window: any");for(let ie of y)Y(ie)}let Z=[...new Set([...Jl,...G,...Sg])].filter((ie)=>_.runtimeGlobals!==!1||!y.includes(ie));if(_.contextScope==="global"){F("declare global {");for(let ie of Z)F(` var ${ie}: any`);F("}")}else{for(let ie of Jl)Y(ie);for(let ie of G)Y(ie);for(let ie of Sg)Y(ie)}F(`declare var ${Gl}: any`);let se=new Set(k.flatMap((ie)=>te(ie.code)));F(`type ${hg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let ie of kv(v)){if(se.has(ie.name))continue;let oe=ie.iterable&&se.has(ie.iterable)?`${hg}<typeof ${ie.iterable}>`:"any";F(`declare var ${ie.name}: ${oe}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let Y of B.declarations.split(`
|
|
2474
|
-
`))F(Y);let U=wc(v).map((Y)=>{let Z=B?.events.get(Y.offset??-1);if(Z){Y.anchor=!0;let se=Y.code.trim(),ie=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(se),oe=ie?`void ((${ie[2]}) satisfies __StxAssignedValue<typeof ${ie[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(se)?`${se} satisfies (($event: ${Z}) => unknown)`:se,ae=`;(($event: ${Z}): void => { `;return{expression:Y,statement:{text:`${ae}${oe} });`,prefixLength:ae.length}}}return{expression:Y,statement:Mv(Y)}}).filter((Y)=>Y.statement!==null);if(U.push(...B?.checks||[]),U.length>0){let Y=va(v),Z=Pv(k.map((ae)=>ae.code)),ie=[...new Set(k.flatMap((ae)=>te(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),oe=0;if(ie.length>0){F(vv);for(let ae of ie)F(`type __StxT_${ae} = ${kg}<typeof ${ae}>`);F(`;((${ie.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),oe=1}for(let{expression:ae,statement:le}of U){let ce=" ".repeat(oe),fe=ae.offset===void 0?[]:Dv(Y,ae.offset),ye=fe.length>0?`${fe.map(($e)=>`if (${Rg($e,Z)}) `).join("")}{ `:"",Se=fe.length>0?" }":"";F(ce+ye+le.text+Se,{line:ae.line,column:ae.column,expression:ae,prefixLength:le.prefixLength+ce.length+ye.length,guardPrefixLength:ce.length+ye.length})}if(oe>0)F("});")}}let V=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,V=!0;return F("export {}"),{text:T.join(`
|
|
2475
|
-
`),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:V}}function ci(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function li(v,_,k){let E=v.lineMap.get(_);if(!E)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=E.expression?.anchor?0:Math.max(0,k-1-(E.prefixLength??0));return{line:E.line,column:E.column+T,expression:E.expression,inGuard:k<=(E.guardPrefixLength??0)}}import Ag from"fs";import Tg from"path";var Ig=!1;function jv(v,_,k,E=!1,T=new Set){let j={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},B=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),z=(U)=>{if(B.size===0)return!1;let Y=s(U),Z=Y.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&B.has(Z))return!0;for(let se of B){let ie=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${ie}\\s*\\(`).test(Y))return!0}return!1},W=new Set(Hi),F=(U)=>{if(!U.includes("-")||U.startsWith("@")||U.startsWith(":")||U.startsWith("x-")||U.startsWith("__"))return U;if(U.startsWith("aria-")||U.startsWith("data-"))return U;return U.replace(/-([a-z0-9])/g,(Y,Z)=>Z.toUpperCase())},V=(U,Y)=>{let Z=F(U);if(j.static[Z]=Y,Z!==U)j.staticNames[Z]=U};for(let[U,Y]of Object.entries(v)){let Z=U.startsWith("x-")&&!W.has(U)&&!U.startsWith("x-bind:")&&!U.startsWith("x-on:")?`:${U.slice(2)}`:U;if(Z.startsWith("@")){j.events[Z]=Y;continue}if(Z.startsWith("__stx_")){let se=F(Z.slice(6));j.serverDynamic[se]=ag(Y,k);continue}if(Z.startsWith(":")){let se=F(Z.slice(1)),ie=Y===_r?se:Y;if(se==="if"||se==="for"||se==="show"){j.clientReactive[se]=ie;continue}if(E){j.clientReactive[se]=ie;continue}if(Ar(ie,T)){j.clientReactive[se]=ie;continue}if(z(ie)){j.clientReactive[se]=ie;continue}try{if(!p(ie)){if(k.debug)console.error(`Unsafe expression in :${se} binding: ${ie}`);j.clientReactive[se]=ie;continue}let oe=Object.keys(_),ae=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),le=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Ce(ie).some((Se)=>!ae.has(Se)&&!oe.includes(Se)&&(!(Se in globalThis)||le.has(Se)))){j.clientReactive[se]=ie;continue}let ye=c(ie,oe)(...Object.values(_));if(j.serverDynamic[se]=ye,se!==Z.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[se]=Z.slice(1)}catch{j.clientReactive[se]=ie}continue}if(typeof Y==="string"&&Y.includes("{{")&&Y.includes("}}")){let se=Lv(Y,T);if(se!==null){j.clientReactive[F(Z)]=se;continue}let ie=Y.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ie)try{let oe=ie[1];if(p(oe)){let le=c(oe,Object.keys(_))(...Object.values(_));V(Z,le!=null?String(le):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${oe}`);V(Z,Y)}}catch(oe){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,oe);V(Z,Y)}else{let oe=Y,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,le;while((le=ae.exec(Y))!==null)try{let ce=le[1];if(!p(ce)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${ce}`);continue}let ye=c(ce,Object.keys(_))(...Object.values(_));oe=oe.replace(le[0],String(ye??""))}catch(ce){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,ce)}V(Z,oe)}continue}V(Z,Y===_r?"true":og(Y))}return j}function Lv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Ar(z[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&E.length===1)return T[1];let j="",B=0;for(let z of E)j+=v.slice(B,z.index).replace(/[`\\$]/g,(W)=>`\\${W}`),j+=`\${${z[1]}}`,B=z.index+z[0].length;return j+=v.slice(B).replace(/[`\\$]/g,(z)=>`\\${z}`),`\`${j}\``}var Bv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function zv(v,_,k){if(!v.includes("@"))return v;if(!Bv.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return fr(v,_,k)}catch{return v}}function Mg(v){let _={},k=0,E=v.length;while(k<E){while(k<E&&/\s/.test(v[k]))k++;if(k>=E)break;let T="";while(k<E&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<E&&/\s/.test(v[k]))k++;if(k<E&&v[k]==="="){k++;while(k<E&&/\s/.test(v[k]))k++;let j="";if(k<E&&(v[k]==='"'||v[k]==="'")){let B=v[k];k++;while(k<E){let z=v[k];if(z==="\\"&&k+1<E){k++,j+=v[k],k++;continue}if(z===B){k++;break}j+=z,k++}}else if(v[k]==="{"){j=ql(v,k),k+=j.length;let B=cg(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=_r}return _}function Pg(v){return Object.entries(v).map(([_,k])=>k===_r?_:`${_}="${Wv(k)}"`).join(" ")}function Wv(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Fv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(v))!==null){let T=E[1];if(Vs.isBuiltin(T))_.add(T)}return[..._].sort()}async function vc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=Tg.dirname(k),z=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of v.matchAll(W)){let[Y,Z,se]=U,ie=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=se,ae,le=[];while((ae=ie.exec(se))!==null){let[ce,fe,ye,Se]=ae,$e=null,Re=null;if(Se.startsWith(".")||Se.startsWith("/")){let Ie=Tg.resolve(B,Se);if(Ie.endsWith(".stx"))Re=Ie;else{let _e=`${Ie}.stx`;try{if(Ag.statSync(_e).isFile())Re=_e}catch{try{if(Ag.statSync(Ie).isDirectory())$e=Ie}catch{}}}}else $e=Co(Se,B);if(!$e&&!Re)continue;let Ae=!1,Te=(Ie,_e)=>{j.set(Ie,_e),j.set(Ie.toLowerCase(),_e);let De=Ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(De,_e),T.add(_e)};if(ye&&Re)Te(ye,Re),Ae=!0;else if(fe){let Ie=fe.slice(1,-1).split(",").map((De)=>De.trim()).filter(Boolean).map((De)=>{let Ne=De.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ne)return{source:Ne[1],local:Ne[2]};return{source:De,local:De}}),_e=$e?Eo($e):null;for(let{source:De,local:Ne}of Ie){let Oe=null;if(Re)Oe=Re;else if(_e)Oe=_e.get(De)??_e.get(De.toLowerCase())??_e.get(De.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Oe)Te(Ne,Oe),Ae=!0}}if(Ae)le.push({start:ae.index,end:ae.index+ce.length})}if(le.length===0)continue;for(let ce=le.length-1;ce>=0;ce--)oe=oe.slice(0,le[ce].start)+oe.slice(le[ce].end);z.push({start:U.index,end:U.index+Y.length,value:`<script${Z}>${oe}</script>`})}if(z.length===0)return v;let F=[],V=0;for(let U of z)F.push(v.slice(V,U.start),U.value),V=U.end;return F.push(v.slice(V)),F.join("")}async function Vv(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=z.exec(j))!==null){let[F,V]=W,U=V.split(",").map((Y)=>Y.trim().replace(/^['"]|['"]$/g,"")).filter((Y)=>Y.length>0);for(let Y of U){let Z=Y.split("/"),ie=Z[Z.length-1].replace(/\.stx$/,""),oe=ie.includes("-")?ie.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""):ie.charAt(0).toUpperCase()+ie.slice(1),ae=null,le=Ro(Y,k,E);for(let ce of le)try{if(await Bun.file(ce).exists()){ae=ce;break}}catch{}if(ae){B.set(oe,ae),B.set(ie,ae),B.set(ie.toLowerCase(),ae);let ce=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(ce,ae),T.add(ae),E.debug)console.log(`Imported component: ${oe} -> ${ae}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${Y}`)}j=j.replace(F,""),z.lastIndex=0}return j}async function Uv(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,W=/@component\s*\(/g,F;while((F=W.exec(j))!==null){let V=F.index,U=V+F[0].length-1,Y=1,Z=U+1;while(Z<j.length&&Y>0){if(j[Z]==="(")Y++;else if(j[Z]===")"){if(Y--,Y===0)break}Z++}if(Y!==0)break;let se=j.substring(U+1,Z),ie=Z+1,oe=se.match(/^\s*['"]([^'"]+)['"]/);if(!oe){W.lastIndex=0;continue}let ae=oe[1],le,ce=se.slice(oe[0].length),fe=ce.match(/^\s*,\s*/);if(fe)le=ce.slice(fe[0].length).trim();let ye={};if(le)try{ye=O(le,_)}catch(Ie){let _e=Ie instanceof Error?Ie.message:String(Ie);j=j.replace(j.substring(V,ie),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=ie,Ae=j.substring(ie).match(/^([\s\S]*?)@endcomponent/);if(Ae)Se=Ae[1].trim(),$e=ie+Ae[0].length;let Te=await Xe(ae,ye,Se,B,_,k,E,z,T);j=j.substring(0,V)+Te+j.substring($e),W.lastIndex=0}return j}async function Hv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,W=Xv(j);if(W.size>0){let ie=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...ie,...W])]}let F=$n(j);j=F.output;let V=mr(_);return j=await se(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await se(j,/[A-Z][a-zA-Z0-9]*/,!0,sg(io)),j=await se(j,/[a-z][a-z0-9]*/,!1,io),j=F.restore(j),j;async function se(ie,oe,ae,le){if(!ie)return ie;let ce=ie,fe=ig(ce,oe,le),ye=Kl(ce),Se=new Map;for(let Ae=fe.length-1;Ae>=0;Ae--){let Te=fe[Ae],Ie=ae?nn(Te.tagName):Te.tagName,_e=Mg(zv(Te.attributes,_,k)),De=ye.filter(({start:lt,end:wt})=>Te.startIndex>=lt&&Te.startIndex<wt),Ne=De.length>0,Oe=new Set(V);for(let lt of De)for(let wt of lt.names)Oe.add(wt);let Pe=jv(_e,_,E,Ne,Oe);if(typeof Pe.clientReactive.for==="string")for(let lt of Gr(Pe.clientReactive.for))Oe.add(lt);let Le=Vs.getBuiltin(Te.tagName),ct=Le?await Yn(Te.tagName,B,_,k,E):!1;if(Le&&!ct){let lt={context:_,filePath:k,options:E,dependencies:T},wt=Le.render(Pe,Te.content,lt);if(Object.keys(Pe.events).length>0){let dt=Pg(Pe.events);wt=wt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${dt}`)}if(Object.keys(Pe.clientReactive).length>0)wt=Dg(wt,Pe.clientReactive);Se.set(Ae,wt);continue}if(!ae&&Te.tagName.includes("-")&&!await Yn(Ie,B,_,k,E))continue;let yt={};for(let[lt,wt]of Object.entries(Pe.static))yt[lt]=wt;for(let[lt,wt]of Object.entries(Pe.serverDynamic))yt[lt]=wt;let ft={declaredProps:new Set},pt=await Xe(Ie,yt,F.restore(Te.content),B,_,k,E,z,T,[...Oe],ft,Te.tagName);if(pt=qv(pt,Pe,ft.declaredProps),Object.keys(Pe.events).length>0){let lt=Ql(pt);if(lt){let wt=Pg(Pe.events),dt=Object.keys(Pe.events).map((St)=>St.replace(/^@/,"").split(".")[0]).join(" ");pt=pt.substring(0,lt.insertPos)+` data-stx-parent-events="${dt}" ${wt}`+pt.substring(lt.insertPos)}}if(Object.keys(Pe.clientReactive).length>0)pt=Dg(pt,Pe.clientReactive);Se.set(Ae,pt)}if(Se.size===0)return ce;let $e="",Re=0;for(let Ae=0;Ae<fe.length;Ae++){let Te=Se.get(Ae);if(Te===void 0)continue;$e+=ce.slice(Re,fe[Ae].startIndex),$e+=Te,Re=fe[Ae].endIndex}return $e+=ce.slice(Re),$e}}function Dg(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([V])=>!k.has(V)),j=T.filter(([V])=>!E.has(V)).map(([V])=>nn(V)).join(" "),B=v,z=T.length>0?Ql(B):null;if(z){let V=T.map(([Y,Z])=>`:${nn(Y)}="${Z.replace(/"/g,""")}"`).join(" "),U=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${U} ${V}`+B.substring(z.insertPos)}let W=_.if;if(W)B=`<template :if="${W.replace(/"/g,""")}">${B}</template>`;let F=_.for;if(F)B=`<template :for="${F.replace(/"/g,""")}">${B}</template>`;return B}function qv(v,_,k=new Set){let E=Kv(v);if(!E)return v;let T=v.slice(E.insertPos,E.tagEnd),j=/\bdata-native(?:\s|=)/i.test(T),B=new Set(Object.keys(Mg(T))),z=new Set(["class","className"]);for(let V of Object.keys(_.static)){let U=_.staticNames[V]??V;if(B.has(U)||!j&&(k.has(V)||!$l(U)))z.add(V)}for(let V of Object.keys(_.serverDynamic)){let U=_.serverDynamicNames?.[V]??V;if(B.has(U)||!j&&(k.has(V)||!$l(U)))z.add(V)}let W=[];if(j){for(let[V,U]of Object.entries(_.static)){if(z.has(V)||U!==!0&&U!==_r)continue;z.add(V),W.push(`${Bt(_.staticNames?.[V]??V)}="true"`)}for(let[V,U]of Object.entries(_.serverDynamic)){if(z.has(V)||U!==!0)continue;z.add(V),W.push(`${Bt(_.serverDynamicNames?.[V]??V)}="true"`)}}let F=[...kr(_,z),...Er(_,z),...W];if(j){for(let[V,U]of Object.entries(_.serverDynamic)){if(z.has(V)||U!==!1)continue;let Y=_.serverDynamicNames?.[V]??V;F.push(`${Bt(Y)}="false"`)}for(let[V,U]of Object.entries(_.serverDynamic)){if(z.has(V)||U===null||typeof U!=="object")continue;let Y=JSON.stringify(U);if(Y!==void 0){let Z=_.serverDynamicNames?.[V]??V;F.push(`${Bt(Z)}="${Bt(Y)}"`)}}}if(F.length===0)return v;return`${v.slice(0,E.insertPos)} ${F.join(" ")}${v.slice(E.insertPos)}`}function Ql(v){let _=Og(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:Ng(v,k.index+1+k[1].length)};return null}function Kv(v){let _=Ql(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Og(v,_.tagEnd+1)}function Og(v,_){let k=_;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,W=v.toLowerCase().indexOf(z,k+j[0].length);if(W===-1)return null;k=W+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Ng(v,k+1+B[1].length)}}return null}function Ng(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function Xv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let E=k[1];if(!/\bclient\b/.test(E)||/\bserver\b/.test(E))continue;for(let T of Yl(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let j of(T[2]??"").split(",")){let B=j.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(B))_.add(B)}}}return _}async function us(v,_,k,E,T){if(!Ig)tg(Vs),Ig=!0;let j=await vc(v,_,k,E,T);j=await Vv(j,_,k,E,T),j=await Uv(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let W=B.length,F=Dn(j,ze,(U,Y)=>`\x00STX_COMPONENT_COMMENT_${W+Y}\x00`,`STX_COMPONENT_COMMENT:${W}`);B.push(...F.tokens);let V=j;if(j=await Hv(F.output,_,k,E,T),j===V)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,W)=>B[Number(W)]??"");if(E.debug){let z=Fv(j);if(z.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function iu(v,_){let k=0;for(let E=_;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return E}return-1}function Gv(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,W=1,F=z+1;while(F<E.length&&W>0){if(E[F]==="(")W++;else if(E[F]===")")W--;F++}if(W!==0)break;let V=E.substring(z+1,F-1),U=`${k}(${V})`;E=E.substring(0,B)+U+E.substring(F),T.lastIndex=B+U.length,j=T.exec(E)}return E}function Jv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function zg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(U)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===U){j++;return}j++}},W=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let U=1;while(j<B&&U>0)if(_[j]==="{")U++,j++;else if(_[j]==="}")U--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")W();else j++;continue}j++}},F=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
|
|
2476
|
-
`)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},V=()=>{if(T!==0)return;let U=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let se=U[2];if(!E.has(se))k.push(se),E.add(se);return}let Y=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let se=Y[1];if(!E.has(se))k.push(se),E.add(se);return}let Z=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let se=Z[1];if(!E.has(se))k.push(se),E.add(se)}};while(j<B){if(F())continue;if(_[j]==="'"||_[j]==='"'){z(_[j]);continue}if(_[j]==="`"){W();continue}if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))V();j++}return k.join(", ")}function Yv(v,_=""){let k=zg(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
|
|
2477
|
-
(function() {
|
|
2478
|
-
${Dt("var",k)}
|
|
2479
|
-
var __destroyHooks = [];
|
|
2480
|
-
var __origOnDestroy = onDestroy;
|
|
2481
|
-
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
2482
|
-
|
|
2483
|
-
${v}
|
|
2484
|
-
${_}})();
|
|
2485
|
-
`}function Qv(v,_){let T=zg(v).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
2486
|
-
`);return`
|
|
2487
|
-
// Register scope variables for STX runtime
|
|
2488
|
-
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2489
|
-
var __scopeRegistration = window.stx._scopes['${_}'] || { __destroyCallbacks: __destroyHooks };
|
|
2490
|
-
${T}
|
|
2491
|
-
// #1767: when the bundler renamed a component const that collided with an
|
|
2492
|
-
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
2493
|
-
// renamed declaration so it resolves to the component's value, not the
|
|
2494
|
-
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
2495
|
-
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
2496
|
-
window.stx._scopes['${_}'] = __scopeRegistration;
|
|
2497
|
-
`}function ew(v,_){return v.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,E)=>E===_?k:'<script data-stx-scoped data-stx-run="always"')}function jg(v,_){let k=Qv(v,_);return tw(Yv(v,k),_)}function tw(v,_){let k=`
|
|
2498
|
-
(function() {
|
|
2499
|
-
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
|
|
2500
|
-
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
2501
|
-
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
2502
|
-
if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
|
|
2503
|
-
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2504
|
-
window.stx._scopes['${_}'] = {};
|
|
2505
|
-
}
|
|
2506
|
-
try {`,E=`
|
|
2507
|
-
} finally {
|
|
2508
|
-
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2509
|
-
}
|
|
2510
|
-
})();`;return k+v+`
|
|
2511
|
-
} finally {
|
|
2512
|
-
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2513
|
-
}
|
|
2514
|
-
})();`}function nw(v,_){if(jn(v)){let T=jn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(v,(j,B)=>`<body${B} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let E=k[2]+k[3],T=k[2].slice(1),j=E.match(/data-stx-scope="([^"]*)"/);if(j)return{html:v,mergedIntoExisting:j[1],stamped:!0,root:T};let B=k[1],z=k[2],W=k[3];return{html:`${B}${z} data-stx-scope="${_}"${W}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var rw=0;function Lg(v,_){let k=zt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),E=_.__stx_scope_seq;return E?`stx_scope_${k}_${++E.n}_${E.key}`:`stx_scope_${k}_${++rw}`}var au=new Set,cu=new Set;function tu(){au.clear(),cu.clear()}var sw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ic(v){let _=(z)=>z.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),E=[],T=0,j=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,B;while((B=j.exec(k))!==null){let z=B[1]==="/",W=B[2],F=B[3]==="/"||sw.has(W.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(W);if(!F)T++}return E}function Bg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var ve=new M(500),yi=new Set;function nu(){yi.clear()}function iw(v){if(v.__onceStore instanceof Set)return v.__onceStore;return yi}async function ws(v,_,k,E,T,j=new Set){let B=E.partialsDir||zt.join(zt.dirname(k),"partials");if(B&&!zt.isAbsolute(B))B=zt.resolve(process.cwd(),B);let z=Gv(v,"@partial","@include"),W=iw(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(ie,oe,ae)=>{let le=oe.trim(),ce=`${k}:${le}`;if(W.has(ce))return"";return W.add(ce),oe});{let ie=/@includeIf\s*\(/g,oe;while((oe=ie.exec(z))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,fe=le+1;while(fe<z.length&&ce>0){if(z[fe]==="(")ce++;else if(z[fe]===")")ce--;fe++}if(ce!==0)break;let ye=z.substring(le+1,fe-1),Se=ye.match(/^\s*['"]([^'"]+)['"]/);if(!Se){ie.lastIndex=fe;continue}let $e=Se[1],Re=F($e,B,k),Ae="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ae=`@include(${ye})`;z=z.substring(0,ae)+Ae+z.substring(fe),ie.lastIndex=0}}for(let[ie,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),le;while((le=ae.exec(z))!==null){let ce=le.index,fe=ce+le[0].length-1,ye=1,Se=fe+1;while(Se<z.length&&ye>0){if(z[Se]==="(")ye++;else if(z[Se]===")")ye--;Se++}if(ye!==0)break;let $e=z.substring(fe+1,Se-1),Re=iu($e,0);if(Re===-1){ae.lastIndex=Se;continue}let Ae=$e.substring(0,Re).trim(),Te=$e.substring(Re+1).trim(),Ie=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Ie){ae.lastIndex=Se;continue}let _e=Ie[1],De=Te.substring(Ie[0].length),Ne,Oe=iu(De,0);if(Oe!==-1)Ne=De.substring(Oe+1).trim();try{let Pe=`Boolean(${Ae})`,Le;if(p(Pe)){let ft=c(Pe,Object.keys(_));Le=Boolean(ft(...Object.values(_)))}else Le=Boolean(l(Pe,_));let ct=oe?!Le:Le,yt="";if(ct){let ft=F(_e,B,k);if(ft&&await Bun.file(ft).exists())T.add(ft);yt=`@include('${_e}'${Ne?`, ${Ne}`:""})`}z=z.substring(0,ce)+yt+z.substring(Se),ae.lastIndex=0}catch(Pe){let Le=Pe instanceof Error?Pe.message:String(Pe),ct=g("Include",`Error evaluating ${ie} condition: ${Le}`,k,v,ce);z=z.substring(0,ce)+ct+z.substring(Se),ae.lastIndex=0}}}{let ie=/@each\s*\(/g,oe;while((oe=ie.exec(z))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,fe=le+1;while(fe<z.length&&ce>0){if(z[fe]==="(")ce++;else if(z[fe]===")"){if(ce--,ce===0)break}fe++}if(ce!==0)break;let ye=z.substring(le+1,fe),Se=z.substring(ae,fe+1),$e=ye.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){ie.lastIndex=0,z=z.replace(Se,"");continue}let[,Re,Ae,Te,Ie]=$e;try{let _e,De=Ae.trim();if(p(De))_e=c(De,Object.keys(_))(...Object.values(_));else _e=l(De,_);let Ne="";if(Array.isArray(_e)&&_e.length>0)for(let Oe of _e){let Pe={..._,[Te]:Oe},Le=await Y(Re,Pe,v,ae);Ne+=Le}else if(Ie)Ne=await Y(Ie,{},v,ae);z=z.substring(0,ae)+Ne+z.substring(fe+1),ie.lastIndex=0}catch(_e){let De=_e instanceof Error?_e.message:String(_e);z=z.substring(0,ae)+g("Each",`Error in @each: ${De}`,k,v,ae)+z.substring(fe+1),ie.lastIndex=0}}}{let ie=/@includeFirst\s*\(/g,oe;while((oe=ie.exec(z))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,fe=le+1;while(fe<z.length&&ce>0){if(z[fe]==="(")ce++;else if(z[fe]===")"){if(ce--,ce===0)break}fe++}if(ce!==0)break;let ye=z.substring(le+1,fe),Se=z.substring(ae,fe+1),$e=ye.match(/^\s*(\[[^\]]+\])/);if(!$e){ie.lastIndex=0,z=z.replace(Se,"");continue}let Re=$e[1],Ae=ye.slice($e[0].length),Te,Ie=Ae.match(/^\s*,\s*\{/);if(Ie){Ae=Ae.slice(Ie[0].length-1);let Ne=1,Oe=1;while(Oe<Ae.length&&Ne>0){if(Ae[Oe]==="{")Ne++;else if(Ae[Oe]==="}"){if(Ne--,Ne===0)break}Oe++}Te=Ae.substring(0,Oe+1),Ae=Ae.slice(Oe+1)}let _e,De=Ae.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(De)_e=De[1];try{let Ne=JSON.parse(Re.replace(/'/g,'"')),Oe={};if(Te)try{Oe=O(Te,_)}catch(Le){let ct=Le instanceof Error?Le.message:String(Le);if(E.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ct}`,k,v,ae,Se);z=z.replace(Se,()=>yt)}else z=z.replace(Se,()=>_e||"");continue}let Pe=!1;for(let Le of Ne){let ct=F(Le,B,k);if(!ct)continue;if(await r(ct)){let yt=await Y(Le,Oe,v,ae);z=z.replace(Se,()=>yt),Pe=!0;break}}if(!Pe)if(_e!==void 0)z=z.replace(Se,()=>_e);else if(E.debug){let Le=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,Se);z=z.replace(Se,()=>Le)}else z=z.replace(Se,"")}catch(Ne){let Oe=Ne instanceof Error?Ne.message:String(Ne),Pe=g("Include",`Error processing @includeFirst: ${Oe}`,k,v,ae,Se);z=z.replace(Se,()=>Pe)}ie.lastIndex=0}}function F(ie,oe,ae){try{let le=ie;if(!ie.endsWith(".stx"))le=`${ie}.stx`;let ce=zt.resolve(oe),fe=zt.resolve(zt.dirname(ae)),ye;if(!le.startsWith("./")&&!le.startsWith("../")){for(let Ie of E._layerPartialDirs??[]){let _e=zt.resolve(Ie,le);if(_e.startsWith(`${zt.resolve(Ie)}${zt.sep}`)&&Zv(_e))return _e}ye=zt.resolve(oe,le)}else ye=zt.resolve(fe,le);let Se=zt.normalize(ye),$e=Se.startsWith(ce+zt.sep)||Se===ce,Re=Se.startsWith(fe+zt.sep)||Se===fe,Ae=!1,Te=zt.dirname(fe);if(Se.startsWith(Te+zt.sep)){if(!zt.relative(Te,Se).split(zt.sep).some((Ne)=>Ne.startsWith(".")&&Ne!=="."&&Ne!==".."))Ae=!0}if(!$e&&!Re&&!Ae)return console.error(`Security: Path traversal attempt blocked for include path: ${ie}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${ce}, ${fe}`),null;return Se}catch(le){return console.error(`Error resolving path ${ie}: ${le}`),null}}let V=zt.resolve(k);j.add(V);function U(ie,oe,ae,le){return E.onIncludeError?.({includePath:ie,templatePath:k,message:oe,partialsDir:B}),g("Include",oe,k,ae,le)}async function Y(ie,oe={},ae,le){let ce=F(ie,B,k);if(!ce)return U(ie,`Could not resolve path for include: ${ie}`,ae,le);let fe=zt.resolve(ce);if(j.has(fe)){let ye=[...j,fe].map((Se)=>zt.basename(Se)).join(" -> ");return U(ie,`Circular include detected: ${ye}`,ae,le)}try{T.add(ce);let ye;if(!ye)try{ye=await Bun.file(ce).text()}catch(dt){let St=dt instanceof Error?dt.message:String(dt);return U(ie,`Error loading include file ${ie}: ${St}`,ae,le)}if(ye)ye=ye.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ye&&ye.includes("@stream")){let{processStreamDirectives:dt}=await import("./chunk-1xyhdpbn.js");ye=dt(ye,_)}if(ye&&(E.debug||!he()&&!Sn()))try{let{warnUnbalancedTags:dt}=await import("./chunk-cqeccn7x.js");dt(ye,ce)}catch{}try{let{processESImports:dt}=await import("./chunk-t1tqn3xx.js");ye=await dt(ye,_,ce,E,T)}catch(dt){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${ce}:`,dt instanceof Error?dt.message:dt)}let Se=ye,$e=ee(Se);if($e)Se=$e.content.trim();let Ae=ye.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ae)Te=`<style${Ae[1]}>${Ae[2]}</style>`;let Ie=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(dt,St,gt)=>{if(!Bg(St))return"";return Ie.push({attrs:St,body:gt}),`__STX_DATA_BLOCK_${Ie.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=we(ye,ce);for(let[dt,St]of Object.entries(oe))_e[dt]=St;let De=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ne=[...ye.matchAll(De)],Oe="",Pe=null,Le=!1,ct=!1;for(let dt of Ne){let St=dt[1]||"",gt=dt[2]||"";if(Bg(St))continue;let Ft=St.includes("server"),Pn=Ge(St);if(!Ft&>.trim()){let{interpolateScriptExpressions:ot}=await import("./chunk-3ss3vfad.js");gt=ot(gt,_e,ie)}let An="";try{let{extractAndStripCssImports:ot,renderVendorStyleTags:ht}=await import("./chunk-g8b74qvn.js"),Lt=ot(gt,{filePath:ce,projectRoot:process.cwd()});gt=Lt.code,An=ht(Lt.styles)}catch(ot){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${ce}:`,ot instanceof Error?ot.message:ot)}if(Pn&>.trim())gt=Ke(gt);if(!Ft){try{let{injectBrowserCoreAutoImports:ht}=await import("./chunk-g8b74qvn.js");gt=ht(gt).code;let{hasUserImports:Lt,bundleClientScript:Vt}=await import("./chunk-y3kp87w1.js");if(Lt(gt))gt=await Vt(gt,ce,{projectRoot:process.cwd()})}catch(ht){if(E.debug)console.warn(`[stx] bundler skipped for ${ce}:`,ht instanceof Error?ht.message:ht)}let{stripStxRuntimeImports:ot}=await import("./chunk-jg9fydw8.js");gt=ot(gt)}let ut=Jv(gt);if(ut&&!Ft){Le=!0,Pe=Lg(ce,_);let ot=I(gt),ht=jg(ot,Pe);Oe+=`${An}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Pe}">${ht}</script>
|
|
2515
|
-
`;continue}if(Ft)try{let{extractVariables:ot}=await import("./chunk-98xp5rfe.js");await ot(gt,_e,ce)}catch(ot){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${ce}:`,ot)}if(!Ft&&!ut){let ot=St.replace(/\bclient\b/i,"").trim();Pe=Lg(ce,_);let ht=I(gt),Lt=jg(ht,Pe);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Lt))ct=!0;Oe+=`${An}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Pe}"${ot?` ${ot}`:""}>${Lt}</script>
|
|
2516
|
-
`}}if(Ie.length>0){let{interpolateScriptExpressions:dt}=await import("./chunk-3ss3vfad.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(St,gt)=>{let Ft=Ie[Number(gt)];return`<script${Ft.attrs}>${dt(Ft.body,_e,ie)}</script>`})}if(Pe){let dt=nw(Se,Pe);if(Se=dt.html,dt.mergedIntoExisting){let gt=Pe,Ft=dt.mergedIntoExisting;Oe=Oe.split(`'${gt}'`).join(`'${Ft}'`).split(`"${gt}"`).join(`"${Ft}"`),Pe=Ft}else if(!dt.stamped&&Le&&!au.has(ce))au.add(ce),console.warn(`[stx] ${zt.relative(process.cwd(),ce)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(dt.stamped&&dt.root!=="body"&&(Le||ct)&&!cu.has(ce)){let gt=Ic(Se);if(gt.length>1)cu.add(ce),console.warn(`[stx] ${zt.relative(process.cwd(),ce)} declares ${Le?"signals":"bindings"} and has ${gt.length} top-level elements (${gt.map((Ft)=>`<${Ft}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let St=dt.stamped&&dt.root!==null&&ln(dt.root);Oe=ew(Oe,St?Pe:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await ws(Se,_e,ce,E,T,j);let{processLoops:yt,reportDeferredLoopWarnings:ft}=await import("./chunk-74va4kza.js"),st=yt(Se,_e,ce,void 0,!0);st=fr(st,_e,ce),st=ft(st);let{processMetaDirectives:pt,processSeoDirective:lt,processStructuredData:wt}=await import("./chunk-re030f77.js");if(st=pt(st,_e,ce,E),st=wt(st,_e,ce),st=lt(st,_e,ce,E),st=K(st,_e,ce),Te)st+=`
|
|
2517
|
-
`+Te;if(Oe)st+=`
|
|
2518
|
-
`+Oe;return st}catch(ye){let Se=ye instanceof Error?ye.message:String(ye);return U(ie,`Error processing include ${ie}: ${Se}`,ae,le)}}let Z=/@include\s*\(/g,se;while((se=Z.exec(z))!==null){let ie=se.index,oe=ie+se[0].length-1,ae=1,le=oe+1;while(le<z.length&&ae>0){if(z[le]==="(")ae++;else if(z[le]===")")ae--;le++}if(ae!==0)break;let ce=z.substring(ie,le),fe=z.substring(oe+1,le-1),ye=fe.match(/^\s*['"]([^'"]+)['"]/);if(!ye){Z.lastIndex=le;continue}let Se=ye[1],$e,Re=fe.substring(ye[0].length),Ae=iu(Re,0);if(Ae!==-1)$e=Re.substring(Ae+1).trim();let Te={};if($e)try{Te=O($e,_)}catch(_e){let De=_e instanceof Error?_e.message:String(_e);z=z.replace(ce,g("Include",`Error parsing include variables for ${Se}: ${De}`,k,v,ie)),Z.lastIndex=0;continue}let Ie=await Y(Se,Te,v,ie);z=z.substring(0,ie)+Ie+z.substring(le),Z.lastIndex=0}return z}function vs(v,_){let k=v;function E(T,j,B,z){let W=T,F=!0;while(F){F=!1;let V=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),U=W.match(V);if(!U||U.index===void 0)break;let Y=U.index,Z=U[1],se=Y+U[0].length,ie=new RegExp(`@${j}\\(`),oe=new RegExp(`@${B}(?![a-z])`),ae=1,le=se,ce=-1;while(ae>0&&le<W.length){let ye=W.slice(le),Se=ye.match(ie),$e=ye.match(oe),Re=Se?le+Se.index:1/0,Ae=$e?le+$e.index:1/0;if(Re<Ae)ae++,le=Re+(Se[0].length||1);else if(Ae<1/0){if(ae--,ae===0){ce=Ae;break}le=Ae+B.length+1}else break}if(ce===-1)break;let fe=W.slice(se,ce);if(!_[Z])_[Z]=[];if(z)_[Z].unshift(fe);else _[Z].push(fe);W=W.substring(0,Y)+W.substring(ce+`@${B}`.length),F=!0}return W}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function xs(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
|
|
2519
|
-
`)})}import*as lu from"path";async function Wg(v,_,k=""){if(lu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Vg(v,_,k,"@js","@endjs")}async function Fg(v,_,k=""){if(lu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((j)=>({...j,displayName:`User ${j.id}: ${j.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return Vg(v,_,k,"@ts","@endts")}async function Vg(v,_,k,E,T){let j=v,B=Tr(`${E}([\\s\\S]*?)${T}`,"g"),z=[],W;while((W=B.exec(v))!==null)z.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:F,content:V,index:U}of z)try{let Y={..._,global:_},Z=Object.keys(Y),se=Object.values(Y),ie=V.trim();if(E==="@ts")ie=ie.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 ae=(ie.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((Se)=>Se.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),le=ae.length>0?`return { ${ae.join(", ")} };`:"return {};",ce=`
|
|
2520
|
-
${ie}
|
|
2521
|
-
${le}
|
|
2522
|
-
`,ye=Function(...Z,ce)(...se);if(ye&&typeof ye==="object")Object.assign(_,ye);j=j.replace(F,"")}catch(Y){console.error(`Error executing ${E} code block in ${k}:`,Y);let Z=Y instanceof Error?Y.message:String(Y),se=g(`${E} Directive`,`Error executing code: ${Z}`,k,v,U,F);console.error(se),j=j.replace(F,"")}return j}var ow=1000,aw=!1;function cw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index+j[0].length,z=j.index+j[0].indexOf("("),W=S(v,"(",")",z);if(W===-1)continue;let F=v.slice(B,W).trim();if(!F)continue;if(!Object.keys(_).some((Y)=>new RegExp(`(?:^|[^\\w$.])${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(F)))continue;let U;try{let Y=O(F,_);if(!Y||typeof Y!=="object")continue;U=JSON.stringify(Y)}catch{continue}E+=v.slice(T,B)+U,T=W,k.lastIndex=W}return T===0?v:E+v.slice(T)}function lw(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,W=1,F=z+1;while(F<E.length&&W>0){if(E[F]==="(")W++;else if(E[F]===")"){if(W--,W===0)break}F++}if(W!==0)continue;let V=E.substring(z+1,F),U=F+1,Y=V.match(/^\s*['"]([^'"]+)['"]/);if(!Y)continue;let Z=Y[1],se=V.slice(Y[0].length),ie=se.match(/^\s*,\s*/);if(!ie)continue;let oe=se.slice(ie[0].length).trim();if(!oe)continue;try{let ae=O(oe,_),le=JSON.stringify(ae),ce=`@component('${Z}', ${le})`;j.push({start:B,end:U,replacement:ce})}catch{continue}}for(let B=j.length-1;B>=0;B--){let{start:z,end:W,replacement:F}=j[B];E=E.substring(0,z)+F+E.substring(W)}return E}function Sa(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,W=1,F=z+1,V=null,U=!1;while(F<E.length&&W>0){let se=E[F];if(U){U=!1,F++;continue}if(se==="\\"&&V){U=!0,F++;continue}if(V){if(se===V)V=null;F++;continue}if(se==='"'||se==="'"||se==="`"){V=se,F++;continue}if(se==="(")W++;else if(se===")"){if(W--,W===0)break}F++}if(W!==0)break;let Y=E.substring(z+1,F),Z=k(Y);E=E.substring(0,B)+Z+E.substring(F+1)}return E}function uw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,T)=>{if(T in _)return`:${T}="${T}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,T,j)=>{try{let B=Object.keys(_),z=Object.values(_);Fs(j);let F=c(j,B)(...z),V=JSON.stringify(F);if(V===void 0){if(!Ce(j).some((Z)=>!(Z in _)))return"";return E}let U=Buffer.from(V,"utf8").toString("base64");return`__stx_${T}="${U}"`}catch(B){return E}}),k}var $a="<!--__STX_BREAK__-->",_a="<!--__STX_CONTINUE__-->";function dw(v,_){let k=v;return k=Sa(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=c(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(l(j,_));return B?$a:""}catch{return""}}),k=Sa(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=c(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(l(j,_));return B?_a:""}catch{return""}}),k}function fw(v){let _=v;return _=_.replace(/@break(?!\()/g,$a),_=_.replace(/@continue(?!\()/g,_a),_}function Ug(v){let _=v.includes($a),k=_?v.substring(0,v.indexOf($a)):v;return{hasBreak:_,content:k}}function Hg(v){let _=v.includes(_a),k=_?v.substring(0,v.indexOf(_a)):v;return{hasContinue:_,content:k}}function Kg(v){let _=v;return _=Sa(_,"@break",(k)=>{let E=k.trim();if(!ur(E))return"";return`\`; if (${E}) { break; } result += \``}),_=Sa(_,"@continue",(k)=>{let E=k.trim();if(!ur(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function pw(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((V,U)=>V.pos-U.pos);let z=[],W=0;for(let V of E)W+=V.delta,z.push({pos:V.pos,depth:W});function F(V){let U=0,Y=z.length-1,Z=0;while(U<=Y){let se=U+Y>>1;if(z[se].pos<=V)Z=z[se].depth,U=se+1;else Y=se-1}return Z}while((k=_.exec(v))!==null){if(F(k.index)>0)continue;let V=k.index,U=k.index+k[0].length-1,Y=1,Z=U+1,se=-1;while(Z<v.length&&Y>0){if(v[Z]==="(")Y++;else if(v[Z]===")"){if(Y--,Y===0){se=Z;break}}Z++}if(se===-1)continue;let ie=v.substring(U+1,se),oe=Ct(ie);if(!oe)continue;let{arrayExpr:ae,itemVar:le}=oe,ce=se+1,fe=1,ye=ce,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(fe>0&&ye<v.length){Se.lastIndex=ye,$e.lastIndex=ye;let Ne=Se.exec(v),Oe=$e.exec(v);if(!Oe)break;if(Ne&&Ne.index<Oe.index)fe++,ye=Ne.index+Ne[0].length;else{if(fe--,fe===0){Re=Oe.index;break}ye=Oe.index+11}}if(Re===-1)continue;let Ae=v.substring(ce,Re),Te=Re+11,Ie=-1,_e=0,De=0;while(De<Ae.length){let Ne=Ae.indexOf("@",De);if(Ne===-1)break;let Oe=Ae.substring(Ne);if(/^@forelse\s*\(/.test(Oe))_e++,De=Ne+1;else if(Oe.startsWith("@endforelse"))_e--,De=Ne+11;else if(_e===0&&Oe.startsWith("@empty")){if(Ae.length<=Ne+6||!/[a-z]/i.test(Ae[Ne+6])){Ie=Ne;break}De=Ne+1}else De=Ne+1}if(Ie===-1)continue;return{start:V,end:Te,arrayExpr:ae,itemVar:le,foreachContent:Ae.substring(0,Ie),emptyContent:Ae.substring(Ie+6)}}return null}function qg(v,_){let k=v;while(!0){let E=pw(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:W,emptyContent:F}=E;try{let V;if(p(B))V=c(B,Object.keys(_))(...Object.values(_));else V=l(B,_);let U;if(!Array.isArray(V)||V.length===0)U=F;else U=`@foreach (${B} as ${z})${W}@endforeach`;k=k.substring(0,T)+U+k.substring(j)}catch(V){let U=V instanceof Error?V.message:String(V),Y=i("Forelse",`Error in @forelse(${B} as ${z}): ${U}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Y+k.substring(j)}}return k}var Xg="<!--stx:foreach-not-iterable:",gw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function mw(v,_){return`${Xg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function hw(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function bs(v){if(!v.includes(Xg))return v;return v.replace(gw,(_,k,E)=>(hw(decodeURIComponent(k),decodeURIComponent(E)),""))}function hi(v,_,k,E,T=!1){let j=v;j=qg(j,_);function B(F){let V=/@foreach\s*\(/g,U;while((U=V.exec(F))!==null){let Y=U.index,Z=U.index+U[0].length-1,se=1,ie=Z+1,oe=-1;while(ie<F.length&&se>0){if(F[ie]==="(")se++;else if(F[ie]===")"){if(se--,se===0){oe=ie;break}}ie++}if(oe===-1)continue;let ae=F.substring(Z+1,oe),le=Ct(ae);if(!le)continue;let ce=Y,{arrayExpr:fe,itemVar:ye}=le,Se=oe+1,$e=1,Re=Se,Ae=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Re<F.length){Ae.lastIndex=Re,Te.lastIndex=Re;let Ie=Ae.exec(F),_e=Te.exec(F);if(!_e)break;if(Ie&&Ie.index<_e.index)$e++,Re=Ie.index+Ie[0].length;else{if($e--,$e===0){let De=F.substring(Se,_e.index),Ne=_e.index+11;return{start:ce,end:Ne,arrayExpr:fe,itemVar:ye,content:De}}Re=_e.index+11}}}return null}function z(F,V){let U=F;while(!0){let Y=B(U);if(!Y)break;let{start:Z,end:se,arrayExpr:ie,itemVar:oe,content:ae}=Y;try{let le=ie.trim(),ce;if(p(le))ce=c(le,Object.keys(V))(...Object.values(V));else ce=l(le,V);let fe=!1;if(!Array.isArray(ce))if(ce instanceof Map)ce=Array.from(ce),fe=!0;else if(ce instanceof Set)ce=Array.from(ce);else if(typeof ce==="string")ce=Array.from(ce);else if(ce&&typeof ce==="object"&&!(ce instanceof Date)&&!(ce instanceof RegExp))ce=Object.entries(ce),fe=!0;else{let _e=mw(le,k)+i("Foreach",`Error in @foreach: ${le} is not iterable`,t.TYPE_ERROR);U=U.substring(0,Z)+_e+U.substring(se);continue}let ye=E?.loops?.useAltLoopVariable??aw,Se=oe.trim(),$e=null,Re,Ae=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((De)=>De.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((De)=>De.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ae=!0;else Re=Se}else Re=Se;let Te="",Ie=ce;for(let _e=0;_e<Ie.length;_e++){let De=Ie[_e],Ne={index:_e,iteration:_e+1,first:_e===0,last:_e===Ie.length-1,count:Ie.length},Oe={...V,loop:Ne,$loop:Ne};if(Re.startsWith("[")&&Re.endsWith("]")){let yt=Re.slice(1,-1).split(",").map((ft)=>ft.trim());if(Array.isArray(De))yt.forEach((ft,st)=>{if(ft)Oe[ft]=De[st]});else Oe[Re]=De}else if(Re.startsWith("{")&&Re.endsWith("}")){let yt=Re.slice(1,-1).split(",").map((ft)=>ft.trim()).filter(Boolean);if(De!==null&&typeof De==="object")yt.forEach((ft)=>{let st=ft.indexOf(":"),pt=(st===-1?ft:ft.slice(0,st)).trim(),lt=st===-1?pt:ft.slice(st+1).trim();if(pt&<)Oe[lt]=De[pt]});else Oe[Re]=De}else Oe[Re]=De;if($e)if(!Ae&&fe&&Array.isArray(De)&&De.length===2)Oe[$e]=De[0],Oe[Re]=De[1];else Oe[$e]=_e;let Pe=dw(ae,Oe),Le=Hg(Pe);if(Le.hasContinue){Te+=Le.content;continue}let ct=Ug(Pe);if(ct.hasBreak){Te+=ct.content;break}if(Pe=qg(Pe,Oe),Pe=z(Pe,Oe),Pe=fr(Pe,Oe,k),Pe=fw(Pe),ct=Ug(Pe),ct.hasBreak){Te+=ct.content;break}if(Le=Hg(Pe),Le.hasContinue){Te+=Le.content;continue}Pe=K(Pe,Oe,k),Pe=uw(Pe,Oe),Pe=lw(Pe,Oe),Pe=cw(Pe,Oe),Te+=Pe}U=U.substring(0,Z)+Te+U.substring(se)}catch(le){let ce=i("Foreach",`Error in @foreach(${ie.trim()} as ${oe.trim()}): ${le instanceof Error?le.message:String(le)}`,t.EVALUATION_ERROR);U=U.substring(0,Z)+ce+U.substring(se)}}return U}j=z(j,_),j=Gg(j,_,k,E);let W=E?.loops?.maxWhileIterations??ow;return j=bw(j,_,W),T?j:bs(j)}function Pc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function Zg(v){return ur(v)}function Gg(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=z+B[0].length-1,F=S(T,"(",")",W);if(F===-1)break;let V=Pc(T.slice(W+1,F)),U=F+1,Y=oa(T.slice(z),"for","endfor");if(Y.length===0)break;let Z=Y[0].content,se=z+Y[0].end;if(!Zg(V)){let ie=i("For",`Unsafe expression in @for: ${V}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+ie+T.substring(se),j=!0;continue}try{let ie=yw(V),oe=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(ie.length>0&&oe){let Se=xw({forExpr:V,content:Z,iterVarNames:ie,context:_,filePath:k,options:E});T=T.substring(0,z)+Se+T.substring(se),j=!0;continue}let ae=Object.keys(_),le=Object.values(_),ce=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);ce=Kg(ce);let ye=Function(...ae,`
|
|
2523
|
-
let result = '';
|
|
2524
|
-
for (${V}) {
|
|
2525
|
-
result += \`${ce}\`;
|
|
2526
|
-
}
|
|
2527
|
-
return result;
|
|
2528
|
-
`)(...le);T=T.substring(0,z)+ye+T.substring(se),j=!0}catch(ie){let oe=i("For",`Error in @for(${V}): ${ie instanceof Error?ie.message:String(ie)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+oe+T.substring(se),j=!0}}return T}function yw(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((z)=>{let W=z.trim();if(!W)return"";let F=W.indexOf(":");if(F>=0&&j.startsWith("{")){let Y=W.slice(F+1).trim(),Z=Y.indexOf("=");return(Z>=0?Y.slice(0,Z):Y).trim()}let V=W.indexOf("="),U=(V>=0?W.slice(0,V):W).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let E=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function xw(v){let{forExpr:_,content:k,iterVarNames:E,context:T,filePath:j,options:B}=v,z=Object.keys(T),W=Object.values(T),F=Function(...z,"__pushIter",`
|
|
2529
|
-
for (${_}) {
|
|
2530
|
-
__pushIter([${E.join(", ")}])
|
|
2531
|
-
}
|
|
2532
|
-
`),V=[];F(...W,(Z)=>{V.push(Z)});let U=j??"inline.stx",Y="";for(let Z of V){let se={...T};E.forEach((oe,ae)=>{se[oe]=Z[ae]});let ie=Gg(k,se,j,B);ie=fr(ie,se,U),ie=K(ie,se,U),Y+=ie}return Y}function bw(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@while\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=B+j[0].length-1,W=S(E,"(",")",z);if(W===-1)break;let F=E.slice(z+1,W),V=oa(E.slice(B),"while","endwhile");if(V.length===0)break;let U=V[0].content,Y=B+V[0].end;if(!Zg(F)){let Z=i("While",`Unsafe expression in @while: ${F}`,t.UNSAFE_EXPRESSION);E=E.substring(0,B)+Z+E.substring(Y),T=!0;continue}try{let Z=Object.keys(_),se=Object.values(_),ie=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(le,ce)=>`\${${ce}}`);ie=Kg(ie);let ae=Function(...Z,`
|
|
2533
|
-
let result = '';
|
|
2534
|
-
let maxIterations = ${k}; // Configurable safety limit
|
|
2535
|
-
let counter = 0;
|
|
2536
|
-
while (${F} && counter < maxIterations) {
|
|
2537
|
-
counter++;
|
|
2538
|
-
result += \`${ie}\`;
|
|
2539
|
-
}
|
|
2540
|
-
if (counter > maxIterations) {
|
|
2541
|
-
result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
2542
|
-
}
|
|
2543
|
-
return result;
|
|
2544
|
-
`)(...se);E=E.substring(0,B)+ae+E.substring(Y),T=!0}catch(Z){let se=i("While",`Error in @while(${F}): ${Z instanceof Error?Z.message:String(Z)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+se+E.substring(Y),T=!0}}return E}function vw(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function Jg(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,E,T,j)=>vw(E,j||"_method"))}async function Yg(v,_,k,E,T){if(!E.middleware||E.middleware.length===0)return v;let j=v,B=E.middleware.filter((z)=>z.timing===T);if(B.length===0)return j;for(let z of B){if(!z.name||typeof z.handler!=="function"){if(E.debug)console.warn("Invalid middleware:",z);continue}try{let W=await z.handler(j,_,k,E);if(typeof W==="string")j=W;else if(E.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(W){if(E.debug)console.error(`Error in middleware ${z.name}:`,W);if(E.debug){let F=g("Middleware",`Error in middleware '${z.name}': ${W instanceof Error?W.message:String(W)}`,k,v);j=j.replace(/<body[^>]*>/,`$&
|
|
2545
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(F)}</div>
|
|
2546
|
-
`)}}}return j}async function Qg(v,_,k,E){return Yg(v,_,k,E,"before")}async function em(v,_,k,E){return Yg(v,_,k,E,"after")}function tm(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?O(T,{}):{};return En(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var lo={patterns:[],exact:{}};async function nm(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(lo.exact[v])for(let E of lo.exact[v])await Promise.resolve(E(_,v));if(lo.exact[k])for(let E of lo.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of lo.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var ww=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Sw=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 Lr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let E=k.exec(v);if(!E)return null;let T=/\/\s*>$/.test(E[0])||E[1]===E[1].toLowerCase()&&ww.has(E[1]),j=T?E[2].replace(/\/\s*$/,""):E[2];return{full:E[0],tag:E[1],attrs:j,selfClosing:T,start:E.index,end:E.index+E[0].length}}function $w(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),B=new RegExp(`</${_}\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T;let z=j.exec(v),W=B.exec(v);if(!W)return-1;if(z&&z.index<W.index)E++,T=z.index+z[0].length;else{if(E--,E===0)return W.index+W[0].length;T=W.index+W[0].length}}return-1}function jr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=$w(v,_.tag,_.end);if(k===-1)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};return{outerStart:_.start,outerEnd:k,innerHTML:v.slice(_.end,k-`</${_.tag}>`.length)}}function rm(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function uo(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function Cr(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return v.replace(new RegExp(`\\s*${k}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${k}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${k}(?=\\s|$|>|/)`,"g"),"")}function Zs(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function _w(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function kw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=uo(E.attrs,"v-for");if(T===null){k=E.end;continue}let j=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!j){k=E.end;continue}let B=j[1].trim(),z=j[2].trim(),W;if(B.includes(",")){let oe=B.split(",").map((ce)=>ce.trim()),ae=oe[0],le=oe[1];W=`${z} as ${le} => ${ae}`}else W=`${z} as ${B}`;let F=Cr(E.attrs,"v-for"),V=Cr(F,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=jr(_,E),Y=_.slice(U.outerStart,U.outerEnd),Z=Zs(Y,{...E,start:0,end:E.end-E.start},V),se=`@foreach(${W})
|
|
2547
|
-
`,ie=`${se}${Z}
|
|
2548
|
-
@endforeach`;_=_.slice(0,U.outerStart)+ie+_.slice(U.outerEnd),k=U.outerStart+se.length}return _}function Ew(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=uo(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=jr(_,E),z=Cr(E.attrs,"v-if"),W=Zs(_.slice(B.outerStart,B.outerEnd),{...E,start:0,end:E.end-E.start},z);j.push({type:"if",expr:T,outerStart:B.outerStart,outerEnd:B.outerEnd,element:W,parsedTag:E});let F=B.outerEnd,V=!0;while(V){let ie=_.slice(F).match(/^\s*/),oe=ie?ie[0].length:0,ae=Lr(_,F+oe);if(!ae){V=!1;break}let le=uo(ae.attrs,"v-else-if"),ce=rm(ae.attrs,"v-else");if(le!==null){let fe=jr(_,ae),ye=Cr(ae.attrs,"v-else-if"),Se=Zs(_.slice(fe.outerStart,fe.outerEnd),{...ae,start:0,end:ae.end-ae.start},ye);j.push({type:"else-if",expr:le,outerStart:F,outerEnd:fe.outerEnd,element:Se,parsedTag:ae}),F=fe.outerEnd}else if(ce){let fe=jr(_,ae),ye=Cr(ae.attrs,"v-else"),Se=Zs(_.slice(fe.outerStart,fe.outerEnd),{...ae,start:0,end:ae.end-ae.start},ye);j.push({type:"else",outerStart:F,outerEnd:fe.outerEnd,element:Se,parsedTag:ae}),V=!1}else V=!1}let U=[];for(let ie of j)if(ie.type==="if")U.push(`@if(${ie.expr})
|
|
2549
|
-
${ie.element}`);else if(ie.type==="else-if")U.push(`@elseif(${ie.expr})
|
|
2550
|
-
${ie.element}`);else U.push(`@else
|
|
2551
|
-
${ie.element}`);U.push("@endif");let Y=U.join(`
|
|
2552
|
-
`),Z=j[0].outerStart,se=j[j.length-1].outerEnd;_=_.slice(0,Z)+Y+_.slice(se),k=Z+Y.length}return _}function Cw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Rw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=Sw.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,W,F)=>{let V=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(W);if(!V||!F||!/^["']/.test(F))return z;let U=V[1]||"modelValue",Y=V[2];if(T&&!V[1])return`@model${Y}=${F}`;let Z=F[0],se=F.slice(1,-1),ie=`:${U}=${F} @update:${U}=${Z}${se} = $event${Z}`;if(Y){let oe=V[1]?`${U}Modifiers`:"modelModifiers",ae=Y.slice(1).split(".").map((le)=>`${le}: true`).join(", ");ie+=` :${oe}="{ ${ae} }"`}return ie});if(j===E.attrs){k=E.end;continue}let B=Zs(E.full,{...E,start:0,end:E.full.length},j);_=_.slice(0,E.start)+B+_.slice(E.end),k=E.start+B.length}return _}function Aw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Tw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Iw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=uo(E.attrs,"v-html");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=jr(_,E),B=Cr(E.attrs,"v-html"),z=E.selfClosing?" /":"",W=`<${E.tag}${B}${z}>{!! ${T} !!}</${E.tag}>`;_=_.slice(0,j.outerStart)+W+_.slice(j.outerEnd),k=j.outerStart+W.length}return _}function Pw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=uo(E.attrs,"v-text");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=jr(_,E),B=Cr(E.attrs,"v-text"),z=E.selfClosing?" /":"",W=`<${E.tag}${B}${z}>{{ ${T} }}</${E.tag}>`;_=_.slice(0,j.outerStart)+W+_.slice(j.outerEnd),k=j.outerStart+W.length}return _}function Dw(v){return v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Mw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;if(!rm(E.attrs,"v-once")){k=E.end;continue}let T=Cr(E.attrs,"v-once"),j=jr(_,E),B=_.slice(j.outerStart,j.outerEnd),W=`@once
|
|
2553
|
-
${Zs(B,{...E,start:0,end:E.end-E.start},T)}
|
|
2554
|
-
@endonce`;_=_.slice(0,j.outerStart)+W+_.slice(j.outerEnd),k=j.outerStart+W.length}return _}function Ow(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Nw(v){return v.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function sm(v){if(!_w(v))return v;let _=v;return _=kw(_),_=Ew(_),_=Mw(_),_=Aw(_),_=Tw(_),_=Rw(_),_=Cw(_),_=Nw(_),_=Iw(_),_=Pw(_),_=Dw(_),_=Ow(_),_}function ka(v){return v.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var uu=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"]),jw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function im(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),E=k?k[1]:v,T=l(E,_);if(T&&typeof T==="string")return T;let j=E.trim();return uu.has(j)?j:null}function om(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function am(v,_,k){let E=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=E?`<${v} ${E}>`:`<${v}>`;if(jw.has(v))return E?`<${v} ${E}>`:`<${v}>`;return`${T}${k}</${v}>`}async function cm(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],W;while((W=B.exec(j))!==null)z.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let F=z.length-1;F>=0;F--){let V=z[F];try{let U=im(V.expr,_);if(!U||typeof U!=="string"){let le=`<!-- dynamic component: could not resolve "${ka(om(V.expr))}" -->`;j=j.slice(0,V.index)+le+j.slice(V.index+V.full.length);continue}if(uu.has(U)){let le=am(U,V.attrs,V.slotContent);j=j.slice(0,V.index)+le+j.slice(V.index+V.full.length);continue}let Y=V.attrs.trim(),Z={},se=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,ie;while((ie=se.exec(Y))!==null){let le=ie[1]||ie[2],ce=ie[3];if(ie[1])try{Z[le]=l(ce,_)}catch{Z[le]=ce}else Z[le]=ce}let oe=E.componentsDir||"components",ae=await Xe(U,Z,V.slotContent,oe,_,k,E,new Set,T??new Set);j=j.slice(0,V.index)+ae+j.slice(V.index+V.full.length)}catch(U){let Y=U instanceof Error?U.message:String(U),Z=`<!-- dynamic component error: ${ka(Y)} -->`;j=j.slice(0,V.index)+Z+j.slice(V.index+V.full.length)}}return j=await Lw(j,_,k,E,T),j}async function Lw(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],W;while((W=B.exec(j))!==null)z.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let F=z.length-1;F>=0;F--){let V=z[F];try{let U=im(V.expr,_);if(!U||typeof U!=="string"){let se=`<!-- dynamic component: could not resolve "${ka(om(V.expr))}" -->`;j=j.slice(0,V.index)+se+j.slice(V.index+V.full.length);continue}if(uu.has(U)){let se=am(U,V.attrs,"");j=j.slice(0,V.index)+se+j.slice(V.index+V.full.length);continue}let Y=E.componentsDir||"components",Z=await Xe(U,{},"",Y,_,k,E,new Set,T??new Set);j=j.slice(0,V.index)+Z+j.slice(V.index+V.full.length)}catch(U){let Y=U instanceof Error?U.message:String(U),Z=`<!-- dynamic component error: ${ka(Y)} -->`;j=j.slice(0,V.index)+Z+j.slice(V.index+V.full.length)}}return j}var bi="X-STX-Build",du=Symbol.for("stx.buildId");function Ss(){let v=globalThis;if(!v[du])v[du]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[du]}function lm(v,_=Ss()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
|
|
2555
|
-
<meta name="stx-build" content="${_}">`}function Bw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let E=null,T=!1,j=[],B={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>E,onUpdateReady(V){if(B.updateReady)try{V()}catch{}else j.push(V);return()=>{let U=j.indexOf(V);if(U!==-1)j.splice(U,1)}},applyUpdate(){let V=E&&E.waiting;if(!V)return!1;return T=!0,V.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=B;let z=(V)=>{if(!V.waiting||!_.controller||B.updateReady)return;B.updateReady=!0;let U=j.splice(0);for(let Y of U)try{Y()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(V)=>{let U=V.data||{};if(U.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:U.url,kind:U.kind,fragment:!!U.fragment}}))}catch{}if(U.type==="stx:reachability"){if(k.stxOffline.reachable=U.reachable!==!1,Number(U.at)>0)k.stxOffline.reachedAt=Number(U.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:U.reachable!==!1,at:Number(U.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&E&&E.waiting)E.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let W=()=>{_.register(v,{scope:"/"}).then((V)=>{E=V;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(V.waiting)z(V),V.waiting.postMessage({type:"stx:activate-update",reason:"load"});V.addEventListener("updatefound",()=>{let U=V.installing;if(!U)return;U.addEventListener("statechange",()=>{if(U.state==="installed")z(V)})})}).catch(()=>{})},F=()=>{let V=(U)=>{setTimeout(U,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>V(W));else V(W)};if(!_.controller)if(document.readyState==="complete")F();else addEventListener("load",F);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",F);else F()}function zw(){let v=`(${Bw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var um=`<script data-stx-offline>${zw()}</script>`;import{AsyncLocalStorage as Ww}from"async_hooks";var dm=new Ww;function dn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function fm(v,_){return dm.run(dn(v),_)}async function pm(v,_){let k=dm.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let E=k.pending.get(v);if(E)return E;let T=Promise.resolve().then(_).then((j)=>{let B=JSON.stringify(j,(W,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(v)}) 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(v)}) requires JSON-serializable data`);return F}),z=JSON.parse(B);return k.values.set(v,z),z}).catch((j)=>{throw k.pending.delete(v),j});return k.pending.set(v,T),T}function Jn(v){let _=v.__stx_server_data;if(!_?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(_.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var Fw=/<\/(script)/gi;function Gs(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Fw,"<\\/$1")}import gm from"path";function N(v,_={}){return new _n(v,_).routes}var mm=new Map;async function hm(v,_){let k=v,E=_;if(!k||!E)try{let z=await o();k||=z?.pagesDir||"pages",E||=z?.root||"."}catch{k||="pages",E||="."}let T=gm.isAbsolute(k)?k:gm.join(E,k),j=mm.get(T);if(j)return j;let B=[];try{B=N(".",{pagesDir:T,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{B=[]}return mm.set(T,B),B}function Uw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ym(v){return Uw(JSON.stringify(v))}function de(v){return v.includes("data-stx-runtime")}function xm(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let E=v.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 fu(v,_){let k=Vi(v),E=v.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return v.slice(0,k)+_+`
|
|
2556
|
-
`+v.slice(k);let T=gn(v);if(T!==null)return`${v.slice(0,T)}
|
|
2557
|
-
${_}${v.slice(T)}`;if(v.includes("</head>")){let B=v.indexOf("</head>");return v.slice(0,B)+_+`
|
|
2558
|
-
`+v.slice(B)}if(jn(v))return fs(v,(B)=>`${B}
|
|
2559
|
-
${_}`);return`${_}
|
|
2560
|
-
${v}`}async function Ea(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-ge87hcgb.js"),{url:j}=await T("runtime",_.debug===!0);return fu(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return fu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-ge87hcgb.js"),E=await k(_.debug);return fu(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function Hw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function bm(v){if(v.includes("data-stx-tooltip-runtime")||!Hw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Vl()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
|
|
2561
|
-
${_}`;return`${v.slice(0,k)}${_}
|
|
2562
|
-
${v.slice(k)}`}var qw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Kw(v){return qw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function X(v,_){if(!v.includes("</body>"))return v;if(Kw(v))return v;let k=_?.router,E="";{let W={};if(k){if(k.container)W.container=k.container;if(k.interceptAllLinks!==void 0)W.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)W.progress=k.progress;if(k.viewTransitions!==void 0)W.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)W.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)W.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)W.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)W.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)W.prefetch=k.prefetch;if(k.cache!==void 0)W.cache=k.cache;if(k.progressColor!==void 0)W.progressColor=k.progressColor;if(k.progressHeight!==void 0)W.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)W.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)W.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)W.keepOpening=k.keepOpening}try{let F=await hm(_?.pagesDir,_?.root);if(F.length>0)W.ownedRoutes=F}catch{}if(Object.keys(W).length>0)E=`<script>window.__stxRouterConfig=${ym(W)};</script>
|
|
2563
|
-
`}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-ge87hcgb.js"),B=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await j("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,z=v.lastIndexOf("</body>");return v.slice(0,z)+E+B+`
|
|
2564
|
-
</body>`+v.slice(z+7)}var vm=Symbol.for("stx.lazy-module-promises");function Xw(){let v=globalThis;return v[vm]??=new Map,v[vm]}function mt(v,_){let k=Xw(),E=`${import.meta.url}\x00${v}`,T=k.get(E);if(T)return T;let j=_();return k.set(E,j),j.catch(()=>{if(k.get(E)===j)k.delete(E)}),j}var pu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Cm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Zw=65536,Gw=4,Ra=new Map;function eu(){Ra.clear()}function Jw(v){let _=[];for(let k of Q(v,H)){let E=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!E||!T)continue;let j=E[0].length,B=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,B),start:k.start,end:k.end}))}return _}function xc(v,_={}){let k=v.length>=Zw,E=k?Ra.get(v):void 0;if(E===void 0){if(E=Jw(v),k)rd(Ra,Gw),Ra.set(v,E)}let T=_.skipAttrs;if(!T)return E.slice();let j=[];for(let B of E)if(T.lastIndex=0,!T.test(B.attrs))j.push(B);return j}function ps(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),j=k[2].trim(),{itemVar:B,indexVar:z}=wm(j);if(B)return{style:"as",iterable:T,itemVar:B,indexVar:z}}let E=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(E){let T=E[1].trim(),j=E[2].trim(),{itemVar:B,indexVar:z}=wm(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function wm(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let E=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(E)return{itemVar:E[1],indexVar:E[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let j=_.match(/^(\w+)$/);if(j)return{itemVar:j[1],indexVar:null};return{itemVar:null,indexVar:null}}function gs(v,_){return Fi(v,_)}function Yw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,E;while((E=_.exec(v))!==null){let T=E[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Rm(v){let _=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,T;while((T=k.exec(v))!==null){let j=T[1],B;while((B=E.exec(j))!==null)_.add(B[1])}return _}function Qw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${pu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=Q(v,(j,B)=>{_.lastIndex=B;let z=_.exec(j);if(!z||z.index!==B||!k.test(z[2]))return-1;return _.lastIndex}),T=[];for(let j of E){_.lastIndex=0;let B=_.exec(j.token);if(!B)continue;let z=B[2].match(k),W=ps(z?.[1]??z?.[2]??""),F=[W.itemVar,W.indexVar].filter(Boolean);if(F.length===0)continue;let V=B[1],Y=/\/\s*>$/.test(j.token)||Aa.has(V.toLowerCase())?j.end:mu(v,j.start,V,j.end);if(Y!==-1)T.push({start:j.start,end:Y,vars:new Set(F)})}return T}var Sm=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 eS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function $m(v,_,k,E){if(!v)return!1;let T=eS(v),j=!1,B=!1,z=!1,W=/([a-zA-Z_$][\w$]*)/g,F;while((F=W.exec(T))!==null){let Z=F[1];if(T.slice(0,F.index).trimEnd().endsWith("."))continue;if(Sm.has(Z))continue;if(_.has(Z)||E?.has(Z))j=!0;else if(k&&Z in k)B=!0}let V=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=V.exec(T))!==null){let Z=U[1];if(T.slice(0,U.index).trimEnd().endsWith("."))continue;if(Sm.has(Z)||k&&Z in k)continue;z=!0}return(j||z)&&!B}function Ca(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,""")}"`,T=v.trim(),j=T.match(Cm);if(j&&tS(j[3],j[1])){let[,B,z,W]=j;return`<${B}${z}${E}>${W}</${B}>`}return`<template${E}>${T}</template>`}function tS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),E=0,T;while((T=k.exec(v))!==null)if(T[1]){if(E--,E<0)return!1}else E++;return!0}function di(v,_){let k=Rm(v);function E(T){let j=T,B=Qw(T),z=(U)=>{let Y=new Set;for(let Z of B)if(U>Z.start&&U<Z.end)for(let se of Z.vars)Y.add(se);return Y},W=/@if\s*\(/g,F,V=[];while((F=W.exec(j))!==null){let U=F.index,Y=U+F[0].length,Z=1,se=Y;while(se<j.length&&Z>0){if(j[se]==="(")Z++;else if(j[se]===")")Z--;se++}if(Z!==0)continue;let ie=j.substring(Y,se-1).trim(),oe=se,ae=1,le=oe,ce=/@(if\s*\(|endif)/g;ce.lastIndex=oe;let fe;while((fe=ce.exec(j))!==null)if(fe[1].startsWith("if"))ae++;else if(fe[1]==="endif"){if(ae--,ae===0){le=fe.index+fe[0].length;break}}if(ae!==0)continue;let ye=j.substring(oe,le-6).trim(),Se;if(Yw(ye)){let $e=Zi(j.substring(U,le));if($e.length===0)continue;let Re=$e[0].branches.filter((_e)=>_e.type!=="else"),Ae=z(U);if(!(Re.length>0&&Re.every((_e)=>$m(_e.condition,k,_,Ae))))continue;Se=$e[0].branches.map((_e)=>{let De=E(_e.content);if(_e.type==="elseif")return Ca(De,"@else-if",_e.condition??"");if(_e.type==="else")return Ca(De,"@else");return Ca(De,"@if",_e.condition??"")}).join(`
|
|
2565
|
-
`)}else{if(!$m(ie,k,_,z(U)))continue;Se=Ca(E(ye),"@if",ie)}V.push({start:U,end:le,replacement:Se}),W.lastIndex=le}for(let U=V.length-1;U>=0;U--){let{start:Y,end:Z,replacement:se}=V[U];j=j.substring(0,Y)+se+j.substring(Z)}return j}return E(v)}function nS(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let E=_.match(/^"((?:\\.|[^"\\])*)"$/);if(E)return E[1].length>0;return}var Aa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_m=/<(script|style)\b/iy,rS=/<\/script/gi,sS=/<\/style/gi;function mu(v,_,k,E){if(Aa.has(k.toLowerCase()))return E;let T=k.toLowerCase(),j=v.length,B=1,z=E;while(z<j){let W=v.indexOf("<",z);if(W===-1)return-1;if(z=W,v.startsWith("<!--",z)){let Y=v.indexOf("-->",z+4);if(Y===-1)return-1;z=Y+3;continue}_m.lastIndex=z;let F=_m.exec(v);if(F){let Y=v.indexOf(">",z);if(Y===-1)return-1;if(v[Y-1]==="/"){z=Y+1;continue}let Z=F[1].toLowerCase()==="script"?rS:sS;Z.lastIndex=z;let se=Z.exec(v);if(se===null)return-1;let ie=v.indexOf(">",se.index);if(ie===-1)return-1;z=ie+1;continue}if(v[z+1]==="/"){let Y=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!Y){z++;continue}if(Y[1].toLowerCase()===T){if(B--,z+=Y[0].length,B===0)return z;continue}z+=Y[0].length;continue}let V=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!V){z++;continue}let U=v.indexOf(">",z);if(U===-1)return-1;if(V[1].toLowerCase()===T){let Y=v.slice(z,U+1);if(!(/\/\s*>$/.test(Y)||Aa.has(T)))B++}z=U+1}return-1}var iS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function oS(v,_){let k=_,E=v.length;for(;;){while(k<E&&v[k]!=="<")k++;if(k>=E)return!1;if(v.startsWith("<!--",k)){let B=v.indexOf("-->",k+4);if(B===-1)return!1;k=B+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let j=v.slice(k,T+1);return iS.test(j)}function ui(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(v))!==null)_.push([E.index,E.index+E[0].length]);let T=(U)=>_.some(([Y,Z])=>U>=Y&&U<Z),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,B=[],z;while((z=j.exec(v))!==null){if(T(z.index))continue;let[U,Y,Z,se,ie,oe,ae]=z,le=nS(ie);if(le===void 0)continue;let ce=z.index,fe=ce+U.length,$e=!!ae||/\/\s*>$/.test(U)||Aa.has(Y.toLowerCase())?fe:mu(v,ce,Y,fe);if($e===-1)continue;if((se===":if"||se==="x-if"||se==="@if")&&oS(v,$e)){j.lastIndex=fe;continue}if(le===!0){let Ae=`<${Y}${Z}${oe}${ae}>`;B.push({start:ce,end:fe,replacement:Ae});continue}B.push({start:ce,end:$e,replacement:""}),j.lastIndex=$e}if(B.length===0)return v;B.sort((U,Y)=>U.start-Y.start);let W=[],F=-1;for(let U of B){if(U.start<F)continue;W.push(U),F=U.end}let V=v;for(let U=W.length-1;U>=0;U--){let{start:Y,end:Z,replacement:se}=W[U];V=V.substring(0,Y)+se+V.substring(Z)}return V}var km=[":for","@for","x-for"];function ms(v,_){if(!_||Object.keys(_).length===0)return v;if(!km.some((z)=>v.includes(`${z}=`)))return v;let k=Rm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let z of _.__stx_client_signal_names)if(typeof z==="string")k.add(z)}let E=v,T=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,B;while((B=j.exec(E))!==null){let[z,W,F]=B,V=B.index,U=V+z.length,Y=km.map((Se)=>({attr:Se,m:new RegExp(`\\s${Se}="([^"]*)"`).exec(F)})).find((Se)=>Se.m!==null);if(!Y||!Y.m)continue;let Z=ps(Y.m[1]);if(!Z.iterable||!Z.itemVar)continue;let se=Z.iterable.trim().split(/[.[(]/)[0].trim();if(!se||k.has(se)||!(se in _))continue;let ie=mu(E,V,W,U);if(ie===-1)continue;let oe=F.replace(new RegExp(`\\s${Y.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=E.slice(U,ie-`</${W}>`.length),le={..._,[Z.itemVar]:void 0};if(Z.indexVar)le[Z.indexVar]=void 0;let ce=ms(ae,le),fe=Z.indexVar?`${Z.iterable} as ${Z.indexVar} => ${Z.itemVar}`:`${Z.iterable} as ${Z.itemVar}`,ye=W.toLowerCase()==="template"?ce:`<${W}${oe}>${ce}</${W}>`;T.push({start:V,end:ie,replacement:`@foreach(${fe})${ye}@endforeach`}),j.lastIndex=ie}for(let z=T.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=T[z];E=E.slice(0,W)+V+E.slice(F)}return E}function hs(v,_){let k=v,E=/@(for|foreach)\s*\(/g,T,j=[],B=[];while((T=E.exec(k))!==null){let z=T[1],W=T.index,F=W+T[0].length,V=1,U=F;while(U<k.length&&V>0){if(k[U]==="(")V++;else if(k[U]===")")V--;U++}if(V!==0)continue;let Y=k.substring(F,U-1).trim(),Z=U,se=ps(Y),ie=z==="for"?"@endfor":"@endforeach",oe=1,ae=Z,le=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");le.lastIndex=Z;let ce;while((ce=le.exec(k))!==null)if(ce[1].startsWith(z))oe++;else if(oe--,oe===0){ae=ce.index+ce[0].length;break}if(oe!==0)continue;let fe=()=>{let Te=[se.itemVar,se.indexVar].filter(Boolean);if(Te.length)B.push({start:W,end:ae,vars:Te})};if(se.iterable){let Te=se.iterable.trim();if(Te.startsWith("[")||Te.startsWith("{")||Te.startsWith("'")||Te.startsWith('"')||Te.startsWith("`")||/^-?\d/.test(Te)){fe();continue}let Ie=Te.split(/[.[(]/)[0].trim(),_e=_?Ie in _:!1,De=B.some((Ne)=>W>Ne.start&&W<Ne.end&&Ne.vars.includes(Ie));if(Ie&&(_e||De)){fe();continue}}if(se.style==="as")Y=se.indexVar?`(${se.itemVar}, ${se.indexVar}) in ${se.iterable}`:`${se.itemVar} in ${se.iterable}`;let ye=k.substring(Z,ae-ie.length).trim(),Se=_?{..._}:{};if(se.itemVar)delete Se[se.itemVar];if(se.indexVar)delete Se[se.indexVar];let $e=hs(ye,Se),Re=$e.match(Cm),Ae;if(Re){let[,Te,Ie,_e]=Re;Ae=`<${Te}${Ie} @for="${Y}">${_e}</${Te}>`}else Ae=`<template @for="${Y}">${$e}</template>`;j.push({start:W,end:ae,replacement:Ae}),E.lastIndex=ae}for(let z=j.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=j[z];k=k.substring(0,W)+V+k.substring(F)}return k}function aS(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(V)=>{let U=E+1;while(U<j){let Y=v[U];if(Y==="\\"){U+=2;continue}if(Y===V)return U+1;U++}return j},z=()=>{let V=E+2;while(V<j&&v[V]!==`
|
|
2566
|
-
`)V++;return V},W=()=>{let V=E+2;while(V<j-1){if(v[V]==="*"&&v[V+1]==="/")return V+2;V++}return j},F=(V)=>{let U=V,Y=0;while(U<j){let Z=v[U];if(Z==="/"&&v[U+1]==="/"){let se=U+2;while(se<j&&v[se]!==`
|
|
2567
|
-
`)se++;U=se;continue}if(Z==="/"&&v[U+1]==="*"){let se=U+2;while(se<j-1&&!(v[se]==="*"&&v[se+1]==="/"))se++;U=se+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let se=U+1;while(se<j){if(v[se]==="\\"){se+=2;continue}if(v[se]===Z){se++;break}se++}U=se;continue}if(Z==="("||Z==="["||Z==="{"){Y++,U++;continue}if(Z===")"||Z==="]"||Z==="}"){Y--,U++;continue}if(Z===";"&&Y===0)return U+1;U++}return j};while(E<j){let V=v[E];if(V==="/"&&v[E+1]==="/"){let U=z();k.push(v.slice(E,U)),E=U;continue}if(V==="/"&&v[E+1]==="*"){let U=W();k.push(v.slice(E,U)),E=U;continue}if(V==='"'||V==="'"||V==="`"){let U=B(V);k.push(v.slice(E,U)),E=U;continue}if(V==="{"){T++,k.push(V),E++;continue}if(V==="}"){T--,k.push(V),E++;continue}if(T===0){let U=E>0?v[E-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let Z=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Z){let se=Z[2],ie=F(E+Z[0].length);if(_.has(se)){k.push(`/* stx: deduped const ${se} */`),E=ie;continue}_.add(se),k.push(v.slice(E,ie)),E=ie;continue}}}k.push(V),E++}return k.join("")}var cS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function gu(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function lS(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!gu(T,T+_.length,k))return!0;E=T+_.length}return!1}function uS(v,_){if(lS(v,"<body",_)){let T=new RegExp(`<body(${pu})>`,"g"),j;while((j=T.exec(v))!==null)if(!gu(j.index,j.index+j[0].length,_))return j.index+j[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${pu})>`,"gi"),E;while((E=k.exec(v))!==null){if(gu(E.index,E.index+E[0].length,_))continue;if(cS.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function dS(v,_,k,E){let T=[],j=` data-stx="${E}"`,B=0,z=!1,W=(F)=>{if(k!==null&&!z&&k>=B&&k<=F)T.push(v.slice(B,k),j,v.slice(k,F)),z=!0;else T.push(v.slice(B,F))};for(let F of _){if(F.start<B)continue;W(F.start),B=F.end}return W(v.length),T.join("")}async function Xn(v,_,k,E={}){let T=xc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),j=/\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*\(/,B=[],{hasUserImports:z,bundleClientScript:W}=await mt("stx/client-script-bundler",()=>import("./chunk-y3kp87w1.js"));for(let ce of T){let fe=ce.body;if(Ge(ce.attrs))fe=Ke(fe);if(E.forceClientSetup||j.test(fe)){B.push({content:fe,start:ce.start,end:ce.end});continue}if(!z(fe))continue;try{let ye=await W(kt(fe).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(ye))B.push({content:fe,start:ce.start,end:ce.end})}catch{}}if(B.length===0)return{output:v,setupCode:null};let F=`${_??""}\x00${B.map((ce)=>ce.content).join("\x00")}`,V=`__stx_setup_${Bun.hash(F).toString(36).slice(0,10)}`,U=[];for(let ce=0;ce<B.length;ce++){let fe=B[ce].bundled??kt(B[ce].content).code;if(!B[ce].bundled&&z(fe))fe=await W(fe,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});fe=qe(fe);let ye=I(fe);U.push(`// \u2500\u2500 merged signal script #${ce+1} \u2500\u2500
|
|
2568
|
-
${ye}`)}let Y=U.join(`
|
|
2569
|
-
|
|
2570
|
-
`);Y=aS(Y);let Z=Sc(Y),se=Z.split(",").map((ce)=>ce.trim()).filter(Boolean),ie=ns(Y,k),oe=`
|
|
2571
|
-
<script data-stx-scoped>
|
|
2572
|
-
function ${V}() {
|
|
2573
|
-
${Dt("const",se)}
|
|
2574
|
-
${Gs(`${ie}${Y}`)}
|
|
2575
|
-
return { ${Z} };
|
|
2576
|
-
}
|
|
2577
|
-
window.__stx_latestSetup=${V};
|
|
2578
|
-
if(window.stx)window.stx._latestSetup=${V};
|
|
2579
|
-
</script>`,ae=uS(v,B);return{output:dS(v,B,ae,V),setupCode:oe}}function Sc(v){let _=s(v),k=[],E=new Set,T=0,j=0,B=_.length,z=()=>{if(T!==0)return;let W=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(W){let Z=W[2];if(!E.has(Z))k.push(Z),E.add(Z);return}let F=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(F){F[1].split(",").forEach((Z)=>{let se=Z.trim();if(!se)return;let ie=se.indexOf(":"),ae=(ie>=0?se.slice(ie+1).trim():se).split(/[\s=]/)[0];if(ae&&!E.has(ae))k.push(ae),E.add(ae)});return}let V=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(V){V[1].split(",").forEach((Z)=>{let se=Z.trim().replace(/^\.\.\./,"");if(!se)return;let ie=se.split(/[\s=]/)[0];if(ie&&!E.has(ie))k.push(ie),E.add(ie)});return}let U=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let Z=U[1];if(!E.has(Z))k.push(Z),E.add(Z);return}let Y=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!E.has(Z))k.push(Z),E.add(Z)}};while(j<B){if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))z();j++}return k.join(", ")}async function pi(v,_,k,E){if(!gs(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await Xn(T,k,E);if(T=j,!B){let z=jn(T);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let W=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,z.index)+W+T.slice(z.index+z.tag.length)}}if(T=await Ea(T,_),B){let z=fi(T,/<\/head>/i),W=z===-1?fi(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
|
|
2580
|
-
${T.slice(z)}`;else if(W!==-1){let F=/<body[^>]*>/i.exec(T.slice(W))[0],V=W+F.length;T=`${T.slice(0,V)}
|
|
2581
|
-
${B}${T.slice(V)}`}else T=`${T}
|
|
2582
|
-
${B}`}return T}function fi(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],T;while((T=k.exec(v))!==null)E.push([T.index,T.index+T[0].length]);let j=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),B=0;while(B<v.length){let z=j.exec(v.slice(B));if(!z)return-1;let W=B+z.index;if(!E.some(([V,U])=>W>=V&&W<U))return W;B=W+Math.max(z[0].length,1)}return-1}var Em="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function kc(v){let _=[];for(let k of v.split(",")){let E=k.trim();if(!E||E.startsWith("type "))continue;let T=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T&&T[1]!==T[2])_.push(`${T[2]} = ${T[1]}`)}if(_.length===0)return Em;return`var ${_.join(", ")}; ${Em}`}var fS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function qe(v){return v.replace(fS,(_,k)=>kc(k))}import Js from"path";import pS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[E,T]of Object.entries(pS.env)){if(!E.startsWith(v)||T===void 0)continue;_[`import.meta.env.${E}`]=JSON.stringify(T),k[E]=T}return _["import.meta.env"]=JSON.stringify(k),_}function Am(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function Tm(v,_,k){try{let E;if(v.startsWith("/")){let T=_;for(let j=0;j<5;j++){let B=Js.join(T,v);if(await Bun.file(B).exists())return B;T=Js.dirname(T)}E=Js.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))E=Js.resolve(_,v);else E=Js.resolve(_,v);if(await Bun.file(E).exists())return E;return null}catch{return null}}var Im=Symbol.for("stx.inline-assets.import-meta");function gS(v,_){if(!v.includes("import.meta"))return;let k=Error(`[stx] ${_} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
2583
|
-
`+" `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[Im]=!0,k}async function Pm(v,_,k){let E=v,T=Js.dirname(_),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,B;while((B=j.exec(E))!==null){let[F,V,U,Y]=B;if(Am(U))continue;let Z=await Tm(U,T,_);if(Z)try{let se=await Bun.file(Z).text();if(k.add(Z),U.endsWith(".ts")||U.endsWith(".tsx")){let oe=await Bun.build({entrypoints:[Z],target:"browser",minify:!0,define:w()});if(oe.outputs.length>0)se=await oe.outputs[0].text(),gS(se,U)}let ie=`<script>
|
|
2584
|
-
// Source: ${U}
|
|
2585
|
-
${se}
|
|
2586
|
-
</script>`;E=E.replace(F,ie),j.lastIndex=0}catch(se){if(se?.[Im])throw se}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=z.exec(E))!==null){let[F,V,U,Y]=W,Z=V+Y;if(Am(U))continue;if(/rel=["']stylesheet["']/.test(Z)||U.endsWith(".css")){let ie=await Tm(U,T,_);if(ie)try{let oe=await Bun.file(ie).text();k.add(ie);let ae=`<style>
|
|
2587
|
-
/* Source: ${U} */
|
|
2588
|
-
${oe}
|
|
2589
|
-
</style>`;E=E.replace(F,ae),z.lastIndex=0}catch(oe){}}}return E}function ks(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,W=B+1,F=null,V=!1;while(W<k.length&&z>0){let ce=k[W];if(V){V=!1,W++;continue}if(ce==="\\"&&F){V=!0,W++;continue}if(F){if(ce===F)F=null;W++;continue}if(ce==='"'||ce==="'"||ce==="`"){F=ce,W++;continue}if(ce==="(")z++;else if(ce===")"){if(z--,z===0)break}W++}if(z!==0)break;let U=k.substring(B+1,W).trim(),Y=k.substring(j,W+1),Z=-1,se=0,ie=null,oe=!1;for(let ce=0;ce<U.length;ce++){let fe=U[ce];if(oe){oe=!1;continue}if(fe==="\\"&&ie){oe=!0;continue}if(ie){if(fe===ie)ie=null;continue}if(fe==='"'||fe==="'"||fe==="`"){ie=fe;continue}if(fe==="("||fe==="["||fe==="{")se++;else if(fe===")"||fe==="]"||fe==="}")se--;if(fe===","&&se===0){Z=ce;break}}let ae=Z>=0?U.substring(0,Z).trim():U,le=Z>=0?U.substring(Z+1).trim():void 0;try{let ce=ae.trim(),fe;if(p(ce))fe=c(ce,Object.keys(_))(...Object.values(_));else fe=void 0;let ye;if(le==="true")ye=JSON.stringify(fe,null,2);else ye=JSON.stringify(fe);let Se=ye.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(W+1),E.lastIndex=j+Se.length}catch(ce){P.log(ce instanceof Error?ce:Error(String(ce)),{directive:"@json"},"error"),E.lastIndex=j+Y.length}}return k}function Cs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Nm(v){let _=v,k=/@memo\s*\(/g,E,T=[];while((E=k.exec(_))!==null){let j=E.index,B=j+E[0].length,z=1,W=B;while(W<_.length&&z>0){if(_[W]==="(")z++;else if(_[W]===")")z--;W++}if(z!==0)continue;let F=_.slice(B,W-1).trim(),V=W,U=_.slice(V),Y=U.indexOf("@endmemo");if(Y===-1)continue;let Z=U.slice(0,Y),se=V+Y+8,ie=Z.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=ie?ie[0].length:0,ae=Z.slice(oe),le=Z.match(/(\s*)$/),ce=le?le[0].length:0,fe=ae.slice(0,ae.length-ce),ye=fe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),Se;if(ye){let[$e,Re,Ae="",Te]=ye,Ie=`<${Re}${Ae} data-stx-memo="${F}"${Te}>`;Se=Z.slice(0,oe)+Ie+fe.slice($e.length)+Z.slice(oe+fe.length)}else Se=`${Z.slice(0,oe)}<div data-stx-memo="${F}">${fe}</div>${Z.slice(oe+fe.length)}`;T.push({start:j,end:se,replacement:Se}),k.lastIndex=se}for(let j=T.length-1;j>=0;j--){let B=T[j];_=_.slice(0,B.start)+B.replacement+_.slice(B.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function hu(v){let _=v.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return _=_.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),_}function jm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=Q(v,(W,F)=>{k.lastIndex=F;let V=k.exec(W);if(!V||/^(?:script|style)$/i.test(V[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:W,end:F,token:V}of E){let U=/^<\/?([\w-]+)/.exec(V)[1].toLowerCase();if(V.startsWith("</")){let Z;while(Z=T.pop()){if(Z.scoped)j--;if(Z.name===U)break}continue}let Y=/\sdata-stx-scope\s*=/.test(V);if(!j&&!Y&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(V)&&!/\sdata-stx-ref-caller\s*=/.test(V))z.push(v.slice(B,W),V.replace(/\s*\/?>$/,(Z)=>` data-stx-ref-caller="${_}"${Z}`)),B=F;if(!Lm.has(U)&&!/\/>$/.test(V)){if(T.push({name:U,scoped:Y}),Y)j++}}return z.push(v.slice(B)),z.join("")}var Lm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Bm=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Dm=/<\/?\s*([a-z][\w-]*)/iy,mS=/\s/;function hS(v,_){let k=_-1;while(k>=0&&mS.test(v[k]))k--;return k>=0&&v[k]==="/"}function yS(v,_){let k=!1,E=!1;for(let T=_;T<v.length;T++){let j=v[T];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 T}return-1}function xS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,E=_,T=!1,j=!1,B=!1;while(E<v.length){let z=v.indexOf("<",E),W=z===-1?v.length:z;if(W>E){if(k===0)while(E<W){let U=v.indexOf(j?"}":"{",E);if(U===-1||U>=W){if(j)B=!1;else T=!1;break}if(U>E)if(j)B=!1;else T=!1;if(j){if(B)return!0;B=!0}else if(T)j=!0,B=!1;else T=!0;E=U+1}E=W;continue}if(v.startsWith("<!--",E)){let U=v.indexOf("-->",E);E=U===-1?v.length:U+3;continue}let F=yS(v,E);if(F===-1)break;Dm.lastIndex=E;let V=Dm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!hS(v,F)&&!Lm.has(V))k++;E=F+1}return!1}var Mm=m(256);function zm(v){if(v.length<1024)return Om(v);let _=h(v),k=Mm.get(_);if(k!==void 0)return k;let E=Om(v);return Mm.set(_,E),E}function Om(v){if(v.length>=32768&&!nd(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index,z=B+j[0].length,W=!1,F=!1,V=-1;while(z<v.length){let Y=v[z];if(W){if(Y==="'")W=!1}else if(F){if(Y==='"')F=!1}else if(Y==="'")W=!0;else if(Y==='"')F=!0;else if(Y===">"){V=z;break}z++}if(V===-1)continue;let U=v.slice(B,V+1);if(Bm.test(U))continue;if(U.includes("x-cloak"))continue;if(xS(v,V+1))E+=v.slice(T,V)+" x-cloak>",T=V+1}return E+=v.slice(T),E}var bS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,vS=/<\/script>/gi,wS=/<\/style>/gi;function Wm(v){let _=/<[a-z][\w-]*/gi,k="",E=0,T;while((T=_.exec(v))!==null){let j=T.index,B=T[0].slice(1).toLowerCase();if(B==="script"||B==="style"){let se=B==="script"?vS:wS;se.lastIndex=j;let ie=se.exec(v);if(ie!==null)_.lastIndex=ie.index+ie[0].length;continue}let z=j+T[0].length,W=!1,F=!1,V=-1;while(z<v.length){let se=v[z];if(W){if(se==="'")W=!1}else if(F){if(se==='"')F=!1}else if(se==="'")W=!0;else if(se==='"')F=!0;else if(se===">"){V=z;break}z++}if(V===-1)continue;let U=v.slice(j+T[0].length,V);if(Bm.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!bS.test(U))continue;let Y=v[V-1]==="/",Z=Y?V-1:V;k+=`${v.slice(E,Z)} x-cloak${Y?" ":""}`,E=Z}return k+=v.slice(E),k}var yu=m(256),SS=[{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"}],Fm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function $S(v){let _=Array.from(v,(T)=>T===`
|
|
2590
|
-
`?`
|
|
2591
|
-
`:" "),k=0,E="";while(k<v.length){let T=v[k],j=v[k+1];if(E){if(T==="\\"){k+=2;continue}if(T===E)E="";k++;continue}if(T==='"'||T==="'"||T==="`"){E=T,k++;continue}if(T==="/"&&j==="/"){while(k<v.length&&v[k]!==`
|
|
2592
|
-
`)_[k]=v[k],k++;continue}if(T==="/"&&j==="*"){let B=v.indexOf("*/",k+2),z=B===-1?v.length:B+2;for(;k<z;k++)_[k]=v[k];continue}if(T==="{"&&j==="{"&&v.slice(k,k+4)==="{{--"){let B=v.indexOf("--}}",k+4),z=B===-1?v.length:B+4;for(;k<z;k++)_[k]=v[k];continue}k++}return _.join("")}function _S(v){let _=new Map,k=$S(v).split(`
|
|
2593
|
-
`),E=v.split(`
|
|
2594
|
-
`);return k.forEach((T,j)=>{Fm.lastIndex=0;for(let B of T.matchAll(Fm)){let z=B[1]==="-next-line",W=(E[j]??"").slice(0,B.index).trim(),F=z||W===""?j+2:j+1,U=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Y=U.filter((se)=>/\w/.test(se));if(U.length>0&&Y.length===0)continue;let Z=_.get(F);if(Z&&Z.size===0)continue;if(Y.length===0){_.set(F,new Set);continue}if(Z)Y.forEach((se)=>Z.add(se));else _.set(F,new Set(Y))}}),_}function kS(v,_,k){let E=v.get(_);if(!E)return!1;if(E.size===0)return!0;return[...E].some((T)=>k.includes(T))}function _s(v,_,k,E){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let j=h(v,_,E,JSON.stringify(T)),B=yu.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],W=_S(v),F=[],V=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(se)=>se.replace(/[^\n]/g," ")));for(let{pattern:se,message:ie,suggestion:oe}of SS){if(z.some((le)=>/\w/.test(le)&&ie.includes(le)))continue;se.lastIndex=0;let ae=V.match(se);if(ae&&ae.length>0){let le=V.split(`
|
|
2595
|
-
`),ce=v.split(`
|
|
2596
|
-
`),fe=[];if(le.forEach((Re,Ae)=>{if(se.lastIndex=0,se.test(Re)&&!kS(W,Ae+1,ie))fe.push(Ae+1)}),fe.length===0&&le.some((Re)=>(se.lastIndex=0,se.test(Re))))continue;let ye=fe.length>0?` (script line${fe.length>1?"s":""} ${fe.join(", ")})`:"",Se=fe.slice(0,3).map((Re)=>` ${Re} | ${(ce[Re-1]??"").trim().slice(0,100)}`).join(`
|
|
2597
|
-
`),$e=Se?`
|
|
2598
|
-
${Se}`:"";F.push(` \u2717 ${ie}${ye}
|
|
2599
|
-
\u2192 ${oe}${$e}`)}}if(F.length===0){yu.set(j,"");return}let U=(se)=>{let ie=`${process.cwd()}/`;return se.startsWith(ie)?se.slice(ie.length):se},Z=`[STX] DOM API violation in ${E&&E!==_?`${U(E)} (composed into ${U(_)})`:U(_)}:
|
|
2600
|
-
${F.join(`
|
|
2601
|
-
`)}
|
|
2602
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(yu.set(j,Z),T.failOnViolation)throw Error(Z);else console.warn(Z)}import xu from"path";var ES=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,CS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function RS(v,_){if(!_||!v.includes("/"))return v;let k=xu.dirname(_);return v.replace(ES,(E,T,j,B)=>{let z=xu.resolve(k,B);return`${T}${j}${z.split(xu.sep).join("/")}${j}`})}function Vm(v,_){if(!_||!v.includes("<script"))return v;return v.replace(CS,(k,E,T,j)=>`${E}${RS(T,_)}${j}`)}var Br="<!--PARENT_CONTENT_PLACEHOLDER-->";function Um(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Jm(v,_){let k=v.length,E=_,T=!0,j=[],B=(z)=>z+9<=k&&v[z]==="<"&&v[z+1]==="/"&&(v[z+2]==="s"||v[z+2]==="S")&&(v[z+3]==="c"||v[z+3]==="C")&&(v[z+4]==="r"||v[z+4]==="R")&&(v[z+5]==="i"||v[z+5]==="I")&&(v[z+6]==="p"||v[z+6]==="P")&&(v[z+7]==="t"||v[z+7]==="T")&&(v[z+8]===">"||/\s/.test(v[z+8]));while(E<k){let z=v[E];if(B(E))return E;if(z==="/"&&v[E+1]==="/"){if(E=v.indexOf(`
|
|
2603
|
-
`,E+2),E===-1)return-1;E+=1,T=!0;continue}if(z==="/"&&v[E+1]==="*"){let W=v.indexOf("*/",E+2);if(W===-1)return-1;E=W+2,T=!0;continue}if(z==="/"&&T){let W=E+1,F=!1;while(W<k){let V=v[W];if(V==="\\"){W+=2;continue}if(V==="[")F=!0;else if(V==="]")F=!1;else if(V==="/"&&!F){W++;break}else if(V===`
|
|
2604
|
-
`){W=-1;break}W++}if(W===-1){E++,T=!1;continue}while(W<k&&/[a-z]/.test(v[W]))W++;E=W,T=!1;continue}if(z==="'"||z==='"'){let W=z;E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]===W){E++;break}if(v[E]===`
|
|
2605
|
-
`)break;E++}T=!1;continue}if(z==="`"){E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}if(j.length===0)T=!1;continue}if(z==="}"&&j.length>0){j.pop(),E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++,T=!1;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))T=!1;else T=!0;E++}return-1}function Ym(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!E)return null;let T=E.index+E[0].length,j=v.indexOf("</script>",T);if(j===-1)return null;let B=v.indexOf(">",j);if(B===-1)return null;return{start:E.index,end:B+1}}var TS=4096;async function Hm(v,_,k){if(k.buildMode!=="serve"||_.length<TS)return null;let{registerServeModuleBundle:E}=await import("./chunk-ge87hcgb.js");return`<script ${v} src="${E(_)}"></script>`}async function qm(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await mt("stx/client-module-registry",()=>import("./chunk-tc5zk2ka.js")),j=[],B=await T(E(...v),{minify:_.buildMode==="compile",collectInputs:j});for(let z of j)k?.add(z);if(!B)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-ge87hcgb.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(B)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function IS(v,_=""){let k=Ym(v,"data-stx-runtime");if(!k)return v;let E=Vi(v);if(E===-1||E===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(E<k.start)return v.slice(0,E)+v.slice(k.start,k.end)+_+`
|
|
2606
|
-
`+v.slice(E,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),j=v.slice(0,k.start)+v.slice(k.end),B=Vi(j);if(B===-1)return T+_+`
|
|
2607
|
-
`+j;return j.slice(0,B)+T+_+`
|
|
2608
|
-
`+j.slice(B)}function PS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,E,T)=>{let j=v.slice(0,T);return j.lastIndexOf("<")>j.lastIndexOf(">")?`{{${E}}}`:`{<!--stx-literal-->{${E}}}`})}async function n(v,_,k,E,T){if(E.ssr===!1&&!E.autoShell&&E.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=we(v,k);let j=!_.__stxProcessingDepth;dn(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await fn(_,k,E.runtimeConfig);if(j)Vu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ns(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!he()&&!Sn())&&k&&k.endsWith(".stx"))qs(v,k);try{return await q.timeAsync("template-processing",async()=>{let B=await DS(v,_,k,E,T);if(j)B=hu(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=ge(E.app?.head,{known:wn,source:"app.head"}),F=(_.__stx_runtime_head||null)??js(),V=(_.__stx_head_raw||"").trim(),U,Y=V.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Y)U=Y[1].trim(),V=V.replace(Y[0],"").trim();let Z=_.__sections?.title,se=F.title||U||Z,ie=!F.title&&(!!U||!!Z),oe=F.meta||[],ae=new Set(oe.map(($e)=>ke($e)).filter(Boolean)),le={...z,...se&&{title:se},meta:[...(z.meta||[]).filter(($e)=>!ae.has(ke($e))),...oe],link:[...z.link||[],...F.link||[]],script:[...z.script||[],...F.script||[]],headRaw:[z.headRaw,V].filter(Boolean).join(`
|
|
2609
|
-
`),...F.htmlAttrs&&{htmlAttrs:Oi(z.htmlAttrs,F.htmlAttrs)},...F.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...F.bodyAttrs}}},ce=Ls(B);if(B=yn(B,le,{...ie&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},ce),ce)B=Mi(B,z),B=hn(B,le.htmlAttrs);let fe=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(fe&&B.includes("<head")){let $e=fe[1],Re=hr($e);B=B.replace(/<head\b[^>]*>/i,(Ae)=>`${Ae}
|
|
2610
|
-
<meta name="stx-layout" content="${Um($e)}">
|
|
2611
|
-
<meta name="stx-layout-group" content="${Um(Re)}">`)}let ye=B.match(/function (__stx_setup_\w+)\(/),Se=ye?jn(B):null;if(ye&&Se&&!/\bdata-stx=/.test(Se.tag)){B=fs(B,(Re,Ae)=>`<body${Ae} data-stx="${ye[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ye[1]}"`,"i");B=B.replace($e,"$1")}}if(j){let z=_.__stx_head_injections??Ns(),W=Di(B);if(W!==null)z.beforeClose.push(W);let F=lm(B);if(F!==null)z.afterOpen.push(F);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(um);B=Pi(B,z);let V=E.app?.colorMode;if(V)B=mn(B,V)}if(j)if(Ym(B,"data-stx-runtime")){let W=null,F=null,V=null,U=null,Y=null;try{let{getStoreScript:se}=await mt("stx/store-loader",()=>import("./chunk-ewcnyvcd.js")),ie=E.storesDir,oe=await se(ie);if(oe)V=`<script data-stx-stores>${oe}</script>`,F=await Hm("data-stx-stores",oe,E)??V}catch{}W=await qm([B,V],E,T);try{let{getFrameworkComposableScript:se}=await mt("stx/framework-composables",()=>import("./chunk-ncq5n15k.js"));Y=await se(B)}catch{}try{let{getComposableScript:se}=await mt("stx/composable-loader",()=>import("./chunk-wrvksj26.js")),ie=E.composablesDir,oe=[W,V,Y].filter((le)=>le!==null),ae=await se(E._layerComposableDirs??ie,B,oe);if(ae)U=await Hm('data-stx-scoped data-stx-run="always" data-stx-composables',ae,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ae}</script>`}catch{}let Z=[W,F,U,Y].filter((se)=>se!==null).map((se)=>`
|
|
2612
|
-
${se}`).join("");B=IS(B,Z)}else{let W=await qm([B],E,T);if(W){let F=B.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(F!==-1)B=B.slice(0,F)+W+`
|
|
2613
|
-
`+B.slice(F)}}if(j)B=Ii(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=Ti(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=PS(B),j&&_.__stx_runtime_config)B=Ye(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Jn(_);if(z){let W=/<head\b[^>]*>/i.exec(B),F=W?W.index+W[0].length:0;B=B.slice(0,F)+z+B.slice(F)}}return B})}catch(B){if(B instanceof lr)throw B;let z=B instanceof Error?B.message:String(B),W=new J(`Template processing failed: ${z}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(P.log(W,{filePath:k,context:_}),It.logDetailedError(W,{filePath:k,template:v.substring(0,500)}),E.debug)throw W;return Bs.createFallbackContent("Template Processing",W)}}async function DS(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!en.isAbsolute(E.partialsDir)?en.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!en.isAbsolute(E.componentsDir)?en.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!en.isAbsolute(E.layoutsDir)?en.resolve(j,E.layoutsDir):E.layoutsDir},z=B,W=v;await NS(k,_),OS(_,z),W=await re(()=>Qg(W,_,k,z),W,(ye)=>{P.log(ye,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ye.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let F=Dn(W,ze,(ye,Se)=>`\x00STX_HTML_COMMENT_${Se}\x00`);W=F.output;let V=F.tokens,U=(ye)=>V.length===0?ye:ye.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(Se,$e)=>V[Number($e)]??""),Y="\x00STX_ESCAPED_AT\x00",Z="\x00STX_ESC_MUSTACHE_OPEN\x00",se="\x00STX_ESC_MUSTACHE_CLOSE\x00";W=W.replace(/@@/g,Y),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(ye,Se)=>`${Z}${Se}${se}`),W=sm(W),W=await Pm(W,k,T);let ie={};W=vs(W,ie);let oe={..._.__sections||{}},ae="",le=jf(He(v)),ce=/@nolayout\b/.test(W)||le===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let fe=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(fe)ae=fe[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof le==="string"){if(ae=le,!/@section\s*\(/.test(W))W=`@section('content')
|
|
2614
|
-
${W.trim()}
|
|
2615
|
-
@endsection`}if(!ae&&!ce&&z.defaultLayout){let ye=Pt(W),Se=/@section\s*\(/.test(W);if(!ye||Se){let $e="",Re=en.dirname(k),Ae=z.layoutsDir?en.dirname(z.layoutsDir):process.cwd();for(let Te=0;Te<20;Te++){let Ie=en.join(Re,"_layout.stx");if(await r(Ie)){$e=Ie;break}let _e=en.dirname(Re);if(_e===Re||_e.length<Ae.length)break;Re=_e}if($e)ae=$e;else if(z.layoutsDir){let Te=en.isAbsolute(z.layoutsDir)?z.layoutsDir:en.resolve(process.cwd(),z.layoutsDir),Ie=en.join(Te,`${z.defaultLayout}.stx`);if(await r(Ie))ae=Ie}if(ae&&!Se)W=`@section('content')
|
|
2616
|
-
${W.trim()}
|
|
2617
|
-
@endsection`}}if(ae&&W.includes("<script")){let ye=$n(W),Se=ye.scripts.map(($e)=>Km($e,k)??$e);W=Zr(ye.output,Se)}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ye,Se,$e)=>(oe[Se]=$e,"")),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ye,Se,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return ye;try{let Re=l($e.trim(),_);if(Re===void 0)return ye;return oe[Se]=String(Re??""),""}catch{return ye}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ye,Se,$e)=>{if($e.includes("@parent"))oe[Se]=$e.replace("@parent",Br);else oe[Se]=$e.trim();return""}),_.__sections=oe,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ye,Se,$e)=>oe[Se]||$e||""),!("slot"in _)||_.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||"");if(W=xs(W,ie),ae){let ye=[],Se=$n(W),$e=Dn(Se.output,Xr,(Re,Ae)=>`\x00STX_ORPHAN_STYLE_${Ae}\x00`);if(W=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ae,Te)=>{let Ie=Ae==="SCRIPT"?Km(Se.scripts[Number(Te)],k):$e.tokens[Number(Te)];if(Ie)ye.push(Ie);return""}),ye.length>0){let Re=ye.join(`
|
|
2618
|
-
`);oe.content=oe.content?`${oe.content}
|
|
2619
|
-
${Re}`:Re,_.__sections=oe}}if(ae)try{let ye;if(en.isAbsolute(ae))ye=ae,T.add(ae);else ye=await re(()=>Zn(ae,k,B,T),null,()=>{throw new J(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ye){let Ie=(Ne)=>{if(!Ne)return[];try{let Oe=en.isAbsolute(Ne)?Ne:en.resolve(process.cwd(),Ne);return AS.readdirSync(Oe).filter((Pe)=>Pe.endsWith(".stx")).map((Pe)=>Pe.replace(/\.stx$/,""))}catch{return[]}},_e=[...Ie(B.layoutsDir),...Ie(B.fallbackLayoutsDir)].filter((Ne,Oe,Pe)=>Pe.indexOf(Ne)===Oe).sort(),De=`Layout not found: ${ae} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(P.log(Error(De),{layoutPath:ae,filePath:k,available:_e},"error"),console.error(`[stx] ${De}`),B.debug)throw new J(De,k);return W}let Se=await re(()=>Bun.file(ye).text(),"",()=>{throw new J(`Failed to read layout file: ${ye}`,k,void 0,void 0,"Layout content could not be loaded")});Se=Vm(Se,ye);let $e=Se.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(B.debug)console.log(`Found nested layout: ${$e[1]} in ${ye}`);let Ie={},_e=Se.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Oe,Pe,Le)=>(Ie[Pe]=Le.trim(),""));for(let[Oe,Pe]of Object.entries(Ie))if(oe[Oe]&&oe[Oe].includes(Br)){let Le=oe[Oe].indexOf(Br);oe[Oe]=oe[Oe].slice(0,Le)+Pe+oe[Oe].slice(Le+Br.length)}else if(!oe[Oe])oe[Oe]=Pe;let De={..._,__sections:oe},Ne=`@layout('${$e[1]}')${_e}`;return await n(Ne,De,ye,B,T)}let Re=Se.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ae=vs(Re,ie),Te={};return Ae=Ae.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ie,_e,De)=>(Te[_e]=De.trim(),`@slot('${_e}')`)),Ae=Ae.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Ie,_e,De)=>{if(oe[_e]){let Ne=oe[_e];if(Ne.includes(Br)){let Oe=Te[_e]||"",Pe=Ne.indexOf(Br);Ne=Ne.slice(0,Pe)+Oe+Ne.slice(Pe+Br.length)}return Ne}return De||""}),Ae=MS(Ae,oe),Ae=Ae.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),Ae=xs(Ae,ie),_.__originalFilePath=k,W=await Gm(Ae,_,ye,B,T),W=`<!-- stx-layout: ${ae} -->
|
|
2620
|
-
${W}`,U(W)}catch(ye){return P.log(ye instanceof Error?ye:Error(String(ye)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${ye instanceof Error?ye.message:String(ye)}]`}return U(await Gm(W,_,k,B,T))}function MS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,E,T)=>{let j=_[E];if(j!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(j))return j}return T||""})}function OS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",E={};for(let[T,j]of Object.entries(process.env))if(T.startsWith(k)&&j!==void 0)E[T]=j;v.$env=E}async function NS(v,_){await re(()=>nm(v,_),void 0,(k)=>{P.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var bu="data-stx-source";function Km(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(bu))return v;return`<script ${bu}="${encodeURIComponent(_)}"${v.slice(7)}`}function jS(v){let _=new RegExp(`${bu}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Xm(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Zm(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Xm(v)}</span><span style="display:block;margin-top:4px">${Xm(k)}</span></div>`}async function LS(v,_,k,E){let{scanScriptTags:T}=await mt("stx/signal-processing",()=>import("./chunk-jg9fydw8.js")),j=[],B=!he()&&!Sn();for(let W of T(v)){let F=W.attrs;if(!/\bserver\b/.test(F))continue;let V=W.start+W.fullMatch.indexOf(">")+1,U=Jm(v,V);if(U===-1)continue;let Y=v.slice(V,U);if(!Y.trim())continue;let Z=jS(F)??k,se={index:W.start,length:U+9-W.start};try{let{extractVariables:ie}=await mt("stx/variable-extractor",()=>import("./chunk-98xp5rfe.js"));await ie(Y,_,Z,{preserveExisting:!0,onFailure:(oe)=>{if(oe.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:Z,kind:oe.kind,message:oe.message}),!B)return;j.push({...se,markup:Zm(Z,oe.kind,oe.message)})}})}catch(ie){let oe=ie instanceof Error?ie:Error(String(ie));if(P.log(oe,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${oe.message}`),B)j.push({...se,markup:Zm(Z,"unknown",oe.message)})}}if(j.length===0)return v;let z=v;for(let W of j.sort((F,V)=>V.index-F.index))z=z.slice(0,W.index)+W.markup+z.slice(W.index+W.length);return z}async function BS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await mt("stx/expressions",()=>import("./chunk-3ss3vfad.js"));return E(v,_,{skipServer:!0})}catch(E){let T=E instanceof Error?E:Error(String(E));return P.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function Gm(v,_,k,E,T){let j=v,B=E;if(j=await LS(j,_,k,E),j=await BS(j,_,k),j=await Wg(j,_,k),j=await Fg(j,_,k),j=await Sp(j,_,k,B),we(j))j=di(j,_),j=hs(j,_),j=ms(j,_);j=ui(j);let{processStreamDirectives:z}=await mt("stx/streaming",()=>import("./chunk-1xyhdpbn.js"));j=z(j,_),j=hi(j,_,k,B,!0),j=await cm(j,_,k,B,T),j=await us(j,_,k,B,T),j=Nf(j,_,k,B);let{processDeferDirectives:W}=await mt("stx/defer",()=>import("./chunk-ygbdfzqn.js"));j=W(j,_,k);let{processTeleportDirectives:F}=await mt("stx/teleport",()=>import("./chunk-74w81h3v.js"));j=F(j,_,k);let{processTransitionDirectives:V,processTransitionAttributes:U}=await mt("stx/transitions",()=>import("./chunk-z1tnn2pm.js"));j=V(j,_,k),j=U(j);let{processErrorBoundaryDirectives:Y,stripRenderFailedMarkers:Z}=await mt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=Y(j,_,k),j=Z(j);let{processSuspenseDirectives:se}=await mt("stx/suspense",()=>import("./chunk-gra2v7xz.js"));j=se(j,_,k);let{processAsyncDirectives:ie}=await mt("stx/async-components",()=>import("./chunk-nspfk500.js"));j=ie(j,_,k);let{processKeepAliveDirectives:oe}=await mt("stx/keep-alive",()=>import("./chunk-9ah35e2w.js"));j=oe(j,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:le,processInfiniteListDirectives:ce}=await mt("stx/virtual-scrolling",()=>import("./chunk-2j7tr8wj.js"));j=ae(j,_,k),j=le(j,_,k),j=ce(j,_,k);let{processPartialHydrationDirectives:fe,processStaticDirectives:ye}=await mt("stx/partial-hydration",()=>import("./chunk-20nrvpps.js"));j=fe(j,_,k),j=ye(j);let{processComputedDirectives:Se,processWatchDirectives:$e}=await mt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=Se(j,_,k),j=$e(j,_,k);let{processFormValidationDirectives:Re}=await mt("stx/forms-validation",()=>import("./chunk-tma2vac1.js"));j=Re(j,_,k);let{processHeadDirective:Ae,processTitleDirective:Te,processMetaDirective:Ie,resetHead:_e}=await mt("stx/head",()=>import("./chunk-bf572npc.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let De=Ae(j);if(j=De.content,De.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${De.headContent}
|
|
2621
|
-
`;if(j=Te(j,_),j=Ie(j,_,k),j=tm(j),j=yl(j,_),j=wp(j),j=Jg(j),j=await ws(j,_,k,B,T),j=await us(j,_,k,B,T),_.__stxProcessingDepth===1)j=Uu(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=hu(j),j=fr(j,_,k),j=bs(j),j=Lf(j,_,{filePath:k,buildMode:B.buildMode}),j=xl(j,_),j=bl(j,_),j=la(j,_),j=Ap(j,_),j=Tp(j,_),j=await dp(j,_,k,B),j=await Uf(j,_,k),j=await xi(j,_,k,B),j=Si(j,_,k,B),j=Ps(j,_,k,B),j=Is(j,_,k),j=Os(j,_,k,B),j=bp(j,_,k,B),j=ks(j,_),j=Cs(j),j=Nm(j),!B.skipEventDirectives)j=Mu(j,_,k);if(j=Wf(j,_,k),B.debug){let ut=/\bx-data\s*=/.test(j),ot=gs(v);if(ut&&ot)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2622
|
-
Both work on the same page, but they manage separate scopes.
|
|
2623
|
-
Prefer signals (state/derived/effect) for new components.`)}j=ug(j,_),j=await K(j,_,k),j=zm(j),j=Wm(j),j=Cf(j);let{processXElementDirectives:Ne}=await mt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Ne(j);let Oe=_.__originalFilePath||k,Pe=Fe(_);if(j=await pi(j,B,Oe,Pe),j=Ep(j,_),j=await em(j,_,k,B),B.media?.image?.autoSiblings){let ut=B.publicDir||"public",{rewriteImagesWithSiblings:ot}=await mt("stx/image-optimization/auto-sibling",()=>import("./chunk-ypswj8sv.js"));j=await ot(j,{publicDir:ut})}if(B.seo?.enabled)j=Ds(j,_,B);let Le=(ut,ot,ht=!0)=>{if(!ot)return ut;let Lt=ot.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Vt=ut.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Lt&&Vt){if(ht)ut=ut.replace(Vt[0],Lt[0]);if(ot=ot.replace(Lt[0],"").trim(),!ot)return ut}if(/<\/head>/i.test(ut))return ut.replace(/<\/head>/i,`${ot}
|
|
2624
|
-
</head>`);if(/<head\b[^>]*>/i.test(ut))return ut.replace(/(<head\b[^>]*>)/i,`$1
|
|
2625
|
-
${ot}`);if(/<html\b[^>]*>/i.test(ut))return ut.replace(/(<html\b[^>]*>)/i,`$1
|
|
2626
|
-
<head>
|
|
2627
|
-
${ot}
|
|
2628
|
-
</head>`);return ut},{renderHead:ct,getHead:yt}=await mt("stx/head",()=>import("./chunk-bf572npc.js")),st=_.__stx_runtime_head??yt();if(st.title||st.meta?.length||st.link?.length){let ut=ct(st);if(ut)j=Le(j,ut)}if(De.headContent)j=Le(j,De.headContent,!st.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=yp(j,B.csp,_);if(B.analytics?.enabled)j=Rf(j,B);if(B.heatmap?.enabled)j=Tf(j,B);if(B.pwa?.enabled&&B.pwa.autoInject!==!1){let{injectPwaTags:ut}=await mt("stx/pwa/inject",()=>import("./chunk-xwqyw7zt.js"));j=ut(j,B)}let pt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),lt=/\bSTX\.\w+/.test(j),wt=/window\.STX\s*=/.test(j);if(pt&<&&!wt){let ot=`<script data-stx-scoped data-stx-run="once">
|
|
2629
|
-
${_f()}
|
|
2630
|
-
</script>`;if(j.includes("</head>")){let ht=j.indexOf("</head>"),Vt=j.slice(0,ht).indexOf("<script");if(Vt!==-1){let Jt=j.slice(0,Vt),vn=j.slice(Vt);j=Jt+ot+`
|
|
2631
|
-
`+vn}else j=j.replace("</head>",`${ot}
|
|
2632
|
-
</head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
|
|
2633
|
-
${ot}`);else j=ot+`
|
|
2634
|
-
`+j}{let{scanScriptTags:ut}=await mt("stx/signal-processing",()=>import("./chunk-jg9fydw8.js")),ot=[];for(let ht of ut(j)){if(!/\bserver\b/i.test(ht.attrs))continue;let Lt=ht.start+ht.fullMatch.indexOf(">")+1,Vt=Jm(j,Lt);if(Vt===-1)continue;let Jt=Vt+9;while(Jt<j.length&&/\s/.test(j[Jt]))Jt++;ot.push({start:ht.start,end:Jt})}if(ot.length>0){let ht=Array(ot.length+1),Lt=0;for(let Vt=0;Vt<ot.length;Vt++){let{start:Jt,end:vn}=ot[Vt];ht[Vt]=j.slice(Lt,Jt),Lt=vn}ht[ot.length]=j.slice(Lt),j=ht.join("")}}let dt=zo(j,k);if(dt.hasScoped)j=dt.html;let St=_.__stx_event_bindings||[],gt=!1,Ft=[],Pn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:An}=await mt("stx/signal-processing",()=>import("./chunk-jg9fydw8.js"));for(let ut of An(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Ft.push({match:ut.fullMatch,attrs:ut.attrs,content:ut.body});for(let{match:ut,attrs:ot,content:ht}of Ft){gt=!0;let Lt=ht;_s(ht,k,E.strict,_.__originalFilePath);let Vt=await be(ht,{eventBindings:St,attrs:ot,hasColonDirectives:Pn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Pe});j=j.replace(ut,()=>Vt)}if(gt)_.__stx_event_bindings=[];if(!gt&&_.__stxProcessingDepth===1){let ut=_.__stx_event_bindings||[];if(ut.length>0){let ot=za(ut);if(ot){let ht=j.lastIndexOf("</body>");j=ht===-1?j+ot:j.slice(0,ht)+ot+`
|
|
2635
|
-
`+j.slice(ht)}_.__stx_event_bindings=[]}}if(!de(j)&&xm(j))j=await Ea(j,B);if(j=bm(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=xp(j,_.cspNonce);return j}var zS=[{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"}],WS=[{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')"}],FS=[{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 Oc(v){let _=[],k=[];return VS(v,_),US(v,_,k),HS(v,k),qS(v,_),{valid:_.length===0,errors:_,warnings:k}}function VS(v,_){let k=(v.match(/\{\{/g)||[]).length,E=(v.match(/\}\}/g)||[]).length;if(k!==E)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${E} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function US(v,_,k){for(let E of zS){let T=new RegExp(`${E.open}(?:\\s|\\()`,"g"),j=new RegExp(E.close,"g"),B=(v.match(T)||[]).length,z=(v.match(j)||[]).length;if(E.altClose){let W=new RegExp(E.altClose,"g");z+=(v.match(W)||[]).length}if(B>z)_.push({type:"directive",message:`Unclosed @${E.name} directive: found ${B} opening and ${z} closing`,suggestion:`Add ${B-z} missing ${E.close} tag(s)`});else if(z>B)k.push({type:"directive",message:`Extra ${E.close} found: ${z-B} more closing than opening`,suggestion:`Check for orphaned ${E.close} tags`})}}function HS(v,_){for(let k of WS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function qS(v,_){for(let k of FS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Dc(v,_){let k=v.slice(0,_).split(`
|
|
2636
|
-
`);return{line:k.length,column:k[k.length-1].length+1}}function Mc(v,_,k){let E=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(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:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return E}function Nc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Lc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let E of _){let T=E[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Ln from"path";import Ys from"process";var $t=["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 Qm=new Set($t),KS=new Set(["props","$props","defineProps"]),XS=new Set(["stx","@stacksjs/stx"]),eh=m(128),th=m(64);function ZS(v){let _=[],k=0,E=v.split(`
|
|
2637
|
-
`);for(let T of E){let j=k,B=null,z=!1;for(let W=0;W<T.length;W++){let F=T[W];if(z){z=!1;continue}if(F==="\\"){z=!0;continue}if(B){if(F===B)B=null;continue}if(F==="'"||F==='"'||F==="`"){B=F;continue}if(F==="/"&&W+1<T.length&&T[W+1]==="/")break;if(F==="{")k++;else if(F==="}")k--}if(j===0){let W=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)_.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let F=T.match(/(?:const|let|var)\s+(\w+)/);if(F)_.push(F[1])}else{let F=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(F){let U=F[1].slice(1,-1).split(",").map((Y)=>{let Z=Y.split(":");return(Z.length>1?Z[1]:Z[0]).trim()}).filter((Y)=>/^\w+$/.test(Y));_.push(...U)}}}}return[...new Set(_)]}function Cc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let T=[],j="",B=0,z=0,W=null;for(let F=0;F<E.length;F++){let V=E[F];if(W){if(j+=V,V===W)W=null;continue}if(V==='"'||V==="'"||V==="`"){W=V,j+=V;continue}if(V==="<")B++;else if(V===">"&&B>0)B--;else if(V==="(")z++;else if(V===")")z--;if(V===","&&B===0&&z===0){T.push(j),j="";continue}j+=V}if(j)T.push(j);return T.map((F)=>{let V=F.trim(),U=V.startsWith("..."),Y=U?V.slice(3):V,Z=-1,se=0;for(let ye=0;ye<Y.length;ye++)if(Y[ye]==="<")se++;else if(Y[ye]===">")se--;else if(Y[ye]===":"&&se===0){Z=ye;break}if(Z===-1)return F;let oe=Y.substring(0,Z).trim().replace(/\?$/,""),ae=Y.substring(Z+1),le=-1,ce=0;for(let ye=0;ye<ae.length;ye++)if(ae[ye]==="<")ce++;else if(ae[ye]===">")ce--;else if(ae[ye]==="="&&ce===0){le=ye;break}let fe=U?"...":"";if(le!==-1)return`${fe}${oe} = ${ae.substring(le+1).trim()}`;return`${fe}${oe}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,T,j)=>{if(!j.includes(":"))return E;return`${T}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,T,j=[];while((T=E.exec(_))!==null){let B=T.index+T[0].length-1,z=1,W=B+1,F=0,V=null;while(W<_.length&&z>0){let Z=_[W];if(V){if(Z===V)V=null;W++;continue}if(Z==='"'||Z==="'"||Z==="`"){V=Z,W++;continue}if(Z==="<")F++;else if(Z===">"&&F>0)F--;else if(F===0){if(Z==="(")z++;else if(Z===")")z--}if(z>0)W++}if(z!==0)continue;let U=_.substring(B+1,W);if(!U.includes(":"))continue;let Y=k(U);j.push({start:B+1,end:W,replacement:Y})}for(let B=j.length-1;B>=0;B--){let{start:z,end:W,replacement:F}=j[B];_=_.substring(0,z)+F+_.substring(W)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,T)=>{if(!T.includes(":"))return E;if(T.includes("{")||T.includes("}"))return E;return`(${T.split(",").map((B)=>{let[z,...W]=B.split("="),F=z.split(":")[0].trim();if(W.length>0)return`${F} = ${W.join("=").trim()}`;return F}).join(", ")}) =>`}),_=_.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
|
|
2638
|
-
|
|
2639
|
-
`),_}function _c(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,E,T]=k,j=E??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(j)?"":_})}function Ec(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function Tc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function $c(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var nh=new Set;async function d(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=eh.get(j);if(B===void 0){try{let Me=L({loader:"ts",target:"browser",define:T}),Ze=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ze=Ze.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=Me.transformSync(Ze)}catch{B=Cc(v)}eh.set(j,B)}let z={exports:{}},W=z.exports,F=Ys.cwd(),V={},U=[...B.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Me)=>Me[1]).filter((Me)=>!Me.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Me)),Y=new Map;for(let Me of U)try{if(Me.startsWith(".")){V[Me]=await import(Ln.resolve(Ln.dirname(k),Me));continue}let Ze=Ln.resolve(F,"node_modules",Me),it=Ln.join(Ze,"package.json"),xt=JSON.parse(u("fs").readFileSync(it,"utf8")),Mt=xt.main||"index.js";if(xt.exports){let Kt=typeof xt.exports==="string"?xt.exports:xt.exports["."];if(typeof Kt==="string")Mt=Kt;else if(Kt?.bun)Mt=Kt.bun;else if(Kt?.import)Mt=Kt.import;else if(Kt?.default)Mt=Kt.default}V[Me]=await import(Ln.resolve(Ze,Mt))}catch(Ze){if(Me.startsWith("."))Y.set(Me,Ze instanceof Error?Ze.message:String(Ze))}let Z=(Me)=>{if(V[Me])return V[Me];let Ze=Y.get(Me);if(Ze!==void 0)throw Error(`Cannot require '${Me}' from ${k}: ${Ze}`);return u(Me)},se=_.props||{},ie=(Me)=>{if(!Me)return se;let Ze={};for(let[it,xt]of Object.entries(Me)){let Mt=se[it];if(Mt!==void 0)Ze[it]=Mt;else if(typeof xt==="function")Ze[it]=xt();else Ze[it]=xt}return Ze};for(let[Me,Ze]of Object.entries(se))Object.defineProperty(ie,Me,{value:Ze,enumerable:!0,configurable:!0,writable:!0});let oe=(Me,Ze=!1)=>{if(Me===void 0||Me===null)return Ze;if(typeof Me==="string"){let it=Me.trim().toLowerCase();if(it===""||it==="true"||it==="1"||it==="on"||it==="yes")return!0;if(it==="false"||it==="0"||it==="off"||it==="no")return!1;return!0}return Boolean(Me)},ae=(Me,Ze=0)=>{if(Me===void 0||Me===null)return Ze;if(typeof Me==="string"){let xt=Me.trim();if(xt==="")return Ze;let Mt=Number(xt);return Number.isFinite(Mt)?Mt:Ze}let it=Number(Me);return Number.isFinite(it)?it:Ze};for(let Me of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(se,Me))continue;try{Object.defineProperty(ie,Me,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let le=(Me)=>{if(!Me)return se;let Ze={...se};for(let[it,xt]of Object.entries(Me)){let Mt=xt&&typeof xt==="object"&&!Array.isArray(xt)?xt:{type:xt};if(Ze[it]===void 0&&Mt.default!==void 0)Ze[it]=typeof Mt.default==="function"?Mt.default():Mt.default}return Ze},ce=()=>_.slots||{},fe=(Me,Ze)=>{let it={...Me};for(let[xt,Mt]of Object.entries(Ze))if(it[xt]===void 0)if(typeof Mt==="function")it[xt]=Mt();else it[xt]=Mt;return it},ye=(Me)=>{let Ze=()=>Me;return Ze.set=(it)=>{},Ze.update=(it)=>{},Ze},Se=(Me)=>{let Ze,it=!1;return()=>{if(!it)try{Ze=Me(),it=!0}catch{Ze=void 0}return Ze}},$e=(Me)=>{},Re=(Me)=>Me(),Ae=(Me)=>{},Te=(Me)=>{},Ie=qn(_);function _e(Me){let Ze=Me||{};if(Ze.title!==void 0||Ze.description!==void 0)Le({title:Ze.title,description:Ze.description})}function De(Me){if(!Me||typeof Me!=="object")return;let Ze=_.__stxClientPayload??{};Object.assign(Ze,Me),_.__stxClientPayload=Ze}let Ne=()=>{let Me=_.__stxServeContext,Ze=_.__stxServeSearch??Me?.search??"",it=Me?.path??"",xt=Object.fromEntries(new URLSearchParams(Ze)),Mt=_.query,Kt=Object.keys(xt).length>0?xt:Mt??{},Wr=Ze||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:_.params??{},query:Kt,path:it,name:"",fullPath:it+Wr,hash:"",matched:[]}},Oe=()=>({push:(Me)=>{},replace:(Me)=>{},back:()=>{},forward:()=>{},go:(Me)=>{}}),Pe=(Me)=>{let Ze=_.__stx_runtime_head||{};_.__stx_runtime_head=me(Ze,ge(Me||{},{known:ar,source:"useHead()"}))},Le=(Me)=>{Pe(cr(Me||{}))},ct=(Me)=>({value:Me}),yt=(Me)=>Me,ft=(Me)=>({value:typeof Me==="function"?Me():Me}),st=(Me,Ze)=>{},pt=(Me)=>{},lt=(Me)=>{},wt=(Me)=>Me?Me():Promise.resolve(),dt=(Me)=>(Ze,...it)=>{},St=(Me)=>{},gt=(Me,Ze)=>{},Ft=(Me,Ze)=>Ze,Pn=()=>({value:"light"}),An=()=>ye(!1),ut=(Me)=>ye(!1),ot=()=>ye(!1),ht=()=>ut("(prefers-color-scheme: dark)"),Lt=()=>ut("(prefers-color-scheme: light)"),Vt=()=>ut("(prefers-reduced-motion: reduce)"),Jt=()=>ut("(prefers-contrast: more)"),vn={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:{}},Da=new Proxy(vn,{get(Me,Ze){if(Ze in Me)return Me[Ze];return},set(Me,Ze,it){return Me[Ze]=it,!0}}),Bn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ma=console;try{let Me=ys(B,k),Ze=new Set(Object.keys(se)),it=Object.keys(_).filter((et)=>!Ze.has(et)&&!KS.has(et)&&tt(et)),xt=it.map((et)=>_[et]);if(!it.includes("__stxServeContext"))it.push("__stxServeContext"),xt.push(void 0);if(!Ze.has("cookies")){let et=_.cookies??_.__stxServeContext?.cookies??{},Nt=it.indexOf("cookies");if(Nt<0)it.push("cookies"),xt.push(et);else xt[Nt]=et}let Mt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],Wr=[];for(let[et,Nt]of Object.entries(se)){if(!tt(et))continue;if(Mt.has(et))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${et}\\b`).test(Me))continue;Kt.push(et),Wr.push(Nt)}let go=ZS(Me).map((et)=>`module.exports.${et} = typeof ${et} !== 'undefined' ? ${et} : module.exports.${et};`).join(`
|
|
2640
|
-
`),mo=_.params??{},ho=[],pr=[];for(let et=0;et<it.length;et++){if(it[et]==="params")continue;ho.push(it[et]),pr.push(xt[et])}let Fr=[...$t,...Kt,...ho],Fn=`return (async () => {
|
|
2641
|
-
${Me}
|
|
2642
|
-
${go}
|
|
2643
|
-
return module.exports
|
|
2644
|
-
})()`,Yt=h(Fn,Fr.join("\x00")),nt=th.get(Yt);if(!nt)nt=Function(...Fr,Fn),th.set(Yt,nt);let at=_.__stx_options?.runtimeConfig;if(at||/\buse(?:Server)?RuntimeConfig\b/.test(B))await fn(_,k,at);let bt=await pe(_.__stx_runtime_config??At()??C(),()=>fm(_,()=>nt(z,W,Z,se,ie,oe,ae,le,fe,De,pm,As,nr,ye,Se,$e,Re,Ae,Te,_e,Ne,Oe,Pe,Le,Ie.setResponseStatus,Ie.setResponseHeader,Ie.notFound,ct,yt,ft,st,pt,lt,wt,dt,St,ce,gt,Ft,Pn,An,ut,ot,ht,Lt,Vt,Jt,Da,Bn,Ma,vn.confirm,vn.alert,vn.fetch,mo,...Wr,...pr)));if(E.preserveExisting){for(let[et,Nt]of Object.entries(bt))if(!(et in _)||_[et]===void 0)_[et]=Nt}else Object.assign(_,bt);for(let[et,Nt]of Object.entries(se))if(!(et in _))_[et]=Nt}catch(Me){if(_.__stx_strict_hydration)throw Me;let Ze=_c(Me instanceof Error?Me.message:String(Me));if(Ec(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ze}`),E.onFailure?.({kind:"module-resolution",message:Ze,error:Me});else if(Tc(Me))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ze}`),E.onFailure?.({kind:"syntax",message:Ze,error:Me});else if($c(Ze))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: ${Ze}`),E.onFailure?.({kind:"missing-binding",message:Ze,error:Me});else{let it=`${k??"<unknown>"}\x00${Ze}`;if(Ys.env.STX_DEBUG||!nh.has(it))nh.add(it),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: ${Ze}`);E.onFailure?.({kind:"unknown",message:Ze,error:Me})}try{await t0(B,_,k)}catch(it){if(Ys.env.STX_DEBUG){let xt=it instanceof Error?it.message:String(it);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${xt}`)}}}}function Rc(v){let _=0,k=null,E=!1,T=!1;for(let j=0;j<v.length;j++){let B=v[j];if(k){if(B===k){if(k=null,E||_===0)T=!0}continue}if(B==="'"||B==='"'||B==="`"){k=B;continue}if(B==="{")_++;else if(B==="}")_--;else if(v.startsWith("from",j)&&_===0)E=!0}return k===null&&_===0&&T}var GS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function ys(v,_){let k=_?Ln.dirname(_):Ys.cwd(),E=Ys.cwd(),T=v.split(`
|
|
2645
|
-
`),j=[],B=0;while(B<T.length){let z=T[B].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let W=0;for(;B<T.length;B++){for(let F of T[B])if(F==="{")W++;else if(F==="}")W--;if(W<=0)break}}B++;continue}if(z.startsWith("definePageMeta(")){let W=0,F=!1,V=B;for(let Z=B;Z<T.length&&!F;Z++){let se=null,ie=!1,oe=T[Z];for(let ae=0;ae<oe.length;ae++){let le=oe[ae];if(ie){ie=!1;continue}if(le==="\\"){ie=!0;continue}if(se){if(le===se)se=null;continue}if(le==='"'||le==="'"||le==="`"){se=le;continue}if(le==="(")W++;else if(le===")"){if(W--,W===0){B=Z+1,F=!0;break}}}}if(!F)B=T.length;let U=T.slice(V,B).join(`
|
|
2646
|
-
`),Y=[];for(let Z of["title","description"]){let se=new RegExp(`\\b${Z}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(se)Y.push(`${Z}: ${JSON.stringify(se[2])}`)}if(Y.length>0)j.push(`useSeoMeta({ ${Y.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")||/^import['"]/.test(z)){let W=z,F=0;while(!Rc(W)&&B+F+1<T.length)F++,W=`${W} ${T[B+F].trim()}`;B+=F;let V=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Y=W.match(/^import\s*['"](.+?)['"]/),Z=W,se=(ie)=>{if(ie.startsWith("."))return Ln.resolve(k,ie);if(ie.startsWith("~/")||ie.startsWith("@/"))return Ln.resolve(E,ie.slice(2));try{return Bun.resolveSync(ie,k)}catch{return ie}};if(V){let[,ie,oe]=V,ae=se(oe);j.push(`const ${ie} = (await import('${ae}')).default`),j.push(`module.exports.${ie} = ${ie};`)}else if(U){let[,ie,oe]=U,ae=se(oe),le=[],ce=[],fe=XS.has(oe);for(let ye of ie.split(",")){let Se=ye.trim();if(!Se)continue;let $e=Se.split(/\s+as\s+/);if($e.length===2){let[Re,Ae]=[$e[0].trim(),$e[1].trim()];if(fe&&Qm.has(Re)){j.push(`const ${Ae} = ${Re};`);continue}le.push(`${Re}: ${Ae}`),ce.push(Ae)}else{if(fe&&Qm.has(Se))continue;le.push(Se),ce.push(Se)}}if(le.length>0)j.push(`const { ${le.join(", ")} } = await import('${ae}')`);for(let ye of ce)j.push(`module.exports.${ye} = ${ye};`)}else if(Y){let ie=se(Y[1]);j.push(`await import('${ie}')`)}else j.push(Z);B++;continue}if(GS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let W=sh(T,B),{type:F,name:V,value:U}=W;j.push(`${F} ${V} = ${U};`),j.push(`module.exports.${V} = ${V};`),B=W.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let W=vu(T,B);j.push(W.functionCode),j.push(`module.exports.${W.name} = ${W.name};`),B=W.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let W=sh(T,B),{type:F,name:V,value:U}=W;j.push(`${F} ${V} = ${U};`),j.push(`module.exports.${V} = ${V};`),B=W.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let W=vu(T,B);j.push(W.functionCode),j.push(`module.exports.${W.name} = ${W.name};`),B=W.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let W=T[B].replace(/^(\s*)export\s+default\s+/,"$1"),F=[...T];F[B]=W;let V=vu(F,B);if(j.push(V.functionCode),V.name)j.push(`module.exports.default = ${V.name};`);B=V.nextIndex}else if(z.startsWith("export default ")){let W=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${W};`),B++}else if(z.startsWith("class ")||z.startsWith("export class ")){let W=z.match(/(?:export\s+)?class\s+(\w+)/);if(W){let F=W[1],V=T[B].replace(/^export\s+/,""),U=0,Y=B;for(;Y<T.length;Y++){let Z=T[Y];for(let se of Z)if(se==="{")U++;else if(se==="}")U--;if(Y>B)V+=`
|
|
2647
|
-
`+Z;if(U<=0&&Y>=B)break}j.push(V),j.push(`module.exports.${F} = ${F};`),B=Y+1}else j.push(z),B++}else if(z.includes("module.exports"))j.push(z),B++;else if(z.trim()&&!z.startsWith("//"))j.push(z),B++;else B++}return JS(j.join(`
|
|
2648
|
-
`),k,E)}function JS(v,_,k){let E=v.length,T="",j=0,B=null,z=!1,W=!1,F=0;while(j<E){let V=v[j],U=v[j+1];if(z){if(T+=V,V===`
|
|
2649
|
-
`)z=!1;j++;continue}if(W){if(T+=V,V==="*"&&U==="/"){T+=U,j+=2,W=!1;continue}j++;continue}if(!B&&V==="/"&&U==="/"){z=!0,T+=V,j++;continue}if(!B&&V==="/"&&U==="*"){W=!0,T+=V,j++;continue}if(B){if(T+=V,V==="\\"){T+=U,j+=2;continue}if(V===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(V==="$"&&U==="{"){F++,T+=U,j+=2;continue}if(V==="`"){B=null,j++;continue}}j++;continue}if(F>0){if(V==="{")F++;else if(V==="}")F--}if(V==='"'||V==="'"||V==="`"){B=V,T+=V,j++;continue}if(V==="a"&&v.startsWith("await",j)){let Y=YS(v,j);if(Y){let{quote:Z,path:se,end:ie}=Y;if(se.startsWith(".")||se.startsWith("~/")||se.startsWith("@/")){let oe=se.startsWith(".")?Ln.resolve(_,se):Ln.resolve(k,se.slice(2));T+=`await import(${Z}${oe}${Z})`,j=ie;continue}}}T+=V,j++}return T}function YS(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let E=v[k];if(E!=="'"&&E!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==E)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let j=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:E,path:j,end:k+1}}function ch(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function lh(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let E=0,T=0,j="";while(E<k.length){let B=k[E];if(B==="{"||B==="["){let z=T===0?ch(k,E):null;if(z){_.push(...lh(z.pattern)),E=z.endPos,j="";continue}T++}else if(B==="}"||B==="]")T--;if(T>0){E++;continue}if(B===","){if(j.trim())_.push(j.trim());j="",E++;continue}if(B===":"){j="",E++;continue}if(B==="="){if(j.trim())_.push(j.trim());j="",E++;while(E<k.length&&k[E]!==","&&T===0){if(k[E]==="{"||k[E]==="[")T++;else if(k[E]==="}"||k[E]==="]")T--;E++}continue}if(/[\w$]/.test(B))j+=B;E++}if(j.trim())_.push(j.trim());return _}function Ac(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,E=(T)=>T===" "||T==="\t";while(k<v.length&&E(v[k]))k++;if(v[k]===":"){let T=0,j=null;k++;for(;k<v.length;k++){let B=v[k];if(j){if(B==="\\"){k++;continue}if(B===j)j=null;continue}if(B==="'"||B==='"'||B==="`"){j=B;continue}if(B==="("||B==="["||B==="{"||B==="<"){T++;continue}if(B===")"||B==="]"||B==="}"||B===">"){T--;continue}if(B==="="&&T<=0){let z=v[k+1],W=v[k-1];if(z!=="="&&z!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&E(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function rh(v,_,k,E){let T=null,j=!1;for(let B of v){if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(T){if(B===T)T=null;continue}if(B==="'"||B==='"'||B==="`"){T=B;continue}if(B===_)E++;else if(B===k)E--}return E}function sh(v,_){let k=v[_].trim(),E=Ac(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let V=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(V){let U=k.slice(V[0].length),Y=_;if(U.startsWith("{")||U.startsWith("[")){let se=U[0],ie=se==="{"?"}":"]",oe=rh(U,se,ie,0),ae=U;for(let le=_+1;le<v.length&&oe>0;le++)ae+=` ${v[le].trim()}`,Y=le,oe=rh(v[le],se,ie,oe);if(oe>0)ae=U,Y=_;U=ae}let Z=ch(U,0);if(Z){let se=V[1],ie=Z.pattern,oe=U.slice(Z.endPos).trim();if(oe.startsWith("=")){let ae=oe.slice(1).trim(),le=ae,ce=Math.max(Y,_);if(ih(ae)){let $e=oh(v,ce,ae);le=$e.value,ce=$e.nextIndex}else ce=ce+1;le=le.trim().replace(/;$/,"");let fe=lh(ie),ye=`__stx_src_${_}`,Se=fe.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
|
|
2650
|
-
`);return{type:se,name:ye,value:`${le}; ${se} ${ie} = ${ye};
|
|
2651
|
-
${Se}`,nextIndex:ce}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,W=z,F=_;if(ih(z)){let V=oh(v,_,z);W=V.value,F=V.nextIndex}else F=_+1;while(F<v.length){let V=v[F].trim();if(V.startsWith(".")||V.startsWith("?."))W+=`
|
|
2652
|
-
${v[F]}`,F++;else break}return W=W.trim().replace(/;$/,""),{type:j,name:B,value:W,nextIndex:F}}function vu(v,_){let k=v[_].trim(),E=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!E)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=E,j=k.replace(/^export\s+/,""),B=_;if(QS(k)){let z=e0(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function ih(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!uh(_)}function uh(v){let _={paren:0,bracket:0,brace:0},k=null,E=0;for(let T=0;T<v.length;T++){let j=v[T];if((T>0?v[T-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==="$"&&v[T+1]==="{"){E++,T++;continue}if(E>0&&j==="{"){E++;continue}if(E>0&&j==="}"){E--;continue}if(k)continue;if(j==="(")_.paren++;else if(j===")")_.paren--;else if(j==="[")_.bracket++;else if(j==="]")_.bracket--;else if(j==="{")_.brace++;else if(j==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function dh(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function QS(v){let _=dh(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function oh(v,_,k){let E=k,T=_+1;while(T<v.length&&!uh(E)){let j=v[T];E+=`
|
|
2653
|
-
${j}`,T++}while(T<v.length){let j=v[T].trim();if(j.startsWith(".")||j.startsWith("?."))E+=`
|
|
2654
|
-
${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function e0(v,_,k){let E=k,T=_+1;while(T<v.length){let j=dh(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
|
|
2655
|
-
${B}`,T++}return{functionCode:E,nextIndex:T}}function ah(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Ys.env}})},T=Object.keys(E).filter(tt),j=T.map((B)=>E[B]);try{return Function(...T,`'use strict'; return (${v});`)(...j)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...j)}catch{return}}}async function t0(v,_,k){let E=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let j of E){let[,,B,z]=j;try{let W=z.trim().replace(/;$/,""),F=ah(W,_);if(F!==void 0)_[B]=F}catch(W){console.warn(`Failed to parse export ${B} in fallback:`,W)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let j of T){let[,,B,z]=j;if(!(B in _))try{let W=z.trim().replace(/;$/,""),F=ah(W,_);if(F!==void 0)_[B]=F}catch{}}}function gi(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",E=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:E}}function mi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var fo=new M(500),Ia=new M(1000),Su=new M(2000),$u=new M(500),bh=33554432,_u=bh;function n0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===_u)return;_u=_,Pa.setMaxBytes(_)}var Pa=new M(2000,{maxBytes:bh,sizeOf:(v)=>v.output.length});function r0(v){let _=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(_.has(E))throw TypeError("Circular component input");_.add(E);try{if(E instanceof Date)return{__stxType:"date",value:E.toISOString()};if(Array.isArray(E))return E.map(k);let T=Object.getPrototypeOf(E);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let j={};for(let B of Object.keys(E).sort())j[B]=k(E[B]);return j}finally{_.delete(E)}};return JSON.stringify(k(v))}catch{return null}}function s0(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function fh(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function jc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ge(v){return!jc(v)}var Ta=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Ta.get(_);if(k)return k;if(Ta.size>=16)Ta.clear();let E=new Bun.Transpiler(v);return Ta.set(_,E),E}var ph=new WeakMap,i0=256;function Ke(v){try{let _=L({loader:"ts",target:"browser",define:w()}),k=ph.get(_);if(!k)k=new Map,ph.set(_,k);let E=k.get(v);if(E!==void 0)return E;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let j=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let W=j.length;return j.push(z),`"__STX_EXPR_${W}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let W=j.length;return j.push(z),`"__STX_EXPR_${W}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let W=j.length;return j.push(z),`"__STX_EXPR_${W}__"`});let B=_.transformSync(T);for(let z=0;z<j.length;z++)B=B.replace(`"__STX_EXPR_${z}__"`,j[z]),B=B.replace(`'__STX_EXPR_${z}__'`,j[z]);if(k.size>=i0){let z=k.keys().next();if(!z.done)k.delete(z.value)}return k.set(v,B),B}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function o0(v){let _=[],k=new Set,E=0,T=0,j=v.length,B=(V)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===V){T++;return}T++}},z=()=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let V=1;while(T<j&&V>0)if(v[T]==="{")V++,T++;else if(v[T]==="}")V--,T++;else if(v[T]==="'"||v[T]==='"')B(v[T]);else if(v[T]==="`")z();else T++;continue}T++}},W=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<j&&v[T]!==`
|
|
2656
|
-
`)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},F=()=>{if(E!==0)return;let V=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(V){let se=V[2].split(",").map((ie)=>{let oe=ie.trim().split(":");return oe[oe.length-1].trim()});for(let ie of se)if(ie&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ie)&&!k.has(ie))_.push(ie),k.add(ie);return}let U=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let se=U[2];if(!k.has(se))_.push(se),k.add(se);return}let Y=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let se=Y[1];if(!k.has(se))_.push(se),k.add(se);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let se=Z[1];if(!k.has(se))_.push(se),k.add(se)}};while(T<j){if(W())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))F();T++}return _}function a0(v){let _=[],k=0,E=0,T=null;for(let j=0;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(E,j)),E=j+1}if(E<v.length)_.push(v.slice(E));return _}function c0(v){let _=0,k=null;for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let j=v[E-1],B=v[E+1];if(j==="!"||j==="<"||j===">"||j==="=")continue;if(B==="="||B===">")continue;return E}}return-1}function l0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let E=k.index-1;while(E>=0&&/\s/.test(v[E]))E--;if(v[E]!=="}")return;let T=E,j=0,B=-1;for(;E>=0;E--){let W=v[E];if(W==="}")j++;else if(W==="{"){if(j--,j===0){B=E;break}}}if(B===-1)return;let z=v.slice(B+1,T);for(let W of a0(z)){let F=W.trim();if(!F||F.startsWith("..."))continue;let V=c0(F);if(V===-1)continue;let U=F.slice(0,V).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(_[U]!==void 0)continue;let Y=F.slice(V+1).trim();if(!Y)continue;try{let Z=Object.keys(_).filter(tt),se=Function(...Z,`"use strict"; return (${Y});`);_[U]=se(...Z.map((ie)=>_[ie]))}catch{}}}catch{}}var u0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Bc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let E=k[2].toLowerCase();if(!u0.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=Q(v,(F,V)=>(T.lastIndex=V,T.exec(F)?.index===V?T.lastIndex:-1));if(E==="span"&&/\sdata-stx-scope\s*=/.test(j[0]?.token||""))return null;let B=0,z=!1;for(let F of j){if(B+=F.token.startsWith("</")?-1:1,B<0)return null;if(B===0){if(v.slice(F.end).trim())return null;z=!0;break}}if(!z)return null;let W=k[0].length;return v.slice(0,W)+_+v.slice(W)}async function Yn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(fe)=>fe.split("-").map((ye)=>ye.charAt(0).toUpperCase()+ye.slice(1)).join(""),z=k.__importedComponents;if(z){for(let fe of[j,j.toLowerCase(),B(j),nn(j)])if(z.has(fe))return!0}let W=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${nn(j)}.stx`])],F=typeof T.root==="string"?rt.resolve(T.root):void 0,V=F??rt.dirname(E),U=[],Y=(fe)=>{if(fe&&!U.includes(fe))U.push(fe)},Z=k.__originalFilePath;if(Z)Y(rt.join(rt.dirname(Z),"components"));Y(_),Y(T._rootComponentsDir),Y(rt.join(rt.dirname(E),"components")),Y(T.componentsDir);for(let fe of T._targetComponentDirs??[])Y(fe);if(F)Y(rt.resolve(F,"resources/views/components")),Y(rt.resolve(F,"resources/components")),Y(rt.resolve(F,"src/components")),Y(rt.resolve(F,"components"));for(let fe of T._layerComponentDirs??[])Y(fe);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let fe of se)Y(typeof fe==="string"?fe:null);if(Y(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(rt.resolve(rt.dirname(E),`${j}.stx`));let ie=gh(rt.resolve(import.meta.dir,"components")),oe=U.map((fe)=>rt.isAbsolute(fe)?fe:rt.resolve(V,fe)),ae=`${W.join("\x00")}\x00\x00${oe.join("\x00")}`,le=Su.get(ae);if(le!==void 0)return le;let ce=!1;e:for(let fe of oe){if(gh(fe)===ie)continue;for(let ye of W)if(await r(rt.join(fe,ye))){ce=!0;break e}}return Su.set(ae,ce),ce}function gh(v){let _=$u.get(v);if(_!==void 0)return _;let k=v;try{k=xh.realpathSync(v)}catch{}return $u.set(v,k),k}function Fc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function wi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function d0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let E=(T,j)=>{let B;try{B=x(T,_)}catch{return j}if(B===void 0||B===null)return"";let z=String(B);if(/<\/style/i.test(z))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 z};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>E(j,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,j)=>E(j,T))}var mh=new Set;function hh(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&mh.has(T))return;mh.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
|
|
2657
|
-
searched:
|
|
2658
|
-
${k.map((W)=>` - ${W}`).join(`
|
|
2659
|
-
`)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function yh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function zc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let E of v){let T;while((T=k.exec(E))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function Xe(v,_,k,E,T,j,B,z=new Set,W,F=mr(T),V,U=v){let{extractVariables:Y}=await mt("stx/variable-extractor",()=>import("./chunk-98xp5rfe.js")),Z=z??new Set;if(Z.has(v))return`[Circular component reference: ${v}]`;let se=new Set(Z);se.add(v);let ie=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let oe=ie&&ie!=="load"&&Fc(ie)?ie:"";try{let ae=(nt)=>nt.split("-").map((at)=>at.charAt(0).toUpperCase()+at.slice(1)).join(""),le=U.endsWith(".stx")?U.slice(0,-4):U,ce=null,fe=T.__importedComponents;if(fe){let nt=[le,le.toLowerCase(),ae(le),nn(le)];for(let at of nt)if(fe.has(at)){ce=fe.get(at);break}}let ye=[];if(!ce){let nt=[`${le}.stx`,`${ae(le)}.stx`,`${nn(le)}.stx`],at=[...new Set(nt)],bt=T.__originalFilePath,et=[];if(et.push(...B._layerComponentDirs??[]),bt){let jt=rt.join(rt.dirname(bt),"components");et.push(jt)}if(E)et.push(E);let Nt=B._rootComponentsDir;if(typeof Nt==="string"&&!et.includes(Nt))et.push(Nt);let Ut=rt.join(rt.dirname(j),"components");if(!et.includes(Ut))et.push(Ut);if(B.componentsDir&&B.componentsDir!==E&&!et.includes(B.componentsDir))et.push(B.componentsDir);for(let jt of B._targetComponentDirs??[])if(jt&&!et.includes(jt))et.push(jt);let rn=typeof B.root==="string"?rt.resolve(B.root):void 0,Vr=rn??rt.dirname(j),Tn=[];if(rn)Tn.push(rt.resolve(rn,"resources/views/components")),Tn.push(rt.resolve(rn,"resources/components")),Tn.push(rt.resolve(rn,"src/components")),Tn.push(rt.resolve(rn,"components"));Tn.push(rt.resolve(import.meta.dir,"components"));for(let jt of Tn)if(!et.includes(jt))et.push(jt);let yo=B._pluginComponentDirs;if(Array.isArray(yo)){for(let jt of yo)if(typeof jt==="string"&&!et.includes(jt))et.push(jt)}if(B.fallbackComponentsDir&&!et.includes(B.fallbackComponentsDir))et.push(B.fallbackComponentsDir);let Qs=[...new Set(et.map((jt)=>{if(!jt)return jt;return rt.isAbsolute(jt)?jt:rt.resolve(Vr,jt)}))];et.length=0,et.push(...Qs);let Ur=`${le}\x00${j}\x00${Qs.join("\x00")}`,Hr=Ia.get(Ur);if(Hr)if(await r(Hr))ce=Hr;else Ia.delete(Ur);if(!ce&&(le.startsWith("./")||le.startsWith("../")))ce=rt.resolve(rt.dirname(j),`${le}.stx`),ye.push(ce);else if(!ce)for(let jt of et){if(!jt)continue;for(let xo of at){let bo=rt.join(jt,xo);if(ye.push(bo),await r(bo)){ce=bo;break}}if(ce)break;if(!ce)try{let xo=await import("fs");if(!xo.statSync(jt,{throwIfNoEntry:!1})?.isDirectory())continue;let kh=8,Na=[{path:jt,depth:0}];while(Na.length>0&&!ce){let vo=Na.pop();if(vo.depth>=kh)continue;let Eu;try{Eu=xo.readdirSync(vo.path,{withFileTypes:!0})}catch{continue}for(let wo of Eu){if(!wo.isDirectory())continue;if(wo.name==="node_modules"||wo.name.startsWith("."))continue;let Cu=rt.join(vo.path,wo.name);for(let Eh of at){let ja=rt.join(Cu,Eh);if(ye.push(ja),await r(ja)){ce=ja;break}}if(ce)break;Na.push({path:Cu,depth:vo.depth+1})}}}catch{}if(ce)break}if(ce)Ia.set(Ur,ce)}if(!ce||!await r(ce))return hh(v,j,ye),yh(v);W.add(ce);let Se;if(fo.has(ce))Se=fo.get(ce);else try{Se=await Bun.file(ce).text(),fo.set(ce,Se)}catch(nt){let at=nt instanceof Error?nt.message:String(nt);return hh(v,j,[ce],at),yh(v)}if(V)for(let nt of Object.keys(_)){let at=nt.toLowerCase();if(at.startsWith("aria-")||at.startsWith("data-"))continue;let bt=nt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${bt}\\b`).test(Se))V.declaredProps.add(nt)}let $e=new Set(["__originalFilePath","__importedComponents",Ao,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[nt,at]of Object.entries(T))if(!nt.startsWith("__")||$e.has(nt))Re[nt]=at;let Ae=F.length>0?{[No]:[...F]}:{},Te=k;if(k.includes("@include")){let{processIncludes:nt}=await mt("stx/includes",()=>import("./chunk-2mxhp1yy.js"));Te=await nt(k,T,j,B,W)}if(/<[A-Z][\w.-]*[\s/>]/.test(Te)){let{processComponents:nt}=await mt("stx/component-renderer",()=>import("./chunk-t1tqn3xx.js"));Te=await nt(Te,{...T,__processedComponents:Z,...Ae},j,B,W)}let Ie=[];if(wi(Te)){let{processExpressions:nt}=await mt("stx/expressions",()=>import("./chunk-3ss3vfad.js")),at=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ae}:F.length>0?{...T,...Ae}:T;Te=nt(Te,at,j);for(let bt of Te.matchAll(/\{\{([\s\S]*?)\}\}/g))Ie.push(bt[1].trim())}let _e=$n(Te),De=[],Ne=_e.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,at)=>{let bt=_e.scripts[Number(at)]||"",et=bt.match(/^<script\b([^>]*)>/i)?.[1]||"",Nt=et.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ut=!Nt||["module","text/javascript","application/javascript"].includes(Nt),rn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${et}`);if(!/\bserver\b/i.test(et)&&Ut&&!rn)return De.push(bt),"";return bt}),{extractSlotContent:Oe}=await mt("stx/slots",()=>import("./chunk-85j8cxfd.js")),Pe=Oe(Ne),Le={};if(Pe.defaultSlot?.trim())Le.default=Pe.defaultSlot;for(let[nt,at]of Pe.namedSlots)Le[nt]=at.content;let ct=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},ft=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ct.n}_${ct.key}`,st={...Re,$uid:ft,..._,props:_,slot:Ne,$slots:Le,__processedComponents:se,__sections:{},__stx_signals_gate:we(Se)||wi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Ie]};l0(Se,st);let pt=Se,lt=ee(pt);if(lt)pt=lt.content.trim();let wt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,dt=[...Se.matchAll(wt)],St=[],gt=null,Ft=dt.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Pn=null,An=null,ut=null,ot=0,ht=null;if(n0(B),Ft&&_u>0){let nt=r0({props:_,slot:Te,slotContext:k.trim()?s0(Re):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,clientLoopNames:[...F].sort(),layers:B._layerGraph?.layers.map((at)=>at.configFile),uid:ft});if(nt!==null){Pn=`${ce}\x00${h(Se)}\x00${nt}`;let at=Pa.get(Pn);if(at){for(let bt of at.dependencies)W.add(bt);if(Ku(T,at.clientFactories),ct.n+=at.uidsConsumed,at.preservedClientExpressions.length>0){let bt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let et of at.preservedClientExpressions)bt.add(et);T.__stx_preserved_client_expressions=[...bt]}return at.output}An=new Set(W),ut=Hu(T),ot=ct.n,ht=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Lt=new Set;for(let nt of dt){let at=nt[1]||"",bt=nt[2]||"",et=at.includes("server");if(Ge(at)&&bt.trim())bt=Ke(bt);if(et&&bt){for(let Ut of te(bt))Lt.add(Ut);try{await Y(bt,st,ce,{onFailure:(Ut)=>{if(Ut.kind!=="unknown")gt=Ut.kind}})}catch(Ut){}}if(!et){let Ut=bt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),rn=Ut.includes("{{")&&Ut.includes("}}"),Vr=Ut.includes("{!!")&&Ut.includes("!!}");if(rn||Vr)Ut=ss(Ut,st,ce);let Tn=at.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");St.push(`<script${Tn}>${Ut}</script>`)}}let Jt=$n(Se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),vn=Jt?Jt[1]:"",Da=Jt?Jt[2]:"",Bn="",Ma=vn&&/\bscoped\b/i.test(vn);if(Jt)Bn=`<style${vn}>${d0(Da,st,ce)}</style>`;let Me=pt;if(Me=Me.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Jt)Me=Me.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,at=[];if(Me=Me.replace(nt,(bt,et)=>{let Nt=et.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Nt)at.push(`<style${Nt[1]}>${Nt[2]}</style>`);return""}),Me=Me.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),at.length>0)Bn=`${Bn}${at.join(`
|
|
2660
|
-
`)}`}if(k&&Me.includes("{{ text || slot }}"))Me=Me.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ze}=await mt("stx/slots",()=>import("./chunk-85j8cxfd.js")),{defaultSlot:it,namedSlots:xt}=Pe,Mt=St.some((nt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(nt)),Kt=(nt)=>Mt?jm(nt,ft):nt,Wr=new Map([...xt].map(([nt,at])=>[nt,{...at,content:Kt(at.content)}]));Me=await Ze(Me,Kt(it),Wr,st);let Oa=zc(St),go=(Array.isArray(st.__stx_client_signal_names)?st.__stx_client_signal_names:[]).filter((nt)=>!Lt.has(nt));if(Oa.length>0||go.length>0)st.__stx_client_signal_names=[...new Set([...go,...Oa])];else delete st.__stx_client_signal_names;let mo=F.filter((nt)=>!Lt.has(nt)&&!(nt in _));if(mo.length>0)st[No]=mo;let ho={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:rt.dirname(ce),skipSignalsRuntime:!0,skipEventDirectives:Mt||St.length===0,defaultLayout:void 0};st.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let pr=await n(Me,st,ce,ho,W),Fr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of pr.matchAll(/\{\{([\s\S]*?)\}\}/g))Fr.add(nt[1].trim());if(Fr.size>0)T.__stx_preserved_client_expressions=[...Fr];let Fn=ft,Yt=pr;if(Mt){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${fh(JSON.stringify(_))}"`}catch{}let at=oe?` stx-hydrate="${fh(oe)}"`:"",bt=` data-stx-scope="${Fn}"${nt}${at}`,et=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(pr),Nt=et?"span":"div";Yt=Bc(pr,bt)??`<${Nt}${bt} data-stx-component-wrapper${et?' style="display:contents"':""}>${pr}</${Nt}>`;let Ut=await Promise.all(St.map(async(rn)=>{let Vr=rn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Vr)return rn;let[,Tn,yo]=Vr,{vendorStyleTags:Qs,factoryBody:Ur}=await g0(yo,ce,B.buildMode==="compile"),Hr=oe?null:Ha(T,Ur),jt=Hr?`window.__stxComponentFactories[${JSON.stringify(Hr)}](${JSON.stringify(Fn)});`:`(${Ur})(${JSON.stringify(Fn)});`;if(oe)return`${Qs}<script type="stx/island" data-stx-island="${Fn}" data-stx-scoped data-stx-owner="${Fn}"${Tn}>${jt}</script>`;return`${Qs}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Fn}"${Tn}>${jt}</script>`}));if(Yt=Yt+`
|
|
2661
|
-
`+Ut.join(`
|
|
2662
|
-
`),Bn)Yt+=`
|
|
2663
|
-
`+Bn}else{if(Bn)Yt+=`
|
|
2664
|
-
`+Bn;if(St.length>0){let nt=st.__stx_event_bindings||[],at=Fe(st),bt=await Promise.all(St.map(async(et)=>{let Nt=et.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Nt)return et;return await be(Nt[1],{eventBindings:nt,templateContent:Yt,filePath:ce,projectRoot:process.cwd(),serverData:at,instanceId:ft})}));Yt+=`
|
|
2665
|
-
`+bt.join(`
|
|
2666
|
-
`),st.__stx_event_bindings=[]}}if(Ma){let nt=zo(Yt,ce);if(nt.hasScoped)Yt=nt.html}if(Pn&&An){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Pa.set(Pn,{output:Yt,dependencies:[...W].filter((at)=>!An.has(at)),clientFactories:ut?qu(T,ut):[],uidsConsumed:ct.n-ot,preservedClientExpressions:ht?nt.filter((at)=>!ht.has(at)):[]})}if(gt)Yt=`<!--stx-render-failed:${gt}-->${Yt}`;return De.length>0?`${Yt}
|
|
2667
|
-
${De.join(`
|
|
2668
|
-
`)}`:Yt}catch(ae){return`[Error processing component: ${ae instanceof Error?ae.message:String(ae)}]`}finally{Z.delete(v)}}async function r(v){return Bun.file(v).exists()}function ku(v,_){let k=rt.resolve(_),E=rt.resolve(v),T=k.endsWith(rt.sep)?k:k+rt.sep;if(E===k||E.startsWith(T))return E;return null}async function f0(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=rt.join(v,T);for(let B of j.endsWith(".stx")?[j]:[j,`${j}.stx`])if(await r(B)){if(E)console.log(`Found layout in ${v}: ${B}`);return k?.add(B),B}return null}async function Zn(v,_,k,E){let T=await p0(v,_,k,E);if(T===null)return null;let j=ku(T,process.cwd());if(j)return j;let B=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of B){let W=rt.isAbsolute(z)?z:rt.resolve(process.cwd(),z);if(ku(T,W))return rt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function p0(v,_,k,E){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=rt.dirname(_),j=process.cwd();if(v.startsWith("/")){let Y=rt.join(j,v),Z=ku(Y,j);if(!Z)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${Z}`);if(await r(Z)&&E)E.add(Z);return Z}let B=rt.join(T,v);if(await r(B)){if(k.debug)console.log(`Found direct path: ${B}`);if(E)E.add(B);return B}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let Y of[".stx",".tsx",".jsx"]){let Z=`${B}${Y}`;if(await r(Z)){if(k.debug)console.log(`Found direct path with extension: ${Z}`);if(E)E.add(Z);return Z}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(rt.isAbsolute(k.layoutsDir)?k.layoutsDir:rt.resolve(process.cwd(),k.layoutsDir));let W=rt.resolve(T),F=process.cwd();for(let Y=0;Y<10;Y++){let Z=rt.join(W,"layouts"),se=!1;try{se=xh.statSync(Z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(se){z.push(Z);break}let ie=rt.dirname(W);if(ie===W||ie.length<F.length)break;W=ie}for(let Y of z){let Z=await f0(Y,v,E,k.debug);if(Z)return Z}if(k.fallbackLayoutsDir){let Y=rt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:rt.resolve(process.cwd(),k.fallbackLayoutsDir),Z=v.startsWith("layouts/")?v.slice(8):v,se=[rt.join(Y,Z)];if(!v.endsWith(".stx"))se.push(`${se[0]}.stx`);for(let ie of se)if(await r(ie)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${ie}`);if(E)E.add(ie);return ie}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let Y=v.split("layouts/"),Z=rt.join(k.partialsDir||T,"layouts",Y[1]);if(await r(Z)){if(k.debug)console.log(`Found in layouts path: ${Z}`);if(E)E.add(Z);return Z}if(!Z.endsWith(".stx")){let se=`${Z}.stx`;if(await r(se)){if(k.debug)console.log(`Found in layouts path with extension: ${se}`);if(E)E.add(se);return se}}}if(k.partialsDir){let Y=rt.join(k.partialsDir,"layouts");if(await r(Y)){let Z=rt.join(Y,v);if(await r(Z)){if(k.debug)console.log(`Found in partials layouts dir: ${Z}`);if(E)E.add(Z);return Z}if(!v.endsWith(".stx")){let se=`${Z}.stx`;if(await r(se)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${se}`);if(E)E.add(se);return se}}}}let V=k.partialsDir||rt.join(process.cwd(),"views"),U=rt.join(V,v);if(await r(U)){if(k.debug)console.log(`Found in views path: ${U}`);if(E)E.add(U);return U}if(!v.endsWith(".stx")){let Y=`${U}.stx`;if(await r(Y)){if(k.debug)console.log(`Found in views path with extension: ${Y}`);if(E)E.add(Y);return Y}}if(T.includes("temp")){let Y=rt.join(rt.dirname(T),"layouts",v);if(await r(Y)){if(k.debug)console.log(`Found in temp layouts dir: ${Y}`);if(E)E.add(Y);return Y}if(!v.endsWith(".stx")){let Z=`${Y}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${Z}`);if(E)E.add(Z);return Z}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function vi(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
|
|
2669
|
-
`),z=0;for(let W=0;W<B.length;W++)if(z+=B[W].length+1,z>=_){E=W+1,T=B[W].trim();let F=Math.max(0,W-2),V=Math.min(B.length,W+3);j=B.slice(F,V).map((U,Y)=>{let Z=F+Y+1;return`${Z===E?"> ":" "}${Z}: ${U}`}).join(`
|
|
2670
|
-
`);break}}else if(k){let B=v.indexOf(k);if(B>=0)return vi(v,B)}}catch{}return{lineNumber:E,lineContent:T,context:j}}var vt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(v,_,k,E,T,j){let{lineNumber:B,context:z}=vi(E,T,j),W=k.split("/").pop(),F=0;if(typeof T==="number"&&T>=0&&E){let U=E.lastIndexOf(`
|
|
2671
|
-
`,Math.max(0,T-1));F=T-(U+1)+1}let V="";if(B>0)V+=`
|
|
2672
|
-
${k}:${B}${F>0?`:${F}`:""}: ${v.toLowerCase()} error: ${_}
|
|
2673
|
-
`;if(V+=`
|
|
2674
|
-
${vt.bold}${vt.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${vt.reset}
|
|
2675
|
-
`,V+=`${vt.bold}${vt.red}\u2502${vt.reset} ${vt.bold}${vt.bgRed} ERROR ${vt.reset} ${vt.red}${v} Error${vt.reset}${" ".repeat(Math.max(0,43-v.length))}${vt.bold}${vt.red}\u2502${vt.reset}
|
|
2676
|
-
`,V+=`${vt.bold}${vt.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${vt.reset}
|
|
2677
|
-
`,V+=`
|
|
2678
|
-
${vt.cyan}${vt.bold}File:${vt.reset} ${vt.dim}${W}${vt.reset}`,B>0)V+=` ${vt.gray}(line ${B}${F>0?`, col ${F}`:""})${vt.reset}`;if(V+=`
|
|
2679
|
-
${vt.yellow}${vt.bold}Message:${vt.reset} ${_}
|
|
2680
|
-
`,z)V+=`
|
|
2681
|
-
${vt.blue}${vt.bold}Context:${vt.reset}
|
|
2682
|
-
${vt.dim}${z}${vt.reset}
|
|
2683
|
-
`;return V}function ne(){fo.clear(),Ia.clear(),Su.clear(),$u.clear(),Pa.clear()}function ru(){return{size:fo.size,maxSize:500}}var wu=m(128);async function g0(v,_,k){let E=h(v,_,k),T=wu.get(E);if(T){if(sn(T.deps))return T;wu.delete(E)}let j=Qr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=es(j.styles);B=kt(B).code;let{hasUserImports:W,bundleClientScript:F}=await mt("stx/client-script-bundler",()=>import("./chunk-y3kp87w1.js")),V=[],U=!1;if(W(B)){let ae=B;B=await F(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:V}),U=B===ae}let{stripStxRuntimeImports:Y}=await mt("stx/signal-processing",()=>import("./chunk-jg9fydw8.js"));B=Y(B);let Z=I(B),se=o0(Z),ie=`function(__scopeId) {
|
|
2684
|
-
${Dt("const",[...ji,...se],Z)}
|
|
2685
|
-
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2686
|
-
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
2687
|
-
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
2688
|
-
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
2689
|
-
const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
|
|
2690
|
-
// A clone the runtime is setting up may not be in the document yet (rows
|
|
2691
|
-
// a loop builds inside a closed :if), where a lookup cannot see it, so the
|
|
2692
|
-
// runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
|
|
2693
|
-
const __setupRoot = window.__STX_SETUP_ROOT__;
|
|
2694
|
-
const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
2695
|
-
window.__STX_CURRENT_ELEMENT__ = __componentElement;
|
|
2696
|
-
let __componentProps = __componentElement && __componentElement.__stx_props;
|
|
2697
|
-
if (!__componentProps && __componentElement) {
|
|
2698
|
-
try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
|
|
2699
|
-
catch { __componentProps = {}; }
|
|
2700
|
-
}
|
|
2701
|
-
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
2702
|
-
|
|
2703
|
-
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
2704
|
-
// hook lists keep what setup registered, because a component behind an :if
|
|
2705
|
-
// unmounts at each hide and mounts again at each show (signals.ts,
|
|
2706
|
-
// suspendSubtreeScopes).
|
|
2707
|
-
if (__scopeVars.__suspended && !__scopeVars.__mounted) {
|
|
2708
|
-
// Set up again after an :if hid it -- a <template :if> clones the
|
|
2709
|
-
// component afresh on every show, and the clone's script runs. This run's
|
|
2710
|
-
// hooks close over this run's state, so they replace the ones the hide
|
|
2711
|
-
// kept for a re-show rather than queueing beside them.
|
|
2712
|
-
__scopeVars.__mountCallbacks = [];
|
|
2713
|
-
__scopeVars.__destroyCallbacks = [];
|
|
2714
|
-
__scopeVars.__mountHooks = [];
|
|
2715
|
-
__scopeVars.__destroyHooks = [];
|
|
2716
|
-
}
|
|
2717
|
-
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
2718
|
-
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
2719
|
-
__scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
|
|
2720
|
-
__scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
|
|
2721
|
-
const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
|
|
2722
|
-
const onDestroy = (fn) => { __scopeVars.__destroyCallbacks.push(fn); __scopeVars.__destroyHooks.push(fn); };
|
|
2723
|
-
|
|
2724
|
-
try {
|
|
2725
|
-
${Z}
|
|
2726
|
-
|
|
2727
|
-
// Register all defined signals and functions in this scope
|
|
2728
|
-
const __localVars = {};
|
|
2729
|
-
try {
|
|
2730
|
-
${se.map((ae)=>`if (typeof ${ae} !== 'undefined') __localVars['${ae}'] = ${ae};`).join(`
|
|
2731
|
-
`)}
|
|
2732
|
-
}
|
|
2733
|
-
catch (e) {}
|
|
2734
|
-
Object.assign(__scopeVars, __localVars);
|
|
2735
|
-
}
|
|
2736
|
-
finally {
|
|
2737
|
-
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2738
|
-
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
2739
|
-
}
|
|
2740
|
-
}`,oe={vendorStyleTags:z,factoryBody:ie,deps:xd([...V,...j.styles.map((ae)=>ae.resolvedPath)])};if(!U&&j.unresolved.length===0)wu.set(E,oe);return oe}var m0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function h0(v){if(v.startsWith(".")||v.startsWith("/"))return null;if(v.startsWith("@")){let k=v.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let _=v.match(/^([^/]+)(\/.*)?$/);if(!_)return null;return{pkg:_[1],subpath:_[2]||""}}function y0(v,_){let k=_;while(!0){let E=zr.join(k,"node_modules",v,"package.json");if(po.existsSync(E))return zr.dirname(E);let T=zr.dirname(k);if(T===k)return null;k=T}}function x0(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let E=null;for(let T of Object.keys(v)){let j=T.indexOf("*");if(j===-1)continue;let B=T.slice(0,j),z=T.slice(j+1);if(!_.startsWith(B)||!_.endsWith(z))continue;if(_.length<B.length+z.length)continue;if(!E||B.length>E.prefix.length)E={pattern:T,prefix:B,suffix:z}}if(E){let T=_.slice(E.prefix.length,_.length-E.suffix.length),j=k(v[E.pattern]);if(j)return j.replace("*",T)}return null}function b0(v,_){let k=h0(v);if(!k||!k.subpath)return null;let E=y0(k.pkg,_);if(!E)return null;let T;try{T=JSON.parse(po.readFileSync(zr.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,B=x0(T.exports,j);if(!B)return null;let z=zr.resolve(E,B);return po.existsSync(z)?z:null}function Qr(v,_){let k=_.filePath?zr.dirname(_.filePath):_.projectRoot||process.cwd(),E=_.projectRoot||process.cwd(),T=new Set,j=[],B=[];return{code:v.replace(m0,(W,F)=>{let V;try{if(F.startsWith("./")||F.startsWith("../")||F.startsWith("/")){if(V=F.startsWith("/")?F:zr.resolve(k,F),!po.existsSync(V))throw Error(`file not found: ${V}`)}else{let U=null;try{U=Bun.resolveSync(F,E)}catch{U=b0(F,E)}if(!U)throw Error(`could not resolve ${F} (Bun.resolveSync + exports fallback both failed)`);V=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(F)} (from ${_.filePath||"<unknown>"}): ${U?.message||U}`),B.push(F),""}if(T.has(V))return"";T.add(V);try{let U=po.readFileSync(V,"utf8");j.push({source:F,resolvedPath:V,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${V}: ${U?.message||U}`),B.push(F)}return""}),styles:j,unresolved:B}}function v0(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function es(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${v0(_.source)}" data-stx-layer="vendor">
|
|
2741
|
-
@layer vendor {
|
|
2742
|
-
${_.contents}
|
|
2743
|
-
}
|
|
2744
|
-
</style>`).join(`
|
|
2745
|
-
`)}
|
|
2746
|
-
`}var oc=y,vh=m(256);function kt(v){let _=h(v),k=vh.get(_);if(!k)k=w0(v),vh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function w0(v){let _=s(v),k=new Set;for(let z of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of z[1].split(",")){let F=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(F)k.add(F)}let E=_o(_),T=G.filter((z)=>{if(k.has(z)||E.has(z))return!1;return ts(_,z,!0)}),j=_h(_).filter((z)=>!k.has(z)&&!E.has(z));if(T.length===0&&j.length===0)return{code:v,imports:T,models:j};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",j.length>0?"import '@stacksjs/browser'":"",j.length>0?`const { ${j.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2747
|
-
`)}
|
|
2748
|
-
${v}`,imports:T,models:j}}var S0=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 _h(v){let _=new Set,k=Fa(v),E=_o(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let j of k.code.matchAll(T)){let B=j[1];if(S0.has(B)||E.has(B)||B.length<3)continue;if(k.shadows(B,j.index??0))continue;_.add(B)}return Array.from(_)}function $0(v){return _o(v)}var wh=m(128);function Ko(v){let _=h(v),k=wh.get(_);if(!k)k=_0(v),wh.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function _0(v){let _=new Set,k=new Set,E=v;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,B;while((B=j.exec(v))!==null){let U=B[1],Y=B[2];if(B[0].includes("import type"))continue;let Z=[];for(let ie of U.split(",")){let oe=ie.trim();if(!oe||oe.startsWith("type "))continue;let ae=oe.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ae)continue;let le=ae[1],ce=ae[2]||le;if(T.add(le),T.add(ce),Y==="stx"||Y==="@stacksjs/stx")_.add(le);else k.add(le);if(ce!==le)Z.push(`${ce} = ${le}`)}let se=Z.length>0?`var ${Z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],se)}let z=$0(E);for(let U of oc){if(T.has(U)||z.has(U))continue;if(ts(E,U,!0))_.add(U)}let W=s(E),F=new Set;for(let U of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Y of U[1].split(",")){let Z=Y.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let se of Z){let ie=se.trim();if(ie)F.add(ie)}}for(let U of G){if(T.has(U)||z.has(U)||F.has(U))continue;if(ts(W,U))k.add(U)}let V=_h(W);for(let U of V)if(!T.has(U)&&!z.has(U))k.add(U);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function ts(v,_,k=!1){let E=Fa(v);v=E.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let j of v.matchAll(T)){let B=j.index??0;if(E.shadows(_,B))continue;let z=B+_.length,W=B-1;while(W>=0&&/\s/.test(v[W]))W--;if(v[W]==="."&&v.slice(Math.max(0,W-2),W+1)!=="...")continue;let F=z;while(F<v.length&&/\s/.test(v[F]))F++;if(v[F]===":"&&v[F+1]!==":"&&(v[W]==="{"||v[W]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(z)))continue;if(k0(v,z))continue;return!0}return!1}function k0(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let E=0;for(;k<v.length;k++){let T=v[k];if(T==="(")E++;else if(T===")"){if(E--,E===0)break}}if(E!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function Xo(v,_){let k=[];if(v.length>0)k.push(` var { ${v.join(", ")} } = window.stx || window;`);if(_.length>0)k.push(` var { ${_.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
2749
|
-
${k.join(`
|
|
2750
|
-
`)}
|
|
2751
|
-
${E0(v,_)}`;return""}function Md(v,_=[]){let{browserImports:k}=Ko(v),E=new Set(_);return Xo([],k.filter((T)=>!E.has(T)))}function E0(v,_){let k=[...v.map((E)=>`['${E}', typeof ${E}, 'stx']`),..._.map((E)=>`['${E}', typeof ${E}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
2752
|
-
[${k.join(", ")}].forEach(function (e) {
|
|
2753
|
-
if (e[1] !== 'undefined') return;
|
|
2754
|
-
console.error(
|
|
2755
|
-
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
2756
|
-
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
2757
|
-
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2758
|
-
);
|
|
2759
|
-
});
|
|
2760
|
-
`}function Fe(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let E={};for(let T in _){let j=_[T];if(typeof j==="function")continue;E[T]=j}return E.__stxDeclaredPayload=!0,E}let k={};for(let E in v){if(E.startsWith("__")||E.startsWith("$"))continue;let T=v[E];if(typeof T==="function")continue;k[E]=T}return k}function C0(v,_){return new RegExp(`(?<![.#\\w$])${_}(?![\\w$])`).test(v)}var R0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Sh=new Set;function A0(v,_){let k=R0.test(v),E=_.length>32768;if(!k&&!E)return;if(Sh.has(v))return;if(Sh.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(E)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function ns(v,_){if(!_)return"";let k=s(v),E=_.__stxDeclaredPayload===!0,T=[];for(let[j,B]of Object.entries(_)){if(!/^[A-Za-z_$][\w$]*$/.test(j))continue;if(j.startsWith("__")||j.startsWith("$"))continue;if(!E&&!C0(k,j))continue;if(So(v,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 z;try{z=JSON.stringify(B)}catch{continue}if(z===void 0)continue;A0(j,z),T.push(` var ${j} = ${z.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2761
|
-
${T.join(`
|
|
2762
|
-
`)}
|
|
2763
|
-
`}var T0={left:0,middle:1,right:2};function I0(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((E)=>`$event.key === '${E}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=T0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function P0(v,_){let{elementId:k,event:E,modifiers:T}=v,j=Ba(v.handler),B=I0(T),z=[];if(T.once)z.push("once: true");if(T.capture)z.push("capture: true");if(La(E,T))z.push("passive: true");let W=z.length>0?`, { ${z.join(", ")} }`:"",F="";if(B)F+=`${B}; `;let V=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
|
|
2764
|
-
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2765
|
-
};`;function Y(Z){if(/\$emit\s*\(/.test(Z))return`${U}
|
|
2766
|
-
${Z}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
2767
|
-
if (scope && scope.__stx_execute) {
|
|
2768
|
-
scope.__stx_execute('${V}', $event, $el);
|
|
2769
|
-
}
|
|
2770
|
-
else {
|
|
2771
|
-
${Z}
|
|
2772
|
-
}`}if(T.debounce!==null)return` ;(function() {
|
|
2773
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
2774
|
-
var $el = document.getElementById('${k}')
|
|
2775
|
-
if (!$el) return
|
|
2776
|
-
var __timer
|
|
2777
|
-
$el.addEventListener('${E}', function($event) {
|
|
2778
|
-
${B?B+"; ":""}clearTimeout(__timer)
|
|
2779
|
-
__timer = setTimeout(function() { ${Y(j)} }, ${T.debounce})
|
|
2780
|
-
}${W})
|
|
2781
|
-
})()`;if(T.throttle!==null)return` ;(function() {
|
|
2782
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
2783
|
-
var $el = document.getElementById('${k}')
|
|
2784
|
-
if (!$el) return
|
|
2785
|
-
var __last = 0
|
|
2786
|
-
$el.addEventListener('${E}', function($event) {
|
|
2787
|
-
${B?B+"; ":""}var __now = Date.now()
|
|
2788
|
-
if (__now - __last >= ${T.throttle}) {
|
|
2789
|
-
__last = __now
|
|
2790
|
-
${Y(j)}
|
|
2791
|
-
}
|
|
2792
|
-
}${W})
|
|
2793
|
-
})()`;if(/\$emit\s*\(/.test(j))return` var $el = document.getElementById('${k}')
|
|
2794
|
-
if ($el) $el.addEventListener('${E}', function($event) {
|
|
2795
|
-
${F}${U}
|
|
2796
|
-
${j}
|
|
2797
|
-
}${W})`;return` var $el = document.getElementById('${k}')
|
|
2798
|
-
if ($el) $el.addEventListener('${E}', function($event) {
|
|
2799
|
-
${F}var scope = $el.closest('[data-stx-scope]');
|
|
2800
|
-
if (scope && scope.__stx_execute) {
|
|
2801
|
-
scope.__stx_execute('${V}', $event, $el);
|
|
2802
|
-
}
|
|
2803
|
-
else {
|
|
2804
|
-
${j}
|
|
2805
|
-
}
|
|
2806
|
-
}${W})`}function D0(v){if(v.length===0)return"";return`
|
|
2807
|
-
// STX: auto-generated event bindings
|
|
2808
|
-
${v.map((k,E)=>P0(k,E)).join(`
|
|
2809
|
-
`)}`}function $h(v){let _=[],k=new Set,E=v.replace(/^\s*import\s+.*$/gm,""),T=0,j=E.length,B=0;while(B<j){let z=E[B];if(z==="'"||z==='"'||z==="`"){let W=z;if(B++,W==="`"){let F=0;while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]==="`"&&F===0){B++;break}if(E[B]==="$"&&E[B+1]==="{"){F++,B+=2;continue}if(E[B]==="}"&&F>0){F--,B++;continue}B++}}else while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]===W){B++;break}B++}continue}if(z==="/"&&E[B+1]==="/"){while(B<j&&E[B]!==`
|
|
2810
|
-
`)B++;continue}if(z==="/"&&E[B+1]==="*"){B+=2;while(B<j-1&&!(E[B]==="*"&&E[B+1]==="/"))B++;B+=2;continue}if(z==="{"){T++,B++;continue}if(z==="}"){T--,B++;continue}if(T===0){let W=E.slice(B),F=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(F){let Y=F[1];if(!Y.startsWith("_")&&!k.has(Y))_.push(Y),k.add(Y);B+=F[0].length;continue}let V=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((Y)=>{let Z=Y.trim(),se=Z.indexOf(":"),ie=se>=0?Z.slice(se+1).trim().split(/[\s=]/)[0]:Z.split(/[\s=]/)[0];if(ie&&!ie.startsWith("_")&&!k.has(ie))_.push(ie),k.add(ie)}),B+=V[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let Y=U[1];if(!Y.startsWith("_")&&!k.has(Y))_.push(Y),k.add(Y);B+=U[0].length;continue}}B++}return _}var M0=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 O0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(Y){let Z;while((Z=k.exec(Y))!==null){let se=Z[0];if(!M0.has(se))_.add(se)}}let T=/\{\{([\s\S]*?)\}\}/g,j;while((j=T.exec(v))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=B.exec(v))!==null)E(j[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=z.exec(v))!==null)E(j[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=W.exec(v))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=F.exec(v))!==null)E(j[1]);let V=/@model\s*=\s*["']([^"']*)["']/gi;while((j=V.exec(v))!==null)E(j[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=U.exec(v))!==null)E(j[1]);return _}async function be(v,_={}){let k=v,E="",T=!1,j=[],B=Qr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=es(B.styles),W=kt(k);k=W.code,j=[...W.imports,...W.models];let{hasUserImports:F,bundleClientScript:V}=await mt("stx/client-script-bundler",()=>import("./chunk-y3kp87w1.js"));if(F(k))k=await V(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ce=Ko(k);k=ce.code,E=Xo(ce.stxImports,ce.browserImports.filter((fe)=>!j.includes(fe)))}if(E=`${ns(k,_.serverData)}${E}`,k=I(k),!T&&Ge(_.attrs||""))k=Ke(k);let U=D0(_.eventBindings||[]),Y=(_.attrs||"").trim(),Z=/\btype\s*=\s*["']module["']/i.test(Y),se=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(Z){let ce=Y.replace(/\btype\s*=\s*["']module["']/i,"").trim(),fe=`type="module" data-stx-scoped${se}${ce?` ${ce}`:""}`;return`${z}<script ${fe}>
|
|
2811
|
-
${Gs(`${E}${k}
|
|
2812
|
-
${U}`)}
|
|
2813
|
-
</script>`}let ie=zs(v),oe=/function __stx_setup_/.test(k),ae=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function le(ce){let fe=ce.length>0?`
|
|
2814
|
-
return { ${ce.join(", ")} };`:"",ye=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${z}<script data-stx-scoped data-stx-run="always"${se}>
|
|
2815
|
-
window.stx.mount(function() {
|
|
2816
|
-
'use strict';
|
|
2817
|
-
try {
|
|
2818
|
-
${Gs(`${E}${k}
|
|
2819
|
-
${U}${fe}`)}
|
|
2820
|
-
} catch (error) {
|
|
2821
|
-
console.error(${ye}, error);
|
|
2822
|
-
return {};
|
|
2823
|
-
}
|
|
2824
|
-
})</script>`}if(!ae&&!oe){if(ie)return le($h(v));if(_.templateContent){let ce=$h(v);if(ce.length>0){let fe=O0(_.templateContent);if(ce.some((Se)=>fe.has(Se)))return le(ce)}}}return`${z}<script data-stx-scoped data-stx-run="always"${se}>
|
|
2825
|
-
;(function() {
|
|
2826
|
-
'use strict';
|
|
2827
|
-
try {
|
|
2828
|
-
${Gs(`${E}${k}
|
|
2829
|
-
${U}`)}
|
|
2830
|
-
} catch (error) {
|
|
2831
|
-
console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
|
|
2832
|
-
}
|
|
2833
|
-
})()</script>`}
|
|
2834
|
-
export{zn,je,Go,M,q,m,h,sn,G,w,Be,Qr,es,oc,kt,Ko,ts,Xo,Md,Fe,ns,be,Jo,Yo,Zo,rs,H,ze,Q,Ct,Hn,ic,Nd,ac,Ld,cc,Un,b,_t,we,lc,ss,dc,jd,K,uc,Bd,x,Fd,pc,zd,Hd,Ud,Vd,fc,gc,Wd,qd,Qo,Gd,on,an,Vn,Wn,e,Kd,ei,Xd,ti,mc,hc,Et,cn,Jd,yc,bc,Yd,f,He,Tt,Ue,Ve,ni,qn,ee,os,is,as,Zd,Gn,Qd,ln,We,cs,ls,wc,te,ri,si,oi,ii,Kn,ds,ai,ci,li,vc,us,N,de,X,eu,xc,ps,gs,di,ui,ms,hs,Xn,Sc,pi,fi,kc,qe,dn,Jn,$t,Cc,_c,Ec,Tc,$c,d,Rc,ys,Ac,gi,mi,bs,hi,Pc,tu,Ic,ve,yi,nu,ws,vs,xs,bi,Ss,ks,Cs,_s,n,Oc,Dc,Mc,Nc,Lc,jc,Ge,L,Ke,Bc,Yn,Fc,wi,zc,Xe,r,Zn,vi,g,ne,ru,Qn,R,Hc,Es,o,A,su,ou,ue};
|