@stacksjs/stx 0.2.630 → 0.2.631
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-05zhvg8t.js +20 -0
- package/dist/chunk-0c31twby.js +2 -0
- package/dist/{chunk-0s1hpqas.js → chunk-0jeqp6yz.js} +2 -2
- package/dist/chunk-0nvb2x2f.js +2 -0
- package/dist/chunk-0whv8hnp.js +4 -0
- package/dist/{chunk-q1983d5e.js → chunk-179c1rdn.js} +2 -2
- package/dist/chunk-1e25xd0z.js +6 -0
- package/dist/{chunk-jp6yn9mj.js → chunk-1ma56c2h.js} +2 -2
- package/dist/{chunk-h9ymjtch.js → chunk-27h1xs4k.js} +12 -12
- package/dist/{chunk-5m0r0j79.js → chunk-2vqz7v37.js} +3 -3
- package/dist/{chunk-10s16tad.js → chunk-2wvz3fd2.js} +2 -2
- package/dist/chunk-3jda301z.js +2 -0
- package/dist/{chunk-gc1dzxee.js → chunk-3p2b88pd.js} +2 -2
- package/dist/chunk-46qg1tqe.js +2 -0
- package/dist/{chunk-66e4ga0z.js → chunk-4fv3jq16.js} +2 -2
- package/dist/{chunk-k1k2t4ez.js → chunk-4y06ekvt.js} +1 -1
- package/dist/chunk-5fjb6avv.js +2 -0
- package/dist/chunk-5kprybdd.js +2 -0
- package/dist/{chunk-n5xbv1a9.js → chunk-62kxavc5.js} +3 -3
- package/dist/{chunk-8q9b82ew.js → chunk-6684b8ym.js} +11 -11
- package/dist/{chunk-npvxq89e.js → chunk-6mtth8d1.js} +3 -3
- package/dist/chunk-6n6nnt33.js +2 -0
- package/dist/chunk-6per0k6j.js +2 -0
- package/dist/{chunk-hb46a5rr.js → chunk-70npkeh2.js} +2 -2
- package/dist/{chunk-y706tkyy.js → chunk-776f05vk.js} +4 -4
- package/dist/{chunk-szjgbjw1.js → chunk-7a8jkwah.js} +2 -2
- package/dist/{chunk-wbhzt74k.js → chunk-7cw0wkbx.js} +1 -1
- package/dist/chunk-7f1dw9r4.js +2 -0
- package/dist/{chunk-khzyc41k.js → chunk-7ky2ny63.js} +13 -13
- package/dist/{chunk-h431swg6.js → chunk-7mpv1a02.js} +9 -9
- package/dist/chunk-7zjv015g.js +2 -0
- package/dist/{chunk-q35z0cyg.js → chunk-85bbtv3m.js} +1 -1
- package/dist/{chunk-qb7a4am2.js → chunk-85g35me6.js} +2 -2
- package/dist/chunk-87nt0kty.js +2 -0
- package/dist/{chunk-3dth76ce.js → chunk-88d5s6v3.js} +3 -3
- package/dist/chunk-8a3sdg2y.js +2 -0
- package/dist/chunk-8e9hd2jq.js +4 -0
- package/dist/{chunk-0c7ss25y.js → chunk-8gksvwsm.js} +3 -3
- package/dist/chunk-8vbfbtke.js +2 -0
- package/dist/chunk-91ranpvz.js +2 -0
- package/dist/chunk-96ypgjm4.js +2 -0
- package/dist/{chunk-1gtrs8va.js → chunk-9b4e815s.js} +8 -8
- package/dist/chunk-9cg6q8mw.js +2 -0
- package/dist/{chunk-gd7vq083.js → chunk-a2ztn8cr.js} +1 -1
- package/dist/chunk-ag4eck6d.js +2 -0
- package/dist/chunk-aq02drjz.js +2 -0
- package/dist/{chunk-jsw5yby0.js → chunk-aqra0qcg.js} +3 -3
- package/dist/{chunk-cnvfh74t.js → chunk-av9zf0zb.js} +5 -5
- package/dist/chunk-ayt4qd82.js +2 -0
- package/dist/{chunk-m735gtc4.js → chunk-az1y9jks.js} +2 -2
- package/dist/chunk-b3mazye4.js +2 -0
- package/dist/chunk-b5cv9xp7.js +2852 -0
- package/dist/{chunk-dayjd2sj.js → chunk-b7p3yca7.js} +4 -4
- package/dist/chunk-bn6sarwd.js +2 -0
- package/dist/chunk-c7xt5gyb.js +2 -0
- package/dist/chunk-cac98pkx.js +2 -0
- package/dist/{chunk-q5w9cmr9.js → chunk-cbj2hmx5.js} +5 -5
- package/dist/chunk-czg6ewy3.js +2 -0
- package/dist/{chunk-sxpnpvt5.js → chunk-d1ya7f79.js} +4 -4
- package/dist/chunk-dcwmcqbr.js +2 -0
- package/dist/{chunk-19bhnbyn.js → chunk-dz4hrgw8.js} +83 -64
- package/dist/chunk-ed1qn902.js +2 -0
- package/dist/chunk-ev479f3z.js +2 -0
- package/dist/{chunk-x6pz1h3x.js → chunk-evs5gb3q.js} +10 -10
- package/dist/{chunk-w3c2c74q.js → chunk-fskpdva4.js} +46 -46
- package/dist/{chunk-5rtatjwq.js → chunk-gh34r6qb.js} +2 -2
- package/dist/chunk-gmg6aj7y.js +2 -0
- package/dist/{chunk-t455jpzx.js → chunk-h4ashx84.js} +1 -1
- package/dist/chunk-hc1m2psz.js +3 -0
- package/dist/{chunk-4hmdcmw1.js → chunk-hfe8g644.js} +6 -6
- package/dist/chunk-htaed68z.js +2 -0
- package/dist/{chunk-g8gzxhp8.js → chunk-j1rnhv0w.js} +3 -3
- package/dist/chunk-j2jm2nqz.js +2 -0
- package/dist/chunk-jb8d4n60.js +2 -0
- package/dist/{chunk-mktk70gq.js → chunk-k2nrx78c.js} +2 -2
- package/dist/chunk-kdnbxwkb.js +2 -0
- package/dist/{chunk-01hf94pa.js → chunk-kf2vas4j.js} +5 -5
- package/dist/chunk-kt5mzw2w.js +2 -0
- package/dist/chunk-kt994306.js +2 -0
- package/dist/{chunk-6qvskcwp.js → chunk-mer3aea0.js} +4 -4
- package/dist/chunk-mezphhpa.js +2 -0
- package/dist/{chunk-5wrmcbch.js → chunk-myhxapnn.js} +2 -2
- package/dist/chunk-n7d69a2q.js +2 -0
- package/dist/{chunk-z4te6223.js → chunk-nz6bzffm.js} +4 -4
- package/dist/{chunk-st71ar7s.js → chunk-pfas39mf.js} +9 -9
- package/dist/{chunk-j18z5nxq.js → chunk-phbnrw2h.js} +2 -2
- package/dist/{chunk-9g5sv1p6.js → chunk-q2p6y0cn.js} +7 -7
- package/dist/{chunk-6rxnh3th.js → chunk-qfppetcn.js} +1 -1
- package/dist/{chunk-wsbccxwy.js → chunk-qpbd2fwp.js} +9 -9
- package/dist/{chunk-y794qh69.js → chunk-qvqgbvfa.js} +6 -6
- package/dist/chunk-qz3tnvwm.js +2 -0
- package/dist/{chunk-dvbgbd06.js → chunk-rns21kkv.js} +2 -2
- package/dist/{chunk-08jyyegp.js → chunk-rq9cbw2y.js} +1 -1
- package/dist/{chunk-q7wj2ypd.js → chunk-s0ar60ng.js} +6 -6
- package/dist/chunk-sddytf9n.js +2 -0
- package/dist/chunk-spvr2vvh.js +2 -0
- package/dist/{chunk-0z189871.js → chunk-t84ww3qb.js} +2 -2
- package/dist/chunk-t91250ag.js +2 -0
- package/dist/{chunk-n8595zaf.js → chunk-tmbqz710.js} +1 -1
- package/dist/{chunk-hjp38m0w.js → chunk-tme29zh9.js} +2 -2
- package/dist/chunk-txkc9w9q.js +2 -0
- package/dist/chunk-ty1c2276.js +2 -0
- package/dist/{chunk-det49x62.js → chunk-v5500ews.js} +2 -2
- package/dist/chunk-vepjs3tg.js +2 -0
- package/dist/{chunk-v3anfm9d.js → chunk-vfbdxxbf.js} +2 -2
- package/dist/{chunk-7mehf3h5.js → chunk-w9c7z8p3.js} +2 -2
- package/dist/chunk-wfp754ya.js +2 -0
- package/dist/chunk-wp3qcfb4.js +3 -0
- package/dist/{chunk-ga48aas6.js → chunk-x17fpc0x.js} +6 -6
- package/dist/chunk-x3sbsxdq.js +2 -0
- package/dist/chunk-xdcvp8tt.js +2 -0
- package/dist/{chunk-ebkjpj5m.js → chunk-xh98er3b.js} +2 -2
- package/dist/{chunk-9z9f3d6b.js → chunk-xrj3tekf.js} +2 -2
- package/dist/chunk-xxnh7gv8.js +2 -0
- package/dist/{chunk-zswn0s45.js → chunk-y2t8xd39.js} +2 -2
- package/dist/chunk-y4egzqqf.js +2 -0
- package/dist/chunk-y4nm9wq4.js +2 -0
- package/dist/{chunk-ygkwp4sf.js → chunk-y5hdc1sb.js} +2 -2
- package/dist/chunk-ygx0akfn.js +2 -0
- package/dist/chunk-yn9fwnq2.js +2 -0
- package/dist/{chunk-3dcdgp1k.js → chunk-yq9rfnd6.js} +1 -1
- package/dist/chunk-z0gfb7b4.js +2 -0
- package/dist/chunk-z3e54btj.js +2 -0
- package/dist/{chunk-773vgw1k.js → chunk-z6fb4m1j.js} +3 -3
- package/dist/cli.js +21 -21
- package/dist/client/signals-class-runtime.js +1 -1
- package/dist/client/signals-component-hydration-runtime.js +1 -1
- package/dist/client/signals-component-props-runtime.js +3 -3
- package/dist/client/signals-container-cleanup-runtime.js +1 -1
- package/dist/client/signals-dom-ready-runtime.js +4 -4
- package/dist/client/signals-event-shorthand-runtime.js +2 -2
- package/dist/client/signals-expression-runtime.js +21 -2
- package/dist/client/signals-for-runtime.js +6 -6
- package/dist/client/signals-handler-runtime.js +1 -1
- package/dist/client/signals-hydration-audit-runtime.js +1 -1
- package/dist/client/signals-hydration-runtime.js +1 -1
- package/dist/client/signals-if-chain-runtime.js +3 -3
- package/dist/client/signals-if-runtime.js +7 -7
- package/dist/client/signals-lazy-hydration-runtime.js +1 -1
- package/dist/client/signals-manifest-hydration-runtime.js +1 -1
- package/dist/client/signals-model-runtime.js +1 -1
- package/dist/client/signals-mount-runtime.js +3 -3
- package/dist/client/signals-process-element-runtime.js +7 -7
- package/dist/client/signals-show-runtime.js +1 -1
- package/dist/client/signals-spa-load-runtime.js +5 -5
- package/dist/client/signals-style-runtime.js +1 -1
- package/dist/client-scope-bindings.d.ts +6 -0
- package/dist/client-scope-bindings.js +98 -0
- package/dist/client-script-bundler.js +9 -3
- package/dist/client-script.js +2 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/includes.js +4 -2
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +2 -6
- package/dist/signal-processing.js +4 -80
- package/dist/ssg.js +10 -10
- package/dist/utils.js +5 -3
- package/package.json +5 -5
- package/dist/chunk-0fgp13q4.js +0 -2
- package/dist/chunk-0v0q0960.js +0 -2
- package/dist/chunk-0xxjmnqc.js +0 -2
- package/dist/chunk-1peszdcc.js +0 -2
- package/dist/chunk-1v92x0we.js +0 -15
- package/dist/chunk-2340emvg.js +0 -2
- package/dist/chunk-2xy5p3n4.js +0 -2
- package/dist/chunk-6p57991f.js +0 -2
- package/dist/chunk-711zygzk.js +0 -2
- package/dist/chunk-74r2q9ab.js +0 -2
- package/dist/chunk-7h4mxhkh.js +0 -2
- package/dist/chunk-7zdefvrn.js +0 -2
- package/dist/chunk-847nyz30.js +0 -2
- package/dist/chunk-8898f767.js +0 -2
- package/dist/chunk-9c7wkq4t.js +0 -2
- package/dist/chunk-9g01gnz5.js +0 -6
- package/dist/chunk-9wbraw07.js +0 -2
- package/dist/chunk-apaqfgsx.js +0 -2
- package/dist/chunk-bdnahg9m.js +0 -2
- package/dist/chunk-bfste5zk.js +0 -2
- package/dist/chunk-by4ngspf.js +0 -4
- package/dist/chunk-c0yb755y.js +0 -2
- package/dist/chunk-chaee0vj.js +0 -2
- package/dist/chunk-cy1krwqy.js +0 -2
- package/dist/chunk-d57fh04e.js +0 -2
- package/dist/chunk-dcham5kg.js +0 -2
- package/dist/chunk-e876sg0j.js +0 -2
- package/dist/chunk-ekfmad19.js +0 -2
- package/dist/chunk-f0ghgkxs.js +0 -2
- package/dist/chunk-fnzv245x.js +0 -2
- package/dist/chunk-hjkm6k8c.js +0 -2
- package/dist/chunk-hpvkkke2.js +0 -2
- package/dist/chunk-jb683m9n.js +0 -2
- package/dist/chunk-jfqvmq5w.js +0 -2
- package/dist/chunk-k1vjhhd4.js +0 -2
- package/dist/chunk-k5kj93g7.js +0 -2
- package/dist/chunk-kp4j8vja.js +0 -2
- package/dist/chunk-mb8c650x.js +0 -2
- package/dist/chunk-mfcxhfhb.js +0 -2
- package/dist/chunk-mmqt6qkf.js +0 -2
- package/dist/chunk-n6ek151q.js +0 -2
- package/dist/chunk-ph3ttt90.js +0 -2
- package/dist/chunk-pk68a878.js +0 -2
- package/dist/chunk-ptas1qqx.js +0 -2850
- package/dist/chunk-pz5zh3tg.js +0 -2
- package/dist/chunk-q068mc46.js +0 -2
- package/dist/chunk-q4a2j4qr.js +0 -3
- package/dist/chunk-rfkrktt9.js +0 -2
- package/dist/chunk-rj0nyb2t.js +0 -2
- package/dist/chunk-smpyb21z.js +0 -2
- package/dist/chunk-swv69q75.js +0 -4
- package/dist/chunk-t9ww2z0r.js +0 -2
- package/dist/chunk-th9wcse5.js +0 -2
- package/dist/chunk-v1ck0wd3.js +0 -2
- package/dist/chunk-vgd3yq11.js +0 -3
- package/dist/chunk-w24zd7sj.js +0 -2
- package/dist/chunk-wfettff6.js +0 -2
- package/dist/chunk-xfvbm4pn.js +0 -2
- package/dist/chunk-z04480ar.js +0 -2
- package/dist/chunk-zemkt4kg.js +0 -2
package/dist/chunk-ptas1qqx.js
DELETED
|
@@ -1,2850 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Bn,y,Qi,Wt,ro,ea,ta,na,ra}from"./chunk-dvbgbd06.js";import{I}from"./chunk-66e4ga0z.js";import{t,U,W,i,ie,eo,O,Vt,Mn,to,_r,l,p,Zi,N,Pe,lt,c,Tr}from"./chunk-1gtrs8va.js";import{zn,Hn,Ir,Oe}from"./chunk-sxpnpvt5.js";import{S,Js,at,Ys,qi,Rn,An,Gi,Ae,Ki,Pn,Xi,Ht,Zs,Ji,In,Nn,kr,ve,Qs,we,Cr}from"./chunk-x6pz1h3x.js";import{qs,Gs,Ks,Xs,vr,wr}from"./chunk-khzyc41k.js";import{Vi,Vs,hr,yr}from"./chunk-z4te6223.js";import{ye,zt,br,Ws,C,ot}from"./chunk-gc1dzxee.js";import{$n}from"./chunk-hb46a5rr.js";import{co}from"./chunk-jp6yn9mj.js";import{Mi,Li,Bi,Fi}from"./chunk-n5xbv1a9.js";import{st}from"./chunk-det49x62.js";import{s,$e}from"./chunk-6qvskcwp.js";import{Ft,Wi,En,a,Tn}from"./chunk-q4a2j4qr.js";import{d}from"./chunk-yn2d8x8m.js";import{E,D,Ln,no}from"./chunk-szjgbjw1.js";import{Or}from"./chunk-ygkwp4sf.js";import ts from"path";import Do from"fs";var Uh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ic(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Uh.has(v.toLowerCase())}var Vu=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"]),Uu={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"},Hh=new Set(["ctrl","alt","shift","meta"]),Ku={left:0,middle:1,right:2};function Hu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Hh.has(R))_.systemKeys.push(R);else if(R in Ku)_.mouse=R;else if(R in Uu||/^[a-z]$/.test(R))_.keys.push(Uu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Xu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,F,H]=B,q=B.index,K=q+z.length,G=`__stx_evt_${_}${R++}`,ee=[],ae=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Q;while((Q=ae.exec(H))!==null){let[,ue,le]=Q,pe=ue.split("."),de=pe[0];if(!Vu.has(de))continue;ee.push({attribute:`@${ue}`,event:de,handler:le,modifiers:Hu(pe.slice(1)),elementId:G})}let ce=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Q=ce.exec(H))!==null){let[,ue,le]=Q,pe=ue.split("."),de=pe[0];if(!Vu.has(de))continue;ee.push({attribute:`@${ue}`,event:de,handler:le,modifiers:Hu(pe.slice(1)),elementId:G})}if(ee.length>0)k.push({originalTag:z,elementId:G,events:ee,startIndex:q,endIndex:K})}return k}function qh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Ku[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Kh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function oc(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Xh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=qh(v),T=Kh(oc(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(ic(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",F=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
|
|
3
|
-
(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('${F}', null, $el);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
__stx_runHandler('${F}', 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('${F}', null, $el);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
__stx_runHandler('${F}', 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
|
-
${R?R+";":""}
|
|
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('${F}', $event, $el);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
-
__stx_runHandler('${F}', $event, $el);
|
|
54
|
-
}
|
|
55
|
-
}${z});
|
|
56
|
-
})();`}function ac(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(Xh).join(`
|
|
112
|
-
`)}
|
|
113
|
-
})();
|
|
114
|
-
</script>`}function Zh(v,_=""){let k=Xu(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],F=z.originalTag;if(!F.includes(" id="))F=F.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let H=F.match(/id=["']([^"']+)["']/);if(H)for(let q of z.events)q.elementId=H[1]}for(let H of z.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");F=F.replace(K,""),F=F.replace(G,"")}R=R.slice(0,z.startIndex)+F+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function qu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Gu(v,_,k){if(ea(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:F,bindings:H}=Zh(v,qu(_)),q=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...q,...H],F}let R=Xu(v,qu(_));if(R.length===0)return v;let T=v;for(let F=R.length-1;F>=0;F--){let H=R[F],q=H.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${H.elementId}"`);else{let K=q.match(/id=["']([^"']+)["']/);if(K)for(let G of H.events)G.elementId=K[1]}for(let K of H.events){let G=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ee=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ae=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");q=q.replace(ee,""),q=q.replace(ae,"")}T=T.slice(0,H.startIndex)+q+T.slice(H.endIndex)}let B=ac(R.flatMap((F)=>F.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
|
|
115
|
-
`+T.slice(z);else T+=B;return T}function Ju(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function Ui(v,_){let k=s(v),{depths:R,balanced:T}=$e(k),B=(F)=>!T||R[F]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let F of k.matchAll(z)){let H=(F.index??0)+F[0].length-F[1].length;if(B(H))return!0}for(let F of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(F.index??0)&&Ju(F[1],!0).has(_))return!0;for(let F of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(F.index??0)&&Ju(F[1],!1).has(_))return!0;return!1}var Sd="",Uo,Rr=/^[A-Za-z_$][\w$]*$/,Gh=new Set(["if","for","while","switch","with"]),$d=["(","[","{"],_d=[")","]","}"],Jh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Yh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function cc(v){if(Uo&&v===Sd)return Uo;let{code:_,tokens:k}=Yh(v),R=new Map,T=[];for(let Q=0;Q<k.length;Q++){let ce=k[Q].text;if(["(","[","{"].includes(ce))T.push(Q);else if([")","]","}"].includes(ce)){let ue=T.at(-1);if(ue!==void 0&&["()","[]","{}"].includes(k[ue].text+ce))T.pop(),R.set(ue,Q),R.set(Q,ue)}}function B(Q,ce){let ue=[],le=Q;for(let pe=Q;pe<ce;pe++){if(["(","[","{"].includes(k[pe].text)&&(R.get(pe)??ce)<ce){pe=R.get(pe);continue}if(k[pe].text===",")ue.push([le,pe]),le=pe+1}return ue.push([le,ce]),ue}let z=[];function F(Q,ce,ue,le=!1){if(k[Q]?.text==="...")Q++;if(Q>=ce)return;let pe=k[Q].text;if(Rr.test(pe)){if(ue.add(pe),ue===K)z.push({name:pe,token:Q,functionScoped:le});return}if(pe!=="{"&&pe!=="[")return;let de=R.get(Q);if(de===void 0||de>=ce)return;for(let[Re,be]of B(Q+1,de)){let xe=Re;if(pe==="{")for(let Ie=Re;Ie<be;Ie++){if(k[Ie].text===":"){xe=Ie+1;break}if(k[Ie].text==="=")break;if(["(","[","{"].includes(k[Ie].text)&&R.has(Ie))Ie=R.get(Ie)}F(xe,be,ue,le)}}function H(Q,ce){let ue=new Set;for(let[le,pe]of B(Q,ce))F(le,pe,ue);return ue}function q(Q){let ce=Q;for(;ce<k.length;ce++){let ue=k[ce].text;if(["(","[","{"].includes(ue)&&R.has(ce)){ce=R.get(ce);continue}if([",",";",")","]","}"].includes(ue))break}return k[Math.max(Q,ce-1)]?.end??_.length}let K=new Set,G=[];for(let Q=0;Q<k.length;Q++)if(k[Q].text==="=>"){let ce=Q-1,ue=ce,le;if(k[ce]?.text===")"&&R.has(ce))ue=R.get(ce),le=H(ue+1,ce);else if(k[ce]&&Rr.test(k[ce].text))le=new Set([k[ce].text]);else continue;let pe=Q+1,de=k[pe]?.text==="{"&&R.has(pe)?k[R.get(pe)].end:q(pe);G.push({start:k[ue].start,end:de,bodyStart:k[pe]?.start??de,functionBody:!0,names:le})}else if(k[Q].text==="("&&R.has(Q)){let ce=k[Q-1]?.text;if(!ce||Gh.has(ce)||!Rr.test(ce)&&ce!=="*"&&ce!=="]")continue;let ue=R.get(Q),le=ue+1;if(k[le]?.text===":"){le++;while(le<k.length&&!["{","=>",";","="].includes(k[le].text))le++}if(k[le]?.text!=="{"||!R.has(le))continue;G.push({start:k[Q].start,end:k[R.get(le)].end,bodyStart:k[le].start,functionBody:ce!=="catch",names:H(Q+1,ue)})}function ee(Q){let ce=Q;for(;ce<k.length;ce++){let ue=k[ce].text;if($d.includes(ue)&&R.has(ce)){ce=R.get(ce);continue}if(ue===";"||_d.includes(ue))break;let le=k[ce-1];if(ce>Q&&Jh.has(ue)&&le.text!==".")break;if(ce>Q&&/[\n\r]/.test(_.slice(le.end,k[ce].start))&&(/^[\w$]+$/.test(le.text)||_d.includes(le.text)||['"',"'","`"].includes(le.text))&&Rr.test(ue)&&!["in","of","instanceof"].includes(ue))break}return ce}let ae=[];for(let Q=0;Q<k.length;Q++){if(k[Q].text!=="for")continue;let ce=k[Q+1]?.text==="await"?Q+2:Q+1;if(k[ce]?.text!=="("||!R.has(ce))continue;let ue=R.get(ce),le=ue+1,pe=k[le]?.text==="{"&&R.has(le)?R.get(le):ee(le),de=k[pe]?.text===";"||k[pe]?.text==="}"?k[pe].end:k[Math.max(le,pe-1)]?.end??_.length;ae.push({headStart:ce,headEnd:ue,start:k[ce].start,end:de})}for(let Q=0;Q<k.length;Q++){let ce=k[Q].text,ue=k[Q-1]?.text;if(ue==="."||k[Q+1]?.text===":")continue;if(ue==="as"||ue==="<")continue;if(ce==="const"||ce==="let"||ce==="var"){let le=ee(Q+1),pe=Q+1,de=!1,Re=!1,be=0;for(let xe=Q+1;xe<=le;xe++){let Ie=k[xe]?.text;if(xe<le&&$d.includes(Ie)&&R.has(xe)&&R.get(xe)<le){xe=R.get(xe);continue}if(xe<le&&Ie===":"&&!Re)de=!0;else if(xe<le&&Ie==="="&&be===0)de=!1,Re=!0;else if(xe<le&&de&&Ie==="<")be++;else if(xe<le&&de&&Ie===">"&&be>0)be--;else if(xe===le||Ie===","&&be===0)F(pe,xe,K,ce==="var"),pe=xe+1,de=!1,Re=!1}}else if(ce==="function"||ce==="class"){let le=Q+1;if(k[le]?.text==="*")le++;if(k[le]&&Rr.test(k[le].text)&&k[le].text!=="extends")K.add(k[le].text),z.push({name:k[le].text,token:le})}else if(ce==="import"){let le=Q+1;if(k[le]?.text==="*"&&k[le+1]?.text==="as")le+=2;let pe=k[le]?.text;if(pe&&Rr.test(pe)&&pe!=="type"&&k[le+1]?.text!=="("&&k[le+1]?.text!==".")K.add(pe),z.push({name:pe,token:le,file:!0});let de=k[le]?.text==="{"?le:k[le+1]?.text===","&&k[le+2]?.text==="{"?le+2:-1;if(de!==-1&&R.has(de)){let Re=R.get(de);for(let[be,xe]of B(de+1,Re)){let Ie=xe-1;while(Ie>=be&&!Rr.test(k[Ie].text))Ie--;if(Ie>=be&&k[Ie].text!=="type")z.push({name:k[Ie].text,token:Ie,file:!0})}}}}return Sd=v,Uo={code:_,scopes:G,loops:ae,declarations:K,sites:z,tokens:k,pairs:R},Uo}function lc(v){let _=cc(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Ho(v){return new Set(cc(v).declarations)}function It(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=cc(v),F=Array.from({length:B.length},()=>-1),H=[];for(let ae=0;ae<B.length;ae++){F[ae]=H.length?H[H.length-1]:-1;let Q=B[ae].text;if(Q==="{"&&z.has(ae))H.push(ae);else if(Q==="}"&&H.length&&z.get(ae)===H[H.length-1])H.pop()}let q=new Set,K=new Map;for(let ae of T){if(!_.has(ae.name))continue;q.add(ae.token);let Q=ae.file?-1:F[ae.token],ce=Q===-1?[0,Number.POSITIVE_INFINITY]:[B[Q].start,B[z.get(Q)].end];if(ae.functionScoped){let le=B[ae.token].start,pe=k.filter((de)=>de.functionBody&&le>=de.bodyStart&&le<de.end).sort((de,Re)=>de.end-de.bodyStart-(Re.end-Re.bodyStart))[0];ce=pe?[pe.bodyStart,pe.end]:[0,Number.POSITIVE_INFINITY]}else if(!ae.file){let le=R.filter((pe)=>ae.token>pe.headStart&&ae.token<pe.headEnd).sort((pe,de)=>pe.headEnd-pe.headStart-(de.headEnd-de.headStart))[0];if(le)ce=[le.start,le.end]}let ue=K.get(ae.name);if(ue)ue.push(ce);else K.set(ae.name,[ce])}let G=new Set;for(let ae=0;ae<B.length;ae++){if(B[ae].text!=="import"||B[ae-1]?.text===".")continue;let Q=ae+1;if(B[Q]?.text==="type")Q++;if(B[Q]&&Rr.test(B[Q].text)&&B[Q+1]?.text===",")Q+=2;if(B[Q]?.text==="{"&&z.has(Q))for(let ce=Q+1;ce<z.get(Q);ce++)G.add(ce)}let ee=new Set;for(let ae=0;ae<B.length;ae++){let Q=B[ae].text;if(!_.has(Q)||ee.has(Q)||q.has(ae)||G.has(ae))continue;let ce=B[ae-1]?.text;if(ce==="#"||ce==="."&&B[ae-2]?.text!=="..")continue;if(B[ae+1]?.text===":"&&(ce==="{"||ce===","))continue;let ue=B[ae].start;if(K.get(Q)?.some(([le,pe])=>ue>=le&&ue<pe))continue;if(k.some((le)=>ue>=le.start&&ue<le.end&&le.names.has(Q)))continue;ee.add(Q)}return ee}import qo from"fs";import en from"path";function pn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var kd=new Map;function Ko(v,_=!0){let k=kd.get(v);if(_&&k)return k;let R=new Map,T=[en.join(v,"src"),en.join(v,"dist"),v];function B(z,F){if(F>6)return;let H;try{H=qo.readdirSync(z,{withFileTypes:!0})}catch{return}for(let q of H){let K=en.join(z,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;B(K,F+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let G=q.name.slice(0,-4);if(!R.has(G))R.set(G,K);let ee=G.toLowerCase();if(!R.has(ee))R.set(ee,K);let ae=pn(G);if(!R.has(ae))R.set(ae,K)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)kd.set(v,R);return R}function Xo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=en.join(k,"node_modules",v);try{if(qo.statSync(R).isDirectory())return R}catch{}let T=en.dirname(k);if(T===k)return null;k=T}}function Zo(v,_,k={}){return[en.resolve(en.dirname(_),`${v}.stx`),en.resolve(en.dirname(_),v),en.resolve(k.componentsDir||"components",`${v}.stx`),en.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function Ed(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=pn(_);return[_,k,R]}function uc(v,_){let[k,R,T]=Ed(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*dc(v,_,k={},R){let T=Ed(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield en.resolve(en.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((H)=>`${H}.stx`))],z=k.projectRoot||process.cwd(),F=[...R?.__originalFilePath?[en.join(en.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],en.join(en.dirname(_),"components"),en.resolve(z,"src/components"),en.resolve(z,"components"),...import.meta.dir?[en.resolve(import.meta.dir,"components")]:[]];for(let H of new Set(F)){for(let q of B)yield en.join(H,q);try{for(let q of qo.readdirSync(H,{withFileTypes:!0}))if(q.isDirectory())for(let K of B)yield en.join(H,q.name,K)}catch{}}}function Cd(v,_,k={},R){let T=uc(v,R);if(T!==void 0)return T;for(let B of dc(v,_,k,R))try{if(qo.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import Mh from"fs";import pt from"path";import{createHash as Qh}from"crypto";var Go="__stx_component_client_factories";function Jo(v){let _=v[Go];return _ instanceof Map?_:null}function Ad(v){v[Go]=new Map}function fc(v,_){let k=Jo(v);if(!k)return null;let R=Qh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function Td(v,_){let k=Jo(_);if(!k?.size)return v;let R=new Map;for(let[K,G]of k)if(G.instances===1)R.set(K,G.body);let T=[];if(R.size>0){let K=[...R.keys()].map((ae)=>JSON.stringify(ae).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${K})\\]\\(("[^"]+")\\);`,"g"),ee=G.exec(v);while(ee!==null){let ae=R.get(JSON.parse(ee[1]));if(ae!==void 0)T.push({start:ee.index,end:ee.index+ee[0].length,replacement:`(${ae})(${ee[2]});`});ee=G.exec(v)}}let B=[...k].filter(([,K])=>K.instances>1);if(B.length===0)return Rd(v,T);let F=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
|
-
(function() {
|
|
117
|
-
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
|
-
${B.map(([K,G])=>` try { factories[${JSON.stringify(K)}] = factories[${JSON.stringify(K)}] || ${G.body}; }
|
|
119
|
-
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(K)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
120
|
-
`)}
|
|
121
|
-
})();
|
|
122
|
-
</script>`,H=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),q=H<0?0:H;return T.push({start:q,end:q,replacement:`${F}
|
|
123
|
-
`}),Rd(v,T)}function Rd(v,_){if(_.length===0)return v;_.sort((B,z)=>B.start-z.start||B.end-z.end);let k=Array(_.length*2+1),R=0,T=0;for(let B of _)k[T++]=v.slice(R,B.start),k[T++]=B.replacement,R=B.end;return k[T]=v.slice(R),k.join("")}function Id(v){let _=Jo(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function Pd(v,_){let k=Jo(v);if(!k)return[];let R=[];for(let[T,B]of k){let z=B.instances-(_.get(T)??0);if(z>0)R.push({body:B.body,count:z})}return R}function Dd(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)fc(v,k)}import qd from"fs";var Od=0,pc=new Map;function di(){Od=0,pc.clear()}function Yo(v,_){let k=Od++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return pc.set(R,{type:v,expression:_}),R}function pi(){let v={};for(let[_,k]of pc)v[_]={type:k.type,expression:k.expression};return v}function fi(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function vs(v){return v.includes("<!--__STX_")}var ey=/@(?=[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 ty(v){return Array.from({length:v},()=>"{").join("⁠")}function Md(v){return v.replace(/\{{2,}/g,(_)=>ty(_.length)).replace(/\{(?=!)/g,"{⁠").replace(ey,"@")}function Nd(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),B=R.lastIndexOf(">");if(T>=0&&B>T)return null;if(T<0&&!k)return null;let z=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(z))return/^\s*\/?\s*$/.test(z)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(z))return{kind:"tag-name"};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:'"',valuePrefix:F[2]};let H=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(H)return{kind:"attribute",name:H[1],quote:"'",valuePrefix:H[2]};let q=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(q)return{kind:"attribute",name:q[1],quote:null,valuePrefix:q[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class er extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var jd="unsafe:";var ny=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ry=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,sy=/^data:(?:text\/html|application\/xhtml\+xml)/,iy=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function oy(v){return v.replace(iy,"").toLowerCase()}function gc(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 Qo(v,_="navigable"){let k=oy(v);if(ny.test(k))return!0;return _==="navigable"?ry.test(k):sy.test(k)}function Hi(v,_="navigable"){return Qo(v,_)?"unsafe:"+v:v}function ay(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return gc(_[1])}function Ld(v,_,k=256){if(_<=k)return v.slice(0,_);let R=v.slice(_-k,_),T=R.search(/[\s"'`/]/);return T===-1?"":R.slice(T)}function Bd(v,_,k=_){let R=ay(v);return R&&Qo(_,R)?"unsafe:"+k:k}var sa=/<script\b[^>]*>/iy,bc=/<\/script\s*>/ig,ia=/<style\b[^>]*>/iy,vc=/<\/style\s*>/ig;function zd(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let B=R.exec(v);if(!B)return-1;return B.index+B[0].length}function V(v,_){return zd(v,_,sa,bc)}function ls(v,_){return zd(v,_,ia,vc)}function Ge(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Wd(v,_){if(v.startsWith("<!--",_)){let T=Ge(v,_);return T===-1?v.length:T}if(sa.lastIndex=_,sa.exec(v)?.index===_){bc.lastIndex=sa.lastIndex;let T=bc.exec(v);return T?T.index+T[0].length:v.length}if(ia.lastIndex=_,ia.exec(v)?.index===_){vc.lastIndex=ia.lastIndex;let T=vc.exec(v);return T?T.index+T[0].length:v.length}return-1}function te(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let F=v[R];if(B){if(z){if(F===z)z=null}else if(F==='"'||F==="'")z=F;else if(F===">")B=!1;R++;continue}if(F!=="<"){let G=v.indexOf("<",R+1);if(G===-1)break;R=G;continue}let H=_(v,R);if(H>R){k.push({start:R,end:H,token:v.slice(R,H)}),R=H;continue}let q=Wd(v,R);if(q>R){R=q;continue}let K=v.charCodeAt(R+1);if(K>=65&&K<=90||K>=97&&K<=122)B=!0;R++}return k}function Fd(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let G=v[R];if(B){if(G===B)B=null}else if(G==='"'||G==="'")B=G;else if(G===">")T=!1;R++;continue}let z=v.indexOf("<",R),F=z===-1?v.length:z;while(R<F){let G=v[R++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let H=Wd(v,z);if(H>z){R=H;continue}let q=v.charCodeAt(z+1),K=q===47?v.charCodeAt(z+2):q;if(K>=65&&K<=90||K>=97&&K<=122)T=!0;R=z+1}return!1}function Vd(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var cy=1024,ly=16777216,as=new Map,mc=0;function uy(v,_){as.set(v,_),mc+=v.length+_.output.length;for(let[k,R]of as){if(mc<=ly)break;as.delete(k),mc-=k.length+R.output.length}}function Un(v,_,k,R){let T=R!==void 0&&v.length>=cy,B=T?`${R}\x00${v}`:"";if(T){let K=as.get(B);if(K)return as.delete(B),as.set(B,K),{output:K.output,tokens:K.tokens.slice()}}let z=te(v,_);if(z.length===0)return{output:v,tokens:[]};let F=z.map((K)=>K.token),H="",q=0;for(let K=0;K<z.length;K++){let G=z[K];H+=v.slice(q,G.start),H+=k(G.token,K),q=G.end}if(H+=v.slice(q),T)return uy(B,{output:H,tokens:F}),{output:H,tokens:F.slice()};return{output:H,tokens:F}}var dy=1024,fy=16777216,cs=new Map,hc=0;function py(v,_){cs.set(v,_),hc+=v.length+_.output.length;for(let[k,R]of cs){if(hc<=fy)break;cs.delete(k),hc-=k.length+R.output.length}}function yc(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:us(R,k)}}function hn(v){let _=v.length>=dy;if(_){let T=cs.get(v);if(T)return cs.delete(v),cs.set(v,T),yc(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=Un(v,V,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return py(v,{output:k,scripts:R}),yc(v,k,R.slice());return yc(v,k,R)}function us(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Nt(v){let _=v.indexOf(" as ");if(_!==-1){let B=v.slice(0,_).trim(),z=v.slice(_+4).trim();return B&&z?{arrayExpr:B,itemVar:z}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let R=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return R&&T?{arrayExpr:T,itemVar:R}:null}function oa(v){let _=[],k=0,R="",T=0;for(let B=0;B<v.length;B++){let z=v[B];if(R){if(z==="\\")B++;else if(z===R)R="";continue}if(z==="'"||z==='"'||z==="`")R=z;else if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(T,B)),T=B+1}return _.push(v.slice(T)),_}function Ud(v,_){let k=0;for(let R=0;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return R}return-1}function Hd(v){let _=0;for(let k=0;k<v.length;k++){let R=v[k];if(R==="("||R==="["||R==="{")_++;else if((R===")"||R==="]"||R==="}")&&--_===0)return k}return-1}function Vr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=Ud(k,"=");if(R!==-1&&k[R+1]!==">")k=k.slice(0,R).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of oa(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){Vr(B,_);continue}let z=Ud(B,":");Vr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of oa(k.slice(1,-1)))Vr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Ur(v){let _=v.trim(),k=[],R=0;for(let B=0;B<_.length;B++){let z=_[B];if(z==="("||z==="["||z==="{")R++;else if(z===")"||z==="]"||z==="}")R--;else if(R===0&&/\s/.test(z)){if(!/^\s+(?:in|of)\s/.exec(_.slice(B)))continue;let H=_.slice(0,B).trim();if(H.startsWith("(")&&Hd(H)===H.length-1)H=H.slice(1,-1);for(let q of oa(H))Vr(q,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let B=T[1].trim();if(B.startsWith("(")&&Hd(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)Vr(z[2],k),Vr(z[1],k);else for(let F of oa(B))Vr(F,k)}return k}function ne(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let z=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let F of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(F))return!0;return!1}var aa="__stx_client_loop_names";function Ar(v){let _=v?.[aa];return Array.isArray(_)?_:[]}function ca(v){if(!v.includes("#")&&!v.includes("v-slot:"))return[];let _=[],k=[],R=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let T of v.matchAll(R)){let B=T[0];if(/^<\/template\s*>$/i.test(B)){let z=k.pop();if(z)z.end=T.index}else if(/^<template\b/i.test(B)&&!/\/\s*>$/.test(B)){let F=[...B.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((K)=>/^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(K[1])),H=(F?.[2]??F?.[3])?.trim(),q=H?{start:T.index+B.length,end:v.length,binding:H}:void 0;if(k.push(q),q)_.push(q)}}return _}var so={},Kd=new Map;function gy(v){let _=Kd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Kd.set(v,_)}return _.lastIndex=0,_}var or={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let R=Number(v);return Number.isNaN(R)?"":R.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let R=Number(v);if(Number.isNaN(R))return String(v);return R.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return Dt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let H of B){if(z===void 0||z===null)break;z=z[H]}if(z===void 0||z===null)return T?v:"";let F=String(z);return Object.entries(k).forEach(([H,q])=>{F=F.replace(gy(H),String(q))}),F},t:(v,_,k={})=>or.translate(v,_,k),truncate:(v,_,k=50,R="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=R.length)return R.substring(0,k);return T.substring(0,k-R.length)+R},date:(v,_,k="short",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let B={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(R,B[k]||B.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(R,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,R)=>{let T=Number(v);if(Number.isNaN(T))return k;let B=R||`${k}s`;return T===1?k:B},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,R)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,R);return v},replace:(v,_,k,R="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>R)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let R=Number(v);if(Number.isNaN(R))return 0;let T=10**k;return Math.round(R*T)/T}};function Sc(v,_){if(v in or)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);so[v]=_}function Zu(v){for(let[_,k]of Object.entries(v))Sc(_,k)}function kc(){return{...or,...so}}function Qu(){for(let v of Object.keys(so))delete so[v]}function Cc(v,_,k=2){let R=0,T=null;for(let B=_+k;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="{"){R++;continue}if(z==="}"){if(R>0){R--;continue}let F=0;while(v[B+F]==="}")F++;if(F>=k)return B}}return-1}function ir(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",B=0;for(;;){let z=v.indexOf(R,B);if(z===-1)break;let F=Cc(v,z,k);if(F===-1)break;T+=v.slice(B,z)+_(v.slice(z,F+k),v.slice(z+k,F),z),B=F+k}return B===0?v:T+v.slice(B)}function b(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Dt(v){return Md(b(v))}function my(v){return v.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function hy(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 yy(v,_){let k=hy(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new er(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let B=T[1].replace(/^["']|["']$/g,""),z=B.startsWith("/")&&!B.startsWith("//")||B.startsWith("./")||B.startsWith("../")||B.startsWith("#"),F=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!F)throw new er(_,"CSS URLs must be local paths or base64 raster images")}}function Qd(v,_,k,R=!1,T=0){let B=Nd(v,_,R),z=Dt(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new er("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let q=v.slice(_+T).trimStart(),K=k.trim();if(!q.startsWith("=")&&(K===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(K)))return K;throw new er("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let F=B.name.toLowerCase();if(/^on[a-z]/.test(F))throw new er(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(F==="srcdoc")z=Dt(z);if(F==="style")yy(k,B.name);if(B.quote===null)z=my(z);let H=gc(F);if(H&&B.valuePrefix.trim()===""&&Qo(k,H))return jd+z;return Bd(Ld(v,_),k,z)}function ef(v){return v.flatMap((_)=>{let k=_.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!k||/\bserver\b|\bsrc\s*=/.test(k[1])?[]:[k[2]]})}function Ce(v,_){let{scripts:k}=hn(v);for(let R of ef(k)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(R))return!0;if(Bn(R,_))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 _c(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let R=k.exec(v);R;R=k.exec(v)){let T=R[1].toLowerCase(),B=new Set(Ur(R[3]));if(B.size===0)continue;let z=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:z,names:B});continue}let F=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");F.lastIndex=z;let H=1,q=v.length;for(let K=F.exec(v);K;K=F.exec(v)){if(K[2]==="/")continue;if(H+=K[1]==="/"?-1:1,H===0){q=K.index+K[0].length;break}}_.push({start:R.index,end:q,names:B})}return _}function Xd(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let B of T.names)if(new RegExp(`(?<![.#\\w$])${B.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function Zd(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],R=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",B=!1,z=0;for(let q=0;q<R.length;q++){let K=R[q];if(!B&&K==="`"){B=!0,z=0;continue}if(B){if(K==="`"&&z===0){B=!1;continue}if(K==="$"&&R[q+1]==="{"){z++,q++,T+=" ";continue}if(K==="}"&&z>0){z--;continue}if(z>0){T+=K;continue}continue}T+=K}R=T;let F=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,H;while((H=F.exec(R))!==null){let q=H[1];if(!R.substring(0,H.index).trimEnd().endsWith(".")){if(!k.includes(q)&&!(q in _))return!1}}return!0}function xy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let R=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(R))return!0;return!1}var Gd=new Set;function Jd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Yd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!Gd.has(k))Gd.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 ws(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return Jd(B)?Yd(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=ir(R,(T,B,z)=>{let F=B.trim();if(/^__[A-Z_]+__$/.test(F))return T;try{let H=x(B,_);if(H===void 0)return Jd(F)?Yd(F,k):T;return JSON.stringify(H).replace(/</g,"\\u003c")}catch{return T}}),R}function Ec(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let B=x(T,_);if(B===void 0)return R;return B===null?"":String(B)}catch{return R}}),k=ir(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let F=x(T,_);if(F===void 0)return R;if(F===null)return"";let H=String(F);return Qd(k,B,H,!0,R.length)}catch(F){if(F instanceof er)throw F;return R}}),k}function ed(v,_,k={}){let{output:R,scripts:T}=hn(v),B=T.map((z)=>{let F=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),H=z.match(/^<script\b[^>]*>/i),q=z.search(/<\/script\s*>$/i);if(!F||!H||q===-1)return z;let K=F[1],G=F[2];if(/\bdata-raw\b/.test(K))return z;if(k.skipServer&&/\bserver\b/.test(K))return z;let ae=`<script${Ec(K,_)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return ae+G+z.slice(q);return ae+ws(G,_)+z.slice(q)});return us(R,B)}function Y(v,_,k){let R=v,T=(Q,ce)=>{let ue=ls(Q,ce);if(ue===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Q.slice(ce,ue))?-1:ue},B=(Q,ce,ue,le)=>{let pe=ue.length,{output:de,tokens:Re}=Un(Q,ce,(be,xe)=>le(pe+xe));return ue.push(...Re),de},z=[];R=B(R,T,z,(Q)=>`<!--__STX_STYLE_${Q}__-->`);let F=[];R=B(R,V,F,(Q)=>`<!--__STX_SCRIPT_EXPR_${Q}__-->`);let H=_?.__stx_signals_gate===!0||Ce(v),q=new Set([...Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[],...Fs(ef(F))]),K=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);R=ir(R,(Q,ce,ue)=>{try{let le=x(ce,_,!1,(pe)=>wc(pe,Q,k,v));return le!==void 0&&le!==null?String(le):""}catch(le){let pe=le instanceof Error?le.message:String(le);return g("Expression",`Error evaluating: {{{ ${ce.trim()}}}}: ${pe}`,k,v,ue,Q)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Q,ce,ue)=>{try{let le=x(ce,_,!1,(pe)=>wc(pe,Q,k,v));if(le===void 0&&_.__stx_buildMode==="compile")return Yo("raw",ce.trim());return le!==void 0&&le!==null?String(le):""}catch(le){if(_.__stx_buildMode==="compile")return Yo("raw",ce.trim());let pe=le instanceof Error?le.message:String(le);return g("Expression",`Error evaluating: {!! ${ce.trim()} !!}: ${pe}`,k,v,ue,Q)}}),R=B(R,V,F,(Q)=>`<!--__STX_SCRIPT_EXPR_${Q}__-->`),R=B(R,T,z,(Q)=>`<!--__STX_STYLE_${Q}__-->`);let G=H?_c(R):[],ee=ca(R).map((Q)=>({...Q,names:new Set(Ur(`${Q.binding} in __slot`))})),ae=new Set(Ar(_));if(R=ir(R,(Q,ce,ue)=>{let le=ce.trim();if(Xd(ee,ue,le))return Q;if(ne(le,ae))return Q;if(G.length>0&&Xd(G,ue,le))return Q;if(K.has(le))return Q;let pe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],de=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,be=le.match(de)?.[1],xe=be&&((be in _)||pe.includes(be)),Ie=Boolean(be&&q.has(be)),Me=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ne=le.match(Me),je=Ne&&!pe.includes(Ne[1])&&!(Ne[1]in _);if(/^__[A-Z_]+__$/.test(le))return"";if(Ie)return Q;let Le;try{let De=x(ce,_,!1,(Fe)=>{Le=Fe});if(H&&!Zd(le,_))return Q;if(Le)wc(Le,Q,k,v);if(_.__stx_buildMode==="compile"&&!H&&(De===void 0||xy(le,_)))return Yo("expr",le);if(De===void 0||De===null)return"";let ze=String(De);return Qd(R,ue,ze,!1,Q.length)}catch(De){if(De instanceof er)throw De;if(H&&!Zd(le,_))return Q;if(je)return Q;let ze=De instanceof Error?De.message:String(De);return g("Expression",`Error evaluating: {{ ${le} }}: ${ze}`,k,v,ue,Q)}}),F.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Q,ce)=>F[Number(ce)]??Q);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Q,ce)=>z[Number(ce)]??Q);return R}function Tc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let B=T.match(/^(\w+)/);if(!B)break;let z=B[1];T=T.substring(z.length).trim();let F=so[z]||or[z];if(!F)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(kc()).join(", ")}`);let H=[];if(T.startsWith(":")){let q=T.match(/^:([^|\s]+)/);if(q){let K=q[1].trim();try{let G=Number(K);H=[Number.isNaN(G)?K:G]}catch{H=[K]}T=T.substring(q[0].length).trim()}}else if(T.startsWith("(")){let q=1,K=1;while(q>0&&K<T.length){if(T[K]==="(")q++;if(T[K]===")")q--;K++}if(q===0){let G=T.substring(1,K-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))H=[x(`(${G})`,k,!0)];else{let ee=[],ae="",Q=null,ce=0,ue=0,le=0,pe=!1;for(let de=0;de<G.length;de++){let Re=G[de];if(pe){ae+=Re,pe=!1;continue}if(Re==="\\"){ae+=Re,pe=!0;continue}if(Q){if(ae+=Re,Re===Q)Q=null;continue}if(Re==='"'||Re==="'"||Re==="`"){Q=Re,ae+=Re;continue}if(Re==="(")ce++;else if(Re===")")ce--;else if(Re==="[")ue++;else if(Re==="]")ue--;else if(Re==="{")le++;else if(Re==="}")le--;if(Re===","&&ce===0&&ue===0&&le===0){ee.push(ae),ae="";continue}ae+=Re}if(ae)ee.push(ae);H=ee.map((de)=>{let Re=de.trim();return x(Re,k,!0)})}}catch{H=[G]}T=T.substring(K).trim()}}try{R=F(R,k,...H)}catch(q){let K=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${z}': ${K}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function by(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let F=0;F<v.length;F++){let H=v[F],q=v[F+1];if(_&&z){z=!1;continue}if(_&&H==="\\"){z=!0;continue}if(z=!1,(H==='"'||H==="'"||H==="`")&&!z){if(!_)_=!0,k=H;else if(H===k)_=!1,k="";continue}if(_&&k==="`"&&H==="$"&&q==="{"){let K=1;F+=2;while(F<v.length&&K>0){if(v[F]==="{")K++;else if(v[F]==="}")K--;if(K>0)F++}continue}if(_)continue;if(H==="(")R++;else if(H===")")R--;else if(H==="[")T++;else if(H==="]")T--;else if(H==="{")B++;else if(H==="}")B--;if(H==="|"&&R===0&&T===0&&B===0){if(q==="|"){F++;continue}if(q==="="){F++;continue}return F}}return-1}var Yi=new Set,vy=1000;function td(){Yi.clear()}function wc(v,_,k,R){if(!D())return;let T=`${k}\x00${v.expression}`;if(Yi.has(T))return;if(Yi.size>=vy)Yi.clear();Yi.add(T);let B=k,z=R;try{if(k&&qd.existsSync(k))z=qd.readFileSync(k,"utf8")}catch{}let F=z.indexOf(_);if(F>=0)B=`${k}:${z.slice(0,F).split(`
|
|
124
|
-
`).length}`;console.warn(`${B}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,R){try{let T=v.trim(),B=by(T);if(B>0){let F=T.substring(0,B).trim(),H=T.substring(B+1).trim(),q=x(F,_,!0,R);return Tc(q,H,_)}let z=Mn(T);if(z!==null){R?.({expression:T,rule:z});return}try{let F=Object.keys(_),H=Object.values(_);return c(T,F)(...H)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let B=/(\b\w+)\s+is not defined/.exec(T.message);if(B){let z=B[1],F=wy(z,Object.keys(_));if(F&&F!==z)T.message=`${T.message} \u2014 did you mean '${F}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function wy(v,_){let k=null;for(let T of _){if(T===v)continue;let B=Sy(v,T);if(k===null||B<k.dist)k={key:T,dist:B}}if(!k)return null;let R=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/R<=0.35)return k.key;return null}function Sy(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,R]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),B=Array(k.length+1);for(let z=0;z<=k.length;z++)T[z]=z;for(let z=1;z<=R.length;z++){B[0]=z;for(let F=1;F<=k.length;F++){let H=k[F-1]===R[z-1]?0:1;B[F]=Math.min(B[F-1]+1,T[F]+1,T[F-1]+H)}for(let F=0;F<=k.length;F++)T[F]=B[F]}return T[k.length]}function nd(v){if(!v)return"";return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import rf from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let R=this.cache.keys().next().value;if(R===void 0)break;this.delete(R)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var ds=new Map,$y=500;function Hr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!ds.has(k)){if(ds.size>=$y){let R=ds.keys().next().value;if(R)ds.delete(R)}ds.set(k,new RegExp(v,_))}return ds.get(k)}class tf{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((F)=>F.context.join(",")===k);if(R)return R.func;let T=this.fnCache,B=this.fnCacheMaxSize,z=(...F)=>(H)=>{try{let q=`${k}:${H}`,K=T.get(q);if(!K){if(T.size>=B){let G=T.keys().next().value;if(G)T.delete(G)}K=Function(..._,`
|
|
125
|
-
'use strict';
|
|
126
|
-
try {
|
|
127
|
-
return ${H};
|
|
128
|
-
}
|
|
129
|
-
catch (e) {
|
|
130
|
-
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
throw e;
|
|
134
|
-
}
|
|
135
|
-
`),T.set(q,K)}return K(...F)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:z,context:_.slice()});return z}clear(){this.pool.length=0,this.fnCache.clear()}}var R$=new tf;class nf{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),R=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),R=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let R=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,B=_>=k.maxTime;if(!T&&!B)return;let z={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(z);while(this.violations.length>this.maxViolations)this.violations.shift();for(let H of this.violationHandlers)try{H(z)}catch{}let F=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${R.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(R-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(F);break;case"warn":console.warn(F);break;case"error":console.error(F);break;case"throw":if(B)throw Error(F);else console.warn(F);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let R=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:R?.maxTime,budgetUtilization:R?k.totalTime/k.count/R.maxTime*100:void 0}}let _={};for(let[k,R]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:R.count,avgTime:R.totalTime/R.count,totalTime:R.totalTime,maxTime:R.maxTime,minTime:R.minTime,budget:T?.maxTime,budgetUtilization:T?R.totalTime/R.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let R of this.violations)if(v[R.label]=(v[R.label]||0)+1,R.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var sl=null;function _y(){if(!sl)sl=new nf;return sl}var X=new Proxy({},{get(v,_){return _y()[_]}});var sf=[];function m(v){let _=new M(v);return sf.push(_),_}function of(){for(let v of sf)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function yn(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:rf.statSync(k).mtimeMs})}catch{}return _}function sr(v){for(let _ of v)try{if(rf.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import US from"fs";import dn from"path";import ao from"fs";import Xt from"path";import{hasLocalConfig as If}from"bunfig";import qn from"fs";import qr from"path";import il from"fs";import af from"path";import{fileURLToPath as ky}from"url";var ol;function qe(){if(ol)return ol;let v="unknown";try{v=String(JSON.parse(il.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=af.dirname(ky(import.meta.url)),k=0;for(let R of il.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,il.statSync(af.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return ol=v,v}var $c=new Map,Kr=new Map;async function rd(v){let k;for(let R=0;R<3;R++)try{let B=(await qn.promises.stat(v)).mtime.getTime(),z=Kr.get(v);if(z&&z.mtime===B)return z.content;let F=await Bun.file(v).text(),q=(await qn.promises.stat(v)).mtime.getTime();if(q!==B)continue;return Kr.set(v,{content:F,mtime:q}),F}catch(T){k=T;break}throw Kr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function sd(v){Kr.delete(v)}function od(v){for(let _ of Kr.keys())if(_.startsWith(v))Kr.delete(_)}var ua=null,Ey=null,lf=null;function id(v){lf=v}async function Rc(v=!1){let _=lf??await import("./chunk-chaee0vj.js");if(v)return _.generateSignalsRuntimeDev();if(ua===null)ua=_.generateSignalsRuntime();return ua}var da=null;async function Ac(){if(da===null){let{getRouterScript:v}=await import("./chunk-k1vjhhd4.js");da=v()}return da}var cf={};async function ad(v,_=!1){let k=v==="runtime"?await Rc(_):await Ac(),R=v==="runtime"&&_?"runtime-debug":v,T=cf[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},cf[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var Cy=500,Ry=33554432,tr=new Map,la=0;function uf(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function cd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=tr.get(_),R=k!==void 0;if(R)tr.delete(_),la-=k.length*2;tr.set(_,v),la+=v.length*2;while(tr.size>1&&(tr.size>Cy||la>Ry)){let T=tr.keys().next().value;la-=tr.get(T).length*2,tr.delete(T)}if(!R)try{let T=uf(_);if(!qn.existsSync(T))qn.mkdirSync(qr.dirname(T),{recursive:!0}),qn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function gi(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=tr.get(v);if(_!==void 0)return _;try{return qn.readFileSync(uf(v),"utf8")}catch{return}}function ld(){Kr.clear(),oe(),of(),ua=null,Ey=null,da=null}function df(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 vn(v,_){try{if(!_.cachePath)return null;let k=qr.resolve(_.cachePath),R=qr.join(k,`${ar(v)}.html`),T=qr.join(k,`${ar(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let B=await Bun.file(T).text(),z=JSON.parse(B);if(z.cacheVersion!==_.cacheVersion)return null;if(z.engine!==qe())return null;if(z.optionsSignature!==df(_))return null;if((await qn.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let H of z.dependencies)if(await r(H)){if((await qn.promises.stat(H)).mtime.getTime()>z.mtime)return null}else return null;return await Bun.file(R).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function wn(v,_,k,R){try{if(!R.cachePath)return;let T=qr.resolve(R.cachePath);await qn.promises.mkdir(T,{recursive:!0});let B=qr.join(T,`${ar(v)}.html`),z=qr.join(T,`${ar(v)}.meta.json`),F=await qn.promises.stat(v);await Bun.write(B,_);let H={sourcePath:v,mtime:F.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:qe(),optionsSignature:df(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(H,null,2)),$c.set(v,{output:_,mtime:F.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Ay=16;function ar(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Ay)}var Ke={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 _e(v){return`--stx-${v}`}function fa(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let R=v[_.slice(0,k)];if(!R||typeof R!=="object")return;let T=R[_.slice(k+1)];return typeof T==="string"?T:void 0}var Ty=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function ff(v,_){let k=_.trim();return fa(v,k)??(Ty.test(k)?k:void 0)}function pf(v={}){return[...Object.keys(v.roles??{}).filter((_)=>!Ke[_]).map((_)=>`roles.${_}`),...Object.keys(v.shapes??{}).filter((_)=>!re[_]).map((_)=>`shapes.${_}`),...Object.keys(v.density??{}).filter((_)=>!fe[_]).map((_)=>`density.${_}`)]}function gf(v){let _={};for(let[k,R]of Object.entries(Ke)){let T=fa(v,R.light);if(T===void 0)continue;_[k]=`var(${_e(k)}, ${T})`}return _}function mf(v,_={}){let k=[],R=[];for(let[T,B]of Object.entries(Ke)){let z=_[T],F=typeof z==="string"?z:z?.light,H=typeof z==="string"?z:z?.dark,q=F&&ff(v,F)||fa(v,B.light),K=H&&ff(v,H)||fa(v,B.dark);if(q===void 0)continue;if(k.push(` ${_e(T)}: ${q};`),K!==void 0)R.push(` ${_e(T)}: ${K};`)}if(k.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...k,"}",".dark {",...R,"}",""].join(`
|
|
136
|
-
`)}var re={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 Mt(v){return`--stx-radius-${v}`}function hf(){let v={};for(let[_,k]of Object.entries(re))v[_]=`var(${Mt(_)}, ${k.value})`;return v}function yf(v={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(re).map(([_,k])=>` ${Mt(_)}: ${v[_]??k.value};`),"}",""].join(`
|
|
137
|
-
`)}var fe={"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"}},xn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Sn={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 Ee(v){return`--stx-${v}`}function al(v){let _=fe[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${Ee(v)}, ${_.value})`}function xf(){let v={};for(let[_,k]of Object.entries(xn))v[_]=al(k);return v}function bf(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(Sn))v[_]=[al(k),{lineHeight:al(R)}];return v}function vf(v={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(fe).map(([_,k])=>` ${Ee(_)}: ${v[_]??k.value};`),"}",""].join(`
|
|
138
|
-
`)}function wf(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function cl(v,_){let k={...v};for(let[R,T]of Object.entries(_))k[R]=wf(T)&&wf(k[R])?cl(k[R],T):T;return k}function Sf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
|
|
139
|
-
`:k}function $f(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...F}=k,H=F.colors||{};F.colors={...H,...gf(H)};let q=F.borderRadius||{};F.borderRadius={...q,...hf()};let K=F.spacing||{};F.spacing={...K,...xf()};let G=F.fontSize||{};F.fontSize={...G,...bf()};let ee=cl(F,B),ae=cl(z||{},T||{});if(Object.keys(ae).length>0)ee.extend=ae;let Q=[...v.safelist||[],..._.safelist||[]],ce={...v.shortcuts||{},..._.shortcuts||{}},ue=[...v.preflights||[],..._.preflights||[]],{fonts:le,...pe}=v,{fonts:de,roles:Re,shapes:be,density:xe,...Ie}=_,Me={roles:Re,shapes:be,density:xe},Ne=de??le;return{config:{...pe,...Ie,theme:ee,safelist:Q,shortcuts:ce,...ue.length>0?{preflights:ue}:{},content:[],output:""},safelist:Q,shortcuts:ce,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:mf({...H,...ee.colors},Re)+yf(be)+vf(xe),unknownRoles:pf(Me),...Ne?{fonts:Ne}:{}}}function _f(v,_=""){let k=`${v}${_}`,R=0;for(let T=0;T<k.length;T++){let B=k.charCodeAt(T);R=(R<<5)-R+B,R=R&R}return`stx-${Math.abs(R).toString(36)}`}function kf(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:B=!0,scopeCustomProperties:z=!1}=k;if(!v.trim())return"";let F=ll(v),H=[],q=new Map;if(B)for(let K of F){let G=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let ee=G[1],ae=`${_}_${ee}`;q.set(ee,ae)}}for(let K of F){let G=Ef(K,_,R,T,q,z);H.push(G)}return H.join(`
|
|
140
|
-
|
|
141
|
-
`)}function ll(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",B=!1,z="";for(let F=0;F<k.length;F++){let H=k[F];if(H==="@"&&R===0)B=!0;if(H==="{")R++;else if(H==="}"){if(R--,R===0){if(B){z+=H;let q=z.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,K,G,ee]=q;if(K==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:ee.trim()});else if(K==="media"||K==="supports"||K==="container"){let ae=ll(ee);_.push({selector:`@${K} ${G.trim()}`,declarations:ae.map((Q)=>`${Q.selector} { ${Q.declarations} }`).join(`
|
|
142
|
-
`)})}else _.push({selector:`@${K} ${G.trim()}`,declarations:ee.trim()})}z="",B=!1}else if(T.trim()){T+=H;let q=T.match(/([^{]+)\{([^}]*)\}/);if(q)_.push({selector:q[1].trim(),declarations:q[2].trim()});T=""}continue}}if(B)z+=H;else T+=H}return _}function Ef(v,_,k,R,T,B){let{selector:z,declarations:F}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let K=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(K)||K} { ${F} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let G=ll(`x { ${F} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((ee)=>Ef(ee,_,k,R,T,B)).join(`
|
|
143
|
-
`);return`${z} {
|
|
144
|
-
${G}
|
|
145
|
-
}`}return`${z} { ${F} }`}let H=Iy(z,_,k,R),q=F;for(let[K,G]of T)q=q.replace(new RegExp(`\\b${K}\\b`,"g"),G);if(B)q=q.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${H} { ${q} }`}function Iy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let q=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(q)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let F=k?`${k} .${_}`:`.${_}`;B.push(`${F} ${z}`);let H=Py(z,_);if(H)B.push(k?`${k} ${H}`:H)}return B.join(", ")}function Py(v,_){let k=0,R=v.length;for(let H=0;H<v.length;H++){let q=v[H];if(q==="["||q==="(")k++;else if(q==="]"||q===")")k--;else if(k===0&&(q===" "||q===">"||q==="+"||q==="~")){R=H;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,F=0;for(let H=0;H<T.length;H++){let q=T[H];if(q==="["||q==="(")F++;else if(q==="]"||q===")")F--;else if(k===0&&F===0&&q===":"){z=H;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var Af=String.raw`(?<![\w-])scoped(?![\w-])`,ul=/<style\s+([^>]*)>/gi,Cf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Tf=new RegExp(Af,"i"),Dy=new RegExp(Af,"gi"),dl=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Oy(v){ul.lastIndex=0;let _=ul.exec(v);while(_!==null){if(Tf.test(_[1]))return!0;_=ul.exec(v)}return!1}function fl(v){let _=new Set,k=[];dl.lastIndex=0;let R=dl.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=dl.exec(v)}return k}function io(v){let _=fl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function pa(v,_){if(!Oy(v))return{html:v,hasScoped:!1};let k=_f(_),R=`data-v-${k}`,T=v,B=!1;if(Cf.lastIndex=0,T=T.replace(Cf,(z,F,H)=>{if(!Tf.test(F))return z;B=!0;let q=My(H,R),K=F.replace(Dy,"").trim(),G=K?` ${K}`:"";return`<style data-stx-scoped="${k}"${G}>${q}</style>`}),!B)return{html:v,hasScoped:!1};return T=jy(T,R),{html:T,hasScoped:!0}}function My(v,_){return kf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Ny=(v)=>`\x00stx-scope-mask-${v}\x00`,Rf=/\u0000stx-scope-mask-(\d+)\u0000/g;function jy(v,_){let k=Un(v,(T,B)=>{let z=V(T,B);return z>B?z:ls(T,B)},(T,B)=>Ny(B)),R=Ly(k.output,_);return Rf.lastIndex=0,R.replace(Rf,(T,B)=>k.tokens[Number(B)])}function Ly(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Kn=null,ga="";function Pf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;ga=`${_}@${Math.trunc(ao.statSync(_).mtimeMs)}`}catch{ga=v}}var gl=!1,Xr=null,oo="",fs=!1,Nf=256,Pr=new Map,Xn=new Map,ma=null,jf=null,ha=new Map,Df=new Set;function ya(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function pl(v,_){if(Pr.has(v))Pr.delete(v);else if(Pr.size>=Nf)Pr.delete(Pr.keys().next().value);Pr.set(v,_)}function By(v){let _=ya(v);if(Xn.has(_))Xn.delete(_);else if(Xn.size>=Nf)Xn.delete(Xn.keys().next().value);return Xn.set(_,v),_}function ud(v){let _=Xn.get(v);if(_===void 0)return;return Xn.delete(v),Xn.set(v,_),_}async function zy(v,_=ma){if(!_)return null;try{let k=Bun.file(Xt.join(_,`cw-${ya(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Wy(v,_,k=ma){if(!k)return;try{if(!ao.existsSync(k))ao.mkdirSync(k,{recursive:!0});await Bun.write(Xt.join(k,`cw-${ya(v)}.css`),_)}catch{}}async function Of(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Fy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Vy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Uy(){let v=[],_=process.cwd();while(_!==Xt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Fy)v.push(Xt.join(_,k,...R));_=Xt.dirname(_)}return v}function Hy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Xt.join(_,"Code","Tools","ts-css"),_&&Xt.join(_,"Code","Tools","crosswind"),_&&Xt.join(_,"repos","stacks-org","ts-css"),_&&Xt.join(_,"repos","stacks-org","crosswind"),Xt.join(process.cwd(),"..","ts-css"),Xt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Xt.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Xt.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Xt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function mi(){if(gl)return Kn;gl=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await Of(B);if(z){if(Pf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Xt.dirname(Xt.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Xt.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Kn=B,Kn}let _=await v(Uy());if(_)return Kn=_,Kn;let k=Vy;for(let T of k){let B=await Of(T);if(B){Kn=B;try{Pf(import.meta.resolve(T))}catch{ga=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Kn}}let R=await v(Hy());if(R)return Kn=R,Kn;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function dd(){ml.clear(),Kn=null,gl=!1,Xr=null,oo="",Pr.clear(),Xn.clear(),jf=null,ha.clear()}var Mf=!1;async function hi(v){try{let _=If({name:"css",cwd:v})?"css":If({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Mf)Mf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Xt.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Pc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-847nyz30.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Xt.isAbsolute(R.css)?R.css:Xt.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Xt.isAbsolute(R.css.config)?R.css.config:Xt.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await hi(v)}function Ic(v){try{let _=new WeakSet;return ya(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Lt(v){if(fs)return oo;fs=!0;try{let _=await mi();if(!_||!_.build)return fs=!1,"";if(!Xr)Xr=await hi(v);if(!Xr)return fs=!1,"";let k=_.defaultConfig?.theme||{},R=Xr.theme||{},T={..._.defaultConfig,...Xr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),F=performance.now()-B;if(oo=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${F.toFixed(1)}ms`),T.output){let H=Xt.isAbsolute(T.output)?T.output:Xt.join(v,T.output),q=Xt.dirname(H);if(!ao.existsSync(q))ao.mkdirSync(q,{recursive:!0});await Bun.write(H,z.css)}return fs=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),fs=!1,oo}}async function kn(v){Xr=null,await Lt(v)}function pd(){return oo}function Oc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let F of z)for(let H of F.slice(1,-1).split(/\s+/))if(H.trim())_.add(H.trim())}B=T.exec(v)}return _}var ml=m(64);async function Nc(v,_){let k=()=>ha.get(_?Xt.resolve(_):process.cwd())?.fingerprint??null,R=ml.get(h(v,_,k()));if(R!==void 0)return R;let T=await qy(v,_);if(T)ml.set(h(v,_,k()),T);return T}function*Lf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=gi(R);if(T)yield T}}function fd(v){return[...Lf(v)].join(`
|
|
146
|
-
`)}async function qy(v,_){try{let k=await mi();if(!k)return"";let R=new Set;for(let Me of Lf(v)){let Ne=typeof k.extractClasses==="function"?k.extractClasses(Me):Oc(Me);for(let je of Ne)R.add(je)}if(R.size===0)return"";let T=_?Xt.resolve(_):process.cwd(),B=a(T,"cache");if(!ma)ma=B;let z=ha.get(T);if(!z){let Me=await Pc(T);z={config:Me,fingerprint:Ic(Me)},ha.set(T,z),jf=z.fingerprint}let F=[...R].sort().join(" "),H=`${ga}::${z.fingerprint||"default"}::${F}`,q=Pr.get(H);if(q!==void 0)return pl(H,q),q;let K=await zy(H,B);if(K!==null)return pl(H,K),K;let G=k.defaultConfig||k.config,ee=z.config||{},ae=$f(G,ee),{safelist:Q,includePreflight:ce,minify:ue,tokenCSS:le}=ae;if(ae.unknownRoles.length>0&&!Df.has(T))Df.add(T),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${ae.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let pe=ae.config,de=new k.CSSGenerator(pe),Re=pe.shortcuts||ee.shortcuts||{},be=Object.keys(Re).filter((Me)=>R.has(Me)||Q.includes(Me));for(let Me of Q)if(!Re[Me])de.generate(Me);for(let Me of R)if(!Re[Me])de.generate(Me);let xe="";if(be.length>0){let Me=new k.CSSGenerator(pe);for(let Ne of be)Me.generate(Ne);if(xe=Me.toCSS(!1,ue),xe&&!xe.endsWith(`
|
|
147
|
-
`))xe+=`
|
|
148
|
-
`}let Ie=xe+de.toCSS(ce,ue);return Ie=Sf(k.CSSGenerator,ae)+le+Ie,pl(H,Ie),Wy(H,Ie,B),Ie}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await Nc(v,_);if(!T)return R?io(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${By(T)}.css">`:`<style data-css="generated">
|
|
149
|
-
${T}
|
|
150
|
-
</style>`;if(R)return Ky(v,B);let z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(z.test(v)){let F=!1;return v.replace(z,()=>{if(F)return"";return F=!0,B})}if(v.includes("</head>"))return v.replace("</head>",`${B}
|
|
151
|
-
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
152
|
-
${B}`);return B+v}function Ky(v,_){let k=fl(v).map((H)=>({...H,replacement:""})),R=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=R.exec(v);if(T!==null){let H=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:H?_:""}),H=!1,T=R.exec(v)}else{let H=v.indexOf("</head>");if(H!==-1)k.push({start:H,end:H,replacement:`${_}
|
|
153
|
-
`});else{let q=v.match(/<body([^>]*)>/);if(q?.index!==void 0)k.push({start:q.index,end:q.index+q[0].length,replacement:`${q[0]}
|
|
154
|
-
${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((H,q)=>H.start-q.start||H.end-q.end);for(let H=1;H<k.length;H++)if(k[H].start<k[H-1].end)return Xy(io(v),_);let B=Array(k.length*2+1),z=0,F=0;for(let H of k)B[F++]=v.slice(z,H.start),B[F++]=H.replacement,z=H.end;return B[F]=v.slice(z),B.join("")}function Xy(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let R=!1;return v.replace(k,()=>{if(R)return"";return R=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
|
|
155
|
-
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
156
|
-
${_}`);return _+v}var hl=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Bf=/<body\b([^>]*)>/gi;function Zn(v){let _=0,k,R=hl.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Bf.lastIndex=_,k=Bf.exec(v);if(!k)return null;let T=k.index,B=-1,z=null;for(let H=0;H<hl.length;H++){let q=hl[H],K=R[H];if(K===void 0||K!==null&&K.index<_)q.open.lastIndex=_,K=q.open.exec(v),R[H]=K;if(!K)continue;if(K.index<T&&(B===-1||K.index<B))B=K.index,z=q.close}if(B===-1||!z)return{index:T,tag:k[0],attrs:k[1]??""};z.lastIndex=B;let F=z.exec(v);if(!F)return null;_=F.index+F[0].length}return null}function ps(v,_){let k=Zn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var zf=/<style\b[^>]*>/iy,Wf=/<\/style>/gi,Ff=/<script\b[^>]*>/iy,Vf=/<template(?=[\s>/])[^>]*>/iy,Uf=/<\/template\s*>/iy;function lo(v){let _=0,k=0,R=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let H=v.indexOf("-->",T+4);_=H===-1?v.length:H+3;continue}zf.lastIndex=T;let B=zf.exec(v);if(B){Wf.lastIndex=T+B[0].length;let H=Wf.exec(v);_=H===null?v.length:H.index+8;continue}Vf.lastIndex=T;let z=Vf.exec(v);if(z){if(k===0)R=T;k++,_=T+z[0].length;continue}Uf.lastIndex=T;let F=Uf.exec(v);if(F){if(k>0)k--;_=T+F[0].length;continue}if(Ff.lastIndex=T,Ff.test(v))return k>0?R:T;_=T+1}return-1}function Hf(){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 yl(v){return Symbol(v)}var d_=yl("theme"),f_=yl("router"),p_=yl("i18n");import*as Kf from"crypto";function qf(v){let _=/\$(\w+)\./g,k=[],R;while((R=_.exec(v))!==null)if(!k.includes(R[1]))k.push(R[1]);return k}function Zy(){return`stx-${Kf.randomBytes(4).toString("hex")}`}function Gy(v){return/\$\w+\./.test(v)}function Jy(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,R=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(R,(B,z,F,H)=>{if(["script","style","template"].includes(z.toLowerCase()))return B;let q=[],K=!1,G=F,ee=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ae=[...F.matchAll(ee)];for(let ue of ae){let le=ue[0],pe=ue[1],de=ue[2];if(Gy(de)){K=!0;let Re=de.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(Re){let be=Re[1];if(q.push({attr:pe,expr:be,fullMatch:le,originalAttr:pe}),qf(be).forEach((Ie)=>k.add(Ie)),pe==="text")G=G.replace(le,"");else if(pe==="class")G=G.replace(le,'class=""');else if(pe==="disabled"||pe==="hidden")G=G.replace(le,"");else G=G.replace(le,`${pe}=""`)}}}if(!K)return B;let Q=G.match(/\bid\s*=\s*"([^"]+)"/),ce;if(Q)ce=Q[1];else ce=Zy(),G=` id="${ce}"${G}`;for(let ue of q)_.push({elementId:ce,attribute:ue.attr,expression:ue.expr,stores:qf(ue.expr)});return`<${z}${G}${H}`}),{html:T,bindings:_,stores:k}}function Yy(v,_){if(v.length===0)return"";let k=Array.from(_),R=`
|
|
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)R+=` $state.${T} = stores.${T} ? stores.${T}.get() : {};
|
|
521
|
-
`;R+=`
|
|
522
|
-
// Binding update functions
|
|
523
|
-
function updateBindings() {
|
|
524
|
-
`;for(let T of v){let{elementId:B,attribute:z,expression:F}=T,H=F.replace(/\$(\w+)\./g,"$state.$1.");if(z==="text")R+=` (function() {
|
|
525
|
-
var el = document.getElementById('${B}');
|
|
526
|
-
if (el) {
|
|
527
|
-
try {
|
|
528
|
-
el.textContent = ${H};
|
|
529
|
-
}
|
|
530
|
-
catch (e) { console.error('Binding error:', e); }
|
|
531
|
-
}
|
|
532
|
-
})();
|
|
533
|
-
`;else if(z==="html")R+=` (function() {
|
|
534
|
-
var el = document.getElementById('${B}');
|
|
535
|
-
if (el) {
|
|
536
|
-
try {
|
|
537
|
-
el.innerHTML = ${H};
|
|
538
|
-
}
|
|
539
|
-
catch (e) { console.error('Binding error:', e); }
|
|
540
|
-
}
|
|
541
|
-
})();
|
|
542
|
-
`;else if(z==="class")R+=` (function() {
|
|
543
|
-
var el = document.getElementById('${B}');
|
|
544
|
-
if (el) {
|
|
545
|
-
try {
|
|
546
|
-
var value = ${H};
|
|
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(z==="show")R+=` (function() {
|
|
572
|
-
var el = document.getElementById('${B}');
|
|
573
|
-
if (el) {
|
|
574
|
-
try {
|
|
575
|
-
el.style.display = (${H}) ? '' : 'none';
|
|
576
|
-
}
|
|
577
|
-
catch (e) { console.error('Binding error:', e); }
|
|
578
|
-
}
|
|
579
|
-
})();
|
|
580
|
-
`;else if(z==="if")R+=` (function() {
|
|
581
|
-
var el = document.getElementById('${B}');
|
|
582
|
-
if (el) {
|
|
583
|
-
try {
|
|
584
|
-
el.style.visibility = (${H}) ? 'visible' : 'hidden';
|
|
585
|
-
}
|
|
586
|
-
catch (e) { console.error('Binding error:', e); }
|
|
587
|
-
}
|
|
588
|
-
})();
|
|
589
|
-
`;else R+=` (function() {
|
|
590
|
-
var el = document.getElementById('${B}');
|
|
591
|
-
if (el) {
|
|
592
|
-
try {
|
|
593
|
-
var value = ${H};
|
|
594
|
-
if (value === false || value === null || value === undefined) {
|
|
595
|
-
el.removeAttribute('${z}');
|
|
596
|
-
}
|
|
597
|
-
else if (value === true) {
|
|
598
|
-
el.setAttribute('${z}', '');
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
el.setAttribute('${z}', value);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
catch (e) { console.error('Binding error:', e); }
|
|
605
|
-
}
|
|
606
|
-
})();
|
|
607
|
-
`}R+=` }
|
|
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)R+=` 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 R+=`
|
|
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
|
-
`,R}function Xf(v){let{html:_,bindings:k,stores:R}=Jy(v);if(k.length===0)return v;let T=Yy(k,R),B=_.lastIndexOf("</body>");if(B!==-1)return _.slice(0,B)+T+_.slice(B);return _+T}function Qy(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return ex(_);case"google-analytics":return tx(_);case"plausible":return nx(_);case"self-hosted":return rx(_);case"custom":return sx(_);default:return""}}function ex(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",R=_.defer!==!1?" defer":"",T=[`data-site="${mn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${mn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
|
|
663
|
-
<!-- Fathom Analytics -->
|
|
664
|
-
<script src="${mn(k)}" ${T.join(" ")}${R}></script>
|
|
665
|
-
`}function tx(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=mn(_.measurementId),R=_.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
|
-
${R}
|
|
674
|
-
</script>
|
|
675
|
-
`}function nx(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",R=[`data-domain="${mn(_.domain)}"`],T=k,B=[];if(_.trackLocalhost)B.push("local");if(_.hashMode)B.push("hash");if(B.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${B.join(".")}.js`;return`
|
|
676
|
-
<!-- Plausible Analytics -->
|
|
677
|
-
<script defer data-domain="${mn(_.domain)}" src="${mn(T)}"></script>
|
|
678
|
-
`}function rx(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=mn(_.siteId),R=mn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",B=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",z=_.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="${R}" 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
|
-
${B}
|
|
705
|
-
${z}
|
|
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 sx(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="${mn(_.scriptId)}"`);if(_.attributes)for(let[T,B]of Object.entries(_.attributes))k.push(`${mn(T)}="${mn(B)}"`);return`
|
|
717
|
-
<!-- Custom Analytics -->
|
|
718
|
-
<script${k.length>0?` ${k.join(" ")}`:""} src="${mn(_.scriptUrl)}" defer></script>
|
|
719
|
-
`}function Zf(v,_){let k=Qy(_);if(!k)return v;if(!v.includes("</head>")){let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}return v.replace("</head>",`${k}</head>`)}function mn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var ix={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 Gf(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...ix,..._};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 Jf(v,_){let k=Gf(_);if(!k)return v;let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}var Yf={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,R)=>{let T=k.__stx_config||{};if(_.length>0){let B=ox(_.join(" "));T.heatmap={...T.heatmap,...B,enabled:!0}}return Gf(T)}};function ox(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let R of k){let[T,B]=R.split("="),z=B?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=z;break;case"samplingRate":_.samplingRate=Number.parseInt(z,10);break;case"batchSize":_.batchSize=Number.parseInt(z,10);break;case"trackMouse":_.trackMouse=z==="true";break;case"trackClicks":_.trackClicks=z==="true";break;case"trackScroll":_.trackScroll=z==="true";break;case"honorDnt":_.honorDnt=z==="true";break;case"debugOverlay":_.debugOverlay=z==="true";break}}return _}var nr={duration:300,delay:0,ease:"ease",direction:"both"};function ax(v,_={}){let{duration:k,delay:R,ease:T,direction:B,custom:z}={...nr,..._};if(v==="custom"&&z)return z;switch(v){case"fade":return`${B==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="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`${B==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="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`${B==="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;":B==="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`${B==="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;":B==="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`${B==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="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 cx(){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 lx(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 ux(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 dx(){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 fx(v,_,k={}){let{staggerDelay:R=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 = ${R};
|
|
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 Qf={name:"transition",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||nr.duration:nr.duration,z=_.length>2?_[2]||nr.ease:nr.ease,F=_.length>3?Number.parseInt(_[3],10)||nr.delay:nr.delay,H=_.length>4?_[4]||nr.direction:nr.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=ax(T,{duration:B,delay:F,ease:z,direction:H}),G="stx-transition",ee="";if(T==="fade")ee="stx-fade";else if(T==="slide")ee="stx-slide";else if(T==="scale")ee="stx-scale";else if(T==="flip")ee="stx-flip";else if(T==="rotate")ee="stx-rotate";return`<div id="${q}" class="${G} ${ee} ${H==="out"?"stx-out":""}"
|
|
1336
|
-
style="--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${F}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},ep={name:"scrollAnimate",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||300:300,z=_.length>2?_[2]||"ease":"ease",F=_.length>3?Number.parseFloat(_[3])||0.2:0.2,H=_.length>4?Number.parseInt(_[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${H}ms; will-change: opacity, transform;`,G="stx-transition stx-observe stx-out";if(T==="fade")G+=" stx-fade";else if(T==="slide-up"||T==="slide")G+=" stx-from-bottom";else if(T==="slide-down")G+=" stx-from-top";else if(T==="slide-left")G+=" stx-from-right";else if(T==="slide-right")G+=" stx-from-left";else if(T==="scale")G+=" stx-scale";else if(T.includes("-"))G+=` stx-${T}`;else G+=` stx-${T}`;return`<div id="${q}" class="${G}" style="${K}" data-threshold="${F}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},tp={name:"animationGroup",handler:(v,_,k,R)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],B=_.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),z=k.staggerDelay||50,F=k.sequence||!0,H=fx(T,B,{staggerDelay:z,sequence:F});return`${v}
|
|
1337
|
-
${H}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},np={name:"motion",handler:(v,_,k,R)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,B=cx();return`<div data-animate="${T?"auto":"true"}">${v}</div>${B}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function rp(v,_,k,R){let T=v;if(R.animation?.enabled===!1)return T;let B=k.includes("test")&&k.includes("animation");if(!lx(T)&&!B)return T;if(!T.includes('<style id="stx-animation-base">')){let F=dx();T=T.replace("</head>",`${F}
|
|
1338
|
-
</head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let H=ux(),q=T.lastIndexOf("</body>");if(q!==-1)T=T.slice(0,q)+H+`
|
|
1339
|
-
`+T.slice(q)}}return T}function Xe(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function sp(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var px=100,gx=599,bl="__stxResponseStatus",uo="__stxResponseHeaders";function xa(v){return typeof v==="number"&&Number.isInteger(v)&&v>=px&&v<=gx}function jt(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let R=Number(k[1]);if(xa(R))return R}return}function xl(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!xa(k))return!1;return v[bl]=k,!0}function mx(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[uo]={...v[uo],[R]:String(k)}}function Je(v){let _=v?.[bl];return xa(_)?_:void 0}function Ye(v){let _=v?.[uo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function yi(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Je(v);if(k!==void 0)_[bl]=k;let R=Ye(v);if(R)_[uo]={..._[uo],...R}}function cr(v){return{setResponseStatus:(_)=>{xl(v,_)},notFound:(_=404)=>{let k=xa(_)&&_>=400?_:404;xl(v,k)},setResponseHeader:(_,k)=>{mx(v,_,k)}}}function ip(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",F=0,H=/@status\s*\(/g,q;while((q=H.exec(v))!==null){let K=hx(v,q.index+q[0].length-1);if(K<0)break;let G=v.slice(q.index+q[0].length,K).trim(),ee=/^\d+$/.test(G)?Number(G):l(G,_),ae=R?` in ${R}`:"";if(B)console.warn(`[stx] @status(${G})${ae} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${G}) from <script server> instead \u2014 that runs per request.`);else if(!xl(_,ee))console.warn(`[stx] @status(${G})${ae} is not an HTTP status (100-599) \u2014 ignoring it.`);z+=v.slice(F,q.index),F=K+1+(v.slice(K+1).match(/^[^\S\n]*\n?/)?.[0].length??0),H.lastIndex=F}return F===0?v:z+v.slice(F)}function hx(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}var yx=0,xx=0;function op(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let R=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(R)return R[1];return null}function bx(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,R;while((R=k.exec(v))!==null){let[T,B,z]=R,F=R.index,H=op(z,"x-data");if(!H)continue;let q=`__stx_scope_${yx++}`,K=op(z,"x-init"),G=vx(v,B,F+T.length),ee=v.slice(F,G.endIndex),ae=wx(ee);_.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:H,initExpr:K,bindings:[],refs:ae})}return _}function vx(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s|>)`,"gi"),z=new RegExp(`</${_}>`,"gi"),F=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T,F.lastIndex=T;let H=B.exec(v),q=z.exec(v),K=F.exec(v);if(K&&K.index<(H?.index??1/0)){T=K.index+K[0].length;continue}if(!q)return{endIndex:v.length};if(H&&H.index<q.index)R++,T=H.index+H[0].length;else{if(R--,R===0)return{endIndex:q.index+q[0].length};T=q.index+q[0].length}}return{endIndex:v.length}}function wx(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),R=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=R.exec(k))!==null){let[,B,z]=T,F=Sx(B);_.set(z,F)}return _}function Sx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${xx++}`}function $x(){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 ap(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(F,H)=>{try{let q=x(H,_,!0);if(q===void 0)return F;return String(q)}catch{return F}}),R="",T=0,B=null;while(T<k.length){let F=k[T];if(B&&F==="\\"){R+=F+(k[T+1]??""),T+=2;continue}if(F==="{"&&k[T+1]==="{"){let H=k.indexOf("}}",T+2);if(H!==-1){let q=k.slice(T,H+2);R+=z(k.slice(T+2,H),q,B),T=H+2;continue}}if(B){if(F===B)B=null}else if(F==="'"||F==='"'||F==="`")B=F;R+=F,T++}return R;function z(F,H,q){let K;try{K=x(F,_,!0)}catch{return H}if(K===void 0)return H;if(q){let G=String(K).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof K==="string"){let G=K.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(K)}}function _x(v,_){if(v.length===0)return"";let k=v.map((R)=>{let T=JSON.stringify(Object.fromEntries(R.refs)),B=ap(R.stateExpr,_),z=R.initExpr?ap(R.initExpr,_):null,F=JSON.stringify(B),H=z?JSON.stringify(z):"null";return`
|
|
1593
|
-
(function() {
|
|
1594
|
-
var scopeEl = document.querySelector('${R.selector}');
|
|
1595
|
-
if (!scopeEl) return;
|
|
1596
|
-
var refs = ${T};
|
|
1597
|
-
__stx_reactive.initScope(scopeEl, ${F}, [], refs, ${H});
|
|
1598
|
-
})();`}).join(`
|
|
1599
|
-
`);return`
|
|
1600
|
-
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1601
|
-
${$x()}
|
|
1602
|
-
${k}
|
|
1603
|
-
</script>`}function cp(v,_,k){if(!Ex(v))return v;let R=bx(v);if(R.length===0)return v;let T=kx(v,R),B=_x(R,_),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
|
|
1604
|
-
`+T.slice(z);else T+=B;return T}function kx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let F=_[k++];if(!F)return T;let H=/data-stx-scope="([^"]*)"/.exec(z);if(H)return F.id=H[1],F.selector=`[data-stx-scope="${F.id}"]`,T;return`<${B} data-stx-scope="${F.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function Ex(v){return/x-data\s*=\s*["']/.test(v)}import ub from"fs";import Pl from"path";import{createHighlighter as db}from"ts-syntax-highlighter";import ms from"fs";import cn from"path";import{loadConfigWithResult as sb}from"bunfig";async function Cx(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Oe();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var lp={name:"stxRouter",handler:Cx,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Dr(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function up(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function rr(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
|
|
1605
|
-
`)){let F=z.trim();if(!F||F.startsWith("#"))continue;let H=F.indexOf(":");if(H===-1)continue;let q=F.slice(0,H).trim(),K=F.slice(H+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}B[q]=K}return{data:B,content:T.trim()}}function We(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(K,G,ee)=>{let ae=B.length,Q=G?` class="language-${Dr(G)}"`:"";return B.push(`<pre><code${Q}>${Dr(ee.trim())}</code></pre>`),`\x00CODEBLOCK${ae}\x00`}),T=T.replace(/`([^`]*)`/g,(K,G)=>`<code>${Dr(G)}</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,(K,G,ee)=>`<img src="${up(ee)?Dr(ee):""}" alt="${Dr(G)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,G,ee)=>`<a href="${up(ee)?Dr(ee):""}">${G}</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,(K,G,ee)=>{let Q=`<tr>${G.split("|").map((ue)=>ue.trim()).filter(Boolean).map((ue)=>`<th>${Dr(ue)}</th>`).join("")}</tr>`,ce=ee.trim().split(`
|
|
1607
|
-
`).map((ue)=>`<tr>${ue.split("|").map((pe)=>pe.trim()).filter(Boolean).map((pe)=>`<td>${Dr(pe)}</td>`).join("")}</tr>`).join(`
|
|
1608
|
-
`);return`<table>
|
|
1609
|
-
<thead>
|
|
1610
|
-
${Q}
|
|
1611
|
-
</thead>
|
|
1612
|
-
<tbody>
|
|
1613
|
-
${ce}
|
|
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 z=T.split(`
|
|
1616
|
-
`),F=[],H=!1,q=[];for(let K of z){let G=K.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(G)||/^\0CODEBLOCK\d+\0$/.test(G)||G===""){if(H&&q.length>0)F.push(`<p>${q.join(R?`<br />
|
|
1617
|
-
`:`
|
|
1618
|
-
`)}</p>`),q=[],H=!1;F.push(K)}else H=!0,q.push(G)}if(H&&q.length>0)F.push(`<p>${q.join(R?`<br />
|
|
1619
|
-
`:`
|
|
1620
|
-
`)}</p>`);if(T=F.join(`
|
|
1621
|
-
`),R)T=T.replace(/\n/g,`<br />
|
|
1622
|
-
`);for(let K=0;K<B.length;K++)T=T.replace(`\x00CODEBLOCK${K}\x00`,B[K]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function dp(v,_,k=""){let R=v,T=[],B=/@markdown(?:\([^)]*\))?/g,z;while((z=B.exec(v))!==null){let F=z.index,H=z[0].match(/@markdown\(([^)]*)\)/),q=H?H[1]:"",K=F+z[0].length,G=1,ee=K,ae=-1;while(G>0&&ee<v.length){let ue=v.indexOf("@markdown",ee),le=v.indexOf("@endmarkdown",ee);if(le===-1)break;if(ue!==-1&&ue<le&&ue!==F){let pe=v[ue+9];if(pe==="("||pe===`
|
|
1623
|
-
`||pe==="\r"||pe===" "||pe===void 0)G++;ee=ue+9}else{if(G--,G===0){ae=le;break}ee=le+12}}if(ae===-1)continue;let Q=v.slice(K,ae),ce=v.slice(F,ae+12);T.push({fullMatch:ce,options:q,content:Q,index:F}),B.lastIndex=ae+12}for(let{fullMatch:F,options:H,content:q,index:K}of T)try{let G={};if(H)H.split(",").forEach((Q)=>{let ce=Q.trim();if(ce)G[ce]=!0});let ee={gfm:G.gfm??!0,breaks:G.breaks??!1},ae=We(q.trim(),ee);R=R.split(F).join(ae)}catch(G){let ee=G instanceof Error?G.message:String(G),ae=g("Markdown Directive",`Error processing markdown: ${ee}`,k,v,K,F);R=R.split(F).join(ae)}return R}async function fp(v,_,k,R){let T={gfm:!0,breaks:!1};return _.forEach((B)=>{let z=B.trim().replace(/['"]/g,"");if(z==="breaks")T.breaks=!0;if(z==="no-gfm")T.gfm=!1}),We(v.trim(),T)}var gs=[320,480,640,768,1024,1280,1536,1920,2560],Rx=[1,1.5,2,3],fo=["avif","webp","jpeg"],Ax={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function vl(v,_=gs,k={},R){return _.sort((T,B)=>T-B).map((T)=>`${po(v,{...k,w:T,fm:R})} ${T}w`).join(", ")}function pp(v,_,k=Rx,R={},T){return k.sort((B,z)=>B-z).map((B)=>{let z=Math.round(_*B);return`${po(v,{...R,w:z,dpr:B,fm:T})} ${B}x`}).join(", ")}function wl(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let R=Object.entries(v).map(([T,B])=>{let z=/^\d+$/.test(T)?`${T}px`:T;return{bp:z,size:B,numericBp:Number.parseInt(z)||0}}).sort((T,B)=>T.numericBp-B.numericBp).map(({bp:T,size:B})=>`(max-width: ${T}) ${B}`);return R.push(_),R.join(", ")}function po(v,_={}){let k=Object.entries(_).filter(([,B])=>B!==void 0&&B!==null).map(([B,z])=>{if(Array.isArray(z))return[B,z.join(",")];return[B,String(z)]});if(k.length===0)return v;let R=k.map(([B,z])=>`${B}=${encodeURIComponent(z)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${R}`}function Sl(v){return Ax[v]||"application/octet-stream"}var Tx={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},_l=`
|
|
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 Ix(){try{return await import("ts-images")}catch{return null}}async function Px(v,_={}){let k={...Tx,..._},R=await Ix();if(R)try{return await Dx(v,k,R)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return Ox(v,k)}async function Dx(v,_,k){let{generatePlaceholder:R,generateThumbHash:T}=k,z={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let F=await R(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:z,base64Encode:!0});return{dataURL:F.dataURL,width:F.width,height:F.height,aspectRatio:F.aspectRatio,originalWidth:F.originalWidth,originalHeight:F.originalHeight,strategy:_.strategy,dominantColor:F.dominantColor,css:F.css}}function Ox(v,_){let k=_.width||20,R=_.height||k,T="#e5e7eb",B=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${R}" viewBox="0 0 ${k} ${R}"><rect fill="#e5e7eb" width="${k}" height="${R}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(B)}`,width:k,height:R,aspectRatio:k/R,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function gp(v,_,k={}){let R=k.transitionDuration||300,T=k.easing||"ease-out";return`
|
|
1653
|
-
#${v} {
|
|
1654
|
-
--stx-img-transition-duration: ${R}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 $l=new Map;async function mp(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if($l.has(k))return $l.get(k);let R=await Px(v,_);return $l.set(k,R),R}async function Mx(){try{return await import("./chunk-7h4mxhkh.js")}catch(v){if(!hp)console.warn("[stx-media] Image processor not available, some features disabled:",v),hp=!0;return null}}var hp=!1,kl=80,va="async",wa="lazy",yp=!1;async function ba(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Bx(R,k)}if(k.processedResult?.processed)return Rl(v,k.processedResult,_);if(k.responsiveVariants)return vp(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:F,sizes:H,widths:q=gs,dpr:K,formats:G=fo,quality:ee=kl,params:ae={},placeholder:Q="none",placeholderOptions:ce={},lazy:ue=!0,priority:le=!1,loading:pe=le?"eager":wa,decoding:de=va,fetchpriority:Re,objectFit:be,objectPosition:xe,crossorigin:Ie,referrerpolicy:Me}=v,{class:Ne,style:je,id:Le}=v,De=v.data||{},{isDev:ze=!1,baseUrl:Fe=""}=_;if(ze&&!_.optimize)return Lx(v);let Ve,Be,He=Le||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(Q!=="none"&&!le)try{Ve=await mp(T,{strategy:Q,...ce}),Be=gp(He,Ve,ce)}catch{}let vt=K!==void 0&&z!==void 0,bt;if(vt)bt=jx(v,He,Ve,_);else bt=await Nx(v,He,Ve,_);let Et;if(le){let Ct=G.includes("webp")?"webp":G[0],yt=vl(T,q,{...ae,q:ee},Ct),dt=typeof H==="object"?wl(H):H||"100vw";Et=`<link rel="preload" as="image" imagesrcset="${yt}" imagesizes="${dt}" />`}let ft=[];if(!yp&&Q!=="none")ft.push(_l),yp=!0;if(Be)ft.push(Be);let wt=ue?bp(He):void 0;return{html:bt,preloadLink:Et,css:ft.length>0?ft.join(`
|
|
1670
|
-
`):void 0,script:wt}}async function Nx(v,_,k,R){let{src:T,alt:B,width:z,height:F,sizes:H,widths:q=gs,formats:K=fo,quality:G=kl,params:ee={},lazy:ae=!0,priority:Q=!1,loading:ce=Q?"eager":wa,decoding:ue=va,fetchpriority:le,objectFit:pe,objectPosition:de,crossorigin:Re,referrerpolicy:be}=v,{class:xe,style:Ie}=v,Me=v.data||{},Ne=typeof H==="object"?wl(H):H||"100vw",je=[];for(let ze of K){let Fe=vl(T,q,{...ee,q:G},ze),Ve=Sl(ze);if(ae&&!Q)je.push(` <source type="${Ve}" data-srcset="${Fe}" data-sizes="${Ne}" />`);else je.push(` <source type="${Ve}" srcset="${Fe}" sizes="${Ne}" />`)}let Le=El({src:po(T,{...ee,q:G}),alt:B,width:z,height:F,loading:Q?void 0:ce,decoding:ue,fetchpriority:Q?"high":le,objectFit:pe,objectPosition:de,crossorigin:Re,referrerpolicy:be,className:xp(xe,k),style:Cl(Ie,pe,de,k),lazy:ae&&!Q,data:Me}),De;if(k){let ze=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;De=`<div id="${_}" class="stx-img-placeholder" style="${ze}">
|
|
1671
|
-
<picture>
|
|
1672
|
-
${je.join(`
|
|
1673
|
-
`)}
|
|
1674
|
-
<img ${Le} />
|
|
1675
|
-
</picture>
|
|
1676
|
-
</div>`}else De=`<picture${_?` id="${_}"`:""}>
|
|
1677
|
-
${je.join(`
|
|
1678
|
-
`)}
|
|
1679
|
-
<img ${Le} />
|
|
1680
|
-
</picture>`;return De}function jx(v,_,k,R){let{src:T,alt:B,width:z,height:F,dpr:H=[1,2,3],quality:q=kl,params:K={},lazy:G=!0,priority:ee=!1,loading:ae=ee?"eager":wa,decoding:Q=va,fetchpriority:ce,objectFit:ue,objectPosition:le,crossorigin:pe,referrerpolicy:de}=v,{class:Re,style:be}=v,xe=v.data||{},Ie=typeof z==="number"?z:Number.parseInt(String(z),10),Me=pp(T,Ie,H,{...K,q}),Ne=El({src:po(T,{...K,w:Ie,q}),alt:B,width:z,height:F,loading:ee?void 0:ae,decoding:Q,fetchpriority:ee?"high":ce,objectFit:ue,objectPosition:le,crossorigin:pe,referrerpolicy:de,className:xp(Re,k),style:Cl(be,ue,le,k),lazy:G&&!ee,data:xe}),je=G&&!ee?`data-srcset="${Me}"`:`srcset="${Me}"`;if(k){let Le=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Le}">
|
|
1681
|
-
<img ${Ne} ${je} />
|
|
1682
|
-
</div>`}return`<img ${_?`id="${_}" `:""}${Ne} ${je} />`}function Lx(v){let{src:_,alt:k,width:R,height:T,loading:B=wa,decoding:z=va,fetchpriority:F,objectFit:H,objectPosition:q,crossorigin:K,referrerpolicy:G,priority:ee=!1}=v,{class:ae,style:Q,id:ce}=v,ue=v.data||{};return{html:`<img ${El({src:_,alt:k,width:R,height:T,loading:ee?"eager":B,decoding:z,fetchpriority:ee?"high":F,objectFit:H,objectPosition:q,crossorigin:K,referrerpolicy:G,className:ae,style:Cl(Q,H,q),id:ce,data:ue})} />`}}function El(v){let _=[];if(v.lazy)_.push(`data-src="${Fn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${Fn(v.src)}"`);if(_.push(`alt="${Fn(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="${Fn(v.className)}"`);if(v.style)_.push(`style="${Fn(v.style)}"`);if(v.id)_.push(`id="${Fn(v.id)}"`);if(v.data)for(let[k,R]of Object.entries(v.data))_.push(`data-${k}="${Fn(R)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function xp(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function Cl(v,_,k,R){let T=[];if(_)T.push(`object-fit: ${_}`);if(k)T.push(`object-position: ${k}`);if(R)T.push("opacity: 0; transition: opacity 300ms ease-out");if(v)T.push(v);return T.join("; ")}function Fn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function bp(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 Bx(v,_){let k=await Mx();if(!k)return ba({...v,process:!1},_);let R=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let B=await k.generateResponsiveVariants(v.src,v,R);if(B)return vp(v,B,_)}else{let B=await k.processImage(v.src,v,R);if(B.processed)return Rl(v,B,_)}return ba({...v,process:!1},_)}async function Rl(v,_,k){let{alt:R,width:T,height:B,lazy:z=!0,priority:F=!1,objectFit:H,objectPosition:q,crossorigin:K,referrerpolicy:G}=v,{class:ee,style:ae}=v,Q=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,ce=v.data||{},ue=_.variants||[],le=ue.find((Be)=>Be.format==="jpeg")||ue.find((Be)=>Be.format==="webp")||ue[0],pe=le?.url||v.src,de=ue.filter((Be)=>Be.format===(le?.format||"jpeg")).map((Be)=>`${Be.url} ${Be.width}w`).join(", "),Re=new Map;for(let Be of ue){if(!Re.has(Be.format))Re.set(Be.format,[]);Re.get(Be.format).push(Be)}let be=[],xe=["avif","webp","jpeg","png"];for(let Be of xe){let He=Re.get(Be);if(He&&He.length>0){let vt=He.map((Et)=>`${Et.url} ${Et.width}w`).join(", "),bt=Sl(Be);if(z&&!F)be.push(` <source type="${bt}" data-srcset="${vt}" />`);else be.push(` <source type="${bt}" srcset="${vt}" />`)}}let Ie=[];if(z&&!F){if(Ie.push(`data-src="${Fn(pe)}"`),Ie.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),de)Ie.push(`data-srcset="${de}"`)}else if(Ie.push(`src="${Fn(pe)}"`),de)Ie.push(`srcset="${de}"`);Ie.push(`alt="${Fn(R)}"`);let Me=T||_.originalWidth,Ne=B||_.originalHeight;if(Me)Ie.push(`width="${Me}"`);if(Ne)Ie.push(`height="${Ne}"`);if(!F)Ie.push(`loading="${z?"lazy":"eager"}"`);if(Ie.push('decoding="async"'),F)Ie.push('fetchpriority="high"');if(K)Ie.push(`crossorigin="${K}"`);if(G)Ie.push(`referrerpolicy="${G}"`);let je=[];if(H)je.push(`object-fit: ${H}`);if(q)je.push(`object-position: ${q}`);if(_.placeholder&&z)je.push("opacity: 0; transition: opacity 300ms ease-out");if(ae)je.push(ae);if(je.length>0)Ie.push(`style="${je.join("; ")}"`);let Le=[];if(ee)Le.push(ee);if(_.placeholder)Le.push("stx-img-blur");if(Le.length>0)Ie.push(`class="${Le.join(" ")}"`);if(z&&!F)Ie.push("data-stx-lazy");for(let[Be,He]of Object.entries(ce))Ie.push(`data-${Be}="${Fn(He)}"`);let De;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Be=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;De=`<div id="${Q}" class="stx-img-placeholder" style="${Be}">
|
|
1720
|
-
<picture>
|
|
1721
|
-
${be.join(`
|
|
1722
|
-
`)}
|
|
1723
|
-
<img ${Ie.join(" ")} />
|
|
1724
|
-
</picture>
|
|
1725
|
-
</div>`}else De=`<picture${Q?` id="${Q}"`:""}>
|
|
1726
|
-
${be.join(`
|
|
1727
|
-
`)}
|
|
1728
|
-
<img ${Ie.join(" ")} />
|
|
1729
|
-
</picture>`;let ze=[];if(_.placeholder)ze.push(_l);let Fe=z?bp(Q):void 0,Ve;if(F&&de)Ve=`<link rel="preload" as="image" imagesrcset="${de}" />`;return{html:De,preloadLink:Ve,css:ze.length>0?ze.join(`
|
|
1730
|
-
`):void 0,script:Fe}}async function vp(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,B]of Object.entries(_.byFormat))if(B)R.variants.push(...B);return Rl(v,R,k)}function zx(){return st({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:B,options:z}=Wx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let F={src:T,alt:B||"",widths:z.widths||gs,formats:z.formats||fo,quality:z.quality,sizes:z.sizes,dpr:z.dpr,params:z.params,placeholder:z.placeholder,placeholderOptions:z.placeholderOptions,lazy:z.lazy!==!1,priority:z.priority||!1,loading:z.loading,decoding:z.decoding,fetchpriority:z.fetchpriority,objectFit:z.objectFit,objectPosition:z.objectPosition,class:z.class,style:z.style,id:z.id,width:z.width,height:z.height},H=k.__isDev||!1,q=await ba(F,{isDev:H}),K=q.html;if(q.preloadLink)K=q.preloadLink+`
|
|
1731
|
-
`+K;if(q.css)K+=`
|
|
1732
|
-
<style>${q.css}</style>`;if(q.script)K+=`
|
|
1733
|
-
<script>${q.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Wx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Fx(R),B=Al(T[0],k)||"",z=Al(T[1],k)||"",F={};if(T[2]){let H=Al(T[2],k);if(typeof H==="object"&&H!==null)F=H;else if(typeof T[2]==="string")try{F=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:F}}function Fx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let F=0;F<v.length;F++){let H=v[F],q=F>0?v[F-1]:"";if((H==='"'||H==="'"||H==="`")&&q!=="\\"){if(!R)R=!0,T=H;else if(H===T)R=!1,T="";else k+=H;continue}if(!R){if(H==="{")B++;if(H==="}")B--;if(H==="[")z++;if(H==="]")z--;if(H===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=H}if(k.trim())_.push(k.trim());return _}function Al(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var wp=zx();async function $p(){try{return await import("./chunk-w24zd7sj.js")}catch(v){if(!Sp)console.warn("[stx-media] Video processor not available, some features disabled:",v),Sp=!0;return null}}var Sp=!1,_p=!0,kp="metadata",Vx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function Sa(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Xx(R,k)}if(k.processedResult?.processed)return Cp(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Zx(R,k);let{src:B,sources:z=[],poster:F,posterPlaceholder:H,controls:q=_p,autoplay:K=!1,muted:G=!1,loop:ee=!1,preload:ae=kp,playsinline:Q=!0,lazy:ce=!0,player:ue="native",type:le,width:pe,height:de,crossorigin:Re,disablePictureInPicture:be=!1,disableRemotePlayback:xe=!1}=v,Ie=T||F,{class:Me,style:Ne}=v,je=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ue==="ts-video")return Hx(v,_);if(le&&le!=="video")return Ux(B||"",le,v);let Le=z.length>0?z:B?[{src:B,type:Ep(B)}]:[],De=[`id="${je}"`];if(q)De.push("controls");if(K)De.push("autoplay");if(G)De.push("muted");if(ee)De.push("loop");if(Q)De.push("playsinline");if(be)De.push("disablepictureinpicture");if(xe)De.push("disableremoteplayback");if(Re)De.push(`crossorigin="${Re}"`);if(ce){if(De.push(`data-preload="${ae}"`),De.push('preload="none"'),Ie)De.push(`data-poster="${an(Ie)}"`);De.push("data-stx-lazy")}else if(De.push(`preload="${ae}"`),Ie)De.push(`poster="${an(Ie)}"`);if(pe)De.push(`width="${pe}"`);if(de)De.push(`height="${de}"`);if(Me)De.push(`class="${an(Me)}"`);if(Ne)De.push(`style="${an(Ne)}"`);let ze=Le.map((Be)=>` <source ${ce?`data-src="${an(Be.src)}"`:`src="${an(Be.src)}"`} type="${Be.type}"${Be.media?` media="${Be.media}"`:""} />`).join(`
|
|
1734
|
-
`),Fe=`<video ${De.join(" ")}>
|
|
1735
|
-
${ze}
|
|
1736
|
-
Your browser does not support the video tag.
|
|
1737
|
-
</video>`,Ve;if(ce)Ve=`
|
|
1738
|
-
(function() {
|
|
1739
|
-
var video = document.getElementById('${je}');
|
|
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:Fe,script:Ve}}function Ux(v,_,k){let{width:R=640,height:T=360}=k,{class:B,style:z}=k,F=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,H,q=null;switch(_){case"youtube":q=qx(v),H=q?`https://www.youtube-nocookie.com/embed/${q}`:v;break;case"vimeo":q=Kx(v),H=q?`https://player.vimeo.com/video/${q}`:v;break;case"dailymotion":q=v.split("/").pop()||"",H=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=v.split("/").pop()||"",H=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:H=v}let K=[`id="${F}"`,`src="${an(H)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(B)K.push(`class="${an(B)}"`);if(z)K.push(`style="${an(z)}"`);if(k.lazy)K.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1773
|
-
<iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1774
|
-
</div>`}}function Hx(v,_={}){let{src:k,sources:R=[],poster:T,controls:B=!0,autoplay:z=!1,muted:F=!1,loop:H=!1,preload:q="metadata",playsinline:K=!0,lazy:G=!0,width:ee,height:ae}=v,{class:Q,style:ce}=v,ue=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,le={src:R.length>0?R:k,autoplay:z,loop:H,muted:F,playsinline:K,preload:q,poster:T,controls:B,title:v.title},pe=["position: relative",ee?`width: ${typeof ee==="number"?ee+"px":ee}`:"width: 100%",ae?`height: ${typeof ae==="number"?ae+"px":ae}`:"",ce||""].filter(Boolean).join("; "),de=`
|
|
1775
|
-
<div
|
|
1776
|
-
id="${ue}"
|
|
1777
|
-
class="ts-video-player${Q?" "+an(Q):""}"
|
|
1778
|
-
style="${pe}"
|
|
1779
|
-
data-ts-video-player
|
|
1780
|
-
data-config='${JSON.stringify(le)}'
|
|
1781
|
-
${G?"data-lazy":""}
|
|
1782
|
-
>
|
|
1783
|
-
<div class="ts-video-player__container">
|
|
1784
|
-
${T?`
|
|
1785
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${an(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(),Re=`
|
|
1796
|
-
(function() {
|
|
1797
|
-
var container = document.getElementById('${ue}');
|
|
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 = '${Vx}';
|
|
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(),be=`
|
|
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:de,script:Re,css:be}}function Ep(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 qx(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let R=v.match(k);if(R)return R[1]}return null}function Kx(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function an(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function Xx(v,_){let k=await $p();if(!k)return Sa({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return Cp(v,T,_);return Sa({...v,process:!1},_)}async function Zx(v,_){let k=await $p();if(!k||!v.src)return;let R=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,R,T.outputDir,T.baseUrl||"/videos"))?.url}function Cp(v,_,k){let{controls:R=_p,autoplay:T=!1,muted:B=!1,loop:z=!1,preload:F=kp,playsinline:H=!0,lazy:q=!0,width:K,height:G,crossorigin:ee,disablePictureInPicture:ae=!1,disableRemotePlayback:Q=!1}=v,{class:ce,style:ue}=v,le=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,pe=v.src,de=Ep(pe);if(_.transcoded)pe=_.transcoded.url,de="video/mp4";let Re=_.streaming?.hls||_.streaming?.dash;if(Re){if(_.streaming?.hls)pe=_.streaming.hls.manifestUrl,de="application/x-mpegURL";else if(_.streaming?.dash)pe=_.streaming.dash.manifestUrl,de="application/dash+xml"}let be=_.poster?.url||v.poster,xe=[`id="${le}"`];if(R)xe.push("controls");if(T)xe.push("autoplay");if(B)xe.push("muted");if(z)xe.push("loop");if(H)xe.push("playsinline");if(ae)xe.push("disablepictureinpicture");if(Q)xe.push("disableremoteplayback");if(ee)xe.push(`crossorigin="${ee}"`);if(q){if(xe.push(`data-preload="${F}"`),xe.push('preload="none"'),be)xe.push(`data-poster="${an(be)}"`);xe.push("data-stx-lazy")}else if(xe.push(`preload="${F}"`),be)xe.push(`poster="${an(be)}"`);let Ie=K||_.metadata?.width,Me=G||_.metadata?.height;if(Ie)xe.push(`width="${Ie}"`);if(Me)xe.push(`height="${Me}"`);if(ce)xe.push(`class="${an(ce)}"`);if(ue)xe.push(`style="${an(ue)}"`);let je=` <source ${q?`data-src="${an(pe)}"`:`src="${an(pe)}"`} type="${de}" />`,Le=`<video ${xe.join(" ")}>
|
|
1942
|
-
${je}
|
|
1943
|
-
Your browser does not support the video tag.
|
|
1944
|
-
</video>`;if(_.spriteSheet)Le=`<div class="stx-video-wrapper" data-sprite-sheet="${an(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
|
|
1945
|
-
${Le}
|
|
1946
|
-
</div>`;let De;if(q)De=`
|
|
1947
|
-
(function() {
|
|
1948
|
-
var video = document.getElementById('${le}');
|
|
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 ze;if(Re)ze=`
|
|
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:Le,script:De,css:ze}}function Rp(){return st({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,R)=>{let{src:T,options:B}=Gx(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let z={src:T,poster:B.poster,controls:B.controls!==!1,autoplay:B.autoplay||!1,muted:B.muted||!1,loop:B.loop||!1,preload:B.preload||"metadata",playsinline:B.playsinline!==!1,lazy:B.lazy!==!1,player:B.player||"native",type:B.type,width:B.width,height:B.height,class:B.class,style:B.style,id:B.id,crossorigin:B.crossorigin,disablePictureInPicture:B.disablePictureInPicture,disableRemotePlayback:B.disableRemotePlayback,title:B.title,quality:B.quality,platform:B.platform,process:B.process,generatePoster:B.generatePoster,streaming:B.streaming,transcode:B.transcode,spriteSheet:B.spriteSheet,waveform:B.waveform},H={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},q=await Sa(z,H),K=q.html;if(q.css)K+=`
|
|
1991
|
-
<style>${q.css}</style>`;if(q.script)K+=`
|
|
1992
|
-
<script>${q.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Gx(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let R=v.trim();if(R.startsWith("@video(")||R.startsWith("("))R=R.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Jx(R),B=Ap(T[0],k)||"",z={};if(T[1]){let F=Ap(T[1],k);if(typeof F==="object"&&F!==null)z=F;else if(typeof T[1]==="string")try{z=JSON.parse(T[1])}catch{}}return{src:B,options:z}}function Jx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let F=0;F<v.length;F++){let H=v[F],q=F>0?v[F-1]:"";if((H==='"'||H==="'"||H==="`")&&q!=="\\"){if(!R)R=!0,T=H;else if(H===T)R=!1,T="";else k+=H;continue}if(!R){if(H==="{")B++;if(H==="}")B--;if(H==="[")z++;if(H==="]")z--;if(H===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=H}if(k.trim())_.push(k.trim());return _}function Ap(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var Tl=Rp();import Yx from"fs";import Dn from"path";async function mr(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],R=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let B=await Qx(T,v,_);if(B)R.push(B)}catch(B){if(console.error(`Error building web component ${T.name}:`,B),v.debug)throw B}}return R}async function Qx(v,_,k){let{name:R,file:T,tag:B,extends:z}=v;if(!R||!T||!B)return console.error("Invalid web component configuration, missing required fields:",v),null;let F=null;if(Dn.isAbsolute(T)&&await r(T))F=T;else if(_.componentsDir){let ce=Dn.join(_.componentsDir,T);if(await r(ce))F=ce}if(!F)F=await gr(T,process.cwd(),_,k);if(!F)return console.error(`Web component source file not found: ${T}`),null;let H=await Bun.file(F).text();k.add(F);let K=(v.outputFormat||"js")==="ts",G=K?tb({name:R,tag:B,baseElement:z,source:H,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):eb({name:R,tag:B,baseElement:z,source:H,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),ee=_.webComponents?.outputDir||"dist/web-components";await Yx.promises.mkdir(ee,{recursive:!0});let ae=K?"ts":"js",Q=Dn.join(ee,`${B}.${ae}`);if(await Bun.write(Q,G),_.debug)console.log(`Built web component ${R} -> ${Q}`);return Q}function eb(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:F,attributes:H=[]}=v,q=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)q=q.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),q=q.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),q=q.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),q=q.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let K="";if(F)K=`<link rel="stylesheet" href="${F}">`;return`/**
|
|
1993
|
-
* ${_} Web Component
|
|
1994
|
-
* Auto-generated from stx component
|
|
1995
|
-
*/
|
|
1996
|
-
class ${_.replace(/\W/g,"")} extends ${R} {
|
|
1997
|
-
constructor() {
|
|
1998
|
-
super()
|
|
1999
|
-
this._initialized = false
|
|
2000
|
-
${B?"":"this._slotContent = []"}
|
|
2001
|
-
${B?'this.attachShadow({ mode: "open" })':""}
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
${z?`
|
|
2005
|
-
_createTemplate() {
|
|
2006
|
-
const template = document.createElement('template')
|
|
2007
|
-
template.innerHTML = \`${K}${q}\`
|
|
2008
|
-
${B?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2009
|
-
this._processSlots()
|
|
2010
|
-
}
|
|
2011
|
-
`:`
|
|
2012
|
-
_render() {
|
|
2013
|
-
${B?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${K}${q}\`
|
|
2014
|
-
this._processSlots()
|
|
2015
|
-
}
|
|
2016
|
-
`}
|
|
2017
|
-
|
|
2018
|
-
_processSlots() {
|
|
2019
|
-
${B?`// 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
|
-
${H.length>0?`
|
|
2058
|
-
static get observedAttributes() {
|
|
2059
|
-
return [${H.map((G)=>`'${G}'`).join(", ")}]
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2063
|
-
if (oldValue !== newValue) {
|
|
2064
|
-
this[name] = newValue
|
|
2065
|
-
${z?"":"if (this._initialized) this._render()"}
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
`:""}
|
|
2069
|
-
|
|
2070
|
-
connectedCallback() {
|
|
2071
|
-
if (this._initialized) return
|
|
2072
|
-
${B?"":"this._slotContent = Array.from(this.childNodes)"}
|
|
2073
|
-
this._initialized = true
|
|
2074
|
-
${z?"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 tb(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:F,attributes:H=[],attributeTypes:q={}}=v,K=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let ee=F?`<link rel="stylesheet" href="${F}">`:"",ae=(be)=>{switch(q[be]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},Q=(be)=>be.replace(/-([a-z])/g,(xe,Ie)=>Ie.toUpperCase()),ce=H.map((be)=>` private _${Q(be)}: ${ae(be)} | null = null;`).join(`
|
|
2085
|
-
`),ue=H.map((be)=>{let xe=ae(be),Ie=Q(be);return`
|
|
2086
|
-
get ${Ie}(): ${xe} | null {
|
|
2087
|
-
return this._${Ie};
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
set ${Ie}(value: ${xe} | null) {
|
|
2091
|
-
this._${Ie} = value;
|
|
2092
|
-
if (value !== null) {
|
|
2093
|
-
this.setAttribute('${be}', String(value));
|
|
2094
|
-
}
|
|
2095
|
-
else {
|
|
2096
|
-
this.removeAttribute('${be}');
|
|
2097
|
-
}
|
|
2098
|
-
}`}).join(`
|
|
2099
|
-
`),le=H.length>0?`/**
|
|
2100
|
-
* Props interface for ${_}
|
|
2101
|
-
*/
|
|
2102
|
-
export interface ${K}Props {
|
|
2103
|
-
${H.map((be)=>{let xe=ae(be);return` ${Q(be)}?: ${xe};`}).join(`
|
|
2104
|
-
`)}
|
|
2105
|
-
}
|
|
2106
|
-
`:"",pe=H.length>0?`
|
|
2107
|
-
static get observedAttributes(): string[] {
|
|
2108
|
-
return [${H.map((be)=>`'${be}'`).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
|
-
${z?"":"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(q)};
|
|
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
|
-
`:"",de=z?`
|
|
2132
|
-
private _createTemplate(): void {
|
|
2133
|
-
const template = document.createElement('template');
|
|
2134
|
-
template.innerHTML = \`${ee}${G}\`;
|
|
2135
|
-
${B?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
|
|
2136
|
-
this._processSlots();
|
|
2137
|
-
}`:`
|
|
2138
|
-
private _render(): void {
|
|
2139
|
-
${B?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${ee}${G}\`;
|
|
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
|
-
${le}
|
|
2160
|
-
/**
|
|
2161
|
-
* ${_} custom element class
|
|
2162
|
-
* @customElement ${k}
|
|
2163
|
-
*/
|
|
2164
|
-
export class ${K} extends ${R} {
|
|
2165
|
-
${ce}
|
|
2166
|
-
private _initialized = false;
|
|
2167
|
-
${B?"":"private _slotContent: Node[] = [];"}
|
|
2168
|
-
|
|
2169
|
-
constructor() {
|
|
2170
|
-
super();
|
|
2171
|
-
${B?'this.attachShadow({ mode: "open" });':""}
|
|
2172
|
-
}
|
|
2173
|
-
${de}
|
|
2174
|
-
${B?`
|
|
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
|
-
${pe}
|
|
2212
|
-
${ue}
|
|
2213
|
-
|
|
2214
|
-
connectedCallback(): void {
|
|
2215
|
-
if (this._initialized) return;
|
|
2216
|
-
${B?"":"this._slotContent = Array.from(this.childNodes);"}
|
|
2217
|
-
this._initialized = true;
|
|
2218
|
-
${z?"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}': ${K};
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
// Register the web component
|
|
2238
|
-
customElements.define('${k}', ${K});
|
|
2239
|
-
`}function nb(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),R=k?k[1].trim():"",T=_,B=[],z=!0;if(R){let G=R.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let ee=G[1],ae=ee.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ae)T=ae[1];let Q=ee.match(/props\s*:\s*\[([\s\S]*?)\]/);if(Q)B=Q[1].split(",").map((ue)=>ue.trim().replace(/['"`]/g,"")).filter((ue)=>ue.length>0);let ce=ee.match(/shadowDOM\s*:\s*(true|false)/);if(ce)z=ce[1]==="true"}catch{}}let F=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),H=F?F[1].trim():"",q=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=q?q[1].trim():"";return{tag:T,props:B,template:H,styles:K,script:R,shadowDOM:z}}function rb(v){let{tag:_,props:k,template:R,styles:T,shadowDOM:B}=v,z=_.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),F=R.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),H=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=k.map((G)=>`'${G}'`).join(", "),K=k.map((G)=>`
|
|
2240
|
-
get ${G}() {
|
|
2241
|
-
return this.getAttribute('${G}') || '';
|
|
2242
|
-
}
|
|
2243
|
-
set ${G}(value) {
|
|
2244
|
-
if (value) {
|
|
2245
|
-
this.setAttribute('${G}', value);
|
|
2246
|
-
}
|
|
2247
|
-
else {
|
|
2248
|
-
this.removeAttribute('${G}');
|
|
2249
|
-
}
|
|
2250
|
-
}`).join(`
|
|
2251
|
-
`);return`/**
|
|
2252
|
-
* ${z} Web Component
|
|
2253
|
-
* Auto-generated from SFC
|
|
2254
|
-
*/
|
|
2255
|
-
class ${z} extends HTMLElement {
|
|
2256
|
-
constructor() {
|
|
2257
|
-
super();
|
|
2258
|
-
${B?"this.attachShadow({ mode: 'open' });":""}
|
|
2259
|
-
this._render();
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
static get observedAttributes() {
|
|
2263
|
-
return [${q}];
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
2267
|
-
if (oldValue !== newValue) {
|
|
2268
|
-
this._render();
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
${K}
|
|
2272
|
-
|
|
2273
|
-
_render() {
|
|
2274
|
-
const template = \`${H?`<style>${H}</style>`:""}${F}\`;
|
|
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
|
-
${B?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
connectedCallback() {
|
|
2285
|
-
this._render();
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
customElements.define('${_}', ${z});
|
|
2290
|
-
`}async function Tp(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",F=Dn.isAbsolute(z)?[Dn.join(z,`${T}.stx`),Dn.join(Dn.dirname(R),`${T}.stx`)]:[Dn.join(Dn.dirname(R),z,`${T}.stx`),Dn.join(process.cwd(),z,`${T}.stx`),Dn.join(Dn.dirname(R),`${T}.stx`)],H=null;for(let G of F)if(await r(G)){H=await Bun.file(G).text();break}if(!H)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let q=nb(H,T);return`<script type="module">
|
|
2291
|
-
${rb(q)}
|
|
2292
|
-
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Ft,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:fp,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Tp,hasEndTag:!1,description:"Include a web component in the template"},Bi,Fi,vr,wr,Qf,tp,np,ep,lp,Yf,wp,Tl,...Or],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function ib(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=cn.join(T,"resources","views"),z=cn.join(T,"resources","layouts");if(ms.existsSync(B)&&ms.existsSync(z))return{root:"resources",pagesDir:"views"};let F=cn.join(T,"resources","views","pages");if(ms.existsSync(F))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var Ip=new Set,_a=["partialsDir","componentsDir","layoutsDir"],Il=new WeakMap;function ob(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function rl(v,_){let k=!v.root,R=ib(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!Ip.has(T))Ip.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Il.has(v)){let T={};for(let B of _a){let z=v[B];if(typeof z==="string"&&z)T[B]=z}Il.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of _a){let z=v[B];if(typeof z!=="string"||!z)continue;if(cn.isAbsolute(z)||ob(z,T))continue;v[B]=cn.join(T,z)}}for(let T of _a){let B=v[T];if(typeof B!=="string"||!B||cn.isAbsolute(B))continue;v[T]=cn.resolve(_,B)}return v}function ab(v,_){let k=Il.get(v);for(let R of _a){let T=v[R];if(typeof T!=="string"||!T)continue;let B=cn.isAbsolute(T)?T:cn.join(_,T);if(ms.existsSync(B))continue;let z=k?.[R]??T,F=v.root,H=!!F&&F!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(H?`, resolved under root "${F}".`:"."))}}function cb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function lb(v){if(Wi(v.stateDir),v.stateDir=En(),v.cachePath=Tn(v.cachePath),v.build)v.build.cacheDir=Tn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=Tn(v.media.cache.directory);if(v.story)v.story.outDir=Tn(v.story.outDir)}var Mr=null,Zr=new Map,$a=new Map,go=null;async function zs(v,_=sb){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?cn.resolve(v):process.cwd(),k=$a.get(_);if(k&&k.signature!==hr(k.graph)){let B=Zr.get(_);if(Zr.delete(_),$a.delete(_),!v)Mr=null,go=null;let{clearComponentCache:z}=await import("./chunk-0v0q0960.js"),{partialsCache:F}=await import("./chunk-n6ek151q.js");if(z(),F.clear(),B&&k.configSignature===yr(k.graph)){let H=B.then(async(q)=>{let K={...k.graph};await Vs(K,_),$a.set(_,{graph:K,signature:hr(K),configSignature:yr(K)});let G={...q,_layerGraph:K};if(!v)Mr=G;return G});return Zr.set(_,H),H}}if(!v){if(Mr)return Mr;if(go)return go}let R=Zr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((ee)=>ms.existsSync(cn.join(_,`stx.config${ee}`))),F=B.some((ee)=>ms.existsSync(cn.join(_,"config",`ui${ee}`))),H;if(z&&F){let ee=await zs({name:"ui",cwd:cn.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});H=(await zs({name:"stx",alias:"ui",cwd:_,defaultConfig:ee.config,errorPolicy:"throw",verbose:!1})).config}else H=(await zs({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(H.extends!==void 0||k){let ee=await Vi(_,A);H=ee.config,$a.set(_,{graph:ee.graph,signature:hr(ee.graph),configSignature:yr(ee.graph)})}if(H.runtimeConfig){let{resolveRuntimeConfig:ee}=await import("./chunk-9wbraw07.js");ee(H.runtimeConfig,{});let{generateRuntimeConfigTypes:ae}=await import("./chunk-cy1krwqy.js");await ae(_,H.runtimeConfig)}cb(H),lb(H),rl(H,_),ab(H,_);let q=[],K=new Set((H.plugins??[]).map((ee)=>typeof ee==="string"?ee:ee[0]));for(let ee of H.componentPackages??["@stacksjs/components"]){let ae=`${ee}/stx-plugin`;if(K.has(ae)||K.has(ee))continue;try{d.resolve(ae,{paths:[_]}),q.push(ae)}catch{}}let G=[...H.plugins??[],...q];if(G.length>0){let{pluginManager:ee}=await import("./chunk-7zdefvrn.js"),ae=[],Q=[];for(let ce of G){let ue=typeof ce==="string"?ce:ce[0],le=typeof ce==="string"?{}:ce[1]||{};try{let pe,de;try{let be=d.resolve(ue,{paths:[_]});pe=await import(be),de=cn.dirname(be)}catch{let be=cn.resolve(_,ue);pe=await import(be),de=cn.dirname(be)}let Re=pe.default||pe;if(!ee.has(Re.name))await ee.register(Re,H);if(Re.components){let be=Array.isArray(Re.components)?Re.components:[Re.components];for(let xe of be)ae.push(cn.resolve(de,xe))}if(Re.pages){let be=cn.resolve(de,Re.pages),xe=le.path||"/";Q.push({dir:be,prefix:xe})}if(Re.setup){let be={addDirective:(xe)=>{H.customDirectives=H.customDirectives||[],H.customDirectives.push(xe)},addRoute:(xe,Ie)=>{H.apiRoutes=H.apiRoutes||{},H.apiRoutes[xe]=Ie},addMiddleware:(xe)=>{H.middleware=H.middleware||[],H.middleware.push(xe)},pluginDir:de,config:H};await Re.setup(le,be)}process.stderr.write(`[stx] Plugin loaded: ${Re.name||ue}
|
|
2293
|
-
`)}catch(pe){console.warn(`[stx] Failed to load plugin ${ue}:`,pe.message)}}H._pluginComponentDirs=ae,H._pluginPageDirs=Q}return H})();if(Zr.set(_,T),T.catch(()=>{if(Zr.get(_)===T)Zr.delete(_)}),!v)go=T,T.then((B)=>{Mr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Mr&&_ in Mr)return Mr[_];if(!go)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function wd(v){return v}function xd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${B}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var Dl=new Map;async function he(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await ub.promises.stat(v)).mtime.getTime();if(_.cache&&Dl.has(v)){let G=Dl.get(v);if(G.updatedAt>=R)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:B,content:z}=rr(T),F=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=We(z,{gfm:!0});if(F.syntaxHighlighting?.enabled&&F.syntaxHighlighting?.serverSide)q=await fb(q,F.syntaxHighlighting?.defaultTheme||"github-dark",F.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:q,data:B||{}};if(_.cache)Dl.set(v,{...K,updatedAt:R});return K}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var ka=null;async function fb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ka)try{ka=await db({theme:_||"github-dark",cache:!0})}catch(F){return console.error("Failed to initialize ts-syntax-highlighter:",F),v}let T=async(F,H,q,K)=>{let G=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),ee=q||(k?"text":"");if(!ee)return F;try{if(!ka.getSupportedLanguages().includes(ee))return F;return(await ka.highlight(G,ee,{theme:_})).html}catch(ae){console.error(`Error highlighting code block with language ${q}:`,ae)}return F},B=v,z=v.matchAll(R);for(let F of z){let[H,q,K,G]=F,ee=await T(H,q,K,G);B=B.replace(H,ee)}return B}async function Pp(v,_,k="",R={}){return await pb(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,F,H,q)=>{try{let K=F;if(!Pl.isAbsolute(F))K=Pl.resolve(Pl.dirname(k),F);let G={};if(H)try{try{G=JSON.parse(H)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let pe=H.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let de of pe){let Re=de.indexOf(":");if(Re>0){let be=de.substring(0,Re).trim(),xe=de.substring(Re+1).trim(),Ie=xe.startsWith('"')&&xe.endsWith('"'),Me=xe.startsWith("'")&&xe.endsWith("'");if(Ie||Me)xe=xe.substring(1,xe.length-1);G[be]=xe}}}}catch(le){if(R.debug)console.error("Error parsing context in @markdown-file directive:",le)}let{content:ee,data:ae}=await he(K,R),Q={..._,...ae,...G},ce=ee,ue=/\{\{([^}]+)\}\}/g;return ce=ce.replace(ue,(le,pe)=>{let de=pe.trim();return Q[de]!==void 0?String(Q[de]):le}),ce}catch(K){let G=K instanceof Error?K.message:String(K);return g("Markdown File",`Error including markdown file: ${G}`,k,v,q,z)}})}async function pb(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let F=T[0],H=T.index,q=T;R.push(k(...q).then((K)=>({match:F,replacement:K,index:H})))}let B=await Promise.all(R);B.sort((F,H)=>H.index-F.index);let z=v;for(let{match:F,replacement:H}of B)z=z.replace(F,()=>H);return z}function Nr(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function jr(v,_){let k=gb(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function gb(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function mb(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Gr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),F=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,F.lastIndex=B;let H=z.exec(v),q=F.exec(v),K=H?H.index:1/0,G=q?q.index:1/0;if(K<G)T++,B=K+H[0].length;else if(G<1/0){if(T--,T===0)return G;B=G+q[0].length}else break}return-1}function Dp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=jr(v,R);if(!T)return null;let B=T.endPos,z=Gr(v,"if","endif",B);if(z===-1)return null;let F=v.slice(B,z),H=[],q=0,K="if",G=T.expression,ee=0,ae=0;while(q<F.length){let Q=F.indexOf("@",q);if(Q===-1)break;q=Q;let ce=F.substring(Q);if(mb(F,Q)){q++;continue}if(/^@if\s*\(/.test(ce)){ae++,q++;continue}if(/^@endif(?![a-z])/.test(ce)){ae--,q+=6;continue}if(ae===0){let ue=ce.match(/^@elseif\s*/);if(ue){H.push({type:K,condition:G,content:F.substring(ee,q),start:B+ee,end:B+q});let le=q+ue[0].length,pe=jr(F,le);if(!pe){q++;continue}K="elseif",G=pe.expression,q=pe.endPos,ee=q;continue}else if(/^@else(?![a-z])/.test(ce)){H.push({type:K,condition:G,content:F.substring(ee,q),start:B+ee,end:B+q}),K="else",G=void 0,q+=5,ee=q;continue}}q++}return H.push({type:K,condition:G,content:F.slice(ee),start:B+ee,end:B+F.length}),{fullMatch:v.slice(_,z+6),branches:H,start:_,end:z+6}}function mo(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=Dp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function Ea(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((ce)=>B.index>ce.start&&B.index<ce.end)){B=T.exec(v);continue}let F=B.index,H=F+B[0].length-1,q=S(v,"(",")",H);if(q===-1){B=T.exec(v);continue}let K=v.slice(H+1,q),G=q+1,ee=Gr(v,_,k,G);if(ee===-1){B=T.exec(v);continue}let ae=v.slice(G,ee),Q=ee+`@${k}`.length;R.push({fullMatch:v.slice(F,Q),name:_,params:K,content:ae,start:F,end:Q}),T.lastIndex=Q,B=T.exec(v)}return R}function Ol(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=jr(v,R);if(!T)return null;let B=T.endPos,z=Gr(v,"switch","endswitch",B);if(z===-1)return null;let F=v.slice(B,z),H=[],q=0,K=null,G=0;while(q<F.length){let ee=F.slice(q),ae=ee.match(/^@switch\s*\(/),Q=ee.match(/^@endswitch(?![a-z])/);if(ae){if(G++,K)K.content+=ae[0];q+=ae[0].length;continue}if(Q){if(G--,K)K.content+=Q[0];q+=Q[0].length;continue}if(G>0){if(K)K.content+=F[q];q++;continue}let ce=ee.match(/^@case\s*/),ue=ee.match(/^@default(?![a-z])/),le=ee.match(/^@break(?![a-z])/);if(ce&&ee.startsWith("@case")){if(K)H.push(K);let pe=q+ce[0].length,de=jr(F,pe);if(!de){q++;continue}K={type:"case",value:de.expression,content:""},q=de.endPos}else if(ue&&ee.startsWith("@default")){if(K)H.push(K);K={type:"default",content:""},q+=ue[0].length}else if(le&&ee.startsWith("@break"))q+=le[0].length;else{if(K)K.content+=F[q];q++}}if(K)H.push(K);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:H,start:_,end:z+10}}function bb(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=Ol(R,z);if(!F)break;try{let H;if(p(F.expression))H=c(F.expression,Object.keys(_))(...Object.values(_));else H=l(F.expression,_);let q="",K=!1;for(let G of F.cases)if(G.type==="default"){if(!K)q=G.content.trim()}else try{let ee;if(G.value&&p(G.value))ee=c(G.value,Object.keys(_))(...Object.values(_));else if(G.value)ee=l(G.value,_);if(H===ee){q=G.content.trim(),K=!0;break}}catch{continue}R=R.substring(0,z)+q+R.substring(F.end),T=!0}catch(H){let q=H instanceof Error?H.message:String(H),K=i("Switch",`Error evaluating @switch expression: ${q}`,t.EVALUATION_ERROR);R=R.substring(0,z)+K+R.substring(F.end);break}}return R}function vb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function wb(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function xr(v,_,k){let{masked:R,scripts:T}=vb(v);return wb(Sb(R,_,k),T)}function Sb(v,_,k){let R=v;R=bb(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let F=z.index,H=jr(R,F+7);if(!H)break;let q=H.endPos,K=Gr(R,"unless","endunless",q);if(K===-1){console.warn(`[stx] @unless directive at position ${F} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=R.slice(q,K),ee=H.expression,ae=-1;{let ce=0,ue=/@(?:if|unless)\s*\(/g,le=/@(?:endif|endunless)(?![a-z])/g,pe=/@else(?![a-z])/g,de=[],Re;while((Re=ue.exec(G))!==null)de.push({pos:Re.index,type:"open"});while((Re=le.exec(G))!==null)de.push({pos:Re.index,type:"close"});while((Re=pe.exec(G))!==null)de.push({pos:Re.index,type:"else"});de.sort((be,xe)=>be.pos-xe.pos);for(let be of de)if(be.type==="open")ce++;else if(be.type==="close")ce--;else if(be.type==="else"&&ce===0){ae=be.pos;break}}let Q;if(ae!==-1){let ce=G.slice(0,ae),ue=G.slice(ae+5);Q=`@if (${ee})${ue}@else ${ce}@endif`}else Q=`@if (!(${ee}))${G}@endif`;R=R.substring(0,F)+Q+R.substring(K+10),B=!0}}R=Nl(R,_,k),R=jl(R,_,k),R=Ml(R,_);let T=()=>{let B=mo(R);if(B.length===0)return!1;let z=Array(B.length);for(let q=B.length-1;q>=0;q--){let K=B[q];try{let G="",ee=!1;for(let ae of K.branches){if(ee)break;if(ae.type==="else")G=ae.content,ee=!0;else try{if(ae.condition?Zi(ae.condition,_):!1)G=ae.content,ee=!0}catch(Q){G=i(ae.type==="if"?"If":"Elseif",`Error in @${ae.type}(${ae.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),ee=!0}}z[q]=G}catch(G){let ee=G instanceof Error?G.message:String(G);z[q]=i("If",`Error processing @if block: ${ee}`,t.EVALUATION_ERROR)}}let F=Array(B.length*2+1),H=0;for(let q=0;q<B.length;q++){let K=B[q];F[q*2]=R.slice(H,K.start),F[q*2+1]=z[q],H=K.end}return F[B.length*2]=R.slice(H),R=F.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function Op(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function Ml(v,_){let k=v;function R(F,H,q,K){let G=1,ee=K,ae=new RegExp(`@${H}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${q}(?![a-z])`,"g");while(ee<F.length&&G>0){ae.lastIndex=ee,Q.lastIndex=ee;let ce=ae.exec(F),ue=Q.exec(F),le=ce?ce.index:1/0,pe=ue?ue.index:1/0;if(le<pe)G++,ee=le+ce[0].length;else if(pe<1/0){if(G--,G===0)return pe;ee=pe+ue[0].length}else break}return-1}function T(F,H,q){let K=0,G=new RegExp(`@${H}(?:\\s*\\(|\\s|$)`,"g"),ee=new RegExp(`@${q}(?![a-z])`,"g"),ae=/@else(?![a-z])/g,Q=[],ce;while((ce=G.exec(F))!==null)Q.push({pos:ce.index,type:"open"});while((ce=ee.exec(F))!==null)Q.push({pos:ce.index,type:"close"});while((ce=ae.exec(F))!==null)Q.push({pos:ce.index,type:"else"});Q.sort((ue,le)=>ue.pos-le.pos);for(let ue of Q)if(ue.type==="open")K++;else if(ue.type==="close")K--;else if(ue.type==="else"&&K===0)return ue.pos;return-1}{let F=!0;while(F){F=!1;let H=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!H||H.index===void 0)break;let q=H.index,K,G,ee=k.slice(q+5),ae=Op(ee);if(ae)K=ae.value,G=q+5+ae.consumed;else G=q+5;let Q=R(k,"auth","endauth",G);if(Q===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let ce=k.slice(G,Q),ue=T(ce,"auth","endauth"),le;if(!_.auth)le=!1;else le=K?Nr(`auth?.check && auth?.user?.[${K}]`,_):Nr("auth?.check",_);let pe;if(ue!==-1){let de=ce.slice(0,ue),Re=ce.slice(ue+5);pe=le?de:Re}else pe=le?ce:"";k=k.substring(0,q)+pe+k.substring(Q+8),F=!0}}{let F=!0;while(F){F=!1;let H=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!H||H.index===void 0)break;let q=H.index,K,G,ee=k.slice(q+6),ae=Op(ee);if(ae)K=ae.value,G=q+6+ae.consumed;else G=q+6;let Q=R(k,"guest","endguest",G);if(Q===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let ce=k.slice(G,Q),ue=T(ce,"guest","endguest"),le;if(!_.auth)le=!0;else le=K?Nr(`!auth?.check || !auth?.user?.[${K}]`,_):Nr("!auth?.check",_);let pe;if(ue!==-1){let de=ce.slice(0,ue),Re=ce.slice(ue+5);pe=le?de:Re}else pe=le?ce:"";k=k.substring(0,q)+pe+k.substring(Q+9),F=!0}}function B(F,H,q){if(_.userCan&&typeof _.userCan[F]==="boolean")return _.userCan[F];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let K=[F];if(H)K.push(H);if(q){let G=Nr(q,_);K.push(G)}return _.permissions.check(...K)}catch{return!1}return!1}function z(F){let H=F.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!H)return null;return{ability:H[1],type:H[2],id:H[3]?.trim(),paramsEnd:H[0].length}}for(let F of["can","cannot"]){let H=`end${F}`,q=F==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let G=k.match(new RegExp(`@${F}\\s*\\(`));if(!G||G.index===void 0)break;let ee=G.index,ae=k.slice(ee+`@${F}`.length),Q=z(ae);if(!Q)break;let ce=ee+`@${F}`.length+Q.paramsEnd,ue=R(k,F,H,ce);if(ue===-1){console.warn(`[stx] @${F} directive at position ${ee} has no matching @${H} \u2014 the block was skipped.`);break}let le=k.slice(ce,ue),pe=[],de=0,Re=new RegExp(`@${F}\\s*\\(`,"g"),be=new RegExp(`@${H}(?![a-z])`,"g"),xe=new RegExp(`@${q}\\s*\\(`,"g"),Ie=/@else(?![a-z])/g,Me=[],Ne;while((Ne=Re.exec(le))!==null)Me.push({pos:Ne.index,type:"open"});while((Ne=be.exec(le))!==null)Me.push({pos:Ne.index,type:"close"});while((Ne=xe.exec(le))!==null)Me.push({pos:Ne.index,type:"elseDirective"});while((Ne=Ie.exec(le))!==null)Me.push({pos:Ne.index,type:"else"});Me.sort((Ve,Be)=>Ve.pos-Be.pos);for(let Ve of Me){if(Ve.type==="open"){de++;continue}if(Ve.type==="close"){de--;continue}if(de===0)pe.push(Ve)}let je=[],Le=0;for(let Ve=0;Ve<pe.length;Ve++){let Be=pe[Ve];if(je.push({content:le.slice(Le,Be.pos),ability:void 0}),Be.type==="elseDirective"){let He=le.slice(Be.pos+`@${q}`.length),vt=z(He);if(vt){je[je.length-1]={content:le.slice(Le,Be.pos)},Le=Be.pos+`@${q}`.length+vt.paramsEnd,je.push({content:"",ability:vt.ability,type:vt.type,id:vt.id}),je.pop();let bt=pe[Ve+1],Et=bt?bt.pos:le.length;je.push({content:le.slice(Le,Et),ability:vt.ability,type:vt.type,id:vt.id}),Le=Et}}else Le=Be.pos+5}if(Le<le.length){let Ve=je[je.length-1];if(pe.length>0&&pe[pe.length-1].type==="else")je.push({content:le.slice(Le),isFinalElse:!0});else if(je.length===0)je.push({content:le.slice(Le)})}let De=B(Q.ability,Q.type,Q.id),ze=F==="can"?De:!De,Fe="";if(ze)Fe=je[0]?.content||"";else{let Ve=!1;for(let Be=1;Be<je.length;Be++){let He=je[Be];if(He.isFinalElse){Fe=He.content,Ve=!0;break}if(He.ability){let vt=B(He.ability,He.type,He.id);if(F==="can"?vt:!vt){Fe=He.content,Ve=!0;break}}}if(!Ve&&je.length>0){let Be=je[je.length-1];if(Be.isFinalElse)Fe=Be.content}}k=k.substring(0,ee)+Fe+k.substring(ue+`@${H}`.length),K=!0}}return k}function Nl(v,_,k){let R=v;function T(B,z,F,H,q){let K=!0;while(K){K=!1;let G=new RegExp(`@${z}\\s*\\(`),ee=B.match(G);if(!ee||ee.index===void 0)break;let ae=ee.index,Q=jr(B,ae+`@${z}`.length);if(!Q)break;let ce=Q.endPos,ue=Gr(B,z,F,ce);if(ue===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let le=B.slice(ce,ue),pe=Q.expression,de=-1,Re=0,be=0;while(be<le.length){let xe=le.indexOf("@",be);if(xe===-1)break;let Ie=le.substring(xe);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Ie)){Re++,be=xe+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Ie)){Re--,be=xe+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Ie)){de=xe;break}be=xe+1}try{let xe=H(pe.trim()),Ie;if(de!==-1){let Me=le.slice(0,de),Ne=le.slice(de+5);Ie=xe?Me:Ne}else Ie=xe?le:"";B=B.substring(0,ae)+Ie+B.substring(ue+`@${F}`.length),K=!0}catch(xe){let Ie=xe instanceof Error?xe.message:String(xe),Me=i(q,`Error processing @${z} directive: ${Ie}`,t.EVALUATION_ERROR);B=B.substring(0,ae)+Me+B.substring(ue+`@${F}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=Nr(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=Nr(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function jl(v,_,k){let R=v,T="development";function B(z,F,H,q){let K=new RegExp(`@${F}(?![a-z])`,"g"),G=new RegExp(`@${H}(?![a-z])`,"g"),ee=new RegExp(`^@${F}(?![a-z])`),ae=new RegExp(`^@${H}(?![a-z])`),Q=z,ce=!0;while(ce){ce=!1,K.lastIndex=0;let ue=K.exec(Q);if(!ue)break;let le=ue.index,pe=le+ue[0].length;if(F==="env"){let De=Q.substring(pe).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!De)break;pe+=De[0].length,q=T===De[2]}let de=1,Re=pe,be=-1;while(de>0&&Re<Q.length){K.lastIndex=Re,G.lastIndex=Re;let De=K.exec(Q),ze=G.exec(Q),Fe=De?De.index:1/0,Ve=ze?ze.index:1/0;if(Fe<Ve)de++,Re=Fe+De[0].length;else if(Ve<1/0){if(de--,de===0){be=Ve;break}Re=Ve+ze[0].length}else break}if(be===-1){console.warn(`[stx] @${F} directive at position ${le} has no matching @${H} \u2014 the block was skipped.`);break}let xe=Q.substring(pe,be),Ie=-1,Me=0,Ne=0;while(Ne<xe.length){let De=xe.indexOf("@",Ne);if(De===-1)break;let ze=xe.substring(De);if(ee.test(ze)){Me++,Ne=De+1;continue}if(ae.test(ze)){Me--,Ne=De+1;continue}if(Me===0&&/^@else(?![a-z])/.test(ze)){Ie=De;break}Ne=De+1}let je;if(Ie!==-1){let De=xe.slice(0,Ie),ze=xe.slice(Ie+5);je=q?De:ze}else je=q?xe:"";let Le=`@${H}`.length;Q=Q.substring(0,le)+je+Q.substring(be+Le),ce=!0}return Q}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var Mp=new WeakMap;function Np(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Ca(v,_){if(!v)return _?.nonceGenerator?.()??Np();let k=Mp.get(v);if(!k)k=_?.nonceGenerator?.()??Np(),Mp.set(v,k);return k}function $b(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function jp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${$b(v,_).replace(/&/g,"&").replace(/"/g,""")}">`}function Lp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let R=_.useNonce?Ca(k,_):void 0,T=jp(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
|
|
2294
|
-
${T}`)}function Bp(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function zp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?Ca(_,B):void 0;return jp(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return Ca(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=Ca(_,B);return T}import _b from"crypto";var kb=40,Wp="_token",Ll=null;function Eb(v=kb){let _=_b.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Ll=_,_}function Cb(){if(!Ll)Eb();return Ll}function Rb(v=Wp){let _=Cb();return`<input type="hidden" name="${v}" value="${_}">`}function Fp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>Rb(R||Wp))}async function Vp(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await Ab(T,B,_,k,R);else T=await Tb(T,B,_,k,R)}return T}async function Ab(v,_,k,R,T){let{name:B,handler:z}=_,F=`@${B}`,H=`@end${B}`,q=v,K=Hr(`${F}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${H}`,"g"),G=[],ee=K.exec(q);while(ee!==null){let[ae,Q="",ce=""]=ee,ue=ee.index||0;try{let le=Q?Up(_,Q):[],pe=ce.trim(),de=await z(pe,le,k,R);G.push({original:ae,processed:de,startIndex:ue})}catch(le){let pe=le instanceof Error?le.message:String(le);if(T.debug)console.error(`Error processing custom directive @${B}:`,le);G.push({original:ae,processed:i("CustomDirective",`Error in @${B}${Q?`(${Q})`:""}: ${pe}`,t.EVALUATION_ERROR),startIndex:ue})}ee=K.exec(q)}for(let ae=G.length-1;ae>=0;ae--){let{original:Q,processed:ce}=G[ae];q=q.replace(Q,ce)}return q}async function Tb(v,_,k,R,T){let{name:B,handler:z}=_,F=v,H=[],q=[];if(_.rawParams){for(let ee of Js(F,Hr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(ee.end!==-1)q.push({fullMatch:ee.call,paramString:ee.args,startIndex:ee.start})}else{let ee=Hr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");ee.lastIndex=0;let ae=ee.exec(F);while(ae!==null)q.push({fullMatch:ae[0],paramString:ae[1]??"",startIndex:ae.index||0}),ae=ee.exec(F)}for(let{fullMatch:ee,paramString:ae,startIndex:Q}of q)try{let ce=Up(_,ae),ue=await z("",ce,k,R);H.push({original:ee,processed:ue,startIndex:Q})}catch(ce){let ue=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);H.push({original:ee,processed:i("CustomDirective",`Error in @${B}(${ae}): ${ue}`,t.EVALUATION_ERROR),startIndex:Q})}let K=Hr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),G=K.exec(F);while(G!==null){let[ee]=G,ae=G.index||0;try{let Q=await z("",[],k,R);H.push({original:ee,processed:Q,startIndex:ae})}catch(Q){let ce=Q instanceof Error?Q.message:String(Q);if(T.debug)console.error(`Error processing custom directive @${B}:`,Q);H.push({original:ee,processed:i("CustomDirective",`Error in @${B}: ${ce}`,t.EVALUATION_ERROR),startIndex:ae})}G=K.exec(F)}for(let ee=H.length-1;ee>=0;ee--){let{original:ae,processed:Q}=H[ee];F=F.replace(ae,Q)}return F}function Up(v,_){return v.rawParams?at(_):Ib(_)}function Ib(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var Hp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,qp=/^[A-Za-z_$][\w$]*$/,Pb=new Set(["light","dark","system"]);function Jr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Db(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Jr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Jr(R.key,"colorMode.key"),Jr(R.attribute,"colorMode.attribute"),Jr(R.default,"colorMode.default"),!qp.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Hp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Pb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Jr(k.key,"appearance.key"),Jr(k.attribute,"appearance.attribute"),Jr(k.default,"appearance.default"),!qp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Hp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function Ob(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Mb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Ob(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 Nb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Kp(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Nb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let F=k.slice(B+1,z).trim(),H=l(`(${F})`,_),q=Mb(Db(H));k=k.slice(0,T.index)+q+k.slice(z+1),R.lastIndex=T.index+q.length}return k}import jb from"crypto";function sn(v){return String(v??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Zp={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ra(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function On(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Us(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${sn(_)}"`}function Bl(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${sn(`${On(v)}-error`)}"`;return R}function Lb(){return jb.randomUUID()}function Aa(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=Lb();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${sn(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${sn(B)}">`;return R}),k}function Gp(v,_,k=Zp){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,F,H,q="")=>{let K=B||z||"POST",G=F||H||"",ee=Lr(q),ae=K.toUpperCase(),Q=["GET","POST"].includes(ae)?ae:"POST",ce=`<form method="${sn(Q)}" action="${sn(G)}"${ee?` ${ee}`:""}>`;if(ce+=`
|
|
2295
|
-
${Aa("@csrf",_)}`,!["GET","POST"].includes(ae))ce+=`
|
|
2296
|
-
${Aa(`@method('${ae}')`,_)}`;return ce}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,F,H,q="")=>{let K=B||z||"",G=F||H||"",ee=Lr(q),ae=ho(K,_),Q=ae!==void 0&&ae!==null?ae:G||"",ce=ee.match(/type=['"]([^'"]+)['"]/i),ue=ce?ce[1]:"text",le=yo(K,_),pe=ee.match(/class=['"]([^'"]+)['"]/i),de=Ra(pe?pe[1]:"",k.input,le,k.inputError),Re=ee.replace(/class=['"][^'"]+['"]/i,"");return Re=Re.replace(/type=['"][^'"]+['"]/i,""),`<input type="${sn(ue)}" name="${sn(K)}"${Us(ee,On(K))} value="${sn(Q)}" class="${de}"${Bl(K,le,ee)}${Re?` ${Re}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",F="")=>{let H=Lr(z),q=ho(B,_)||F.trim(),K=yo(B,_),G=H.match(/class=['"]([^'"]+)['"]/i),ee=Ra(G?G[1]:"",k.input,K,k.inputError),ae=H.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${sn(B)}"${Us(H,On(B))} class="${ee}"${Bl(B,K,H)}${ae?` ${ae}`:""}>${sn(q)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",F)=>{let H=Lr(z),q=ho(B,_),K=yo(B,_),G=H.match(/class=['"]([^'"]+)['"]/i),ee=Ra(G?G[1]:"",k.input,K,k.inputError),ae=H.replace(/class=['"][^'"]+['"]/i,""),Q=F;if(q!==void 0)Q=F.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(ce,ue,le)=>{if((Array.isArray(q)?q.some((de)=>String(de)===le):String(q)===le)&&!ue.includes("selected"))return ue.replace(/(<option)/,"$1 selected");return ce});return`<select name="${sn(B)}"${Us(H,On(B))} class="${ee}"${Bl(B,K,H)}${ae?` ${ae}`:""}>${Q}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,F="")=>{let H=z===void 0?"1":z,q=z===void 0?On(B):`${On(B)}-${On(H)}`,K=Lr(F),G=ho(B,_),ee=G!==void 0&&(Array.isArray(G)?G.some((ue)=>String(ue)===H):G===!0||String(G)===H),ae=K.match(/class=['"]([^'"]+)['"]/i),Q=ae?ae[1]:k.checkInput,ce=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${sn(B)}"${Us(K,q)} value="${sn(H)}" class="${Q}"${ee?" checked":""}${ce?` ${ce}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,F="")=>{let H=Lr(F),q=ho(B,_),K=q!==void 0&&q===z,G=H.match(/class=['"]([^'"]+)['"]/i),ee=G?G[1]:k.checkInput,ae=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${sn(B)}"${Us(H,`${On(B)}-${On(z)}`)} value="${sn(z)}" class="${ee}"${K?" checked":""}${ae?` ${ae}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let F=Lr(z),H=F.match(/accept=['"]([^'"]+)['"]/i),q=H?H[1]:"",K=F.includes("multiple"),G=yo(B,_),ee=F.match(/class=['"]([^'"]+)['"]/i),ae=Ra(ee?ee[1]:"",k.input,G,k.inputError),Q=F.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),ce=[`<input type="file" name="${sn(B)}"${Us(F,On(B))}`,`class="${ae}"`];if(q)ce.push(`accept="${sn(q)}"`);if(K)ce.push("multiple");if(Q)ce.push(Q);return`${ce.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",F)=>{let H=Lr(z),q=H.match(/class=['"]([^'"]+)['"]/i),K=q?q[1]:k.label,G=H.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${sn(On(B))}" class="${K}"${G?` ${G}`:""}>${F}</label>`}),R}function Jp(v,_,k=Zp){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(yo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(F,H)=>{try{if(H.trim()==="$message"||H.trim()==="message")return Xp(T,_);if(H.trim().includes("errors.first")||H.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Xp(T,_)}let q=H.trim();if(p(q)){let K=l(q,_);return K!==void 0?String(K):q}return q}catch{return H}});return`<div id="${sn(`${On(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function yo(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Xp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function ho(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function Lr(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var zl=m(256),Bb=[{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"}],Yp=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function zb(v){let _=Array.from(v,(T)=>T===`
|
|
2297
|
-
`?`
|
|
2298
|
-
`:" "),k=0,R="";while(k<v.length){let T=v[k],B=v[k+1];if(R){if(T==="\\"){k+=2;continue}if(T===R)R="";k++;continue}if(T==='"'||T==="'"||T==="`"){R=T,k++;continue}if(T==="/"&&B==="/"){while(k<v.length&&v[k]!==`
|
|
2299
|
-
`)_[k]=v[k],k++;continue}if(T==="/"&&B==="*"){let z=v.indexOf("*/",k+2),F=z===-1?v.length:z+2;for(;k<F;k++)_[k]=v[k];continue}if(T==="{"&&B==="{"&&v.slice(k,k+4)==="{{--"){let z=v.indexOf("--}}",k+4),F=z===-1?v.length:z+4;for(;k<F;k++)_[k]=v[k];continue}k++}return _.join("")}function Wb(v){let _=new Map,k=zb(v).split(`
|
|
2300
|
-
`),R=v.split(`
|
|
2301
|
-
`);return k.forEach((T,B)=>{Yp.lastIndex=0;for(let z of T.matchAll(Yp)){let F=z[1]==="-next-line",H=(R[B]??"").slice(0,z.index).trim(),q=F||H===""?B+2:B+1,G=(z[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),ee=G.filter((Q)=>/\w/.test(Q));if(G.length>0&&ee.length===0)continue;let ae=_.get(q);if(ae&&ae.size===0)continue;if(ee.length===0){_.set(q,new Set);continue}if(ae)ee.forEach((Q)=>ae.add(Q));else _.set(q,new Set(ee))}}),_}function Fb(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function Ze(v,_,k,R){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let B=h(v,_,R,JSON.stringify(T)),z=zl.get(B);if(z!==void 0){if(z&&T.failOnViolation)throw new W(z,R??_);return}let F=T.allowPatterns??[],H=Wb(v),q=[],K=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(Q)=>Q.replace(/[^\n]/g," ")));for(let{pattern:Q,message:ce,suggestion:ue}of Bb){if(F.some((pe)=>/\w/.test(pe)&&ce.includes(pe)))continue;Q.lastIndex=0;let le=K.match(Q);if(le&&le.length>0){let pe=K.split(`
|
|
2302
|
-
`),de=v.split(`
|
|
2303
|
-
`),Re=[];if(pe.forEach((Me,Ne)=>{if(Q.lastIndex=0,Q.test(Me)&&!Fb(H,Ne+1,ce))Re.push(Ne+1)}),Re.length===0&&pe.some((Me)=>(Q.lastIndex=0,Q.test(Me))))continue;let be=Re.length>0?` (script line${Re.length>1?"s":""} ${Re.join(", ")})`:"",xe=Re.slice(0,3).map((Me)=>` ${Me} | ${(de[Me-1]??"").trim().slice(0,100)}`).join(`
|
|
2304
|
-
`),Ie=xe?`
|
|
2305
|
-
${xe}`:"";q.push(` \u2717 ${ce}${be}
|
|
2306
|
-
\u2192 ${ue}${Ie}`)}}if(q.length===0){zl.set(B,"");return}let G=(Q)=>{let ce=`${process.cwd()}/`;return Q.startsWith(ce)?Q.slice(ce.length):Q},ae=`[STX] DOM API violation in ${R&&R!==_?`${G(R)} (composed into ${G(_)})`:G(_)}:
|
|
2307
|
-
${q.join(`
|
|
2308
|
-
`)}
|
|
2309
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(zl.set(B,ae),console.warn(ae),T.failOnViolation)throw new W(ae,R??_)}var xo=/<\/?template\b[^>]*>/gi,Vb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Ub(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Vb.test(_)}function se(v){xo.lastIndex=0;let _;while((_=xo.exec(v))!==null){if(_[0].startsWith("</")||Ub(_[0]))continue;let k=_.index,R=xo.lastIndex,T=1,B;while((B=xo.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:xo.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Jt from"path";import{existsSync as gw}from"fs";class Qp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=uc(v,R);if(T!==void 0)return T;for(let B of dc(v,_,k,R))if(await r(B))return B;return null}}var Hs=new Qp;function Zt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Br="\x00stx-boolean-attribute";function Wl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Hb=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 Fl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Hb.has(_)}function zr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(Zt(B));continue}if(T===Br){k.push(Zt(B));continue}k.push(`${Zt(B)}="${Zt(Wl(String(T)))}"`)}return k}function Wr(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(Zt(B));continue}if(typeof T==="object")continue;k.push(`${Zt(B)}="${Zt(Wl(String(T)))}"`)}return k}function ei(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function qb(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 Vl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=qb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",F=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,H=[];if(R.reactive)H.push(`:href="${ei(R.value)}"`);else H.push(`href="${ei(Hi(R.value,"navigable"))}"`);if(T)H.push(`class="${ei(T)}"`);if(H.push("data-stx-link"),H.push(`data-stx-active-class="${ei(B)}"`),H.push(`data-stx-exact-active-class="${ei(z)}"`),F)H.push("data-stx-prefetch");let q=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(q)H.push(`data-stx-active-match="${ei(q)}"`);let K=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return H.push(...zr(v,K)),H.push(...Wr(v,K)),`<a ${H.join(" ")}>${_}</a>`}};import{createHash as fg}from"crypto";import gn from"fs";import ln from"path";import{decode as ev,generateThumbHash as tv}from"ts-images";import{createImageDeliveryCatalog as ig}from"ts-images/delivery";import Ul from"fs";function Ta(v,_,k){let R=Buffer.alloc(k),T=Ul.readSync(v,R,0,k,_);return R.subarray(0,T)}function Hl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function ql(v){let _;try{_=Ul.openSync(v,"r");let k=Ta(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=Ta(_,T,8);if(z.length<8)return"unknown";let F=z.toString("latin1",4,8);if(F==="tRNS")return"possible";if(F==="IDAT"||F==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Hl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)Ul.closeSync(_)}}import Kb from"fs";import Ia from"os";import{join as eg}from"path";import{fileURLToPath as tg}from"url";import{Worker as ng}from"worker_threads";var Da=Symbol("stx.image-worker.unavailable");function Xb(v=typeof Ia.availableParallelism==="function"?Ia.availableParallelism():Ia.cpus().length){return Math.max(1,Math.min(2,v-1))}var Pa=0,sg=[];async function Zb(){if(Pa<Xb()){Pa++;return}await new Promise((v)=>sg.push(v)),Pa++}function Gb(){Pa--,sg.shift()?.()}var Jb="@stacksjs/stx/builtins/image-warmup-worker";function Yb(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:"&&Kb.existsSync(tg(k)))return tg(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Jb,v):void 0;return k&&Qb(k)?k:void 0}catch{return}}function Qb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,eg(_.BUN_INSTALL||eg(Ia.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var rg=!1;function bo(v){if(!rg)rg=!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 Da}function Kl(v){return v instanceof Error?v.message:String(v)}async function Xl(v,_){if(typeof ng!=="function")return bo("node:worker_threads has no Worker in this runtime");let k=Yb();if(!k)return bo("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Zb();try{return await new Promise((R,T)=>{let B;try{B=new ng(k)}catch(q){R(bo(`could not start ${k}: ${Kl(q)}`));return}let z=!1,F=!1,H=(q)=>{if(F)return;F=!0,q(),B.terminate()};B.on("message",(q)=>{if(q.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(q.type==="result"){H(()=>R(q.value));return}let K=Error(q.error?.message??"image worker failed");if(q.error?.name)K.name=q.error.name;if(q.error?.stack)K.stack=q.error.stack;H(()=>T(K))}),B.on("error",(q)=>{H(()=>z?T(q instanceof Error?q:Error(Kl(q)||"image worker crashed")):R(bo(`the worker failed before it was ready: ${Kl(q)}`)))}),B.on("exit",(q)=>{H(()=>z?T(Error("image worker exited before it finished")):R(bo(`the worker exited with code ${q} before it was ready`)))})})}finally{Gb()}}var nv=new Set([".avif",".jpeg",".jpg",".png",".webp"]),rv=[320,640,960,1280,1920],vo="/_stx/images",sv=`stx:${vo}:alpha-1`,iv=`stx:${vo}:opaque-1`,ov=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Oa;function av(v,_){let k=ln.dirname(Bun.resolveSync(v,_));while(k!==ln.dirname(k)){let R=ln.join(k,"package.json");if(gn.existsSync(R)){let T=JSON.parse(gn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=ln.dirname(k)}return}function og(){if(Oa!==void 0)return Oa;let v;try{v=ln.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Oa=ov.map((_)=>{let k;try{k=v?av(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Oa}var ag=Symbol.for("stx.image-delivery");function wo(){let v=globalThis;return v[ag]??={catalog:new Map,transparent:new Set},v[ag]}var cg=new Set;function cv(v){return`/${v.split(ln.sep).map(encodeURIComponent).join("/")}`}function lv(v){let _=ln.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=fg("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function lg(v,_=`stx:${vo}`){let k=(R)=>`${vo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=ln.join(v,R);try{let B=await gn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=ln.join(v,R);await gn.promises.mkdir(ln.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await gn.promises.writeFile(z,T),await gn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function pg(v,_=v){let k=await gn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=ln.join(_,T.name);if(T.isDirectory()){R.push(...await pg(v,B));continue}if(!T.isFile()||!nv.has(ln.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:ln.relative(v,B)})}return R}function ug(v,_){return v.map((k)=>({key:cv(k.relativePath),input:k.absolutePath,name:lv(k.relativePath),...uv(k.absolutePath)?{options:{storage:_}}:{}}))}function uv(v){return ql(v)==="possible"}function dv(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function fv(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let F=z.variants.filter((H)=>H.format==="png").sort((H,q)=>H.width-q.width)[0];try{let H=await ev(new Uint8Array(await gn.promises.readFile(F?.path??z.fallback.path)));if(dv(H.data))k.add(B)}catch{k.add(B)}}));return k}function pv(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((F)=>F.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((F)=>{let H;try{return H=gn.openSync(F.path,"r"),!Hl(Ta(H,0,32))}catch{return!0}finally{if(H!==void 0)gn.closeSync(H)}}))continue;if(T.variants=T.variants.filter((F)=>F.format!=="webp"),delete T.sources.webp,k.push(R),!cg.has(R))cg.add(R),console.warn(`[stx-images] ${R} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function gv(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await tv(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Zl(v){return ln.join(v,"undecodable.json")}function mv(v){try{let _=gn.readFileSync(Zl(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function hv(v,_){try{gn.mkdirSync(ln.dirname(Zl(v)),{recursive:!0}),gn.writeFileSync(Zl(v),JSON.stringify(_))}catch{}}function dg(v){try{let _=gn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function gg(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 xs(v){let _=gg(v);return _?wo().catalog.get(_):void 0}function Ss(v){let _=gg(v);return _?wo().transparent.has(_):!1}function ks(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function gd(v){let _=xs(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ks(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:Ss(v)?void 0:_.placeholder?.dataUrl}}function lr(){let v=wo();v.catalog=new Map,v.transparent=new Set}function yv(v){let _=wo();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function md(v,_,k={}){if(!v||!gn.existsSync(v))return lr(),{count:0,fingerprint:""};if(k.offThread){let Q=await Xl("delivery",{publicDir:v,outputDir:_});if(Q!==Da)return yv(Q.state),Q.result}let R=await pg(v);if(R.length===0)return lr(),{count:0,fingerprint:""};let T=mv(_),B=R.filter((Q)=>{let ce=T[Q.relativePath];if(!ce)return!0;let ue=dg(Q.absolutePath);return!ue||ue.mtimeMs!==ce.mtimeMs||ue.size!==ce.size});if(B.length===0)return lr(),{count:0,fingerprint:""};let z=lg(ln.join(_,"_stx","images"),`${sv}:${og()}`),F={outDir:ln.join(_,"_stx","images"),storage:lg(ln.join(_,"_stx","images"),`${iv}:${og()}`),baseUrl:vo,widths:rv,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},H=B,q;try{q=await ig({...F,entries:ug(B,z)})}catch(Q){if(H=await gv(B),H.length===B.length)throw Q;let ce=new Set(H.map((le)=>le.relativePath)),ue=!1;for(let le of B){if(ce.has(le.relativePath))continue;let pe=dg(le.absolutePath);if(!pe)continue;T[le.relativePath]=pe,ue=!0}if(ue)hv(_,T);if(H.length===0)return lr(),{count:0,fingerprint:""};q=await ig({...F,entries:ug(H,z)})}let K=await fv(q.entries),G=pv(q.entries,K),ee=wo();ee.catalog=new Map(Object.entries(q.entries)),ee.transparent=K;let ae=K.size===0&&G.length===0?q.fingerprint:fg("sha256").update(q.fingerprint).update(JSON.stringify({transparent:[...K].sort(),droppedWebp:G.sort()})).digest("hex");return{count:H.length,fingerprint:ae}}var xv=new Map;function Gl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return xv.get(_)}var bv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Jl=[320,640,768,1024,1280,1536,1920];function nn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function rn(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 R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Yl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=bv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let F=Number.parseInt(T);if(!Number.isNaN(F))k.push(`(max-width: ${F}px) ${B}`)}}else k.push(R);return k.join(", ")}function Ql(v,_,k,R){return _.map((T)=>`${So(v,T,void 0,k,R)} ${T}w`).join(", ")}function vv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${So(v,z,void 0,R,T)} ${B}x`}).join(", ")}function So(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function wv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function Sv(v,_,k="#e5e7eb"){let R=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(R)}`}var eu={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=rn(v,"src")||"",T=xs(R),B=rn(v,"alt")||"",z=rn(v,"width")||(T?String(T.source.width):void 0),F=rn(v,"height")||(T?String(T.source.height):void 0),H=rn(v,"sizes"),q=rn(v,"srcset"),K=rn(v,"densities"),G=rn(v,"format"),ee=Ss(R)||Gl(R)?.transparent===!0,ae=rn(v,"placeholder")||(T&&!ee?"thumbhash":void 0),Q=rn(v,"placeholderColor")||"#e5e7eb",ce=rn(v,"provider"),ue=rn(v,"class")||rn(v,"className")||"",le=rn(v,"style")||"",pe=rn(v,"objectFit")||rn(v,"fit"),de=rn(v,"objectPosition")||rn(v,"position"),Re=rn(v,"quality"),be=Ma(v,"lazy",!0),xe=Ma(v,"preload",!1),Ie=Ma(v,"priority",!1),Me=rn(v,"loading"),Ne=rn(v,"decoding")||"async",je=!!T||Ma(v,"picture",!1)||!!G,Le=z?Number.parseInt(z):void 0,De=F?Number.parseInt(F):void 0,ze=q||"",Fe="";if(T)ze=T.sources[T.fallback.format]||"",Fe=H?Yl(H):"100vw";else if(!ze&&H&&ce&&ce!=="local"&&ce!=="static")ze=Ql(R,Jl,ce,G),Fe=Yl(H);else if(!ze&&K){let yt=K.split(/\s+/).map((dt)=>Number.parseFloat(dt.replace("x","")));ze=vv(R,yt,Le,ce,G)}else if(H)Fe=Yl(H);let Ve=[];if(le)Ve.push(le);if(pe)Ve.push(`object-fit:${pe}`);if(de)Ve.push(`object-position:${de}`);if(Le&&De)Ve.push(`aspect-ratio:${Le}/${De}`);let Be=[],He=ae==="blur"||ae==="color"||ae==="thumbhash";if(He&&!ee){let yt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:Q}:Gl(R);if(yt&&ae==="color")Ve.push(`background-color:${yt.color}`),Be.push("backgroundColor");else if(yt)Ve.push(`background-color:${yt.color}`),Ve.push(`background-image:url(${yt.dataUrl})`),Ve.push("background-size:cover"),Ve.push("background-repeat:no-repeat"),Be.push("backgroundColor","backgroundImage");else{let dt=Sv(Le||16,De||9,Q);Ve.push(`background-image:url(${dt})`),Ve.push("background-size:cover"),Ve.push("background-repeat:no-repeat"),Be.push("backgroundImage")}}else if(!He&&ae&&ae!=="empty"&&ae!=="none")Ve.push(`background-image:url(${nn(ae)})`),Ve.push("background-size:cover"),Ve.push("background-repeat:no-repeat"),Be.push("backgroundImage");let vt=T?.fallback.url||So(R,Le,De,ce,G),bt=[];if(bt.push(`src="${nn(Hi(vt,"fetched"))}"`),bt.push(`alt="${nn(B)}"`),z)bt.push(`width="${nn(z)}"`);if(F)bt.push(`height="${nn(F)}"`);let Et=Me||(Ie||xe?"eager":be?"lazy":"");if(Et)bt.push(`loading="${nn(Et)}"`);if(Ie)bt.push('fetchpriority="high"');if(bt.push(`decoding="${nn(Ne)}"`),ue)bt.push(`class="${nn(ue)}"`);if(Ve.length>0)bt.push(`style="${nn(Ve.join(";"))}"`);if(ze)bt.push(`srcset="${nn(Hi(ze,"fetched"))}"`);if(Fe)bt.push(`sizes="${nn(Fe)}"`);let ft=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Be.length>0){let yt=typeof v.static.onload==="string"?v.static.onload:"",dt=wv(Be)+(yt?`;${yt}`:"");bt.push(`onload="${nn(dt)}"`),ft.add("onload")}bt.push(...zr(v,ft)),bt.push(...Wr(v,ft));let wt=`<img ${bt.join(" ")} />`,Ct="";if(xe){let dt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";Ct=`<link rel="preload" as="image" href="${nn(vt)}"${dt?` type="${dt}"`:""}${ze?` imagesrcset="${nn(ze)}"`:""}${Fe?` imagesizes="${nn(Fe)}"`:""} />
|
|
2310
|
-
`}if(je){let yt=[];if(T)for(let dt of ks(T))yt.push(`<source type="image/${dt.format}" srcset="${nn(dt.srcset)}"${Fe?` sizes="${nn(Fe)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let dt=So(R,Le,De,ce,"avif"),$t=ze?Ql(R,Jl,ce,"avif"):`${dt}`;yt.push(`<source type="image/avif" srcset="${nn($t)}"${Fe?` sizes="${nn(Fe)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let dt=So(R,Le,De,ce,"webp"),$t=ze?Ql(R,Jl,ce,"webp"):`${dt}`;yt.push(`<source type="image/webp" srcset="${nn($t)}"${Fe?` sizes="${nn(Fe)}"`:""} />`)}return`${Ct}<picture>
|
|
2311
|
-
${yt.join(`
|
|
2312
|
-
`)}
|
|
2313
|
-
${wt}
|
|
2314
|
-
</picture>`}return`${Ct}${wt}`}};var mg="/images/safe-image-default.svg";function $o(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ti(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var $v=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${mg}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,tu={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let R=ti(v,"src")||"",T=ti(v,"alt")||"",B=ti(v,"fallback")||mg,z=ti(v,"class")||ti(v,"className")||"",F=ti(v,"fallbackClassName")||"",H=[];if(H.push(`src="${$o(R)}"`),H.push(`alt="${$o(T)}"`),z)H.push(`class="${$o(z)}"`);if(H.push(`data-fallback="${$o(B)}"`),F)H.push(`data-fallback-class="${$o(F)}"`);H.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);H.push(...zr(v,q)),H.push(...Wr(v,q));let K=`<img ${H.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${$v}${K}`;return K}};function nu(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function _o(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Na(v,_,k){let R=_o(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var ru={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let R=nu(_o(v,"color")||"#6366f1"),T=nu(_o(v,"initialColor")||_o(v,"initial-color")||""),B=nu(_o(v,"height")||"3px"),z=Na(v,"duration",2000),F=Na(v,"throttle",200),H=Na(v,"zIndex",999999)||Na(v,"z-index",999999),q=T?`linear-gradient(to right, ${T}, ${R})`:R;return`
|
|
2315
|
-
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${B};background:${q};z-index:${H};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
2316
|
-
<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>
|
|
2317
|
-
</div>
|
|
2318
|
-
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
2319
|
-
<script>
|
|
2320
|
-
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${F})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
2321
|
-
</script>`}};function yg(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function _v(v,_,k){let R=yg(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var hg={"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%)"},su={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let R=Zt(yg(v,"position")||"top-right"),T=_v(v,"max",5),B=hg[R]||hg["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${R}" data-stx-toast-max="${T}" style="position:fixed;${B};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
2322
|
-
<style>
|
|
2323
|
-
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
2324
|
-
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
2325
|
-
@keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
|
|
2326
|
-
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
2327
|
-
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
2328
|
-
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
2329
|
-
</style>`}};function ja(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var xg={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)"},iu={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let R=ja(v,"id");if(!R)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Zt(R),B=ja(v,"size")||"md",z=ja(v,"closeOnBackdrop")!=="false",F=ja(v,"closeOnEscape")!=="false",H=xg[B]||xg.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${z}" data-close-escape="${F}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
2330
|
-
<div class="stx-modal-panel" style="${H};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)">
|
|
2331
|
-
<div style="padding:1.5rem">${_}</div>
|
|
2332
|
-
</div>
|
|
2333
|
-
</div>
|
|
2334
|
-
<style>
|
|
2335
|
-
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2336
|
-
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2337
|
-
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2338
|
-
</style>`}};function ni(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var bg={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ou={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let R=ni(v,"id");if(!R)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Zt(R),B=ni(v,"side")||"right",z=ni(v,"size")||"md",F=ni(v,"closeOnBackdrop")!=="false",H=ni(v,"closeOnEscape")!=="false",q=ni(v,"overlay")!=="false",K=bg[z]||bg.md,G=B==="left",ee=G?"left:0":"right:0",ae=G?"translateX(-100%)":"translateX(100%)",Q=G?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${F}" data-close-escape="${H}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
|
|
2339
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${ee};width:${K};max-width:100vw;transform:${ae};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">
|
|
2340
|
-
<div style="padding:1.5rem">${_}</div>
|
|
2341
|
-
</div>
|
|
2342
|
-
</div>
|
|
2343
|
-
<style>
|
|
2344
|
-
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2345
|
-
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2346
|
-
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2347
|
-
</style>`}};import{existsSync as kv,readFileSync as Ev}from"fs";var La=new Map,vg=new Set;function Cv(v){if(vg.has(v))return;vg.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 Rv(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(kv(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return d.resolve(k)}catch{}return null}function Av(v){if(La.has(v))return La.get(v);let _=Rv(v);if(!_)return Cv(v),null;try{let k=JSON.parse(Ev(_,"utf8"));return La.set(v,k.icons),k.icons}catch{return null}}function ri(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 au={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=ri(v,"name")??ri(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let pe=R.split(":");T=pe[0],B=pe[1]}let z=Zt(ri(v,"size")||"24"),F=Zt(ri(v,"color")||"currentColor"),H=Zt(ri(v,"class")||""),q=Zt(ri(v,"style")||""),K=La.get(T)??Av(T);if(!K)return`<!-- Icon: collection "${T}" not loaded -->`;let G=K[B];if(!G)return`<!-- Icon: "${B}" not found in ${T} -->`;let ee=G.width||24,ae=G.height||24,Q=`0 0 ${ee} ${ae}`,ce=G.body;if(F!=="currentColor")ce=ce.replace(/currentColor/g,F);let ue=H?` class="${H}"`:"",le=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${z}" height="${z}" viewBox="${Q}" fill="none"${ue}${le}>${ce}</svg>`}};function cu(){return`
|
|
2348
|
-
(function(){
|
|
2349
|
-
var tip=null,hideTimer=null,currentEl=null;
|
|
2350
|
-
|
|
2351
|
-
function createTip(){
|
|
2352
|
-
tip=document.createElement("div");
|
|
2353
|
-
tip.id="stx-tooltip";
|
|
2354
|
-
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)";
|
|
2355
|
-
var arrow=document.createElement("div");
|
|
2356
|
-
arrow.className="stx-tip-arrow";
|
|
2357
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
|
|
2358
|
-
tip.appendChild(arrow);
|
|
2359
|
-
var text=document.createElement("span");
|
|
2360
|
-
text.className="stx-tip-text";
|
|
2361
|
-
tip.appendChild(text);
|
|
2362
|
-
document.body.appendChild(tip);
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
function position(el){
|
|
2366
|
-
var pos=el.getAttribute("x-tooltip-position")||"top";
|
|
2367
|
-
var r=el.getBoundingClientRect();
|
|
2368
|
-
var sy=window.scrollY,sx=window.scrollX;
|
|
2369
|
-
tip.style.display="block";
|
|
2370
|
-
tip.style.opacity="0";
|
|
2371
|
-
// Force layout so we can measure
|
|
2372
|
-
var tw=tip.offsetWidth,th=tip.offsetHeight;
|
|
2373
|
-
var arrow=tip.querySelector(".stx-tip-arrow");
|
|
2374
|
-
var left,top;
|
|
2375
|
-
|
|
2376
|
-
if(pos==="top"){
|
|
2377
|
-
left=r.left+r.width/2-tw/2+sx;
|
|
2378
|
-
top=r.top-th-8+sy;
|
|
2379
|
-
if(top-sy<0){pos="bottom";}
|
|
2380
|
-
}
|
|
2381
|
-
if(pos==="bottom"){
|
|
2382
|
-
left=r.left+r.width/2-tw/2+sx;
|
|
2383
|
-
top=r.bottom+8+sy;
|
|
2384
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
|
|
2385
|
-
}
|
|
2386
|
-
if(pos==="left"){
|
|
2387
|
-
left=r.left-tw-8+sx;
|
|
2388
|
-
top=r.top+r.height/2-th/2+sy;
|
|
2389
|
-
if(left-sx<0){pos="right";}
|
|
2390
|
-
}
|
|
2391
|
-
if(pos==="right"){
|
|
2392
|
-
left=r.right+8+sx;
|
|
2393
|
-
top=r.top+r.height/2-th/2+sy;
|
|
2394
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
// Set arrow for top/left after potential flips
|
|
2398
|
-
if(pos==="top"){
|
|
2399
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
|
|
2400
|
-
}
|
|
2401
|
-
if(pos==="left"){
|
|
2402
|
-
arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
// Clamp horizontal
|
|
2406
|
-
if(left<sx+4) left=sx+4;
|
|
2407
|
-
if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
|
|
2408
|
-
|
|
2409
|
-
tip.style.left=left+"px";
|
|
2410
|
-
tip.style.top=top+"px";
|
|
2411
|
-
tip.style.opacity="1";
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
function showTip(el){
|
|
2415
|
-
if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
|
|
2416
|
-
if(!tip) createTip();
|
|
2417
|
-
var text=el.getAttribute("x-tooltip");
|
|
2418
|
-
if(!text) return;
|
|
2419
|
-
tip.querySelector(".stx-tip-text").textContent=text;
|
|
2420
|
-
currentEl=el;
|
|
2421
|
-
position(el);
|
|
2422
|
-
}
|
|
2423
|
-
|
|
2424
|
-
function hideTip(){
|
|
2425
|
-
if(!tip) return;
|
|
2426
|
-
tip.style.opacity="0";
|
|
2427
|
-
hideTimer=setTimeout(function(){
|
|
2428
|
-
if(tip) tip.style.display="none";
|
|
2429
|
-
currentEl=null;
|
|
2430
|
-
},150);
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
document.addEventListener("mouseover",function(e){
|
|
2434
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2435
|
-
if(el) showTip(el);
|
|
2436
|
-
});
|
|
2437
|
-
document.addEventListener("mouseout",function(e){
|
|
2438
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2439
|
-
if(el&&el===currentEl) hideTip();
|
|
2440
|
-
});
|
|
2441
|
-
document.addEventListener("focusin",function(e){
|
|
2442
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2443
|
-
if(el) showTip(el);
|
|
2444
|
-
});
|
|
2445
|
-
document.addEventListener("focusout",function(e){
|
|
2446
|
-
var el=e.target.closest("[x-tooltip]");
|
|
2447
|
-
if(el) hideTip();
|
|
2448
|
-
});
|
|
2449
|
-
})();
|
|
2450
|
-
`}function wg(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}function Sg(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),R=v.match(k);if(!R)return{region:null,rest:v};return{region:R[2],rest:v.replace(R[0],"")}}var lu={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=Sg(_,"fallback"),T=R.rest,B=Sg(T,"error"),z=B.rest,F=R.region??wg(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',H=B.region??wg(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${F}</div><div data-stx-suspense-error hidden>${H}</div><div data-stx-suspense-content hidden>${z}</div></div>`}};function Ba(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}var uu={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let R=(Ba(v,"name")||"v").replace(/["'<>]/g,""),T=(Ba(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",B=Ba(v,"class"),z=Ba(v,"id"),F=[`data-stx-transition-group="${R}"`,B?`class="${B}"`:"",z?`id="${z}"`:""].filter(Boolean).join(" ");return`<${T} ${F}>${_}</${T}>`}};function $g(v=Hs){v.registerBuiltin(Vl),v.registerBuiltin(eu),v.registerBuiltin(tu),v.registerBuiltin(ru),v.registerBuiltin(su),v.registerBuiltin(iu),v.registerBuiltin(ou),v.registerBuiltin(au),v.registerBuiltin(lu),v.registerBuiltin(uu)}var _g=new Map;function Tv(v){let _=_g.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),_g.set(v.source,_);return _}var kg=new WeakMap;function Eg(v){let _=kg.get(v);if(!_)_=new Set([...v].map((R)=>R.toLowerCase())),kg.set(v,_);let k=_;return(R)=>!/[a-z]/.test(R)&&k.has(R.toLowerCase())}function Iv(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function Cg(v,_,k){let R=[],T=0,B=typeof k==="function"?k:k?(z)=>k.has(z.toLowerCase()):void 0;while(T<v.length){let z=v.indexOf("<",T);if(z===-1)break;let F=Tv(_);F.lastIndex=z+1;let H=F.exec(v);if(!H){T=z+1;continue}let q=H[1];if(B&&B(q)){let ue=z+1+q.length;while(ue<v.length&&v[ue]!==">")ue++;T=ue+1;continue}let K=z+1+q.length,G=null,ee=K,ae=-1,Q=!1;while(K<v.length){let ue=v[K];if(G){if(ue==="\\"&&K+1<v.length){K+=2;continue}if(ue===G)G=null;K++;continue}if(ue==='"'||ue==="'"){G=ue,K++;continue}if(ue==="/"&&K+1<v.length&&v[K+1]===">"){ae=K+2,Q=!0;break}if(ue===">"){ae=K+1;break}K++}if(ae===-1){T=z+1;continue}let ce=v.slice(ee,Q?ae-2:ae-1).trim();if(Q)R.push({fullMatch:v.slice(z,ae),tagName:q,attributes:ce,content:"",startIndex:z,endIndex:ae,isSelfClosing:!0}),T=ae;else{let ue=`<${q}`,le=`</${q}>`,pe=1,de=ae,Re=-1;while(pe>0&&de<v.length){let Ie=v.indexOf(ue,de),Me=v.indexOf(le,de);if(Me===-1)break;if(Ie!==-1&&Ie<Me){let Ne=v[Ie+ue.length];if(Ne===" "||Ne===">"||Ne==="/"||Ne===`
|
|
2451
|
-
`||Ne==="\t"){let je=Iv(v,Ie+ue.length);if(v[je-1]!=="/")pe++;de=je+1}else de=Ie+ue.length}else{if(pe--,pe===0){Re=Me;break}de=Me+le.length}}if(Re===-1){T=ae;continue}let be=v.slice(ae,Re),xe=Re+le.length;R.push({fullMatch:v.slice(z,xe),tagName:q,attributes:ce,content:be,startIndex:z,endIndex:xe,isSelfClosing:!1}),T=xe}}return R}function du(v){return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Rg(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 fu(v,_){let k=0,R="",T=_;while(T<v.length){let B=v[T];if(R){if(B==="\\")T++;else if(B===R)R=""}else if(B==='"'||B==="'"||B==="`")R=B;else if(B==="{")k++;else if(B==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function Ag(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(fu(_,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"]),Dv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ov(v){return pu(v).map((_)=>[_.start,_.end])}function pu(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",B=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!B)continue;let z=Ur(B[1]??B[2]??B[3]??""),F=R.index,H=F+R[0].length,q=R[1].toLowerCase();if(R[0].endsWith("/>")||Dv.has(q)){_.push({start:F,end:H,names:z});continue}let K=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");G.lastIndex=H;let ee=1,ae=H,Q;while((Q=G.exec(v))!==null)if(Q[0].startsWith("</")){if(ee--,ee===0){ae=Q.index+Q[0].length;break}}else if(!Q[0].endsWith("/>"))ee++;_.push({start:F,end:ae,names:z})}return _}function Tg(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>Tg(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Ig(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,R=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],B;while((B=R.exec(v))!==null)T.push([B.index,B.index+B[0].length]);T.push(...Ov(v));let z=new Set([...Ar(_),...Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]]);function F(ee){return T.some(([ae,Q])=>ee>=ae&&ee<Q)}let H=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,q=[],K=new Map,G=256;while((B=H.exec(k))!==null){if(F(B.index))continue;let ee=B[0],ae=B[2];if(!ae||!ae.includes(":"))continue;let Q=/(?:^|\s)data-native(?:\s|=|$)/i.test(ae.replace(/"[^"]*"|'[^']*'/g,"")),ce=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,ue,le=ae,pe=!1;while((ue=ce.exec(ae))!==null){let de=ue[1],Re=ue[2];if(na(de))continue;if(ne(Re,z))continue;if(Re.includes("()")&&!Re.includes(".get(")||Re.includes("$store")||Re.includes("$ref"))continue;try{let be=Object.keys(_),xe=Object.values(_),Ie=Re.match(/^([a-zA-Z_$][\w$]*)/);if(Ie&&!be.includes(Ie[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Ie[1]))continue;let Me=JSON.stringify([be,Re]),Ne=K.get(Me);if(!Ne){if(Ne=Function(...be,`return (${Re})`),K.size>=G)K.clear();K.set(Me,Ne)}let je=Ne(...xe);if(de==="class"){let Le=Tg(je);if(Le){let De=le.match(/\sclass="([^"]*)"/);if(De)le=le.replace(De[0],` class="${De[1]} ${Le}"`);else le=le.replace(ue[0],` class="${Le}"`)}else le=le.replace(ue[0],"");pe=!0;continue}if(Pv.has(de)){if(je)le=le.replace(ue[0],` ${de}`);else le=le.replace(ue[0],"");pe=!0;continue}if(je===null||je===void 0||je===!1)le=le.replace(ue[0],"");else{let De=(Q&&typeof je==="object"?JSON.stringify(je):String(je)).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");le=le.replace(ue[0],` ${de}="${De}"`)}pe=!0}catch{continue}}if(pe){let de=B[3]?" /":"",be=`<${B[1]}${le}${de}>`;q.push({start:B.index,end:B.index+ee.length,replacement:be})}}if(q.length>0){let ee=Array(q.length*2+1),ae=0;for(let Q=0;Q<q.length;Q++){let{start:ce,end:ue,replacement:le}=q[Q];ee[Q*2]=k.slice(ae,ce),ee[Q*2+1]=le,ae=ue}ee[q.length*2]=k.slice(ae),k=ee.join("")}return k}var J=["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 Ug from"path";import mu from"fs";import Eo from"path";function Pg(v,_,k,R){let T=0;for(let B=_;B<v.length;B++)if(v[B]===k)T++;else if(v[B]===R&&!(R===">"&&v[B-1]==="=")){if(--T===0)return B}return-1}function Mv(v){let _=s(v),k=0,R=0,T=[];for(let B=0;B<_.length;B++)if("([{".includes(_[B]))k++;else if(")]}".includes(_[B]))k--;else if(_[B]===","&&k===0)T.push(v.slice(R,B).trim()),R=B+1;return T.push(v.slice(R).trim()),T}function gu(v,_){let k=s(v),R=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(R)){let B=T.index+T[0].length,z="";if(k[B]==="<"){let H=Pg(k,B,"<",">");if(H<0)continue;z=v.slice(B+1,H),B=H+1;while(/\s/.test(k[B]||"")&&B<k.length)B++}if(k[B]!=="(")continue;let F=Pg(k,B,"(",")");if(F>=0)return{type:z,args:Mv(v.slice(B+1,F))}}return null}var Dg=`
|
|
2452
|
-
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;
|
|
2453
|
-
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
2454
|
-
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>;
|
|
2455
|
-
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
2456
|
-
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
2457
|
-
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]> };
|
|
2458
|
-
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
2459
|
-
`;function Og(v,_){let k=[],R={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),B=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(ee,ae,Q,ce,ue)=>{if(T.slice(ue,ue+6)!=="import")return ee;if(ce.endsWith(".stx"))return"";let le=`${_}Import${k.length}`;if(k.push(`import * as ${le} from ${JSON.stringify(ce)};`),ae.startsWith("*"))return`import ${ae.replace(/^\*\s+as\s+/,"")} = ${le};`;if(!ae.startsWith("{"))return`import ${ae} = ${le}.default;`;return ae.slice(1,-1).split(",").map((pe)=>{let[de,Re=de]=pe.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!de)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(ce)&&de in R)R[de].push(Re);return`import ${Re} = ${le}.${de};`}).join(`
|
|
2460
|
-
`)}),z=gu(v,R.defineProps),F=gu(v,R.defineEmits),H=gu(v,R.withDefaults);if(!z&&!F)return{declarations:"",props:null,events:null};let q=[],K=null,G=null;if(z){q.push(`const __options = (${z.args[0]||"{}"}) as const;`),q.push(`const __defaults = (${H?.args[1]||"{}"});`);let ee=z.type||"__StxOptions<typeof __options>";q.push(`export type __StxProps = __StxDefaults<${ee}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),K=`${_}.__StxProps`}if(F)q.push(`const __events = (${F.args[0]||"[]"}) as const;`),q.push(`export type __StxEvents = ${F.type||"Record<(typeof __events)[number], any[]>"};`),G=`${_}.__StxEvents`;return{declarations:`${k.join(`
|
|
2461
|
-
`)}
|
|
2462
|
-
namespace ${_} {
|
|
2463
|
-
${B}
|
|
2464
|
-
${q.join(`
|
|
2465
|
-
`)}
|
|
2466
|
-
}`,props:K,events:G}}var ko=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Cn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...ko].some((_)=>_.toLowerCase()===v.toLowerCase());return ko.has(v)||/[A-Z]/.test(v)}function*Nv(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let R=_.lastIndex,T=[];while(R<v.length){while(/\s/.test(v[R]||""))R++;if(v[R]===">"||v.slice(R,R+2)==="/>"){R+=v[R]===">"?1:2;break}let B=/^[^\s=/>]+/.exec(v.slice(R))?.[0];if(!B){R++;continue}let z=R;R+=B.length;while(/\s/.test(v[R]||""))R++;if(v[R]!=="="){T.push({name:B,value:!0,offset:z,braced:!1});continue}R++;while(/\s/.test(v[R]||""))R++;let F=v[R],H=F==="{",q=F==='"'||F==="'";if(q||H)R++;let K=R;if(H){let G=s(v.slice(R)),ee=1,ae=0;for(;ae<G.length;ae++){if(G[ae]==="{")ee++;if(G[ae]==="}"&&--ee===0)break}R+=ae}else if(q)while(R<v.length&&v[R]!==F)R++;else while(R<v.length&&!/[\s/>]/.test(v[R]))R++;if(T.push({name:B,value:v.slice(K,R),offset:K,braced:H}),q||H)R++}_.lastIndex=R,yield{name:k[1],offset:k.index,attributes:T}}}function Mg(v,_,k){let R=[],T=[Dg,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],B=new Map,z=new Map,F=new Map,H=k.scriptCode(v,k.filePath),q=s(H);for(let Q of H.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(q.slice(Q.index,Q.index+6)!=="import")continue;let ce=Q[2],ue=Eo.isAbsolute(ce)||ce.startsWith(".")?Eo.resolve(Eo.dirname(k.filePath),ce):Xo(ce,Eo.dirname(k.filePath));if(!ue)continue;let le=ue.endsWith(".stx")?ue:mu.existsSync(`${ue}.stx`)?`${ue}.stx`:void 0,pe=le?null:Ko(ue,!1),de=Q[1].startsWith("{")?Q[1].slice(1,-1).split(","):[Q[1]];for(let Re of de){let[be,xe=be]=Re.trim().split(/\s+as\s+/),Ie=le||pe?.get(be)||pe?.get(be.toLowerCase());if(Ie)F.set(xe,Ie),F.set(xe.toLowerCase(),Ie),F.set(xe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ie)}}for(let Q of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let ce of Q[1].matchAll(/['"]([^'"]+)['"]/g)){let ue=Zo(ce[1],k.filePath,k).find((le)=>mu.statSync(le,{throwIfNoEntry:!1})?.isFile());if(ue)F.set(Eo.basename(ce[1]).replace(/\.stx$/,""),ue)}let K={__importedComponents:F},G=new Map,ee=(Q,ce,ue)=>{let le=v.slice(0,Q);return{code:ce,offset:Q,attribute:ue,anchor:!0,kind:"directive",line:le.split(`
|
|
2467
|
-
`).length,column:Q-le.lastIndexOf(`
|
|
2468
|
-
`)}},ae=(Q,ce,ue)=>R.push({expression:Q,statement:{text:ce+Q.code+ue,prefixLength:ce.length}});for(let Q of Nv(_)){if(Cn(Q.name)||Q.name==="component")continue;let ce=Cd(Q.name,k.filePath,k,K);if(!ce)continue;let ue=G.get(ce);if(!ue){let pe;try{pe=k.readComponent?k.readComponent(ce):mu.readFileSync(ce,"utf8")}catch{continue}if(pe===void 0)continue;z.set(ce,pe),ue=Og(k.scriptCode(pe,ce),`__StxComponent${G.size}`),G.set(ce,ue),T.push(ue.declarations)}let le=[];for(let pe of Q.attributes){let{name:de,offset:Re}=pe,be=pe.value===!0?"true":pe.value;if(de.startsWith("@")||de.startsWith("v-on:")){if(ue.events&&pe.value!==!0)B.set(Re,`__StxEvent<${ue.events}, ${JSON.stringify(de.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let xe=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(de);if(de.startsWith("v-")&&!de.startsWith("v-bind:")&&!xe)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(de))continue;let Ie=(xe?xe[1]||"modelValue":de.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(je,Le)=>Le.toUpperCase());if(le.push(Ie),!ue.props)continue;let Ne=de.startsWith(":")||de.startsWith("v-bind:")||!!xe||pe.braced?be:pe.value!==!0?JSON.stringify(be):"true";ae(ee(Re,Ne,de),";void ((",`) satisfies __StxProp<${ue.props}, ${JSON.stringify(Ie)}>);`)}if(ue.props){let pe=[...new Set(le)].map((Re)=>`${JSON.stringify(Re)}: undefined as any`).join(", "),de=ee(Q.offset,`<${Q.name}>`);R.push({expression:de,statement:{text:`;void ({ ${pe} } satisfies ${ue.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
|
|
2469
|
-
`):"",checks:R,events:B,dependencies:z}}var Ng=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function jv(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Qe(v){let _=[],k=jv(v);Ng.lastIndex=0;let R;while((R=Ng.exec(k))!==null){let T=(R[1]||"").trim(),B=(R[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=(R[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,F=R.index+B,H=R.index+R[0].length-z,q=v.slice(F,H);if(/\bsrc\s*=/.test(T))continue;let K=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(K&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(K[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",ee=Co(v,F);_.push({kind:G,code:q,startLine:ee,startColumn:Ro(v,F),offset:F,attrs:T})}return _}function Co(v,_){let k=1;for(let R=0;R<_&&R<v.length;R++)if(v.charCodeAt(R)===10)k++;return k}function Ro(v,_){let k=v.lastIndexOf(`
|
|
2470
|
-
`,_-1)+1;return _-k+1}function za(v){let _=v.split(""),k=(T,B)=>{for(let z=T;z<B&&z<_.length;z++)if(_[z]!==`
|
|
2471
|
-
`)_[z]=" "},R=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of R){T.lastIndex=0;let B;while((B=T.exec(v))!==null)k(B.index,B.index+B[0].length)}return _.join("")}function Lv(v){let _=0,k="";for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k="";continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{"){_++;continue}if(T===")"||T==="]"||T==="}"){_--;continue}if(T==="|"&&_===0){if(v[R+1]==="|"){R++;continue}if(v[R-1]==="|")continue;return v.slice(0,R)}}return v}var Hg=new Set([":for","x-for","v-for"]),Wa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,hu="__stx_interpolated",jg="__StxElement",qg="__StxTemplateValue",Bv=`type ${qg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Lg(v){return v.replace(/\{\{[\s\S]*?\}\}/g,hu).replace(/\{!![\s\S]*?!!\}/g,hu)}function Cs(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
|
|
2472
|
-
`).length-1,R=_.length-k;return`0${" ".repeat(Math.max(0,R-1))}${`
|
|
2473
|
-
`.repeat(k)}`})}var zv=["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"],Wv=new RegExp(String.raw`^[ \t]*@(?:${zv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function _s(v){return v.replace(Wv,(_)=>_.replace(/[^\n]/g," "))}var Bg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Dc(v){let _=za(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let F=T[2]??T[4]??"",H=T[2]!==void 0?2:3,q=Lv(F);if(!q.trim())continue;let K=T.index+H+(q.length-q.trimStart().length);k.push({code:q.trim(),line:Co(_,K),column:Ro(_,K),offset:K,kind:"interpolation"})}let B=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=B.exec(_))!==null){let z=T.index+T[0].length-1,F=0,H=z;for(;H<_.length;H++){let ee=_[H];if(ee==="(")F++;else if(ee===")"){if(F--,F===0)break}}if(F!==0)continue;let q=_.slice(z+1,H),K=q.trim();if(B.lastIndex=H+1,!K)continue;let G=z+1+(q.length-q.trimStart().length);k.push({code:K,line:Co(_,G),column:Ro(_,G),offset:T.index,kind:"condition"})}Wa.lastIndex=0;while((T=Wa.exec(_))!==null){let z=T[1],F=T[3]??"",H=z.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Bg.has(H)||Bg.has(z))continue;if(!F.trim())continue;let q=T.index+T[0].indexOf(T[2],T[0].indexOf(z)+z.length)+1;if(Hg.has(H)){let G=F.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let ee=F.slice(G.index+G[0].length),ae=G.index+G[0].length+(ee.length-ee.trimStart().length);k.push({code:Lg(ee.trim()),line:Co(_,q+ae),column:Ro(_,q+ae),offset:q+ae,kind:"directive",attribute:H});continue}let K=F.length-F.trimStart().length;k.push({code:Lg(F.trim()),line:Co(_,q+K),column:Ro(_,q+K),offset:q+K,kind:"directive",attribute:H})}return k.sort((z,F)=>z.line-F.line||z.column-F.column),k}var Fv=2000;function Vv(v,_){let k=0,R=Math.min(v.length,_+Fv);for(let T=_;T<R;T++){let B=v[T];if(B==="(")k++;else if(B===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function Uv(v){let _=new Map,k=(F,H)=>{let q=F.split(/[,[\]{}()\s]+/).filter(Boolean);for(let K of q){let G=K.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let ee=q.length===1?H:void 0,ae=_.get(G);if(!ae)_.set(G,{name:G,iterable:ee});else if(ae.iterable!==ee)ae.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(F)=>{let H=F.trim();return R.test(H)?H:void 0};for(let F of v.matchAll(/@for(?:each|else)\s*\(/g)){let H=Vv(v,F.index+F[0].length-1);if(H===null)continue;let q=Nt(H);if(!q)continue;k(q.itemVar.replace(/=>/g," "),T(q.arrayExpr))}for(let F of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(F[1],F[2]==="of"?T(F[3]):void 0);for(let F of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(F[1]);let B=za(v);Wa.lastIndex=0;let z;while((z=Wa.exec(B))!==null){let F=z[1].replace(/\..*$/,"");if(!Hg.has(F))continue;let H=z[3].match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;k(z[3].slice(0,H.index),T(z[3].slice(H.index+H[0].length)))}for(let F of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let H of F[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(H[1]);return[..._.values()].sort((F,H)=>F.name.localeCompare(H.name))}function ge(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let R of k[1].split(",")){let T=R.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var yu=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Hv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function bi(v=new Set){return[...yu.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Hv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
|
|
2474
|
-
`)}function vi(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Kg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,R=!1,T=new Set,B=s(v);while((k=_.exec(B))!==null){R=!0;for(let z of qv(k[1])){let F=z.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(F))T.add(F)}}return R?[...T]:null}function qv(v){let _=[],k=0,R="";for(let T of v){if(T===","&&k===0){_.push(R),R="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;R+=T}return _.push(R),_.filter((T)=>T.trim().length>0)}function Kv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],R=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
|
|
2475
|
-
`).map(()=>"").join(`
|
|
2476
|
-
`)));return{imports:k.join(`
|
|
2477
|
-
`),body:R}}function Xg(v){let _=s(v),k=Array(_.length),R=0;for(let F=0;F<_.length;F++){let H=_[F];if(H==="}"||H===")"||H==="]")R=Math.max(0,R-1);if(k[F]=R,H==="{"||H==="("||H==="[")R++}let T=[],B=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,z;while((z=B.exec(_))!==null){if(k[z.index]!==0)continue;let F=z[1],H=z[2],q;if(F==="interface"){let K=_.indexOf("{",z.index);if(K===-1)continue;let G=0;q=-1;for(let ee=K;ee<_.length;ee++)if(_[ee]==="{")G++;else if(_[ee]==="}"&&--G===0){q=ee+1;break}if(q===-1)continue}else{let K=0;q=_.length;for(let G=_.indexOf("=",z.index)+1;G<_.length;G++){let ee=_[G];if(ee==="{"||ee==="["||ee==="("||ee==="<")K++;else if(ee==="}"||ee==="]"||ee===")"||ee===">")K--;else if(K<=0&&(ee===";"||ee===`
|
|
2478
|
-
`&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){q=ee===";"?G+1:G;break}}}T.push({name:H,text:v.slice(z.index,q).replace(/^[ \t]*export[ \t]+/,"")}),B.lastIndex=q}return T}function Xv(v){return new Set(Xg(v).map((_)=>_.name))}function wi(v,_=""){let k=Kg(v),R=Xv(_),T=Xg(v).filter((q)=>!R.has(q.name)).map((q)=>q.text);if(!k){let q=ge(v).filter((K)=>!Ui(_,K));if(q.length===0&&T.length===0)return"";return["",`// ${Zv}`,...T,...q.map((K)=>`declare var ${K}: any`)].join(`
|
|
2479
|
-
`)}if(k.length===0)return T.length>0?["",`// ${zg}`,...T].join(`
|
|
2480
|
-
`):"";let{imports:B,body:z}=Kv(v),F=z.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),H=["",`// ${zg}`];if(B)H.push(B);return H.push(...T),H.push(`async function ${Wg}() {`,F,` return { ${k.join(", ")} }`,"}",`type ${Fg} = Awaited<ReturnType<typeof ${Wg}>>`,...k.map((q)=>`declare var ${q}: ${Fg}[${JSON.stringify(q)}]`)),H.join(`
|
|
2481
|
-
`)}function xu(v){let k=s(v).split(""),R=0;for(let T=0;T<k.length;T++){let B=k[T];if(B==="{"||B==="("||B==="["){R++;continue}if(B==="}"||B===")"||B==="]"){R=Math.max(0,R-1);continue}if(R>0&&B!==`
|
|
2482
|
-
`)k[T]=" "}return ge(k.join(""))}function xi(v,_){if(Kg(v)!==null)return[];let k=xu(v),R=It(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(Ui(_,B))return!1;return R.has(B)})}var zg="stx: types for the declared client payload (#1868)",Zv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Wg="__stxServerScope",Fg="__StxClientPayload";var Vg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Gv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Jv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=$e(T);if(!z)continue;let F=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let H of T.matchAll(F)){let q=H.index??0;if(B[q+H[1].length]!==0)continue;let K=H[2],G=q+H[0].length-H[3].length,ee=R.slice(G,q+H[0].length).trim().replace(/;$/,"").trim(),ae=H[3],Q=k.test(ae)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ae)&&!/[,+\-*/%&|?:=]$/.test(ee)&&$e(ae).balanced;_.set(K,_.has(K)||!Q?null:ee)}}return new Map([..._].filter((R)=>R[1]!==null))}function Zg(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),B="",z=0;for(let F of T.matchAll(/[A-Za-z_$][\w$]*/g)){let H=F.index??0,q=F[0],K=_.get(q);if(!K||R.has(q))continue;let G=T.slice(0,H).trimEnd(),ee=T.slice(H+q.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(ee)&&/[{,]$/.test(G))continue;if(H>0&&/[\w$]/.test(T[H-1]))continue;B+=`${v.slice(z,H)}(${Zg(K,_,k+1,new Set([...R,q]))})`,z=H+q.length}return B+v.slice(z)}function Yv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,R=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let B=T[1];if(T.index===_){if(B==="elseif"){let F=R[R.length-1];if(F?.current)F.seen.push(F.current);if(F)F.current=null}break}if(B==="endif"||B==="endunless"){R.pop();continue}let z="";if(T[2]==="("){let F=0,H=T.index+T[0].length-1,q=H+1;for(;H<v.length;H++){let K=v[H];if(K==="(")F++;else if(K===")"){if(F--,F===0)break}}z=v.slice(q,H).trim(),k.lastIndex=H+1}if(B==="if")R.push({seen:[],current:z});else if(B==="unless")R.push({seen:[],current:`!(${z})`});else if(B==="elseif"||B==="else"){let F=R[R.length-1];if(!F)continue;if(F.current)F.seen.push(F.current);F.current=B==="elseif"?z:null}}return R.flatMap((B)=>[...B.seen.map((z)=>`!(${z})`),...B.current?[B.current]:[]]).filter(Boolean)}function Qv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Gv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var ew=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function ur(v,_){if(!_)return v;return v.replace(ew,(k,R,T,B)=>{let z=Ug.resolve(_,B).replace(/\\/g,"/");return`${R}${T}${z}${T}`})}function Es(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function tw(v){let _=new Set,k=s(v);for(let R of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=R[1],B=/\{([^}]*)\}/.exec(T);for(let q of B?.[1].split(",")??[]){let K=q.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(K&&/^[A-Z_$][\w$]*$/i.test(K))_.add(K)}let z=T.replace(/\{[^}]*\}/,""),F=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(z);if(F)_.add(F[1]);let H=/^\s*([A-Z_$][\w$]*)/i.exec(z);if(H&&H[1]!=="type")_.add(H[1])}return[..._].sort()}function Si(v,_={}){let k=Qe(v),R=v.split(`
|
|
2483
|
-
`),T=Array.from({length:R.length},()=>""),B=new Map,z=_.filePath&&_.templateExpressions!==!1?Mg(v,za(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,ee)=>Qe(G).map((ae)=>ur(ae.code,Ug.dirname(ee))).join(`
|
|
2484
|
-
`)}):void 0,F=new Set,H=[];for(let G of k){let ee=_s(Cs(G.code)),ae=ur(ee,_.originDir??"").split(`
|
|
2485
|
-
`);ae.forEach((Q,ce)=>{let ue=G.startLine-1+ce;if(ue<T.length)T[ue]=ce===0?Es(G)+Q:Q,F.add(ue)}),H.push(G.startLine-1+ae.length-1)}for(let G of H){let ee=T[G]?.trim()===""?G:G+1;if(ee<T.length&&T[ee].trim()===""&&(ee===G||!F.has(ee)))T[ee]=";"}let q=(G,ee)=>{for(let[ae,Q]of G.split(`
|
|
2486
|
-
`).entries())if(T.push(Q),ee)B.set(T.length,ae===0?ee:{...ee,line:ee.line+ae,column:1,prefixLength:0})};if(_.globals!==!1){q("");let G=new Set([...k.flatMap((ce)=>ge(ce.code)),...k.flatMap((ce)=>tw(ce.code))]),ee=(ce)=>{if(!G.has(ce))q(`declare var ${ce}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))q("declare var window: any");for(let ce of y)ee(ce)}let ae=[...new Set([...yu,...J,...Vg])].filter((ce)=>_.runtimeGlobals!==!1||!y.includes(ce));if(_.contextScope==="global"){q("declare global {");for(let ce of ae)q(` var ${ce}: any`);q("}")}else{for(let ce of yu)ee(ce);for(let ce of J)ee(ce);for(let ce of Vg)ee(ce)}q(`declare var ${hu}: any`);let Q=new Set(k.flatMap((ce)=>ge(ce.code)));q(`type ${jg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let ce of Uv(v)){if(Q.has(ce.name))continue;let ue=ce.iterable&&Q.has(ce.iterable)?`${jg}<typeof ${ce.iterable}>`:"any";q(`declare var ${ce.name}: ${ue}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let ee of z.declarations.split(`
|
|
2487
|
-
`))q(ee);let G=Dc(v).map((ee)=>{let ae=z?.events.get(ee.offset??-1);if(ae){ee.anchor=!0;let Q=ee.code.trim(),ce=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),ue=ce?`void ((${ce[2]}) satisfies __StxAssignedValue<typeof ${ce[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${ae}) => unknown)`:Q,le=`;(($event: ${ae}): void => { `;return{expression:ee,statement:{text:`${le}${ue} });`,prefixLength:le.length}}}return{expression:ee,statement:Qv(ee)}}).filter((ee)=>ee.statement!==null);if(G.push(...z?.checks||[]),G.length>0){let ee=za(v),ae=ca(ee),Q=Jv(k.map((pe)=>pe.code)),ue=[...new Set(k.flatMap((pe)=>ge(pe.code)))].filter((pe)=>/^[A-Z_$][\w$]*$/i.test(pe)),le=0;if(ue.length>0){q(Bv);for(let pe of ue)q(`function __StxRead_${pe}() { return ${pe} }`),q(`type __StxT_${pe} = ${qg}<ReturnType<typeof __StxRead_${pe}>>`);q(`;((${ue.map((pe)=>`${pe}: __StxT_${pe}`).join(", ")}) => {`),le=1}for(let{expression:pe,statement:de}of G){let Re=" ".repeat(le),be=pe.offset===void 0?[]:ae.filter((Le)=>pe.offset>=Le.start&&pe.offset<Le.end),xe=be.map((Le)=>`;((${Le.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ie=" });".repeat(be.length),Me=pe.offset===void 0?[]:Yv(ee,pe.offset),Ne=Me.length>0?`${Me.map((Le)=>`if (${Zg(Le,Q)}) `).join("")}{ `:"",je=Me.length>0?" }":"";q(Re+xe+Ne+de.text+je+Ie,{line:pe.line,column:pe.column,expression:pe,prefixLength:de.prefixLength+Re.length+xe.length+Ne.length,guardPrefixLength:Re.length+xe.length+Ne.length})}if(le>0)q("});")}}let K=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,K=!0;return q("export {}"),{text:T.join(`
|
|
2488
|
-
`),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:K}}function ki(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Ci(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Gg from"fs";import Jg from"path";var Yg=!1;function nw(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),F=(G)=>{if(z.size===0)return!1;let ee=s(G),ae=ee.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(ae&&z.has(ae))return!0;for(let Q of z){let ce=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${ce}\\s*\\(`).test(ee))return!0}return!1},H=new Set(ra),q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;if(G.startsWith("aria-")||G.startsWith("data-"))return G;return G.replace(/-([a-z0-9])/g,(ee,ae)=>ae.toUpperCase())},K=(G,ee)=>{let ae=q(G);if(B.static[ae]=ee,ae!==G)B.staticNames[ae]=G};for(let[G,ee]of Object.entries(v)){let ae=G.startsWith("x-")&&!H.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(ae.startsWith("@")){B.events[ae]=ee;continue}if(ae.startsWith("__stx_")){let Q=q(ae.slice(6));B.serverDynamic[Q]=Rg(ee,k);continue}if(ae.startsWith(":")){let Q=q(ae.slice(1)),ce=ee===Br?Q:ee;if(Q==="if"||Q==="for"||Q==="show"){B.clientReactive[Q]=ce;continue}if(R){B.clientReactive[Q]=ce;continue}if(ne(ce,T)){B.clientReactive[Q]=ce;continue}if(F(ce)){B.clientReactive[Q]=ce;continue}try{if(!p(ce)){if(k.debug)console.error(`Unsafe expression in :${Q} binding: ${ce}`);B.clientReactive[Q]=ce;continue}let ue=Object.keys(_),le=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),pe=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Pe(ce).some((xe)=>!le.has(xe)&&!ue.includes(xe)&&(!(xe in globalThis)||pe.has(xe)))){B.clientReactive[Q]=ce;continue}let be=c(ce,ue)(...Object.values(_));if(B.serverDynamic[Q]=be,Q!==ae.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[Q]=ae.slice(1)}catch{B.clientReactive[Q]=ce}continue}if(typeof ee==="string"&&ee.includes("{{")&&ee.includes("}}")){let Q=rw(ee,T);if(Q!==null){B.clientReactive[q(ae)]=Q;continue}let ce=ee.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ce)try{let ue=ce[1];if(p(ue)){let pe=c(ue,Object.keys(_))(...Object.values(_));K(ae,pe!=null?String(pe):"")}else{if(k.debug)console.error(`Unsafe expression in ${ae}: ${ue}`);K(ae,ee)}}catch(ue){if(k.debug)console.error(`Error evaluating expression for ${ae}:`,ue);K(ae,ee)}else{let ue=ee,le=/\{\{\s*([\s\S]+?)\s*\}\}/g,pe;while((pe=le.exec(ee))!==null)try{let de=pe[1];if(!p(de)){if(k.debug)console.error(`Unsafe expression in ${ae}: ${de}`);continue}let be=c(de,Object.keys(_))(...Object.values(_));ue=ue.replace(pe[0],String(be??""))}catch(de){if(k.debug)console.error(`Error evaluating expression in ${ae}:`,de)}K(ae,ue)}continue}K(ae,ee===Br?"true":du(ee))}return B}function rw(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((F)=>ne(F[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let F of R)B+=v.slice(z,F.index).replace(/[`\\$]/g,(H)=>`\\${H}`),B+=`\${${F[1]}}`,z=F.index+F[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(F)=>`\\${F}`),`\`${B}\``}var sw=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function iw(v,_,k){if(!v.includes("@"))return v;if(!sw.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return xr(v,_,k)}catch{return v}}function si(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let F=v[k];if(F==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(F===z){k++;break}B+=F,k++}}else if(v[k]==="{"){B=fu(v,k),k+=B.length;let z=Ag(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=Br}return _}function Qg(v){return Object.entries(v).map(([_,k])=>k===Br?_:`${_}="${ow(k)}"`).join(" ")}function ow(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function aw(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(Hs.isBuiltin(T))_.add(T)}return[..._].sort()}async function Mc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Jg.dirname(k),F=[],H=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(H)){let[ee,ae,Q]=G,ce=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ue=Q,le,pe=[];while((le=ce.exec(Q))!==null){let[de,Re,be,xe]=le,Ie=null,Me=null;if(xe.startsWith(".")||xe.startsWith("/")){let Le=Jg.resolve(z,xe);if(Le.endsWith(".stx"))Me=Le;else{let De=`${Le}.stx`;try{if(Gg.statSync(De).isFile())Me=De}catch{try{if(Gg.statSync(Le).isDirectory())Ie=Le}catch{}}}}else Ie=Xo(xe,z);if(!Ie&&!Me)continue;let Ne=!1,je=(Le,De)=>{B.set(Le,De),B.set(Le.toLowerCase(),De);let ze=Le.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(ze,De),T.add(De)};if(be&&Me)je(be,Me),Ne=!0;else if(Re){let Le=Re.slice(1,-1).split(",").map((ze)=>ze.trim()).filter(Boolean).map((ze)=>{let Fe=ze.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Fe)return{source:Fe[1],local:Fe[2]};return{source:ze,local:ze}}),De=Ie?Ko(Ie):null;for(let{source:ze,local:Fe}of Le){let Ve=null;if(Me)Ve=Me;else if(De)Ve=De.get(ze)??De.get(ze.toLowerCase())??De.get(ze.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Ve)je(Fe,Ve),Ne=!0}}if(Ne)pe.push({start:le.index,end:le.index+de.length})}if(pe.length===0)continue;for(let de=pe.length-1;de>=0;de--)ue=ue.slice(0,pe[de].start)+ue.slice(pe[de].end);F.push({start:G.index,end:G.index+ee.length,value:`<script${ae}>${ue}</script>`})}if(F.length===0)return v;let q=[],K=0;for(let G of F)q.push(v.slice(K,G.start),G.value),K=G.end;return q.push(v.slice(K)),q.join("")}async function cw(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,F=/@import\s*\(\s*([^)]+)\s*\)/g,H;while((H=F.exec(B))!==null){let[q,K]=H,G=K.split(",").map((ee)=>ee.trim().replace(/^['"]|['"]$/g,"")).filter((ee)=>ee.length>0);for(let ee of G){let ae=ee.split("/"),ce=ae[ae.length-1].replace(/\.stx$/,""),ue=ce.includes("-")?ce.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""):ce.charAt(0).toUpperCase()+ce.slice(1),le=null,pe=Zo(ee,k,R);for(let de of pe)try{if(await Bun.file(de).exists()){le=de;break}}catch{}if(le){z.set(ue,le),z.set(ce,le),z.set(ce.toLowerCase(),le);let de=ue.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(de,le),T.add(le),R.debug)console.log(`Imported component: ${ue} -> ${le}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${ee}`)}B=B.replace(q,""),F.lastIndex=0}return B}async function lw(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let F=_.__processedComponents,H=/@component\s*\(/g,q;while((q=H.exec(B))!==null){let K=q.index,G=K+q[0].length-1,ee=1,ae=G+1;while(ae<B.length&&ee>0){if(B[ae]==="(")ee++;else if(B[ae]===")"){if(ee--,ee===0)break}ae++}if(ee!==0)break;let Q=B.substring(G+1,ae),ce=ae+1,ue=Q.match(/^\s*['"]([^'"]+)['"]/);if(!ue){H.lastIndex=0;continue}let le=ue[1],pe,de=Q.slice(ue[0].length),Re=de.match(/^\s*,\s*/);if(Re)pe=de.slice(Re[0].length).trim();let be={};if(pe)try{be=N(pe,_)}catch(Le){let De=Le instanceof Error?Le.message:String(Le);B=B.replace(B.substring(K,ce),`[Error parsing component props: ${De}]`);continue}let xe="",Ie=ce,Ne=B.substring(ce).match(/^([\s\S]*?)@endcomponent/);if(Ne)xe=Ne[1].trim(),Ie=ce+Ne[0].length;let je=await rt(le,be,xe,z,_,k,R,F,T);B=B.substring(0,K)+je+B.substring(Ie),H.lastIndex=0}return B}async function uw(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let F=_.__processedComponents,H=pw(B);if(H.size>0){let ce=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...ce,...H])]}let q=hn(B);B=q.output;let K=Ar(_);return B=await Q(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await Q(B,/[A-Z][a-zA-Z0-9]*/,!0,Eg(ko)),B=await Q(B,/[a-z][a-z0-9]*/,!1,ko),B=q.restore(B),B;async function Q(ce,ue,le,pe){if(!ce)return ce;let de=ce,Re=Cg(de,ue,pe),be=pu(de),xe=new Map;for(let Ne=Re.length-1;Ne>=0;Ne--){let je=Re[Ne],Le=le?pn(je.tagName):je.tagName,De=si(iw(je.attributes,_,k)),ze=be.filter(({start:Ct,end:yt})=>je.startIndex>=Ct&&je.startIndex<yt),Fe=ze.length>0,Ve=new Set(K);for(let Ct of ze)for(let yt of Ct.names)Ve.add(yt);let Be=nw(De,_,R,Fe,Ve);if(typeof Be.clientReactive.for==="string")for(let Ct of Ur(Be.clientReactive.for))Ve.add(Ct);let He=Hs.getBuiltin(je.tagName),vt=He?await fr(je.tagName,z,_,k,R):!1;if(He&&!vt){let Ct={context:_,filePath:k,options:R,dependencies:T},yt=He.render(Be,je.content,Ct);if(Object.keys(Be.events).length>0){let dt=Qg(Be.events);yt=yt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${dt}`)}if(Object.keys(Be.clientReactive).length>0)yt=em(yt,Be.clientReactive);xe.set(Ne,yt);continue}if(!le&&je.tagName.includes("-")&&!await fr(Le,z,_,k,R))continue;let bt={};for(let[Ct,yt]of Object.entries(Be.static))bt[Ct]=yt;for(let[Ct,yt]of Object.entries(Be.serverDynamic))bt[Ct]=yt;let Et={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(Be.clientReactive),events:Object.keys(Be.events)},wt=await rt(Le,bt,q.restore(je.content),z,_,k,R,F,T,[...Ve],Et,je.tagName);if(wt=dw(wt,Be,Et.declaredProps,Et.consumedProps,R._nativeHostAttrs),R._nativeHostAttrs){let Ct=Et.reactiveProps.filter(($t)=>!Et.consumedProps.has($t)&&!["if","for","show","key","ref"].includes($t)).map(pn),yt=bu(wt,!0);if(Ct.length&&yt){if(!Object.hasOwn(si(wt.slice(yt.insertPos,yt.tagEnd)),"data-stx-native-host-root"))wt=wt.slice(0,yt.insertPos)+' data-stx-native-host-root="true"'+wt.slice(yt.insertPos);let $t=Ao(wt);wt=wt.slice(0,$t.insertPos)+` data-stx-native-forward="${Ct.join(" ")}"`+wt.slice($t.insertPos)}let dt=bu(wt,!0);if(dt){let $t=si(wt.slice(dt.insertPos,dt.tagEnd)),xt=Ao(wt),Kt=si(wt.slice(xt.insertPos,xt.tagEnd));if(Object.hasOwn($t,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))wt=wt.slice(0,xt.insertPos)+" data-stx-native-host-owner"+wt.slice(xt.insertPos)}}if(Object.keys(Be.events).length>0){let Ct=Ao(wt);if(Ct){let yt=Qg(Be.events),dt=Object.keys(Be.events).map(($t)=>$t.replace(/^@/,"").split(".")[0]).join(" ");wt=wt.substring(0,Ct.insertPos)+` data-stx-parent-events="${dt}" ${yt}`+wt.substring(Ct.insertPos)}}if(Object.keys(Be.clientReactive).length>0)wt=em(wt,Be.clientReactive);xe.set(Ne,wt)}if(xe.size===0)return de;let Ie="",Me=0;for(let Ne=0;Ne<Re.length;Ne++){let je=xe.get(Ne);if(je===void 0)continue;Ie+=de.slice(Me,Re[Ne].startIndex),Ie+=je,Me=Re[Ne].endIndex}return Ie+=de.slice(Me),Ie}}function em(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([K])=>!k.has(K)),B=T.filter(([K])=>!R.has(K)).map(([K])=>pn(K)).join(" "),z=v,F=T.length>0?Ao(z):null;if(F){let K=T.map(([ee,ae])=>`:${pn(ee)}="${ae.replace(/"/g,""")}"`).join(" "),G=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,F.insertPos)+`${G} ${K}`+z.substring(F.insertPos)}let H=_.if;if(H)z=`<template :if="${H.replace(/"/g,""")}">${z}</template>`;let q=_.for;if(q)z=`<template :for="${q.replace(/"/g,""")}">${z}</template>`;return z}function dw(v,_,k=new Set,R=new Set,T=!1){let B=bu(v,T);if(!B)return v;let z=v.slice(B.insertPos,B.tagEnd),F=_.serverDynamic.class??_.static.class;if(T&&typeof F==="string"&&F&&!R.has("class")){let Q=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,ce=Q.test(z)?z.replace(Q,(ue,le,pe,de,Re)=>`${le}class="${Zt(`${du(pe??de??Re)} ${F}`)}"`):` class="${Zt(F)}"${z}`;v=v.slice(0,B.insertPos)+ce+v.slice(B.tagEnd),B.tagEnd+=ce.length-z.length,z=ce}let H=T||/\bdata-native(?:\s|=)/i.test(z),q=H?R:k,K=new Set(Object.keys(si(z))),G=new Set(["class","className"]);for(let Q of Object.keys(_.static)){let ce=_.staticNames[Q]??Q;if(K.has(ce)||q.has(Q)||!H&&!Fl(ce))G.add(Q)}for(let Q of Object.keys(_.serverDynamic)){let ce=_.serverDynamicNames?.[Q]??Q;if(K.has(ce)||q.has(Q)||!H&&!Fl(ce))G.add(Q)}let ee=[];if(H){for(let[Q,ce]of Object.entries(_.static)){if(G.has(Q)||ce!==!0&&ce!==Br)continue;G.add(Q),ee.push(`${Zt(_.staticNames?.[Q]??Q)}="true"`)}for(let[Q,ce]of Object.entries(_.serverDynamic)){if(G.has(Q)||ce!==!0)continue;G.add(Q),ee.push(`${Zt(_.serverDynamicNames?.[Q]??Q)}="true"`)}}let ae=[...zr(_,G),...Wr(_,G),...ee];if(H){for(let[Q,ce]of Object.entries(_.serverDynamic)){if(G.has(Q)||ce!==!1)continue;let ue=_.serverDynamicNames?.[Q]??Q;ae.push(`${Zt(ue)}="false"`)}for(let[Q,ce]of Object.entries(_.serverDynamic)){if(G.has(Q)||ce===null||typeof ce!=="object")continue;let ue=JSON.stringify(ce);if(ue!==void 0){let le=_.serverDynamicNames?.[Q]??Q;ae.push(`${Zt(le)}="${Zt(ue)}"`)}}}if(ae.length===0)return v;return`${v.slice(0,B.insertPos)} ${ae.join(" ")}${v.slice(B.insertPos)}`}function Ao(v){let _=tm(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:vu(v,k.index+1+k[1].length)};return null}function bu(v,_=!1){let k=Ao(v);if(!k)return null;let R=v.slice(k.insertPos,k.tagEnd),T=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(R)?tm(v,k.tagEnd+1):k;return T&&_?fw(v,T)??T:T}function fw(v,_){if(!v.includes("data-stx-native-host-root"))return null;let k=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),R=v.lastIndexOf("<",_.insertPos),T=0,B;while(R>=0&&R<v.length){if(v.startsWith("<!--",R)){let K=v.indexOf("-->",R+4);if(K<0)return null;R=v.indexOf("<",K+3);continue}let z=/^<(\/?)([a-z][\w-]*)\b/i.exec(v.slice(R));if(!z){R=v.indexOf("<",R+1);continue}let F=z[2].toLowerCase(),H=R+z[0].length,q=vu(v,H);if(z[1]){if(T--,B!==void 0&&T<B)B=void 0;if(T<=0)return null}else if(F==="script"||F==="style"){let K=new RegExp(`</${F}\\s*>`,"gi");if(K.lastIndex=q+1,!K.exec(v))return null;R=v.indexOf("<",K.lastIndex);continue}else{let K=si(v.slice(H,q)),G=T>0&&(Object.hasOwn(K,"data-stx-component-wrapper")||Object.hasOwn(K,"data-stx-native-host-owner"));if(B===void 0&&!G&&Object.hasOwn(K,"data-stx-native-host-root"))return{insertPos:H,tagEnd:q};if(!k.has(F)&&v[q-1]!=="/"){if(T++,B===void 0&&G)B=T}else if(T===0)return null}R=v.indexOf("<",q+1)}return null}function tm(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let F=v.indexOf("-->",k+4);if(F===-1)return null;k=F+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let F=`</${B[1].toLowerCase()}>`,H=v.toLowerCase().indexOf(F,k+B[0].length);if(H===-1)return null;k=H+F.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:vu(v,k+1+z[1].length)}}return null}function vu(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function pw(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of xu(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function Ts(v,_,k,R,T){if(!Yg)$g(Hs),Yg=!0;let B=await Mc(v,_,k,R,T);B=await cw(B,_,k,R,T),B=await lw(B,_,k,R,T);let z=[];for(let F=0;F<3;F++){let H=z.length,q=Un(B,Ge,(G,ee)=>`\x00STX_COMPONENT_COMMENT_${H+ee}\x00`,`STX_COMPONENT_COMMENT:${H}`);z.push(...q.tokens);let K=B;if(B=await uw(q.output,_,k,R,T),B===K)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(F,H)=>z[Number(H)]??"");if(R.debug){let F=aw(B);if(F.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${F.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function wu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function mw(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,F=z+B[0].length-1,H=1,q=F+1;while(q<R.length&&H>0){if(R[q]==="(")H++;else if(R[q]===")")H--;q++}if(H!==0)break;let K=R.substring(F+1,q-1),G=`${k}(${K})`;R=R.substring(0,z)+G+R.substring(q),T.lastIndex=z+G.length,B=T.exec(R)}return R}function hw(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function im(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,F=(G)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===G){B++;return}B++}},H=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let G=1;while(B<z&&G>0)if(_[B]==="{")G++,B++;else if(_[B]==="}")G--,B++;else if(_[B]==="'"||_[B]==='"')F(_[B]);else if(_[B]==="`")H();else B++;continue}B++}},q=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
|
|
2489
|
-
`)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},K=()=>{if(T!==0)return;let G=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let Q=G[2];if(!R.has(Q))k.push(Q),R.add(Q);return}let ee=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let Q=ee[1];if(!R.has(Q))k.push(Q),R.add(Q);return}let ae=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ae){let Q=ae[1];if(!R.has(Q))k.push(Q),R.add(Q)}};while(B<z){if(q())continue;if(_[B]==="'"||_[B]==='"'){F(_[B]);continue}if(_[B]==="`"){H();continue}if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))K();B++}return k.join(", ")}function yw(v,_=""){let k=im(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
|
|
2490
|
-
(function() {
|
|
2491
|
-
${Wt("var",k)}
|
|
2492
|
-
var __destroyHooks = [];
|
|
2493
|
-
var __origOnDestroy = onDestroy;
|
|
2494
|
-
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
2495
|
-
|
|
2496
|
-
${v}
|
|
2497
|
-
${_}})();
|
|
2498
|
-
`}function xw(v,_){let T=im(v).split(",").map((B)=>B.trim()).filter(Boolean).map((B)=>` try { __scopeRegistration[${JSON.stringify(B)}] = ${B}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
2499
|
-
`);return`
|
|
2500
|
-
// Register scope variables for STX runtime
|
|
2501
|
-
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2502
|
-
var __scopeRegistration = window.stx._scopes['${_}'] || { __destroyCallbacks: __destroyHooks };
|
|
2503
|
-
${T}
|
|
2504
|
-
// #1767: when the bundler renamed a component const that collided with an
|
|
2505
|
-
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
2506
|
-
// renamed declaration so it resolves to the component's value, not the
|
|
2507
|
-
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
2508
|
-
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
2509
|
-
window.stx._scopes['${_}'] = __scopeRegistration;
|
|
2510
|
-
`}function bw(v,_){return v.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,R)=>R===_?k:'<script data-stx-scoped data-stx-run="always"')}function nm(v,_){let k=xw(v,_);return vw(yw(v,k),_)}function vw(v,_){let k=`
|
|
2511
|
-
(function() {
|
|
2512
|
-
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
|
|
2513
|
-
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
2514
|
-
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
2515
|
-
if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
|
|
2516
|
-
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2517
|
-
window.stx._scopes['${_}'] = {};
|
|
2518
|
-
}
|
|
2519
|
-
try {`,R=`
|
|
2520
|
-
} finally {
|
|
2521
|
-
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2522
|
-
}
|
|
2523
|
-
})();`;return k+v+`
|
|
2524
|
-
} finally {
|
|
2525
|
-
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2526
|
-
}
|
|
2527
|
-
})();`}function ww(v,_){if(Zn(v)){let T=Zn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:ps(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],F=k[2],H=k[3];return{html:`${z}${F} data-stx-scope="${_}"${H}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var Sw=0;function rm(v,_){let k=Jt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++Sw}`}var Su=new Set,$u=new Set;function yd(){Su.clear(),$u.clear()}var $w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Kc(v){let _=(F)=>F.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let F=z[1]==="/",H=z[2],q=z[3]==="/"||$w.has(H.toLowerCase());if(F){T=Math.max(0,T-1);continue}if(T===0)R.push(H);if(!q)T++}return R}function sm(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var Te=new M(500),Ii=new Set;function bd(){Ii.clear()}function _w(v){if(v.__onceStore instanceof Set)return v.__onceStore;return Ii}async function Ns(v,_,k,R,T,B=new Set){let z=R.partialsDir||Jt.join(Jt.dirname(k),"partials");if(z&&!Jt.isAbsolute(z))z=Jt.resolve(process.cwd(),z);let F=mw(v,"@partial","@include"),H=_w(_);F=F.replace(/@once([\s\S]*?)@endonce/g,(ce,ue,le)=>{let pe=ue.trim(),de=`${k}:${pe}`;if(H.has(de))return"";return H.add(de),ue});{let ce=/@includeIf\s*\(/g,ue;while((ue=ce.exec(F))!==null){let le=ue.index,pe=le+ue[0].length-1,de=1,Re=pe+1;while(Re<F.length&&de>0){if(F[Re]==="(")de++;else if(F[Re]===")")de--;Re++}if(de!==0)break;let be=F.substring(pe+1,Re-1),xe=be.match(/^\s*['"]([^'"]+)['"]/);if(!xe){ce.lastIndex=Re;continue}let Ie=xe[1],Me=q(Ie,z,k),Ne="";if(Me&&await Bun.file(Me).exists())T.add(Me),Ne=`@include(${be})`;F=F.substring(0,le)+Ne+F.substring(Re),ce.lastIndex=0}}for(let[ce,ue]of[["@includeWhen",!1],["@includeUnless",!0]]){let le=new RegExp(`${ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),pe;while((pe=le.exec(F))!==null){let de=pe.index,Re=de+pe[0].length-1,be=1,xe=Re+1;while(xe<F.length&&be>0){if(F[xe]==="(")be++;else if(F[xe]===")")be--;xe++}if(be!==0)break;let Ie=F.substring(Re+1,xe-1),Me=wu(Ie,0);if(Me===-1){le.lastIndex=xe;continue}let Ne=Ie.substring(0,Me).trim(),je=Ie.substring(Me+1).trim(),Le=je.match(/^\s*['"]([^'"]+)['"]/);if(!Le){le.lastIndex=xe;continue}let De=Le[1],ze=je.substring(Le[0].length),Fe,Ve=wu(ze,0);if(Ve!==-1)Fe=ze.substring(Ve+1).trim();try{let Be=`Boolean(${Ne})`,He;if(p(Be)){let Et=c(Be,Object.keys(_));He=Boolean(Et(...Object.values(_)))}else He=Boolean(l(Be,_));let vt=ue?!He:He,bt="";if(vt){let Et=q(De,z,k);if(Et&&await Bun.file(Et).exists())T.add(Et);bt=`@include('${De}'${Fe?`, ${Fe}`:""})`}F=F.substring(0,de)+bt+F.substring(xe),le.lastIndex=0}catch(Be){let He=Be instanceof Error?Be.message:String(Be),vt=g("Include",`Error evaluating ${ce} condition: ${He}`,k,v,de);F=F.substring(0,de)+vt+F.substring(xe),le.lastIndex=0}}}{let ce=/@each\s*\(/g,ue;while((ue=ce.exec(F))!==null){let le=ue.index,pe=le+ue[0].length-1,de=1,Re=pe+1;while(Re<F.length&&de>0){if(F[Re]==="(")de++;else if(F[Re]===")"){if(de--,de===0)break}Re++}if(de!==0)break;let be=F.substring(pe+1,Re),xe=F.substring(le,Re+1),Ie=be.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Ie){ce.lastIndex=0,F=F.replace(xe,"");continue}let[,Me,Ne,je,Le]=Ie;try{let De,ze=Ne.trim();if(p(ze))De=c(ze,Object.keys(_))(...Object.values(_));else De=l(ze,_);let Fe="";if(Array.isArray(De)&&De.length>0)for(let Ve of De){let Be={..._,[je]:Ve},He=await ee(Me,Be,v,le);Fe+=He}else if(Le)Fe=await ee(Le,{},v,le);F=F.substring(0,le)+Fe+F.substring(Re+1),ce.lastIndex=0}catch(De){let ze=De instanceof Error?De.message:String(De);F=F.substring(0,le)+g("Each",`Error in @each: ${ze}`,k,v,le)+F.substring(Re+1),ce.lastIndex=0}}}{let ce=/@includeFirst\s*\(/g,ue;while((ue=ce.exec(F))!==null){let le=ue.index,pe=le+ue[0].length-1,de=1,Re=pe+1;while(Re<F.length&&de>0){if(F[Re]==="(")de++;else if(F[Re]===")"){if(de--,de===0)break}Re++}if(de!==0)break;let be=F.substring(pe+1,Re),xe=F.substring(le,Re+1),Ie=be.match(/^\s*(\[[^\]]+\])/);if(!Ie){ce.lastIndex=0,F=F.replace(xe,"");continue}let Me=Ie[1],Ne=be.slice(Ie[0].length),je,Le=Ne.match(/^\s*,\s*\{/);if(Le){Ne=Ne.slice(Le[0].length-1);let Fe=1,Ve=1;while(Ve<Ne.length&&Fe>0){if(Ne[Ve]==="{")Fe++;else if(Ne[Ve]==="}"){if(Fe--,Fe===0)break}Ve++}je=Ne.substring(0,Ve+1),Ne=Ne.slice(Ve+1)}let De,ze=Ne.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(ze)De=ze[1];try{let Fe=JSON.parse(Me.replace(/'/g,'"')),Ve={};if(je)try{Ve=N(je,_)}catch(He){let vt=He instanceof Error?He.message:String(He);if(R.debug){let bt=g("Include",`Error parsing includeFirst variables: ${vt}`,k,v,le,xe);F=F.replace(xe,()=>bt)}else F=F.replace(xe,()=>De||"");continue}let Be=!1;for(let He of Fe){let vt=q(He,z,k);if(!vt)continue;if(await r(vt)){let bt=await ee(He,Ve,v,le);F=F.replace(xe,()=>bt),Be=!0;break}}if(!Be)if(De!==void 0)F=F.replace(xe,()=>De);else if(R.debug){let He=g("Include",`None of the includeFirst paths exist: ${Me}`,k,v,le,xe);F=F.replace(xe,()=>He)}else F=F.replace(xe,"")}catch(Fe){let Ve=Fe instanceof Error?Fe.message:String(Fe),Be=g("Include",`Error processing @includeFirst: ${Ve}`,k,v,le,xe);F=F.replace(xe,()=>Be)}ce.lastIndex=0}}function q(ce,ue,le){try{let pe=ce;if(!ce.endsWith(".stx"))pe=`${ce}.stx`;let de=Jt.resolve(ue),Re=Jt.resolve(Jt.dirname(le)),be;if(!pe.startsWith("./")&&!pe.startsWith("../")){for(let Le of R._layerPartialDirs??[]){let De=Jt.resolve(Le,pe);if(De.startsWith(`${Jt.resolve(Le)}${Jt.sep}`)&&gw(De))return De}be=Jt.resolve(ue,pe)}else be=Jt.resolve(Re,pe);let xe=Jt.normalize(be),Ie=xe.startsWith(de+Jt.sep)||xe===de,Me=xe.startsWith(Re+Jt.sep)||xe===Re,Ne=!1,je=Jt.dirname(Re);if(xe.startsWith(je+Jt.sep)){if(!Jt.relative(je,xe).split(Jt.sep).some((Fe)=>Fe.startsWith(".")&&Fe!=="."&&Fe!==".."))Ne=!0}if(!Ie&&!Me&&!Ne)return console.error(`Security: Path traversal attempt blocked for include path: ${ce}`),console.error(` Resolved to: ${xe}`),console.error(` Allowed dirs: ${de}, ${Re}`),null;return xe}catch(pe){return console.error(`Error resolving path ${ce}: ${pe}`),null}}let K=Jt.resolve(k);B.add(K);function G(ce,ue,le,pe){return R.onIncludeError?.({includePath:ce,templatePath:k,message:ue,partialsDir:z}),g("Include",ue,k,le,pe)}async function ee(ce,ue={},le,pe){let de=q(ce,z,k);if(!de)return G(ce,`Could not resolve path for include: ${ce}`,le,pe);let Re=Jt.resolve(de);if(B.has(Re)){let be=[...B,Re].map((xe)=>Jt.basename(xe)).join(" -> ");return G(ce,`Circular include detected: ${be}`,le,pe)}try{T.add(de);let be;if(!be)try{be=await Bun.file(de).text()}catch(dt){let $t=dt instanceof Error?dt.message:String(dt);return G(ce,`Error loading include file ${ce}: ${$t}`,le,pe)}if(be)be=be.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(be&&be.includes("@stream")){let{processStreamDirectives:dt}=await import("./chunk-74r2q9ab.js");be=dt(be,_)}if(be&&(R.debug||!E()&&!Ln()))try{let{warnUnbalancedTags:dt}=await import("./chunk-rj0nyb2t.js");dt(be,de)}catch{}try{let{processESImports:dt}=await import("./chunk-apaqfgsx.js");be=await dt(be,_,de,R,T)}catch(dt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${de}:`,dt instanceof Error?dt.message:dt)}let xe=be,Ie=se(xe);if(Ie)xe=Ie.content.trim();let Ne=be.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),je="";if(Ne)je=`<style${Ne[1]}>${Ne[2]}</style>`;let Le=[];xe=xe.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(dt,$t,xt)=>{if(!sm($t))return"";return Le.push({attrs:$t,body:xt}),`__STX_DATA_BLOCK_${Le.length-1}__`}),xe=xe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let De={..._};De.__stx_signals_gate=Ce(be,de);for(let[dt,$t]of Object.entries(ue))De[dt]=$t;let ze=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Fe=[...be.matchAll(ze)].sort((dt,$t)=>{let xt=(dt[1]||"").includes("server"),Kt=($t[1]||"").includes("server");return Number(Kt)-Number(xt)}),Ve="",Be=null,He=!1,vt=!1;for(let dt of Fe){let $t=dt[1]||"",xt=dt[2]||"";if(sm($t))continue;let Kt=$t.includes("server"),Vn=tt($t);if(!Kt&&!/\bsrc\s*=/i.test($t))Ze(xt,de,R.strict);if(!Kt&&xt.trim()){let{interpolateScriptExpressions:gt}=await import("./chunk-1peszdcc.js");xt=gt(xt,De,ce)}let jn="";try{let{extractAndStripCssImports:gt,renderVendorStyleTags:_t}=await import("./chunk-2xy5p3n4.js"),Ut=gt(xt,{filePath:de,projectRoot:process.cwd()});xt=Ut.code,jn=_t(Ut.styles)}catch(gt){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${de}:`,gt instanceof Error?gt.message:gt)}if(Vn&&xt.trim())xt=nt(xt);if(!Kt){try{let{injectBrowserCoreAutoImports:_t}=await import("./chunk-2xy5p3n4.js");xt=_t(xt).code;let{hasUserImports:Ut,bundleClientScript:Yt}=await import("./chunk-f0ghgkxs.js");if(Ut(xt))xt=await Yt(xt,de,{projectRoot:process.cwd()})}catch(_t){if(R.debug)console.warn(`[stx] bundler skipped for ${de}:`,_t instanceof Error?_t.message:_t)}let{stripStxRuntimeImports:gt}=await import("./chunk-mmqt6qkf.js");xt=gt(xt)}let St=hw(xt);if(!Kt){let{extractBridgeData:gt,generateServerDataBridge:_t}=await import("./chunk-2xy5p3n4.js"),Ut=_t(xt,gt(De));if(Ut)xt=`${Ut}
|
|
2528
|
-
${xt}`}if(St&&!Kt){He=!0,Be=rm(de,_);let gt=I(xt),_t=nm(gt,Be);Ve+=`${jn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Be}">${_t}</script>
|
|
2529
|
-
`;continue}if(Kt)try{let{extractVariables:gt}=await import("./chunk-t9ww2z0r.js");await gt(xt,De,de)}catch(gt){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${de}:`,gt)}if(!Kt&&!St){let gt=$t.replace(/\bclient\b/i,"").trim();Be=rm(de,_);let _t=I(xt),Ut=nm(_t,Be);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Ut))vt=!0;Ve+=`${jn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Be}"${gt?` ${gt}`:""}>${Ut}</script>
|
|
2530
|
-
`}}if(Le.length>0){let{interpolateScriptExpressions:dt}=await import("./chunk-1peszdcc.js");xe=xe.replace(/__STX_DATA_BLOCK_(\d+)__/g,($t,xt)=>{let Kt=Le[Number(xt)];return`<script${Kt.attrs}>${dt(Kt.body,De,ce)}</script>`})}if(Be){let dt=ww(xe,Be);if(xe=dt.html,dt.mergedIntoExisting){let xt=Be,Kt=dt.mergedIntoExisting;Ve=Ve.split(`'${xt}'`).join(`'${Kt}'`).split(`"${xt}"`).join(`"${Kt}"`),Be=Kt}else if(!dt.stamped&&He&&!Su.has(de))Su.add(de),console.warn(`[stx] ${Jt.relative(process.cwd(),de)} 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"&&(He||vt)&&!$u.has(de)){let xt=Kc(xe);if(xt.length>1)$u.add(de),console.warn(`[stx] ${Jt.relative(process.cwd(),de)} declares ${He?"signals":"bindings"} and has ${xt.length} top-level elements (${xt.map((Kt)=>`<${Kt}>`).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 $t=dt.stamped&&dt.root!==null&&Cn(dt.root);Ve=bw(Ve,$t?Be:null)}if(xe.includes("@include")||xe.includes("@partial"))xe=await Ns(xe,De,de,R,T,B);let{processLoops:bt,reportDeferredLoopWarnings:Et}=await import("./chunk-9c7wkq4t.js"),ft=bt(xe,De,de,void 0,!0);ft=xr(ft,De,de),ft=Et(ft);let{processMetaDirectives:wt,processSeoDirective:Ct,processStructuredData:yt}=await import("./chunk-hpvkkke2.js");if(ft=wt(ft,De,de,R),ft=yt(ft,De,de),ft=Ct(ft,De,de,R),ft=Y(ft,De,de),je)ft+=`
|
|
2531
|
-
`+je;if(Ve)ft+=`
|
|
2532
|
-
`+Ve;return ft}catch(be){if(be instanceof W)throw be;let xe=be instanceof Error?be.message:String(be);return G(ce,`Error processing include ${ce}: ${xe}`,le,pe)}}let ae=/@include\s*\(/g,Q;while((Q=ae.exec(F))!==null){let ce=Q.index,ue=ce+Q[0].length-1,le=1,pe=ue+1;while(pe<F.length&&le>0){if(F[pe]==="(")le++;else if(F[pe]===")")le--;pe++}if(le!==0)break;let de=F.substring(ce,pe),Re=F.substring(ue+1,pe-1),be=Re.match(/^\s*['"]([^'"]+)['"]/);if(!be){ae.lastIndex=pe;continue}let xe=be[1],Ie,Me=Re.substring(be[0].length),Ne=wu(Me,0);if(Ne!==-1)Ie=Me.substring(Ne+1).trim();let je={};if(Ie)try{je=N(Ie,_)}catch(De){let ze=De instanceof Error?De.message:String(De);F=F.replace(de,g("Include",`Error parsing include variables for ${xe}: ${ze}`,k,v,ce)),ae.lastIndex=0;continue}let Le=await ee(xe,je,v,ce);F=F.substring(0,ce)+Le+F.substring(pe),ae.lastIndex=0}return F}function Ds(v,_){let k=v;function R(T,B,z,F){let H=T,q=!0;while(q){q=!1;let K=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),G=H.match(K);if(!G||G.index===void 0)break;let ee=G.index,ae=G[1],Q=ee+G[0].length,ce=new RegExp(`@${B}\\(`),ue=new RegExp(`@${z}(?![a-z])`),le=1,pe=Q,de=-1;while(le>0&&pe<H.length){let be=H.slice(pe),xe=be.match(ce),Ie=be.match(ue),Me=xe?pe+xe.index:1/0,Ne=Ie?pe+Ie.index:1/0;if(Me<Ne)le++,pe=Me+(xe[0].length||1);else if(Ne<1/0){if(le--,le===0){de=Ne;break}pe=Ne+z.length+1}else break}if(de===-1)break;let Re=H.slice(Q,de);if(!_[ae])_[ae]=[];if(F)_[ae].unshift(Re);else _[ae].push(Re);H=H.substring(0,ee)+H.substring(de+`@${z}`.length),q=!0}return H}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function Ms(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
|
|
2533
|
-
`)})}import*as _u from"path";async function om(v,_,k=""){if(_u.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return cm(v,_,k,"@js","@endjs")}async function am(v,_,k=""){if(_u.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return cm(v,_,k,"@ts","@endts")}async function cm(v,_,k,R,T){let B=v,z=Hr(`${R}([\\s\\S]*?)${T}`,"g"),F=[],H;while((H=z.exec(v))!==null)F.push({fullMatch:H[0],content:H[1]||"",index:H.index});for(let{fullMatch:q,content:K,index:G}of F)try{let ee={..._,global:_},ae=Object.keys(ee),Q=Object.values(ee),ce=K.trim();if(R==="@ts")ce=ce.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 le=(ce.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((xe)=>xe.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),pe=le.length>0?`return { ${le.join(", ")} };`:"return {};",de=`
|
|
2534
|
-
${ce}
|
|
2535
|
-
${pe}
|
|
2536
|
-
`,be=Function(...ae,de)(...Q);if(be&&typeof be==="object")Object.assign(_,be);B=B.replace(q,"")}catch(ee){console.error(`Error executing ${R} code block in ${k}:`,ee);let ae=ee instanceof Error?ee.message:String(ee),Q=g(`${R} Directive`,`Error executing code: ${ae}`,k,v,G,q);console.error(Q),B=B.replace(q,"")}return B}var kw=1000,Ew=!1;function Cw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,F=B.index+B[0].indexOf("("),H=S(v,"(",")",F);if(H===-1)continue;let q=v.slice(z,H).trim();if(!q)continue;if(!Object.keys(_).some((ee)=>new RegExp(`(?:^|[^\\w$.])${ee.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let G;try{let ee=N(q,_);if(!ee||typeof ee!=="object")continue;G=JSON.stringify(ee)}catch{continue}R+=v.slice(T,z)+G,T=H,k.lastIndex=H}return T===0?v:R+v.slice(T)}function Rw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,F=z+T[0].length-1,H=1,q=F+1;while(q<R.length&&H>0){if(R[q]==="(")H++;else if(R[q]===")"){if(H--,H===0)break}q++}if(H!==0)continue;let K=R.substring(F+1,q),G=q+1,ee=K.match(/^\s*['"]([^'"]+)['"]/);if(!ee)continue;let ae=ee[1],Q=K.slice(ee[0].length),ce=Q.match(/^\s*,\s*/);if(!ce)continue;let ue=Q.slice(ce[0].length).trim();if(!ue)continue;try{let le=N(ue,_),pe=JSON.stringify(le),de=`@component('${ae}', ${pe})`;B.push({start:z,end:G,replacement:de})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:F,end:H,replacement:q}=B[z];R=R.substring(0,F)+q+R.substring(H)}return R}function Fa(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,F=z+B[0].length-1,H=1,q=F+1,K=null,G=!1;while(q<R.length&&H>0){let Q=R[q];if(G){G=!1,q++;continue}if(Q==="\\"&&K){G=!0,q++;continue}if(K){if(Q===K)K=null;q++;continue}if(Q==='"'||Q==="'"||Q==="`"){K=Q,q++;continue}if(Q==="(")H++;else if(Q===")"){if(H--,H===0)break}q++}if(H!==0)break;let ee=R.substring(F+1,q),ae=k(ee);R=R.substring(0,z)+ae+R.substring(q+1)}return R}function Aw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),F=Object.values(_);to(B);let q=c(B,z)(...F),K=JSON.stringify(q);if(K===void 0){if(!Pe(B).some((ae)=>!(ae in _)))return"";return R}let G=Buffer.from(K,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(z){return R}}),k}var Va="<!--__STX_BREAK__-->",Ua="<!--__STX_CONTINUE__-->";function Tw(v,_){let k=v;return k=Fa(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let F=c(B,Object.keys(_));z=Boolean(F(...Object.values(_)))}else z=Boolean(l(B,_));return z?Va:""}catch{return""}}),k=Fa(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let F=c(B,Object.keys(_));z=Boolean(F(...Object.values(_)))}else z=Boolean(l(B,_));return z?Ua:""}catch{return""}}),k}function Iw(v){let _=v;return _=_.replace(/@break(?!\()/g,Va),_=_.replace(/@continue(?!\()/g,Ua),_}function lm(v){let _=v.includes(Va),k=_?v.substring(0,v.indexOf(Va)):v;return{hasBreak:_,content:k}}function um(v){let _=v.includes(Ua),k=_?v.substring(0,v.indexOf(Ua)):v;return{hasContinue:_,content:k}}function fm(v){let _=v;return _=Fa(_,"@break",(k)=>{let R=k.trim();if(!Tr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=Fa(_,"@continue",(k)=>{let R=k.trim();if(!Tr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Pw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((K,G)=>K.pos-G.pos);let F=[],H=0;for(let K of R)H+=K.delta,F.push({pos:K.pos,depth:H});function q(K){let G=0,ee=F.length-1,ae=0;while(G<=ee){let Q=G+ee>>1;if(F[Q].pos<=K)ae=F[Q].depth,G=Q+1;else ee=Q-1}return ae}while((k=_.exec(v))!==null){if(q(k.index)>0)continue;let K=k.index,G=k.index+k[0].length-1,ee=1,ae=G+1,Q=-1;while(ae<v.length&&ee>0){if(v[ae]==="(")ee++;else if(v[ae]===")"){if(ee--,ee===0){Q=ae;break}}ae++}if(Q===-1)continue;let ce=v.substring(G+1,Q),ue=Nt(ce);if(!ue)continue;let{arrayExpr:le,itemVar:pe}=ue,de=Q+1,Re=1,be=de,xe=/@forelse\s*\(/g,Ie=/@endforelse/g,Me=-1;while(Re>0&&be<v.length){xe.lastIndex=be,Ie.lastIndex=be;let Fe=xe.exec(v),Ve=Ie.exec(v);if(!Ve)break;if(Fe&&Fe.index<Ve.index)Re++,be=Fe.index+Fe[0].length;else{if(Re--,Re===0){Me=Ve.index;break}be=Ve.index+11}}if(Me===-1)continue;let Ne=v.substring(de,Me),je=Me+11,Le=-1,De=0,ze=0;while(ze<Ne.length){let Fe=Ne.indexOf("@",ze);if(Fe===-1)break;let Ve=Ne.substring(Fe);if(/^@forelse\s*\(/.test(Ve))De++,ze=Fe+1;else if(Ve.startsWith("@endforelse"))De--,ze=Fe+11;else if(De===0&&Ve.startsWith("@empty")){if(Ne.length<=Fe+6||!/[a-z]/i.test(Ne[Fe+6])){Le=Fe;break}ze=Fe+1}else ze=Fe+1}if(Le===-1)continue;return{start:K,end:je,arrayExpr:le,itemVar:pe,foreachContent:Ne.substring(0,Le),emptyContent:Ne.substring(Le+6)}}return null}function dm(v,_){let k=v;while(!0){let R=Pw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:F,foreachContent:H,emptyContent:q}=R;try{let K;if(p(z))K=c(z,Object.keys(_))(...Object.values(_));else K=l(z,_);let G;if(!Array.isArray(K)||K.length===0)G=q;else G=`@foreach (${z} as ${F})${H}@endforeach`;k=k.substring(0,T)+G+k.substring(B)}catch(K){let G=K instanceof Error?K.message:String(K),ee=i("Forelse",`Error in @forelse(${z} as ${F}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+ee+k.substring(B)}}return k}var pm="<!--stx:foreach-not-iterable:",Dw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ow(v,_){return`${pm}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Mw(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 Os(v){if(!v.includes(pm))return v;return v.replace(Dw,(_,k,R)=>(Mw(decodeURIComponent(k),decodeURIComponent(R)),""))}function Pi(v,_,k,R,T=!1){let B=v;B=dm(B,_);function z(q){let K=/@foreach\s*\(/g,G;while((G=K.exec(q))!==null){let ee=G.index,ae=G.index+G[0].length-1,Q=1,ce=ae+1,ue=-1;while(ce<q.length&&Q>0){if(q[ce]==="(")Q++;else if(q[ce]===")"){if(Q--,Q===0){ue=ce;break}}ce++}if(ue===-1)continue;let le=q.substring(ae+1,ue),pe=Nt(le);if(!pe)continue;let de=ee,{arrayExpr:Re,itemVar:be}=pe,xe=ue+1,Ie=1,Me=xe,Ne=/@foreach\s*\(/g,je=/@endforeach/g;while(Ie>0&&Me<q.length){Ne.lastIndex=Me,je.lastIndex=Me;let Le=Ne.exec(q),De=je.exec(q);if(!De)break;if(Le&&Le.index<De.index)Ie++,Me=Le.index+Le[0].length;else{if(Ie--,Ie===0){let ze=q.substring(xe,De.index),Fe=De.index+11;return{start:de,end:Fe,arrayExpr:Re,itemVar:be,content:ze}}Me=De.index+11}}}return null}function F(q,K){let G=q;while(!0){let ee=z(G);if(!ee)break;let{start:ae,end:Q,arrayExpr:ce,itemVar:ue,content:le}=ee;try{let pe=ce.trim(),de;if(p(pe))de=c(pe,Object.keys(K))(...Object.values(K));else de=l(pe,K);let Re=!1;if(!Array.isArray(de))if(de instanceof Map)de=Array.from(de),Re=!0;else if(de instanceof Set)de=Array.from(de);else if(typeof de==="string")de=Array.from(de);else if(de&&typeof de==="object"&&!(de instanceof Date)&&!(de instanceof RegExp))de=Object.entries(de),Re=!0;else{let ze=Ow(pe,k)+i("Foreach",`Error in @foreach: ${pe} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ae)+ze+G.substring(Q);continue}let be=R?.loops?.useAltLoopVariable??Ew,xe=ue.trim(),Ie=null,Me,Ne=!1;if(xe.includes("=>")){let ze=xe.split("=>").map((Fe)=>Fe.trim());if(ze.length===2&&ze[0]&&ze[1])Ie=ze[0],Me=ze[1];else Me=xe}else if(!xe.startsWith("[")&&!xe.startsWith("{")&&xe.includes(",")){let ze=xe.split(",").map((Fe)=>Fe.trim());if(ze.length===2&&ze[0]&&ze[1])Me=ze[0],Ie=ze[1],Ne=!0;else Me=xe}else Me=xe;let je="",Le=de,De=K[_r]??new WeakMap;for(let ze=0;ze<Le.length;ze++){let Fe=Le[ze],Ve={index:ze,iteration:ze+1,first:ze===0,last:ze===Le.length-1,count:Le.length},Be={...K,loop:Ve,$loop:Ve,[_r]:De};if(Me.startsWith("[")&&Me.endsWith("]")){let Et=Me.slice(1,-1).split(",").map((ft)=>ft.trim());if(Array.isArray(Fe))Et.forEach((ft,wt)=>{if(ft)Be[ft]=Fe[wt]});else Be[Me]=Fe}else if(Me.startsWith("{")&&Me.endsWith("}")){let Et=Me.slice(1,-1).split(",").map((ft)=>ft.trim()).filter(Boolean);if(Fe!==null&&typeof Fe==="object")Et.forEach((ft)=>{let wt=ft.indexOf(":"),Ct=(wt===-1?ft:ft.slice(0,wt)).trim(),yt=wt===-1?Ct:ft.slice(wt+1).trim();if(Ct&&yt)Be[yt]=Fe[Ct]});else Be[Me]=Fe}else Be[Me]=Fe;if(Ie)if(!Ne&&Re&&Array.isArray(Fe)&&Fe.length===2)Be[Ie]=Fe[0],Be[Me]=Fe[1];else Be[Ie]=ze;let He=Tw(le,Be),vt=um(He);if(vt.hasContinue){je+=vt.content;continue}let bt=lm(He);if(bt.hasBreak){je+=bt.content;break}if(He=dm(He,Be),He=F(He,Be),He=xr(He,Be,k),He=Iw(He),bt=lm(He),bt.hasBreak){je+=bt.content;break}if(vt=um(He),vt.hasContinue){je+=vt.content;continue}He=Y(He,Be,k),He=Aw(He,Be),He=Rw(He,Be),He=Cw(He,Be),je+=He}G=G.substring(0,ae)+je+G.substring(Q)}catch(pe){let de=i("Foreach",`Error in @foreach(${ce.trim()} as ${ue.trim()}): ${pe instanceof Error?pe.message:String(pe)}`,t.EVALUATION_ERROR);G=G.substring(0,ae)+de+G.substring(Q)}}return G}B=F(B,_),B=mm(B,_,k,R);let H=R?.loops?.maxWhileIterations??kw;return B=Lw(B,_,H),T?B:Os(B)}function Gc(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 gm(v){return Tr(v)}function mm(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let F=z.index,H=F+z[0].length-1,q=S(T,"(",")",H);if(q===-1)break;let K=Gc(T.slice(H+1,q)),G=q+1,ee=Ea(T.slice(F),"for","endfor");if(ee.length===0)break;let ae=ee[0].content,Q=F+ee[0].end;if(!gm(K)){let ce=i("For",`Unsafe expression in @for: ${K}`,t.UNSAFE_EXPRESSION);T=T.substring(0,F)+ce+T.substring(Q),B=!0;continue}try{let ce=Nw(K),ue=/@(?:for|foreach|if|unless)\s*\(/.test(ae);if(ce.length>0&&ue){let xe=jw({forExpr:K,content:ae,iterVarNames:ce,context:_,filePath:k,options:R});T=T.substring(0,F)+xe+T.substring(Q),B=!0;continue}let le=Object.keys(_),pe=Object.values(_),de=ae.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(xe,Ie)=>`\${${Ie}}`);de=fm(de);let be=Function(...le,`
|
|
2537
|
-
let result = '';
|
|
2538
|
-
for (${K}) {
|
|
2539
|
-
result += \`${de}\`;
|
|
2540
|
-
}
|
|
2541
|
-
return result;
|
|
2542
|
-
`)(...pe);T=T.substring(0,F)+be+T.substring(Q),B=!0}catch(ce){let ue=i("For",`Error in @for(${K}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);T=T.substring(0,F)+ue+T.substring(Q),B=!0}}return T}function Nw(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let B=k[1];return B.slice(1,-1).split(",").map((F)=>{let H=F.trim();if(!H)return"";let q=H.indexOf(":");if(q>=0&&B.startsWith("{")){let ee=H.slice(q+1).trim(),ae=ee.indexOf("=");return(ae>=0?ee.slice(0,ae):ee).trim()}let K=H.indexOf("="),G=(K>=0?H.slice(0,K):H).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let R=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(R)return[R[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function jw(v){let{forExpr:_,content:k,iterVarNames:R,context:T,filePath:B,options:z}=v,F=Object.keys(T),H=Object.values(T),q=Function(...F,"__pushIter",`
|
|
2543
|
-
for (${_}) {
|
|
2544
|
-
__pushIter([${R.join(", ")}])
|
|
2545
|
-
}
|
|
2546
|
-
`),K=[];q(...H,(ae)=>{K.push(ae)});let G=B??"inline.stx",ee="";for(let ae of K){let Q={...T};R.forEach((ue,le)=>{Q[ue]=ae[le]});let ce=mm(k,Q,B,z);ce=xr(ce,Q,G),ce=Y(ce,Q,G),ee+=ce}return ee}function Lw(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@while\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,H=S(R,"(",")",F);if(H===-1)break;let q=R.slice(F+1,H),K=Ea(R.slice(z),"while","endwhile");if(K.length===0)break;let G=K[0].content,ee=z+K[0].end;if(!gm(q)){let ae=i("While",`Unsafe expression in @while: ${q}`,t.UNSAFE_EXPRESSION);R=R.substring(0,z)+ae+R.substring(ee),T=!0;continue}try{let ae=Object.keys(_),Q=Object.values(_),ce=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(pe,de)=>`\${${de}}`);ce=fm(ce);let le=Function(...ae,`
|
|
2547
|
-
let result = '';
|
|
2548
|
-
let maxIterations = ${k}; // Configurable safety limit
|
|
2549
|
-
let counter = 0;
|
|
2550
|
-
while (${q} && counter < maxIterations) {
|
|
2551
|
-
counter++;
|
|
2552
|
-
result += \`${ce}\`;
|
|
2553
|
-
}
|
|
2554
|
-
if (counter > maxIterations) {
|
|
2555
|
-
result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
2556
|
-
}
|
|
2557
|
-
return result;
|
|
2558
|
-
`)(...Q);R=R.substring(0,z)+le+R.substring(ee),T=!0}catch(ae){let Q=i("While",`Error in @while(${q}): ${ae instanceof Error?ae.message:String(ae)}`,t.EVALUATION_ERROR);R=R.substring(0,z)+Q+R.substring(ee),T=!0}}return R}function Bw(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function hm(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,R,T,B)=>Bw(R,B||"_method"))}async function ym(v,_,k,R,T){if(!R.middleware||R.middleware.length===0)return v;let B=v,z=R.middleware.filter((F)=>F.timing===T);if(z.length===0)return B;for(let F of z){if(!F.name||typeof F.handler!=="function"){if(R.debug)console.warn("Invalid middleware:",F);continue}try{let H=await F.handler(B,_,k,R);if(typeof H==="string")B=H;else if(R.debug)console.warn(`Middleware ${F.name} did not return a string`)}catch(H){if(R.debug)console.error(`Error in middleware ${F.name}:`,H);if(R.debug){let q=g("Middleware",`Error in middleware '${F.name}': ${H instanceof Error?H.message:String(H)}`,k,v);B=B.replace(/<body[^>]*>/,`$&
|
|
2559
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(q)}</div>
|
|
2560
|
-
`)}}}return B}async function xm(v,_,k,R){return ym(v,_,k,R,"before")}async function bm(v,_,k,R){return ym(v,_,k,R,"after")}function vm(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,R,T,B)=>{try{let z=T?N(T,{}):{};return Hn(R,z,B==="true")}catch(z){return console.error(`Error processing @route directive: ${z}`),"#route-error"}})}var To={patterns:[],exact:{}};async function wm(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(To.exact[v])for(let R of To.exact[v])await Promise.resolve(R(_,v));if(To.exact[k])for(let R of To.exact[k])await Promise.resolve(R(_,v));for(let{pattern:R,callback:T}of To.patterns)if(R.test(v)||R.test(k))await Promise.resolve(T(_,v))}var zw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ww=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 Qr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let R=k.exec(v);if(!R)return null;let T=/\/\s*>$/.test(R[0])||R[1]===R[1].toLowerCase()&&zw.has(R[1]),B=T?R[2].replace(/\/\s*$/,""):R[2];return{full:R[0],tag:R[1],attrs:B,selfClosing:T,start:R.index,end:R.index+R[0].length}}function Fw(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),z=new RegExp(`</${_}\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T;let F=B.exec(v),H=z.exec(v);if(!H)return-1;if(F&&F.index<H.index)R++,T=F.index+F[0].length;else{if(R--,R===0)return H.index+H[0].length;T=H.index+H[0].length}}return-1}function Yr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Fw(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 Sm(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Io(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return R?R[1]:null}function Fr(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 ii(v,_,k){let R=_.selfClosing?" /":"",T=`<${_.tag}${k}${R}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function Vw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Uw(v){let _=v,k=0;while(k<_.length){let R=Qr(_,k);if(!R)break;let T=Io(R.attrs,"v-for");if(T===null){k=R.end;continue}let B=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!B){k=R.end;continue}let z=B[1].trim(),F=B[2].trim(),H;if(z.includes(",")){let ue=z.split(",").map((de)=>de.trim()),le=ue[0],pe=ue[1];H=`${F} as ${pe} => ${le}`}else H=`${F} as ${z}`;let q=Fr(R.attrs,"v-for"),K=Fr(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Yr(_,R),ee=_.slice(G.outerStart,G.outerEnd),ae=ii(ee,{...R,start:0,end:R.end-R.start},K),Q=`@foreach(${H})
|
|
2561
|
-
`,ce=`${Q}${ae}
|
|
2562
|
-
@endforeach`;_=_.slice(0,G.outerStart)+ce+_.slice(G.outerEnd),k=G.outerStart+Q.length}return _}function Hw(v){let _=v,k=0;while(k<_.length){let R=Qr(_,k);if(!R)break;let T=Io(R.attrs,"v-if");if(T===null){k=R.end;continue}let B=[],z=Yr(_,R),F=Fr(R.attrs,"v-if"),H=ii(_.slice(z.outerStart,z.outerEnd),{...R,start:0,end:R.end-R.start},F);B.push({type:"if",expr:T,outerStart:z.outerStart,outerEnd:z.outerEnd,element:H,parsedTag:R});let q=z.outerEnd,K=!0;while(K){let ce=_.slice(q).match(/^\s*/),ue=ce?ce[0].length:0,le=Qr(_,q+ue);if(!le){K=!1;break}let pe=Io(le.attrs,"v-else-if"),de=Sm(le.attrs,"v-else");if(pe!==null){let Re=Yr(_,le),be=Fr(le.attrs,"v-else-if"),xe=ii(_.slice(Re.outerStart,Re.outerEnd),{...le,start:0,end:le.end-le.start},be);B.push({type:"else-if",expr:pe,outerStart:q,outerEnd:Re.outerEnd,element:xe,parsedTag:le}),q=Re.outerEnd}else if(de){let Re=Yr(_,le),be=Fr(le.attrs,"v-else"),xe=ii(_.slice(Re.outerStart,Re.outerEnd),{...le,start:0,end:le.end-le.start},be);B.push({type:"else",outerStart:q,outerEnd:Re.outerEnd,element:xe,parsedTag:le}),K=!1}else K=!1}let G=[];for(let ce of B)if(ce.type==="if")G.push(`@if(${ce.expr})
|
|
2563
|
-
${ce.element}`);else if(ce.type==="else-if")G.push(`@elseif(${ce.expr})
|
|
2564
|
-
${ce.element}`);else G.push(`@else
|
|
2565
|
-
${ce.element}`);G.push("@endif");let ee=G.join(`
|
|
2566
|
-
`),ae=B[0].outerStart,Q=B[B.length-1].outerEnd;_=_.slice(0,ae)+ee+_.slice(Q),k=ae+ee.length}return _}function qw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Kw(v){let _=v,k=0;while(k<_.length){let R=Qr(_,k);if(!R)break;let T=Ww.has(R.tag),B=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(F,H,q)=>{let K=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(H);if(!K||!q||!/^["']/.test(q))return F;let G=K[1]||"modelValue",ee=K[2];if(T&&!K[1])return`@model${ee}=${q}`;let ae=q[0],Q=q.slice(1,-1),ce=`:${G}=${q} @update:${G}=${ae}${Q} = $event${ae}`;if(ee){let ue=K[1]?`${G}Modifiers`:"modelModifiers",le=ee.slice(1).split(".").map((pe)=>`${pe}: true`).join(", ");ce+=` :${ue}="{ ${le} }"`}return ce});if(B===R.attrs){k=R.end;continue}let z=ii(R.full,{...R,start:0,end:R.full.length},B);_=_.slice(0,R.start)+z+_.slice(R.end),k=R.start+z.length}return _}function Xw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Zw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Gw(v){let _=v,k=0;while(k<_.length){let R=Qr(_,k);if(!R)break;let T=Io(R.attrs,"v-html");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Yr(_,R),z=Fr(R.attrs,"v-html"),F=R.selfClosing?" /":"",H=`<${R.tag}${z}${F}>{!! ${T} !!}</${R.tag}>`;_=_.slice(0,B.outerStart)+H+_.slice(B.outerEnd),k=B.outerStart+H.length}return _}function Jw(v){let _=v,k=0;while(k<_.length){let R=Qr(_,k);if(!R)break;let T=Io(R.attrs,"v-text");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Yr(_,R),z=Fr(R.attrs,"v-text"),F=R.selfClosing?" /":"",H=`<${R.tag}${z}${F}>{{ ${T} }}</${R.tag}>`;_=_.slice(0,B.outerStart)+H+_.slice(B.outerEnd),k=B.outerStart+H.length}return _}function Yw(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 Qw(v){let _=v,k=0;while(k<_.length){let R=Qr(_,k);if(!R)break;if(!Sm(R.attrs,"v-once")){k=R.end;continue}let T=Fr(R.attrs,"v-once"),B=Yr(_,R),z=_.slice(B.outerStart,B.outerEnd),H=`@once
|
|
2567
|
-
${ii(z,{...R,start:0,end:R.end-R.start},T)}
|
|
2568
|
-
@endonce`;_=_.slice(0,B.outerStart)+H+_.slice(B.outerEnd),k=B.outerStart+H.length}return _}function eS(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function tS(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 $m(v){if(!Vw(v))return v;let _=v;return _=Uw(_),_=Hw(_),_=Qw(_),_=Xw(_),_=Zw(_),_=Kw(_),_=qw(_),_=tS(_),_=Gw(_),_=Jw(_),_=Yw(_),_=eS(_),_}function Ha(v){return v.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var ku=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"]),nS=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function _m(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),R=k?k[1]:v,T=l(R,_);if(T&&typeof T==="string")return T;let B=R.trim();return ku.has(B)?B:null}function km(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function Em(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(nS.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function Cm(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,F=[],H;while((H=z.exec(B))!==null)F.push({full:H[0],expr:H[1],attrs:H[2],slotContent:H[3],index:H.index});for(let q=F.length-1;q>=0;q--){let K=F[q];try{let G=_m(K.expr,_);if(!G||typeof G!=="string"){let pe=`<!-- dynamic component: could not resolve "${Ha(km(K.expr))}" -->`;B=B.slice(0,K.index)+pe+B.slice(K.index+K.full.length);continue}if(ku.has(G)){let pe=Em(G,K.attrs,K.slotContent);B=B.slice(0,K.index)+pe+B.slice(K.index+K.full.length);continue}let ee=K.attrs.trim(),ae={},Q=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,ce;while((ce=Q.exec(ee))!==null){let pe=ce[1]||ce[2],de=ce[3];if(ce[1])try{ae[pe]=l(de,_)}catch{ae[pe]=de}else ae[pe]=de}let ue=R.componentsDir||"components",le=await rt(G,ae,K.slotContent,ue,_,k,R,new Set,T??new Set);B=B.slice(0,K.index)+le+B.slice(K.index+K.full.length)}catch(G){let ee=G instanceof Error?G.message:String(G),ae=`<!-- dynamic component error: ${Ha(ee)} -->`;B=B.slice(0,K.index)+ae+B.slice(K.index+K.full.length)}}return B=await rS(B,_,k,R,T),B}async function rS(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,F=[],H;while((H=z.exec(B))!==null)F.push({full:H[0],expr:H[1],attrs:H[2],index:H.index});for(let q=F.length-1;q>=0;q--){let K=F[q];try{let G=_m(K.expr,_);if(!G||typeof G!=="string"){let Q=`<!-- dynamic component: could not resolve "${Ha(km(K.expr))}" -->`;B=B.slice(0,K.index)+Q+B.slice(K.index+K.full.length);continue}if(ku.has(G)){let Q=Em(G,K.attrs,"");B=B.slice(0,K.index)+Q+B.slice(K.index+K.full.length);continue}let ee=R.componentsDir||"components",ae=await rt(G,{},"",ee,_,k,R,new Set,T??new Set);B=B.slice(0,K.index)+ae+B.slice(K.index+K.full.length)}catch(G){let ee=G instanceof Error?G.message:String(G),ae=`<!-- dynamic component error: ${Ha(ee)} -->`;B=B.slice(0,K.index)+ae+B.slice(K.index+K.full.length)}}return B}var Oi="X-STX-Build",Eu=Symbol.for("stx.buildId");function Ls(){let v=globalThis;if(!v[Eu])v[Eu]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[Eu]}function Rm(v,_=Ls()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
|
|
2569
|
-
<meta name="stx-build" content="${_}">`}function sS(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let R=null,T=!1,B=[],z={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(K){if(z.updateReady)try{K()}catch{}else B.push(K);return()=>{let G=B.indexOf(K);if(G!==-1)B.splice(G,1)}},applyUpdate(){let K=R&&R.waiting;if(!K)return!1;return T=!0,K.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let F=(K)=>{if(!K.waiting||!_.controller||z.updateReady)return;z.updateReady=!0;let G=B.splice(0);for(let ee of G)try{ee()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(K)=>{let G=K.data||{};if(G.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:G.url,kind:G.kind,fragment:!!G.fragment}}))}catch{}if(G.type==="stx:reachability"){if(k.stxOffline.reachable=G.reachable!==!1,Number(G.at)>0)k.stxOffline.reachedAt=Number(G.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:G.reachable!==!1,at:Number(G.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&R&&R.waiting)R.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let H=()=>{_.register(v,{scope:"/"}).then((K)=>{R=K;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(K.waiting)F(K),K.waiting.postMessage({type:"stx:activate-update",reason:"load"});K.addEventListener("updatefound",()=>{let G=K.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")F(K)})})}).catch(()=>{})},q=()=>{let K=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>K(H));else K(H)};if(!_.controller)if(document.readyState==="complete")q();else addEventListener("load",q);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",q);else q()}function iS(){let v=`(${sS.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var Am=`<script data-stx-offline>${iS()}</script>`;import{AsyncLocalStorage as oS}from"async_hooks";var Tm=new oS;function _n(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Im(v,_){return Tm.run(_n(v),_)}async function Pm(v,_){let k=Tm.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let R=k.pending.get(v);if(R)return R;let T=Promise.resolve().then(_).then((B)=>{let z=JSON.stringify(B,(H,q)=>{if(q===void 0||typeof q==="function"||typeof q==="symbol"||typeof q==="bigint"||typeof q==="number"&&!Number.isFinite(q))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(q&&typeof q==="object"&&!Array.isArray(q)&&Object.getPrototypeOf(q)!==Object.prototype&&Object.getPrototypeOf(q)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return q}),F=JSON.parse(z);return k.values.set(v,F),F}).catch((B)=>{throw k.pending.delete(v),B});return k.pending.set(v,T),T}function pr(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 aS=/<\/(script)/gi;function oi(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(aS,"<\\/$1")}import Dm from"path";function L(v,_={}){return new zn(v,_).routes}var Om=new Map;async function Mm(v,_){let k=v,R=_;if(!k||!R)try{let F=await o();k||=F?.pagesDir||"pages",R||=F?.root||"."}catch{k||="pages",R||="."}let T=Dm.isAbsolute(k)?k:Dm.join(R,k),B=Om.get(T);if(B)return B;let z=[];try{z=L(".",{pagesDir:T,emit:!1}).map((F)=>F.regex.source).filter(Boolean)}catch{z=[]}return Om.set(T,z),z}function lS(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Nm(v){return lS(JSON.stringify(v))}function me(v){return v.includes("data-stx-runtime")}function jm(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let R=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(R))continue;return!0}return!1}function Cu(v,_){let k=lo(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
|
|
2570
|
-
`+v.slice(k);let T=Rn(v);if(T!==null)return`${v.slice(0,T)}
|
|
2571
|
-
${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
|
|
2572
|
-
`+v.slice(z)}if(Zn(v))return ps(v,(z)=>`${z}
|
|
2573
|
-
${_}`);return`${_}
|
|
2574
|
-
${v}`}async function qa(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-6p57991f.js"),{url:B}=await T("runtime",_.debug===!0);return Cu(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return Cu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-6p57991f.js"),R=await k(_.debug);return Cu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function uS(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Lm(v){if(v.includes("data-stx-tooltip-runtime")||!uS(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${cu()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
|
|
2575
|
-
${_}`;return`${v.slice(0,k)}${_}
|
|
2576
|
-
${v.slice(k)}`}var dS=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function fS(v){return dS.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function Z(v,_){if(!v.includes("</body>"))return v;if(fS(v))return v;let k=_?.router,R="";{let H={};if(k){if(k.container)H.container=k.container;if(k.interceptAllLinks!==void 0)H.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)H.progress=k.progress;if(k.viewTransitions!==void 0)H.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)H.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)H.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)H.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)H.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)H.prefetch=k.prefetch;if(k.cache!==void 0)H.cache=k.cache;if(k.progressColor!==void 0)H.progressColor=k.progressColor;if(k.progressHeight!==void 0)H.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)H.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)H.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)H.keepOpening=k.keepOpening}try{let q=await Mm(_?.pagesDir,_?.root);if(q.length>0)H.ownedRoutes=q}catch{}if(Object.keys(H).length>0)R=`<script>window.__stxRouterConfig=${Nm(H)};</script>
|
|
2577
|
-
`}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-6p57991f.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,F=v.lastIndexOf("</body>");return v.slice(0,F)+R+z+`
|
|
2578
|
-
</body>`+v.slice(F+7)}var Bm=Symbol.for("stx.lazy-module-promises");function pS(){let v=globalThis;return v[Bm]??=new Map,v[Bm]}function kt(v,_){let k=pS(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var Ru=`(?:"[^"]*"|'[^']*'|[^>"'])*`,qm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,gS=65536,mS=4,Xa=new Map;function hd(){Xa.clear()}function hS(v){let _=[];for(let k of te(v,V)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function Lc(v,_={}){let k=v.length>=gS,R=k?Xa.get(v):void 0;if(R===void 0){if(R=hS(v),k)Vd(Xa,mS),Xa.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function $s(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:F}=zm(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:F}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:F}=zm(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:F}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function zm(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function Rs(v,_){return ta(v,_)}function yS(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Km(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function xS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Ru})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=te(v,(B,z)=>{_.lastIndex=z;let F=_.exec(B);if(!F||F.index!==z||!k.test(F[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let F=z[2].match(k),H=$s(F?.[1]??F?.[2]??""),q=[H.itemVar,H.indexVar].filter(Boolean);if(q.length===0)continue;let K=z[1],ee=/\/\s*>$/.test(B.token)||Za.has(K.toLowerCase())?B.end:Tu(v,B.start,K,B.end);if(ee!==-1)T.push({start:B.start,end:ee,vars:new Set(q)})}return T}var Wm=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 bS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Fm(v,_,k,R){if(!v)return!1;let T=bS(v),B=!1,z=!1,F=!1,H=/([a-zA-Z_$][\w$]*)/g,q;while((q=H.exec(T))!==null){let ae=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if(Wm.has(ae))continue;if(_.has(ae)||R?.has(ae))B=!0;else if(k&&ae in k)z=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=K.exec(T))!==null){let ae=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(Wm.has(ae)||k&&ae in k)continue;F=!0}return(B||F)&&!z}function Ka(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,""")}"`,T=v.trim(),B=T.match(qm);if(B&&vS(B[3],B[1])){let[,z,F,H]=B;return`<${z}${F}${R}>${H}</${z}>`}return`<template${R}>${T}</template>`}function vS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function _i(v,_){let k=Km(v);function R(T){let B=T,z=xS(T),F=(G)=>{let ee=new Set;for(let ae of z)if(G>ae.start&&G<ae.end)for(let Q of ae.vars)ee.add(Q);return ee},H=/@if\s*\(/g,q,K=[];while((q=H.exec(B))!==null){let G=q.index,ee=G+q[0].length,ae=1,Q=ee;while(Q<B.length&&ae>0){if(B[Q]==="(")ae++;else if(B[Q]===")")ae--;Q++}if(ae!==0)continue;let ce=B.substring(ee,Q-1).trim(),ue=Q,le=1,pe=ue,de=/@(if\s*\(|endif)/g;de.lastIndex=ue;let Re;while((Re=de.exec(B))!==null)if(Re[1].startsWith("if"))le++;else if(Re[1]==="endif"){if(le--,le===0){pe=Re.index+Re[0].length;break}}if(le!==0)continue;let be=B.substring(ue,pe-6).trim(),xe;if(yS(be)){let Ie=mo(B.substring(G,pe));if(Ie.length===0)continue;let Me=Ie[0].branches.filter((De)=>De.type!=="else"),Ne=F(G);if(!(Me.length>0&&Me.every((De)=>Fm(De.condition,k,_,Ne))))continue;xe=Ie[0].branches.map((De)=>{let ze=R(De.content);if(De.type==="elseif")return Ka(ze,"@else-if",De.condition??"");if(De.type==="else")return Ka(ze,"@else");return Ka(ze,"@if",De.condition??"")}).join(`
|
|
2579
|
-
`)}else{if(!Fm(ce,k,_,F(G)))continue;xe=Ka(R(be),"@if",ce)}K.push({start:G,end:pe,replacement:xe}),H.lastIndex=pe}for(let G=K.length-1;G>=0;G--){let{start:ee,end:ae,replacement:Q}=K[G];B=B.substring(0,ee)+Q+B.substring(ae)}return B}return R(v)}function wS(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var Za=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Vm=/<(script|style)\b/iy,SS=/<\/script/gi,$S=/<\/style/gi;function Tu(v,_,k,R){if(Za.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,F=R;while(F<B){let H=v.indexOf("<",F);if(H===-1)return-1;if(F=H,v.startsWith("<!--",F)){let ee=v.indexOf("-->",F+4);if(ee===-1)return-1;F=ee+3;continue}Vm.lastIndex=F;let q=Vm.exec(v);if(q){let ee=v.indexOf(">",F);if(ee===-1)return-1;if(v[ee-1]==="/"){F=ee+1;continue}let ae=q[1].toLowerCase()==="script"?SS:$S;ae.lastIndex=F;let Q=ae.exec(v);if(Q===null)return-1;let ce=v.indexOf(">",Q.index);if(ce===-1)return-1;F=ce+1;continue}if(v[F+1]==="/"){let ee=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(F,F+64));if(!ee){F++;continue}if(ee[1].toLowerCase()===T){if(z--,F+=ee[0].length,z===0)return F;continue}F+=ee[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec(v.slice(F,F+64));if(!K){F++;continue}let G=v.indexOf(">",F);if(G===-1)return-1;if(K[1].toLowerCase()===T){let ee=v.slice(F,G+1);if(!(/\/\s*>$/.test(ee)||Za.has(T)))z++}F=G+1}return-1}var _S=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function kS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return _S.test(B)}function Ei(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(G)=>_.some(([ee,ae])=>G>=ee&&G<ae),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],F;while((F=B.exec(v))!==null){if(T(F.index))continue;let[G,ee,ae,Q,ce,ue,le]=F,pe=wS(ce);if(pe===void 0)continue;let de=F.index,Re=de+G.length,Ie=!!le||/\/\s*>$/.test(G)||Za.has(ee.toLowerCase())?Re:Tu(v,de,ee,Re);if(Ie===-1)continue;if((Q===":if"||Q==="x-if"||Q==="@if")&&kS(v,Ie)){B.lastIndex=Re;continue}if(pe===!0){let Ne=`<${ee}${ae}${ue}${le}>`;z.push({start:de,end:Re,replacement:Ne});continue}z.push({start:de,end:Ie,replacement:""}),B.lastIndex=Ie}if(z.length===0)return v;z.sort((G,ee)=>G.start-ee.start);let H=[],q=-1;for(let G of z){if(G.start<q)continue;H.push(G),q=G.end}let K=v;for(let G=H.length-1;G>=0;G--){let{start:ee,end:ae,replacement:Q}=H[G];K=K.substring(0,ee)+Q+K.substring(ae)}return K}var Um=[":for","@for","x-for"];function As(v,_){if(!_||Object.keys(_).length===0)return v;if(!Um.some((F)=>v.includes(`${F}=`)))return v;let k=Km(v);if(Array.isArray(_.__stx_client_signal_names)){for(let F of _.__stx_client_signal_names)if(typeof F==="string")k.add(F)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[F,H,q]=z,K=z.index,G=K+F.length,ee=Um.map((xe)=>({attr:xe,m:new RegExp(`\\s${xe}="([^"]*)"`).exec(q)})).find((xe)=>xe.m!==null);if(!ee||!ee.m)continue;let ae=$s(ee.m[1]);if(!ae.iterable||!ae.itemVar)continue;let Q=ae.iterable.trim().split(/[.[(]/)[0].trim();if(!Q||k.has(Q)||!(Q in _))continue;let ce=Tu(R,K,H,G);if(ce===-1)continue;let ue=q.replace(new RegExp(`\\s${ee.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),le=R.slice(G,ce-`</${H}>`.length),pe={..._,[ae.itemVar]:void 0};if(ae.indexVar)pe[ae.indexVar]=void 0;let de=As(le,pe),Re=ae.indexVar?`${ae.iterable} as ${ae.indexVar} => ${ae.itemVar}`:`${ae.iterable} as ${ae.itemVar}`,be=H.toLowerCase()==="template"?de:`<${H}${ue}>${de}</${H}>`;T.push({start:K,end:ce,replacement:`@foreach(${Re})${be}@endforeach`}),B.lastIndex=ce}for(let F=T.length-1;F>=0;F--){let{start:H,end:q,replacement:K}=T[F];R=R.slice(0,H)+K+R.slice(q)}return R}function Ps(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let F=T[1],H=T.index,q=H+T[0].length,K=1,G=q;while(G<k.length&&K>0){if(k[G]==="(")K++;else if(k[G]===")")K--;G++}if(K!==0)continue;let ee=k.substring(q,G-1).trim(),ae=G,Q=$s(ee),ce=F==="for"?"@endfor":"@endforeach",ue=1,le=ae,pe=F==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${F}\\s*\\(|end${F})`,"g");pe.lastIndex=ae;let de;while((de=pe.exec(k))!==null)if(de[1].startsWith(F))ue++;else if(ue--,ue===0){le=de.index+de[0].length;break}if(ue!==0)continue;let Re=()=>{let je=[Q.itemVar,Q.indexVar].filter(Boolean);if(je.length)z.push({start:H,end:le,vars:je})};if(Q.iterable){let je=Q.iterable.trim();if(je.startsWith("[")||je.startsWith("{")||je.startsWith("'")||je.startsWith('"')||je.startsWith("`")||/^-?\d/.test(je)){Re();continue}let Le=je.split(/[.[(]/)[0].trim(),De=_?Le in _:!1,ze=z.some((Fe)=>H>Fe.start&&H<Fe.end&&Fe.vars.includes(Le));if(Le&&(De||ze)){Re();continue}}if(Q.style==="as")ee=Q.indexVar?`(${Q.itemVar}, ${Q.indexVar}) in ${Q.iterable}`:`${Q.itemVar} in ${Q.iterable}`;let be=k.substring(ae,le-ce.length).trim(),xe=_?{..._}:{};if(Q.itemVar)delete xe[Q.itemVar];if(Q.indexVar)delete xe[Q.indexVar];let Ie=Ps(be,xe),Me=Ie.match(qm),Ne;if(Me){let[,je,Le,De]=Me;Ne=`<${je}${Le} @for="${ee}">${De}</${je}>`}else Ne=`<template @for="${ee}">${Ie}</template>`;B.push({start:H,end:le,replacement:Ne}),R.lastIndex=le}for(let F=B.length-1;F>=0;F--){let{start:H,end:q,replacement:K}=B[F];k=k.substring(0,H)+K+k.substring(q)}return k}function ES(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(K)=>{let G=R+1;while(G<B){let ee=v[G];if(ee==="\\"){G+=2;continue}if(ee===K)return G+1;G++}return B},F=()=>{let K=R+2;while(K<B&&v[K]!==`
|
|
2580
|
-
`)K++;return K},H=()=>{let K=R+2;while(K<B-1){if(v[K]==="*"&&v[K+1]==="/")return K+2;K++}return B},q=(K)=>{let G=K,ee=0;while(G<B){let ae=v[G];if(ae==="/"&&v[G+1]==="/"){let Q=G+2;while(Q<B&&v[Q]!==`
|
|
2581
|
-
`)Q++;G=Q;continue}if(ae==="/"&&v[G+1]==="*"){let Q=G+2;while(Q<B-1&&!(v[Q]==="*"&&v[Q+1]==="/"))Q++;G=Q+2;continue}if(ae==='"'||ae==="'"||ae==="`"){let Q=G+1;while(Q<B){if(v[Q]==="\\"){Q+=2;continue}if(v[Q]===ae){Q++;break}Q++}G=Q;continue}if(ae==="("||ae==="["||ae==="{"){ee++,G++;continue}if(ae===")"||ae==="]"||ae==="}"){ee--,G++;continue}if(ae===";"&&ee===0)return G+1;G++}return B};while(R<B){let K=v[R];if(K==="/"&&v[R+1]==="/"){let G=F();k.push(v.slice(R,G)),R=G;continue}if(K==="/"&&v[R+1]==="*"){let G=H();k.push(v.slice(R,G)),R=G;continue}if(K==='"'||K==="'"||K==="`"){let G=z(K);k.push(v.slice(R,G)),R=G;continue}if(K==="{"){T++,k.push(K),R++;continue}if(K==="}"){T--,k.push(K),R++;continue}if(T===0){let G=R>0?v[R-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ae=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ae){let Q=ae[2],ce=q(R+ae[0].length);if(_.has(Q)){k.push(`/* stx: deduped const ${Q} */`),R=ce;continue}_.add(Q),k.push(v.slice(R,ce)),R=ce;continue}}}k.push(K),R++}return k.join("")}var CS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Au(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function RS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!Au(T,T+_.length,k))return!0;R=T+_.length}return!1}function AS(v,_){if(RS(v,"<body",_)){let T=new RegExp(`<body(${Ru})>`,"g"),B;while((B=T.exec(v))!==null)if(!Au(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Ru})>`,"gi"),R;while((R=k.exec(v))!==null){if(Au(R.index,R.index+R[0].length,_))continue;if(CS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function TS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,F=!1,H=(q)=>{if(k!==null&&!F&&k>=z&&k<=q)T.push(v.slice(z,k),B,v.slice(k,q)),F=!0;else T.push(v.slice(z,q))};for(let q of _){if(q.start<z)continue;H(q.start),z=q.end}return H(v.length),T.join("")}async function dr(v,_,k,R={}){let T=Lc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,z=[],{hasUserImports:F,bundleClientScript:H}=await kt("stx/client-script-bundler",()=>import("./chunk-f0ghgkxs.js"));for(let de of T){let Re=de.body;if(tt(de.attrs))Re=nt(Re);if(R.forceClientSetup||B.test(Re)){z.push({content:Re,start:de.start,end:de.end});continue}if(!F(Re))continue;try{let be=await H(Ot(Re).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(be))z.push({content:Re,start:de.start,end:de.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let q=`${_??""}\x00${z.map((de)=>de.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,G=[];for(let de=0;de<z.length;de++){let Re=z[de].bundled??Ot(z[de].content).code;if(!z[de].bundled&&F(Re))Re=await H(Re,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});Re=et(Re);let be=I(Re);G.push(`// \u2500\u2500 merged signal script #${de+1} \u2500\u2500
|
|
2582
|
-
${be}`)}let ee=G.join(`
|
|
2583
|
-
|
|
2584
|
-
`);ee=ES(ee);let ae=jc(ee),Q=ae.split(",").map((de)=>de.trim()).filter(Boolean),ce=bn(ee,k),ue=`
|
|
2585
|
-
<script data-stx-scoped>
|
|
2586
|
-
function ${K}() {
|
|
2587
|
-
${Wt("const",Q)}
|
|
2588
|
-
${oi(`${ce}${ee}`)}
|
|
2589
|
-
return { ${ae} };
|
|
2590
|
-
}
|
|
2591
|
-
window.__stx_latestSetup=${K};
|
|
2592
|
-
if(window.stx)window.stx._latestSetup=${K};
|
|
2593
|
-
</script>`,le=AS(v,z);return{output:TS(v,z,le,K),setupCode:ue}}function jc(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,F=()=>{if(T!==0)return;let H=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(H){let ae=H[2];if(!R.has(ae))k.push(ae),R.add(ae);return}let q=_.slice(B).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(q){q[1].split(",").forEach((ae)=>{let Q=ae.trim();if(!Q)return;let ce=Q.indexOf(":"),le=(ce>=0?Q.slice(ce+1).trim():Q).split(/[\s=]/)[0];if(le&&!R.has(le))k.push(le),R.add(le)});return}let K=_.slice(B).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(K){K[1].split(",").forEach((ae)=>{let Q=ae.trim().replace(/^\.\.\./,"");if(!Q)return;let ce=Q.split(/[\s=]/)[0];if(ce&&!R.has(ce))k.push(ce),R.add(ce)});return}let G=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(G){let ae=G[1];if(!R.has(ae))k.push(ae),R.add(ae);return}let ee=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let ae=ee[1];if(!R.has(ae))k.push(ae),R.add(ae)}};while(B<z){if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))F();B++}return k.join(", ")}async function Ti(v,_,k,R){if(!Rs(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:B,setupCode:z}=await dr(T,k,R);if(T=B,!z){let F=Zn(T);if(F&&!/data-stx/.test(F.attrs)&&!/data-stx-auto/.test(F.attrs)){let H=F.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,F.index)+H+T.slice(F.index+F.tag.length)}}if(T=await qa(T,_),z){let F=$i(T,/<\/head>/i),H=F===-1?$i(T,/<body[^>]*>/i):-1;if(F!==-1)T=`${T.slice(0,F)}${z}
|
|
2594
|
-
${T.slice(F)}`;else if(H!==-1){let q=/<body[^>]*>/i.exec(T.slice(H))[0],K=H+q.length;T=`${T.slice(0,K)}
|
|
2595
|
-
${z}${T.slice(K)}`}else T=`${T}
|
|
2596
|
-
${z}`}return T}function $i(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,R=[],T;while((T=k.exec(v))!==null)R.push([T.index,T.index+T[0].length]);let B=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),z=0;while(z<v.length){let F=B.exec(v.slice(z));if(!F)return-1;let H=z+F.index;if(!R.some(([K,G])=>H>=K&&H<G))return H;z=H+Math.max(F[0].length,1)}return-1}var Hm="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Bc(v){let _=[];for(let k of v.split(",")){let R=k.trim();if(!R||R.startsWith("type "))continue;let T=R.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T&&T[1]!==T[2])_.push(`${T[2]} = ${T[1]}`)}if(_.length===0)return Hm;return`var ${_.join(", ")}; ${Hm}`}var IS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function et(v){return v.replace(IS,(_,k)=>Bc(k))}import ai from"path";import PS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[R,T]of Object.entries(PS.env)){if(!R.startsWith(v)||T===void 0)continue;_[`import.meta.env.${R}`]=JSON.stringify(T),k[R]=T}return _["import.meta.env"]=JSON.stringify(k),_}function Xm(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function Zm(v,_,k){try{let R;if(v.startsWith("/")){let T=_;for(let B=0;B<5;B++){let z=ai.join(T,v);if(await Bun.file(z).exists())return z;T=ai.dirname(T)}R=ai.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))R=ai.resolve(_,v);else R=ai.resolve(_,v);if(await Bun.file(R).exists())return R;return null}catch{return null}}var Gm=Symbol.for("stx.inline-assets.import-meta");function DS(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.
|
|
2597
|
-
`+" `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[Gm]=!0,k}async function Jm(v,_,k){let R=v,T=ai.dirname(_),B=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,z;while((z=B.exec(R))!==null){let[q,K,G,ee]=z;if(Xm(G))continue;let ae=await Zm(G,T,_);if(ae)try{let Q=await Bun.file(ae).text();if(k.add(ae),G.endsWith(".ts")||G.endsWith(".tsx")){let ue=await Bun.build({entrypoints:[ae],target:"browser",minify:!0,define:w()});if(ue.outputs.length>0)Q=await ue.outputs[0].text(),DS(Q,G)}let ce=`<script>
|
|
2598
|
-
// Source: ${G}
|
|
2599
|
-
${Q}
|
|
2600
|
-
</script>`;R=R.replace(q,ce),B.lastIndex=0}catch(Q){if(Q?.[Gm])throw Q}}let F=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,H;while((H=F.exec(R))!==null){let[q,K,G,ee]=H,ae=K+ee;if(Xm(G))continue;if(/rel=["']stylesheet["']/.test(ae)||G.endsWith(".css")){let ce=await Zm(G,T,_);if(ce)try{let ue=await Bun.file(ce).text();k.add(ce);let le=`<style>
|
|
2601
|
-
/* Source: ${G} */
|
|
2602
|
-
${ue}
|
|
2603
|
-
</style>`;R=R.replace(q,le),F.lastIndex=0}catch(ue){}}}return R}function js(v,_){let k=v,R=/@json\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index,z=B+T[0].length-1,F=1,H=z+1,q=null,K=!1;while(H<k.length&&F>0){let de=k[H];if(K){K=!1,H++;continue}if(de==="\\"&&q){K=!0,H++;continue}if(q){if(de===q)q=null;H++;continue}if(de==='"'||de==="'"||de==="`"){q=de,H++;continue}if(de==="(")F++;else if(de===")"){if(F--,F===0)break}H++}if(F!==0)break;let G=k.substring(z+1,H).trim(),ee=k.substring(B,H+1),ae=-1,Q=0,ce=null,ue=!1;for(let de=0;de<G.length;de++){let Re=G[de];if(ue){ue=!1;continue}if(Re==="\\"&&ce){ue=!0;continue}if(ce){if(Re===ce)ce=null;continue}if(Re==='"'||Re==="'"||Re==="`"){ce=Re;continue}if(Re==="("||Re==="["||Re==="{")Q++;else if(Re===")"||Re==="]"||Re==="}")Q--;if(Re===","&&Q===0){ae=de;break}}let le=ae>=0?G.substring(0,ae).trim():G,pe=ae>=0?G.substring(ae+1).trim():void 0;try{let de=le.trim(),Re;if(p(de))Re=c(de,Object.keys(_))(...Object.values(_));else Re=void 0;let be;if(pe==="true")be=JSON.stringify(Re,null,2);else be=JSON.stringify(Re);let xe=be.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,B)+xe+k.substring(H+1),R.lastIndex=B+xe.length}catch(de){O.log(de instanceof Error?de:Error(String(de)),{directive:"@json"},"error"),R.lastIndex=B+ee.length}}return k}function Bs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function th(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let B=R.index,z=B+R[0].length,F=1,H=z;while(H<_.length&&F>0){if(_[H]==="(")F++;else if(_[H]===")")F--;H++}if(F!==0)continue;let q=_.slice(z,H-1).trim(),K=H,G=_.slice(K),ee=G.indexOf("@endmemo");if(ee===-1)continue;let ae=G.slice(0,ee),Q=K+ee+8,ce=ae.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ue=ce?ce[0].length:0,le=ae.slice(ue),pe=ae.match(/(\s*)$/),de=pe?pe[0].length:0,Re=le.slice(0,le.length-de),be=Re.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),xe;if(be){let[Ie,Me,Ne="",je]=be,Le=`<${Me}${Ne} data-stx-memo="${q}"${je}>`;xe=ae.slice(0,ue)+Le+Re.slice(Ie.length)+ae.slice(ue+Re.length)}else xe=`${ae.slice(0,ue)}<div data-stx-memo="${q}">${Re}</div>${ae.slice(ue+Re.length)}`;T.push({start:B,end:Q,replacement:xe}),k.lastIndex=Q}for(let B=T.length-1;B>=0;B--){let z=T[B];_=_.slice(0,z.start)+z.replacement+_.slice(z.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Iu(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 nh(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=te(v,(H,q)=>{k.lastIndex=q;let K=k.exec(H);if(!K||/^(?:script|style)$/i.test(K[1]))return-1;return k.lastIndex}),T=[],B=0,z=0,F=[];for(let{start:H,end:q,token:K}of R){let G=/^<\/?([\w-]+)/.exec(K)[1].toLowerCase();if(K.startsWith("</")){let ae;while(ae=T.pop()){if(ae.scoped)B--;if(ae.name===G)break}continue}let ee=/\sdata-stx-scope\s*=/.test(K);if(!B&&!ee&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(K)&&!/\sdata-stx-ref-caller\s*=/.test(K))F.push(v.slice(z,H),K.replace(/\s*\/?>$/,(ae)=>` data-stx-ref-caller="${_}"${ae}`)),z=q;if(!rh.has(G)&&!/\/>$/.test(K)){if(T.push({name:G,scoped:ee}),ee)B++}}return F.push(v.slice(z)),F.join("")}var rh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),sh=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Ym=/<\/?\s*([a-z][\w-]*)/iy,OS=/\s/;function MS(v,_){let k=_-1;while(k>=0&&OS.test(v[k]))k--;return k>=0&&v[k]==="/"}function NS(v,_){let k=!1,R=!1;for(let T=_;T<v.length;T++){let B=v[T];if(k){if(B==="'")k=!1}else if(R){if(B==='"')R=!1}else if(B==="'")k=!0;else if(B==='"')R=!0;else if(B===">")return T}return-1}function jS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,R=_,T=!1,B=!1,z=!1;while(R<v.length){let F=v.indexOf("<",R),H=F===-1?v.length:F;if(H>R){if(k===0)while(R<H){let G=v.indexOf(B?"}":"{",R);if(G===-1||G>=H){if(B)z=!1;else T=!1;break}if(G>R)if(B)z=!1;else T=!1;if(B){if(z)return!0;z=!0}else if(T)B=!0,z=!1;else T=!0;R=G+1}R=H;continue}if(v.startsWith("<!--",R)){let G=v.indexOf("-->",R);R=G===-1?v.length:G+3;continue}let q=NS(v,R);if(q===-1)break;Ym.lastIndex=R;let K=Ym.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!MS(v,q)&&!rh.has(K))k++;R=q+1}return!1}var Qm=m(256);function ih(v){if(v.length<1024)return eh(v);let _=h(v),k=Qm.get(_);if(k!==void 0)return k;let R=eh(v);return Qm.set(_,R),R}function eh(v){if(v.length>=32768&&!Fd(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index,F=z+B[0].length,H=!1,q=!1,K=-1;while(F<v.length){let ee=v[F];if(H){if(ee==="'")H=!1}else if(q){if(ee==='"')q=!1}else if(ee==="'")H=!0;else if(ee==='"')q=!0;else if(ee===">"){K=F;break}F++}if(K===-1)continue;let G=v.slice(z,K+1);if(sh.test(G))continue;if(G.includes("x-cloak"))continue;if(jS(v,K+1))R+=v.slice(T,K)+" x-cloak>",T=K+1}return R+=v.slice(T),R}var LS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,BS=/<\/script>/gi,zS=/<\/style>/gi;function oh(v){let _=/<[a-z][\w-]*/gi,k="",R=0,T;while((T=_.exec(v))!==null){let B=T.index,z=T[0].slice(1).toLowerCase();if(z==="script"||z==="style"){let Q=z==="script"?BS:zS;Q.lastIndex=B;let ce=Q.exec(v);if(ce!==null)_.lastIndex=ce.index+ce[0].length;continue}let F=B+T[0].length,H=!1,q=!1,K=-1;while(F<v.length){let Q=v[F];if(H){if(Q==="'")H=!1}else if(q){if(Q==='"')q=!1}else if(Q==="'")H=!0;else if(Q==='"')q=!0;else if(Q===">"){K=F;break}F++}if(K===-1)continue;let G=v.slice(B+T[0].length,K);if(sh.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!LS.test(G))continue;let ee=v[K-1]==="/",ae=ee?K-1:K;k+=`${v.slice(R,ae)} x-cloak${ee?" ":""}`,R=ae}return k+=v.slice(R),k}import Pu from"path";var WS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,FS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function VS(v,_){if(!_||!v.includes("/"))return v;let k=Pu.dirname(_);return v.replace(WS,(R,T,B,z)=>{let F=Pu.resolve(k,z);return`${T}${B}${F.split(Pu.sep).join("/")}${B}`})}function ah(v,_){if(!_||!v.includes("<script"))return v;return v.replace(FS,(k,R,T,B)=>`${R}${VS(T,_)}${B}`)}var es="<!--PARENT_CONTENT_PLACEHOLDER-->";function ch(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mh(v,_){let k=v.length,R=_,T=!0,B=[],z=(F)=>F+9<=k&&v[F]==="<"&&v[F+1]==="/"&&(v[F+2]==="s"||v[F+2]==="S")&&(v[F+3]==="c"||v[F+3]==="C")&&(v[F+4]==="r"||v[F+4]==="R")&&(v[F+5]==="i"||v[F+5]==="I")&&(v[F+6]==="p"||v[F+6]==="P")&&(v[F+7]==="t"||v[F+7]==="T")&&(v[F+8]===">"||/\s/.test(v[F+8]));while(R<k){let F=v[R];if(z(R))return R;if(F==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
|
|
2604
|
-
`,R+2),R===-1)return-1;R+=1,T=!0;continue}if(F==="/"&&v[R+1]==="*"){let H=v.indexOf("*/",R+2);if(H===-1)return-1;R=H+2,T=!0;continue}if(F==="/"&&T){let H=R+1,q=!1;while(H<k){let K=v[H];if(K==="\\"){H+=2;continue}if(K==="[")q=!0;else if(K==="]")q=!1;else if(K==="/"&&!q){H++;break}else if(K===`
|
|
2605
|
-
`){H=-1;break}H++}if(H===-1){R++,T=!1;continue}while(H<k&&/[a-z]/.test(v[H]))H++;R=H,T=!1;continue}if(F==="'"||F==='"'){let H=F;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===H){R++;break}if(v[R]===`
|
|
2606
|
-
`)break;R++}T=!1;continue}if(F==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(F==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(F));else if(/[)\].\w$]/.test(F))T=!1;else T=!0;R++}return-1}function hh(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var HS=4096;async function lh(v,_,k){if(k.buildMode!=="serve"||_.length<HS)return null;let{registerServeModuleBundle:R}=await import("./chunk-6p57991f.js");return`<script ${v} src="${R(_)}"></script>`}async function uh(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await kt("stx/client-module-registry",()=>import("./chunk-6rxnh3th.js")),B=[],z=await T(R(...v),{minify:no(_.buildMode),collectInputs:B});for(let F of B)k?.add(F);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:F}=await import("./chunk-6p57991f.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${F(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function qS(v,_=""){let k=hh(v,"data-stx-runtime");if(!k)return v;let R=lo(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
|
|
2607
|
-
`+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),B=v.slice(0,k.start)+v.slice(k.end),z=lo(B);if(z===-1)return T+_+`
|
|
2608
|
-
`+B;return B.slice(0,z)+T+_+`
|
|
2609
|
-
`+B.slice(z)}function KS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=Ce(v,k);let B=!_.__stxProcessingDepth;_n(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await $n(_,k,R.runtimeConfig);if(B)Ad(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ys(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Ln())&&k&&k.endsWith(".stx"))co(v,k);try{return await X.timeAsync("template-processing",async()=>{let z=await XS(v,_,k,R,T);if(B)z=Iu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let F=ve(R.app?.head,{known:Nn,source:"app.head"}),q=(_.__stx_runtime_head||null)??Qs(),K=(_.__stx_head_raw||"").trim(),G,ee=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(ee)G=ee[1].trim(),K=K.replace(ee[0],"").trim();let ae=_.__sections?.title,Q=q.title||G||ae,ce=!q.title&&(!!G||!!ae),ue=q.meta||[],le=new Set(ue.map((Ie)=>Ae(Ie)).filter(Boolean)),pe={...F,...Q&&{title:Q},meta:[...(F.meta||[]).filter((Ie)=>!le.has(Ae(Ie))),...ue],link:[...F.link||[],...q.link||[]],script:[...F.script||[],...q.script||[]],headRaw:[F.headRaw,K].filter(Boolean).join(`
|
|
2610
|
-
`),...q.htmlAttrs&&{htmlAttrs:Ki(F.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...F.bodyAttrs||{},...q.bodyAttrs}}},de=Zs(z);if(z=In(z,pe,{...ce&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},de),de)z=Ji(z,F),z=Pn(z,pe.htmlAttrs);let Re=z.match(/<!-- stx-layout: ([^ ]+) -->/);if(Re&&z.includes("<head")){let Ie=Re[1],Me=Ir(Ie);z=z.replace(/<head\b[^>]*>/i,(Ne)=>`${Ne}
|
|
2611
|
-
<meta name="stx-layout" content="${ch(Ie)}">
|
|
2612
|
-
<meta name="stx-layout-group" content="${ch(Me)}">`)}let be=z.match(/function (__stx_setup_\w+)\(/),xe=be?Zn(z):null;if(be&&xe&&!/\bdata-stx=/.test(xe.tag)){z=ps(z,(Me,Ne)=>`<body${Ne} data-stx="${be[1]}">`);let Ie=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${be[1]}"`,"i");z=z.replace(Ie,"$1")}}if(B){let F=_.__stx_head_injections??Ys(),H=Xi(z);if(H!==null)F.beforeClose.push(H);let q=Rm(z);if(q!==null)F.afterOpen.push(q);if(R.offline?.enabled&&!z.includes("data-stx-offline"))F.beforeClose.push(Am);z=qi(z,F);let K=R.app?.colorMode;if(K)z=An(z,K)}if(B)if(hh(z,"data-stx-runtime")){let H=null,q=null,K=null,G=null,ee=null;try{let{getStoreScript:Q}=await kt("stx/store-loader",()=>import("./chunk-d57fh04e.js")),ce=R.storesDir,ue=await Q(ce);if(ue)K=`<script data-stx-stores>${ue}</script>`,q=await lh("data-stx-stores",ue,R)??K}catch{}H=await uh([z,K],R,T);try{let{getFrameworkComposableScript:Q}=await kt("stx/framework-composables",()=>import("./chunk-t455jpzx.js"));ee=await Q(z)}catch{}try{let{getComposableScript:Q}=await kt("stx/composable-loader",()=>import("./chunk-dcham5kg.js")),ce=R.composablesDir,ue=[H,K,ee].filter((pe)=>pe!==null),le=await Q(R._layerComposableDirs??ce,z,ue);if(le)G=await lh('data-stx-scoped data-stx-run="always" data-stx-composables',le,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${le}</script>`}catch{}let ae=[H,q,G,ee].filter((Q)=>Q!==null).map((Q)=>`
|
|
2613
|
-
${Q}`).join("");z=qS(z,ae)}else{let H=await uh([z],R,T);if(H){let q=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)z=z.slice(0,q)+H+`
|
|
2614
|
-
`+z.slice(q)}}if(B)z=Gi(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=io(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=KS(z),B&&_.__stx_runtime_config)z=ot(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let F=pr(_);if(F){let H=/<head\b[^>]*>/i.exec(z),q=H?H.index+H[0].length:0;z=z.slice(0,q)+F+z.slice(q)}}return z})}catch(z){if(z instanceof W)throw z;let F=z instanceof Error?z.message:String(z),H=new U(`Template processing failed: ${F}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(O.log(H,{filePath:k,context:_}),Vt.logDetailedError(H,{filePath:k,template:v.substring(0,500)}),R.debug)throw H;return eo.createFallbackContent("Template Processing",H)}}async function XS(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!dn.isAbsolute(R.partialsDir)?dn.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!dn.isAbsolute(R.componentsDir)?dn.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!dn.isAbsolute(R.layoutsDir)?dn.resolve(B,R.layoutsDir):R.layoutsDir},F=z,H=v;await JS(k,_),GS(_,F),H=await ie(()=>xm(H,_,k,F),H,(be)=>{O.log(be,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${be.message}`)}),H=H.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=Un(H,Ge,(be,xe)=>`\x00STX_HTML_COMMENT_${xe}\x00`);H=q.output;let K=q.tokens,G=(be)=>K.length===0?be:be.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(xe,Ie)=>K[Number(Ie)]??""),ee="\x00STX_ESCAPED_AT\x00",ae="\x00STX_ESC_MUSTACHE_OPEN\x00",Q="\x00STX_ESC_MUSTACHE_CLOSE\x00";H=H.replace(/@@/g,ee),H=H.replace(/@\{\{([\s\S]*?)\}\}/g,(be,xe)=>`${ae}${xe}${Q}`),H=$m(H),H=await Jm(H,k,T);let ce={};H=Ds(H,ce);let ue={..._.__sections||{}},le="",pe=sp(Xe(v)),de=/@nolayout\b/.test(H)||pe===!1;if(/@nolayout\b/.test(H))H=H.replace(/@nolayout\b\s*/g,"");let Re=H.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Re)le=Re[1],H=H.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof pe==="string"){if(le=pe,!/@section\s*\(/.test(H))H=`@section('content')
|
|
2615
|
-
${H.trim()}
|
|
2616
|
-
@endsection`}if(!le&&!de&&F.defaultLayout){let be=Ht(H),xe=/@section\s*\(/.test(H);if(!be||xe){let Ie="",Me=dn.dirname(k),Ne=F.layoutsDir?dn.dirname(F.layoutsDir):process.cwd();for(let je=0;je<20;je++){let Le=dn.join(Me,"_layout.stx");if(await r(Le)){Ie=Le;break}let De=dn.dirname(Me);if(De===Me||De.length<Ne.length)break;Me=De}if(Ie)le=Ie;else if(F.layoutsDir){let je=dn.isAbsolute(F.layoutsDir)?F.layoutsDir:dn.resolve(process.cwd(),F.layoutsDir),Le=dn.join(je,`${F.defaultLayout}.stx`);if(await r(Le))le=Le}if(le&&!xe)H=`@section('content')
|
|
2617
|
-
${H.trim()}
|
|
2618
|
-
@endsection`}}if(le&&H.includes("<script")){let be=hn(H),xe=be.scripts.map((Ie)=>dh(Ie,k)??Ie);H=us(be.output,xe)}if(H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(be,xe,Ie)=>(ue[xe]=Ie,"")),H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(be,xe,Ie)=>{if(/^(['"]).*\1$/.test(Ie.trim()))return be;try{let Me=l(Ie.trim(),_);if(Me===void 0)return be;return ue[xe]=String(Me??""),""}catch{return be}}),H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(be,xe,Ie)=>{if(Ie.includes("@parent"))ue[xe]=Ie.replace("@parent",es);else ue[xe]=Ie.trim();return""}),_.__sections=ue,H=H.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(be,xe,Ie)=>ue[xe]||Ie||""),!("slot"in _)||_.slot===void 0)H=H.replace(/\{\{\s*slot\s*\}\}/g,()=>ue.content||"");if(H=Ms(H,ce),le){let be=[],xe=hn(H),Ie=Un(xe.output,ls,(Me,Ne)=>`\x00STX_ORPHAN_STYLE_${Ne}\x00`);if(H=Ie.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Me,Ne,je)=>{let Le=Ne==="SCRIPT"?dh(xe.scripts[Number(je)],k):Ie.tokens[Number(je)];if(Le)be.push(Le);return""}),be.length>0){let Me=be.join(`
|
|
2619
|
-
`);ue.content=ue.content?`${ue.content}
|
|
2620
|
-
${Me}`:Me,_.__sections=ue}}if(le)try{let be;if(dn.isAbsolute(le))be=le,T.add(le);else be=await ie(()=>gr(le,k,z,T),null,()=>{throw new U(`Failed to resolve layout path: ${le}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!be){let Le=(Fe)=>{if(!Fe)return[];try{let Ve=dn.isAbsolute(Fe)?Fe:dn.resolve(process.cwd(),Fe);return US.readdirSync(Ve).filter((Be)=>Be.endsWith(".stx")).map((Be)=>Be.replace(/\.stx$/,""))}catch{return[]}},De=[...Le(z.layoutsDir),...Le(z.fallbackLayoutsDir)].filter((Fe,Ve,Be)=>Be.indexOf(Fe)===Ve).sort(),ze=`Layout not found: ${le} (referenced from ${k})`+(De.length>0?`. Available layouts: ${De.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(O.log(Error(ze),{layoutPath:le,filePath:k,available:De},"error"),console.error(`[stx] ${ze}`),z.debug)throw new U(ze,k);return H}let xe=await ie(()=>Bun.file(be).text(),"",()=>{throw new U(`Failed to read layout file: ${be}`,k,void 0,void 0,"Layout content could not be loaded")});xe=ah(xe,be);let Ie=xe.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Ie){if(z.debug)console.log(`Found nested layout: ${Ie[1]} in ${be}`);let Le={},De=xe.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ve,Be,He)=>(Le[Be]=He.trim(),""));for(let[Ve,Be]of Object.entries(Le))if(ue[Ve]&&ue[Ve].includes(es)){let He=ue[Ve].indexOf(es);ue[Ve]=ue[Ve].slice(0,He)+Be+ue[Ve].slice(He+es.length)}else if(!ue[Ve])ue[Ve]=Be;let ze={..._,__sections:ue},Fe=`@layout('${Ie[1]}')${De}`;return await n(Fe,ze,be,z,T)}let Me=xe.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ne=Ds(Me,ce),je={};return Ne=Ne.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Le,De,ze)=>(je[De]=ze.trim(),`@slot('${De}')`)),Ne=Ne.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Le,De,ze)=>{if(ue[De]){let Fe=ue[De];if(Fe.includes(es)){let Ve=je[De]||"",Be=Fe.indexOf(es);Fe=Fe.slice(0,Be)+Ve+Fe.slice(Be+es.length)}return Fe}return ze||""}),Ne=ZS(Ne,ue),Ne=Ne.replace(/\{\{\s*slot\s*\}\}/g,()=>ue.content||""),Ne=Ms(Ne,ce),_.__originalFilePath=k,H=await gh(Ne,_,be,z,T),H=`<!-- stx-layout: ${le} -->
|
|
2621
|
-
${H}`,G(H)}catch(be){if(be instanceof W)throw be;throw new U(`Error processing layout ${le}: ${be instanceof Error?be.message:String(be)}`,k)}return G(await gh(H,_,k,z,T))}function ZS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function GS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function JS(v,_){await ie(()=>wm(v,_),void 0,(k)=>{O.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Du="data-stx-source";function dh(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Du))return v;return`<script ${Du}="${encodeURIComponent(_)}"${v.slice(7)}`}function YS(v){let _=new RegExp(`${Du}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function fh(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ph(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">${fh(v)}</span><span style="display:block;margin-top:4px">${fh(k)}</span></div>`}async function QS(v,_,k,R){let{scanScriptTags:T}=await kt("stx/signal-processing",()=>import("./chunk-mmqt6qkf.js")),B=[],z=!E()&&!Ln();for(let H of T(v)){let q=H.attrs;if(!/\bserver\b/.test(q))continue;let K=H.start+H.fullMatch.indexOf(">")+1,G=mh(v,K);if(G===-1)continue;let ee=v.slice(K,G);if(!ee.trim())continue;let ae=YS(q)??k,Q={index:H.start,length:G+9-H.start};try{let{extractVariables:ce}=await kt("stx/variable-extractor",()=>import("./chunk-t9ww2z0r.js"));await ce(ee,_,ae,{preserveExisting:!0,onFailure:(ue)=>{if(ue.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:ae,kind:ue.kind,message:ue.message}),!z)return;B.push({...Q,markup:ph(ae,ue.kind,ue.message)})}})}catch(ce){let ue=ce instanceof Error?ce:Error(String(ce));if(O.log(ue,{filePath:ae,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ae}: ${ue.message}`),z)B.push({...Q,markup:ph(ae,"unknown",ue.message)})}}if(B.length===0)return v;let F=v;for(let H of B.sort((q,K)=>K.index-q.index))F=F.slice(0,H.index)+H.markup+F.slice(H.index+H.length);return F}async function e0(v,_,k){try{let{interpolateScriptsInTemplate:R}=await kt("stx/expressions",()=>import("./chunk-1peszdcc.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return O.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function gh(v,_,k,R,T){let B=v,z=R;if(B=await QS(B,_,k,R),B=await e0(B,_,k),B=await om(B,_,k),B=await am(B,_,k),B=await Vp(B,_,k,z),Ce(B))B=_i(B,_),B=Ps(B,_),B=As(B,_);B=Ei(B);let{processStreamDirectives:F}=await kt("stx/streaming",()=>import("./chunk-74r2q9ab.js"));B=F(B,_),B=Pi(B,_,k,z,!0),B=await Cm(B,_,k,z,T),B=await Ts(B,_,k,z,T),B=rp(B,_,k,z);let{processDeferDirectives:H}=await kt("stx/defer",()=>import("./chunk-w21444rc.js"));B=H(B,_,k);let{processTeleportDirectives:q}=await kt("stx/teleport",()=>import("./chunk-khzdk7q9.js"));B=q(B,_,k);let{processTransitionDirectives:K,processTransitionAttributes:G}=await kt("stx/transitions",()=>import("./chunk-9e1vjey6.js"));B=K(B,_,k),B=G(B);let{processErrorBoundaryDirectives:ee,stripRenderFailedMarkers:ae}=await kt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=ee(B,_,k),B=ae(B);let{processSuspenseDirectives:Q}=await kt("stx/suspense",()=>import("./chunk-4eb02a0z.js"));B=Q(B,_,k);let{processAsyncDirectives:ce}=await kt("stx/async-components",()=>import("./chunk-8yycg9pb.js"));B=ce(B,_,k);let{processKeepAliveDirectives:ue}=await kt("stx/keep-alive",()=>import("./chunk-2aj6bjyd.js"));B=ue(B,_,k);let{processVirtualListDirectives:le,processVirtualGridDirectives:pe,processInfiniteListDirectives:de}=await kt("stx/virtual-scrolling",()=>import("./chunk-c0yb755y.js"));B=le(B,_,k),B=pe(B,_,k),B=de(B,_,k);let{processPartialHydrationDirectives:Re,processStaticDirectives:be}=await kt("stx/partial-hydration",()=>import("./chunk-mb8c650x.js"));B=Re(B,_,k),B=be(B);let{processComputedDirectives:xe,processWatchDirectives:Ie}=await kt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=xe(B,_,k),B=Ie(B,_,k);let{processFormValidationDirectives:Me}=await kt("stx/forms-validation",()=>import("./chunk-8898f767.js"));B=Me(B,_,k);let{processHeadDirective:Ne,processTitleDirective:je,processMetaDirective:Le,resetHead:De}=await kt("stx/head",()=>import("./chunk-hjkm6k8c.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)De();let ze=Ne(B);if(B=ze.content,ze.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${ze.headContent}
|
|
2622
|
-
`;if(B=je(B,_),B=Le(B,_,k),B=vm(B),B=Ml(B,_),B=Fp(B),B=hm(B),B=await Ns(B,_,k,z,T),B=await Ts(B,_,k,z,T),_.__stxProcessingDepth===1)B=Td(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=Iu(B),B=xr(B,_,k),B=Os(B),B=ip(B,_,{filePath:k,buildMode:z.buildMode}),B=Nl(B,_),B=jl(B,_),B=Aa(B,_),B=Gp(B,_),B=Jp(B,_),B=await Pp(B,_,k,z),B=await dp(B,_,k),B=await Mi(B,_,k,z),B=Li(B,_,k,z),B=qs(B,_,k,z),B=Gs(B,_,k),B=Ks(B,_,k,z),B=zp(B,_,k,z),B=js(B,_),B=Bs(B),B=th(B),!z.skipEventDirectives)B=Gu(B,_,k);if(B=cp(B,_,k),z.debug){let St=/\bx-data\s*=/.test(B),gt=Rs(v);if(St&>)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2623
|
-
Both work on the same page, but they manage separate scopes.
|
|
2624
|
-
Prefer signals (state/derived/effect) for new components.`)}B=Ig(B,_),B=await Y(B,_,k),B=ih(B),B=oh(B),B=Xf(B);let{processXElementDirectives:Fe}=await kt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Fe(B);let Ve=_.__originalFilePath||k,Be=Se(_);if(B=await Ti(B,z,Ve,Be),B=Kp(B,_),B=await bm(B,_,k,z),z.media?.image?.autoSiblings){let St=z.publicDir||"public",{rewriteImagesWithSiblings:gt}=await kt("stx/image-optimization/auto-sibling",()=>import("./chunk-e876sg0j.js"));B=await gt(B,{publicDir:St})}if(z.seo?.enabled)B=Xs(B,_,z);let He=(St,gt,_t=!0)=>{if(!gt)return St;let Ut=gt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Yt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(St),tn=Yt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Yt[0]):null;if(Ut&&Yt&&tn){if(_t){let fn=Yt.index+tn.index;St=St.slice(0,fn)+Ut[0]+St.slice(fn+tn[0].length)}if(gt=gt.replace(Ut[0],"").trim(),!gt)return St}if(/<\/head>/i.test(St))return St.replace(/<\/head>/i,`${gt}
|
|
2625
|
-
</head>`);if(/<head\b[^>]*>/i.test(St))return St.replace(/(<head\b[^>]*>)/i,`$1
|
|
2626
|
-
${gt}`);if(/<html\b[^>]*>/i.test(St))return St.replace(/(<html\b[^>]*>)/i,`$1
|
|
2627
|
-
<head>
|
|
2628
|
-
${gt}
|
|
2629
|
-
</head>`);return St},{renderHead:vt,getHead:bt}=await kt("stx/head",()=>import("./chunk-hjkm6k8c.js")),ft=_.__stx_runtime_head??bt();if(ft.title||ft.meta?.length||ft.link?.length){let St=vt(ft);if(St)B=He(B,St)}if(ze.headContent)B=He(B,ze.headContent,!ft.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=Lp(B,z.csp,_);if(z.analytics?.enabled)B=Zf(B,z);if(z.heatmap?.enabled)B=Jf(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:St}=await kt("stx/pwa/inject",()=>import("./chunk-q068mc46.js"));B=St(B,z)}let wt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),Ct=/\bSTX\.\w+/.test(B),yt=/window\.STX\s*=/.test(B);if(wt&&Ct&&!yt){let gt=`<script data-stx-scoped data-stx-run="once">
|
|
2630
|
-
${Hf()}
|
|
2631
|
-
</script>`;if(B.includes("</head>")){let _t=B.indexOf("</head>"),Yt=B.slice(0,_t).indexOf("<script");if(Yt!==-1){let tn=B.slice(0,Yt),fn=B.slice(Yt);B=tn+gt+`
|
|
2632
|
-
`+fn}else B=B.replace("</head>",`${gt}
|
|
2633
|
-
</head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
|
|
2634
|
-
${gt}`);else B=gt+`
|
|
2635
|
-
`+B}{let{scanScriptTags:St}=await kt("stx/signal-processing",()=>import("./chunk-mmqt6qkf.js")),gt=[];for(let _t of St(B)){if(!/\bserver\b/i.test(_t.attrs))continue;let Ut=_t.start+_t.fullMatch.indexOf(">")+1,Yt=mh(B,Ut);if(Yt===-1)continue;let tn=Yt+9;while(tn<B.length&&/\s/.test(B[tn]))tn++;gt.push({start:_t.start,end:tn})}if(gt.length>0){let _t=Array(gt.length+1),Ut=0;for(let Yt=0;Yt<gt.length;Yt++){let{start:tn,end:fn}=gt[Yt];_t[Yt]=B.slice(Ut,tn),Ut=fn}_t[gt.length]=B.slice(Ut),B=_t.join("")}}let dt=pa(B,k);if(dt.hasScoped)B=dt.html;let $t=_.__stx_event_bindings||[],xt=!1,Kt=[],Vn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:jn}=await kt("stx/signal-processing",()=>import("./chunk-mmqt6qkf.js"));for(let St of jn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Kt.push({match:St.fullMatch,attrs:St.attrs,content:St.body});for(let{match:St,attrs:gt,content:_t}of Kt){xt=!0;let Ut=_t;Ze(_t,k,R.strict,_.__originalFilePath);let Yt=await ke(_t,{eventBindings:$t,attrs:gt,hasColonDirectives:Vn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:no(R.buildMode),serverData:Be});B=B.replace(St,()=>Yt)}if(xt)_.__stx_event_bindings=[];if(!xt&&_.__stxProcessingDepth===1){let St=_.__stx_event_bindings||[];if(St.length>0){let gt=ac(St);if(gt){let _t=B.lastIndexOf("</body>");B=_t===-1?B+gt:B.slice(0,_t)+gt+`
|
|
2636
|
-
`+B.slice(_t)}_.__stx_event_bindings=[]}}if(!me(B)&&jm(B))B=await qa(B,z);if(B=Lm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=Bp(B,_.cspNonce);return B}var t0=[{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"}],n0=[{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')"}],r0=[{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 Xc(v){let _=[],k=[];return s0(v,_),i0(v,_,k),o0(v,k),a0(v,_),{valid:_.length===0,errors:_,warnings:k}}function s0(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function i0(v,_,k){for(let R of t0){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,F=(v.match(B)||[]).length;if(R.altClose){let H=new RegExp(R.altClose,"g");F+=(v.match(H)||[]).length}if(z>F)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${F} closing`,suggestion:`Add ${z-F} missing ${R.close} tag(s)`});else if(F>z)k.push({type:"directive",message:`Extra ${R.close} found: ${F-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function o0(v,_){for(let k of n0)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function a0(v,_){for(let k of r0)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Jc(v,_){let k=v.slice(0,_).split(`
|
|
2637
|
-
`);return{line:k.length,column:k[k.length-1].length+1}}function Yc(v,_,k){let R=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))R.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(k.length===0)R.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)R.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)R.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return R}function Zc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Qc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let R of _){let T=R[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Gn from"path";import ci from"process";var Bt=["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 yh=new Set(Bt),c0=new Set(["props","$props","defineProps"]),l0=new Set(["stx","@stacksjs/stx"]),xh=m(128),bh=m(64);function u0(v){let _=[],k=0,R=v.split(`
|
|
2638
|
-
`);for(let T of R){let B=k,z=null,F=!1;for(let H=0;H<T.length;H++){let q=T[H];if(F){F=!1;continue}if(q==="\\"){F=!0;continue}if(z){if(q===z)z=null;continue}if(q==="'"||q==='"'||q==="`"){z=q;continue}if(q==="/"&&H+1<T.length&&T[H+1]==="/")break;if(q==="{")k++;else if(q==="}")k--}if(B===0){let H=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(H)_.push(H[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let q=T.match(/(?:const|let|var)\s+(\w+)/);if(q)_.push(q[1])}else{let q=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let G=q[1].slice(1,-1).split(",").map((ee)=>{let ae=ee.split(":");return(ae.length>1?ae[1]:ae[0]).trim()}).filter((ee)=>/^\w+$/.test(ee));_.push(...G)}}}}return[...new Set(_)]}function Fc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(R){if(!R.includes(":"))return R;let T=[],B="",z=0,F=0,H=null;for(let q=0;q<R.length;q++){let K=R[q];if(H){if(B+=K,K===H)H=null;continue}if(K==='"'||K==="'"||K==="`"){H=K,B+=K;continue}if(K==="<")z++;else if(K===">"&&z>0)z--;else if(K==="(")F++;else if(K===")")F--;if(K===","&&z===0&&F===0){T.push(B),B="";continue}B+=K}if(B)T.push(B);return T.map((q)=>{let K=q.trim(),G=K.startsWith("..."),ee=G?K.slice(3):K,ae=-1,Q=0;for(let be=0;be<ee.length;be++)if(ee[be]==="<")Q++;else if(ee[be]===">")Q--;else if(ee[be]===":"&&Q===0){ae=be;break}if(ae===-1)return q;let ue=ee.substring(0,ae).trim().replace(/\?$/,""),le=ee.substring(ae+1),pe=-1,de=0;for(let be=0;be<le.length;be++)if(le[be]==="<")de++;else if(le[be]===">")de--;else if(le[be]==="="&&de===0){pe=be;break}let Re=G?"...":"";if(pe!==-1)return`${Re}${ue} = ${le.substring(pe+1).trim()}`;return`${Re}${ue}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,B)=>{if(!B.includes(":"))return R;return`${T}(${k(B)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,B=[];while((T=R.exec(_))!==null){let z=T.index+T[0].length-1,F=1,H=z+1,q=0,K=null;while(H<_.length&&F>0){let ae=_[H];if(K){if(ae===K)K=null;H++;continue}if(ae==='"'||ae==="'"||ae==="`"){K=ae,H++;continue}if(ae==="<")q++;else if(ae===">"&&q>0)q--;else if(q===0){if(ae==="(")F++;else if(ae===")")F--}if(F>0)H++}if(F!==0)continue;let G=_.substring(z+1,H);if(!G.includes(":"))continue;let ee=k(G);B.push({start:z+1,end:H,replacement:ee})}for(let z=B.length-1;z>=0;z--){let{start:F,end:H,replacement:q}=B[z];_=_.substring(0,F)+q+_.substring(H)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(R,T)=>{if(!T.includes(":"))return R;if(T.includes("{")||T.includes("}"))return R;return`(${T.split(",").map((z)=>{let[F,...H]=z.split("="),q=F.split(":")[0].trim();if(H.length>0)return`${q} = ${H.join("=").trim()}`;return q}).join(", ")}) =>`}),_=_.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
|
|
2639
|
-
|
|
2640
|
-
`),_}function zc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function Hc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function Vc(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 Uc(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 vh=new Set;async function u(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=xh.get(B);if(z===void 0){try{let Ue=j({loader:"ts",target:"browser",define:T}),it=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");it=it.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=Ue.transformSync(it)}catch{z=Fc(v)}xh.set(B,z)}let F={exports:{}},H=F.exports,q=ci.cwd(),K={},G=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Ue)=>Ue[1]).filter((Ue)=>!Ue.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Ue)),ee=new Map;for(let Ue of G)try{if(Ue.startsWith(".")){K[Ue]=await import(Gn.resolve(Gn.dirname(k),Ue));continue}let it=Gn.resolve(q,"node_modules",Ue),mt=Gn.join(it,"package.json"),At=JSON.parse(d("fs").readFileSync(mt,"utf8")),qt=At.main||"index.js";if(At.exports){let on=typeof At.exports==="string"?At.exports:At.exports["."];if(typeof on==="string")qt=on;else if(on?.bun)qt=on.bun;else if(on?.import)qt=on.import;else if(on?.default)qt=on.default}K[Ue]=await import(Gn.resolve(it,qt))}catch(it){if(Ue.startsWith("."))ee.set(Ue,it instanceof Error?it.message:String(it))}let ae=(Ue)=>{if(K[Ue])return K[Ue];let it=ee.get(Ue);if(it!==void 0)throw Error(`Cannot require '${Ue}' from ${k}: ${it}`);return d(Ue)},Q=_.props||{},ce=(Ue)=>{if(!Ue)return Q;let it={};for(let[mt,At]of Object.entries(Ue)){let qt=Q[mt];if(qt!==void 0)it[mt]=qt;else if(typeof At==="function")it[mt]=At();else it[mt]=At}return it};for(let[Ue,it]of Object.entries(Q))Object.defineProperty(ce,Ue,{value:it,enumerable:!0,configurable:!0,writable:!0});let ue=(Ue,it=!1)=>{if(Ue===void 0||Ue===null)return it;if(typeof Ue==="string"){let mt=Ue.trim().toLowerCase();if(mt===""||mt==="true"||mt==="1"||mt==="on"||mt==="yes")return!0;if(mt==="false"||mt==="0"||mt==="off"||mt==="no")return!1;return!0}return Boolean(Ue)},le=(Ue,it=0)=>{if(Ue===void 0||Ue===null)return it;if(typeof Ue==="string"){let At=Ue.trim();if(At==="")return it;let qt=Number(At);return Number.isFinite(qt)?qt:it}let mt=Number(Ue);return Number.isFinite(mt)?mt:it};for(let Ue of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(Q,Ue))continue;try{Object.defineProperty(ce,Ue,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let pe=(Ue)=>{if(!Ue)return Q;let it={...Q};for(let[mt,At]of Object.entries(Ue)){let qt=At&&typeof At==="object"&&!Array.isArray(At)?At:{type:At};if(it[mt]===void 0&&qt.default!==void 0)it[mt]=typeof qt.default==="function"?qt.default():qt.default}return it},de=()=>_.slots||{},Re=(Ue,it)=>{let mt={...Ue};for(let[At,qt]of Object.entries(it))if(mt[At]===void 0)if(typeof qt==="function")mt[At]=qt();else mt[At]=qt;return mt},be=(Ue)=>{let it=()=>Ue;return it.set=(mt)=>{},it.update=(mt)=>{},it},xe=(Ue)=>{let it,mt=!1;return()=>{if(!mt)try{it=Ue(),mt=!0}catch{it=void 0}return it}},Ie=(Ue)=>{},Me=(Ue)=>Ue(),Ne=(Ue)=>{},je=(Ue)=>{},Le=cr(_);function De(Ue){let it=Ue||{};if(it.title!==void 0||it.description!==void 0)He({title:it.title,description:it.description})}function ze(Ue){if(!Ue||typeof Ue!=="object")return;let it=_.__stxClientPayload??{};Object.assign(it,Ue),_.__stxClientPayload=it}let Fe=()=>{let Ue=_.__stxServeContext,it=_.__stxServeSearch??Ue?.search??"",mt=Ue?.path??"",At=Object.fromEntries(new URLSearchParams(it)),qt=_.query,on=Object.keys(At).length>0?At:qt??{},ns=it||(Object.keys(on).length>0?`?${new URLSearchParams(on).toString()}`:"");return{params:_.params??{},query:on,path:mt,name:"",fullPath:mt+ns,hash:"",matched:[]}},Ve=()=>({push:(Ue)=>{},replace:(Ue)=>{},back:()=>{},forward:()=>{},go:(Ue)=>{}}),Be=(Ue)=>{let it=_.__stx_runtime_head||{};_.__stx_runtime_head=we(it,ve(Ue||{},{known:kr,source:"useHead()"}))},He=(Ue)=>{Be(Cr(Ue||{}))},vt=(Ue)=>({value:Ue}),bt=(Ue)=>Ue,Et=(Ue)=>({value:typeof Ue==="function"?Ue():Ue}),ft=(Ue,it)=>{},wt=(Ue)=>{},Ct=(Ue)=>{},yt=(Ue)=>Ue?Ue():Promise.resolve(),dt=(Ue)=>(it,...mt)=>{},$t=(Ue)=>{},xt=(Ue,it)=>{},Kt=(Ue,it)=>it,Vn=()=>({value:"light"}),jn=()=>be(!1),St=(Ue)=>be(!1),gt=()=>be(!1),_t=()=>St("(prefers-color-scheme: dark)"),Ut=()=>St("(prefers-color-scheme: light)"),Yt=()=>St("(prefers-reduced-motion: reduce)"),tn=()=>St("(prefers-contrast: more)"),fn={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:{}},Qa=new Proxy(fn,{get(Ue,it){if(it in Ue)return Ue[it];return},set(Ue,it,mt){return Ue[it]=mt,!0}}),Jn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},ec=console;try{let Ue=Is(z,k),it=new Set(Object.keys(Q)),mt=Object.keys(_).filter((ct)=>!it.has(ct)&&!c0.has(ct)&<(ct)),At=mt.map((ct)=>_[ct]);if(!mt.includes("__stxServeContext"))mt.push("__stxServeContext"),At.push(void 0);if(!it.has("cookies")){let ct=_.cookies??_.__stxServeContext?.cookies??{},Gt=mt.indexOf("cookies");if(Gt<0)mt.push("cookies"),At.push(ct);else At[Gt]=ct}let qt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),on=[],ns=[];for(let[ct,Gt]of Object.entries(Q)){if(!lt(ct))continue;if(qt.has(ct))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ct}\\b`).test(Ue))continue;on.push(ct),ns.push(Gt)}let Oo=u0(Ue).map((ct)=>`module.exports.${ct} = typeof ${ct} !== 'undefined' ? ${ct} : module.exports.${ct};`).join(`
|
|
2641
|
-
`),Mo=_.params??{},No=[],Sr=[];for(let ct=0;ct<mt.length;ct++){if(mt[ct]==="params")continue;No.push(mt[ct]),Sr.push(At[ct])}let rs=[...Bt,...on,...No],Yn=`return (async () => {
|
|
2642
|
-
${Ue}
|
|
2643
|
-
${Oo}
|
|
2644
|
-
return module.exports
|
|
2645
|
-
})()`,un=h(Yn,rs.join("\x00")),ut=bh.get(un);if(!ut)ut=Function(...rs,Yn),bh.set(un,ut);let ht=_.__stx_options?.runtimeConfig;if(ht||/\buse(?:Server)?RuntimeConfig\b/.test(z))await $n(_,k,ht);let Rt=await ye(_.__stx_runtime_config??zt()??C(),()=>Im(_,()=>ut(F,H,ae,Q,ce,ue,le,pe,Re,ze,Pm,Ws,br,be,xe,Ie,Me,Ne,je,De,Fe,Ve,Be,He,Le.setResponseStatus,Le.setResponseHeader,Le.notFound,vt,bt,Et,ft,wt,Ct,yt,dt,$t,de,xt,Kt,Vn,jn,St,gt,_t,Ut,Yt,tn,Qa,Jn,ec,fn.confirm,fn.alert,fn.fetch,Mo,...ns,...Sr)));if(R.preserveExisting){for(let[ct,Gt]of Object.entries(Rt))if(!(ct in _)||_[ct]===void 0)_[ct]=Gt}else Object.assign(_,Rt);for(let[ct,Gt]of Object.entries(Q))if(!(ct in _))_[ct]=Gt}catch(Ue){if(_.__stx_strict_hydration)throw Ue;let it=zc(Ue instanceof Error?Ue.message:String(Ue));if(Hc(it))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${it}`),R.onFailure?.({kind:"module-resolution",message:it,error:Ue});else if(Vc(Ue))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${it}`),R.onFailure?.({kind:"syntax",message:it,error:Ue});else if(Uc(it))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: ${it}`),R.onFailure?.({kind:"missing-binding",message:it,error:Ue});else{let mt=`${k??"<unknown>"}\x00${it}`;if(ci.env.STX_DEBUG||!vh.has(mt))vh.add(mt),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: ${it}`);R.onFailure?.({kind:"unknown",message:it,error:Ue})}try{await h0(z,_,k)}catch(mt){if(ci.env.STX_DEBUG){let At=mt instanceof Error?mt.message:String(mt);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${At}`)}}}}function Wc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var d0=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Is(v,_){let k=_?Gn.dirname(_):ci.cwd(),R=ci.cwd(),T=v.split(`
|
|
2646
|
-
`),B=[],z=0;while(z<T.length){let F=T[z].trim();if(F.startsWith("interface ")||F.startsWith("export interface ")||F.startsWith("type ")||F.startsWith("export type ")){if(F.includes("{")&&!F.includes("}")){let H=0;for(;z<T.length;z++){for(let q of T[z])if(q==="{")H++;else if(q==="}")H--;if(H<=0)break}}z++;continue}if(F.startsWith("definePageMeta(")){let H=0,q=!1,K=z;for(let ae=z;ae<T.length&&!q;ae++){let Q=null,ce=!1,ue=T[ae];for(let le=0;le<ue.length;le++){let pe=ue[le];if(ce){ce=!1;continue}if(pe==="\\"){ce=!0;continue}if(Q){if(pe===Q)Q=null;continue}if(pe==='"'||pe==="'"||pe==="`"){Q=pe;continue}if(pe==="(")H++;else if(pe===")"){if(H--,H===0){z=ae+1,q=!0;break}}}}if(!q)z=T.length;let G=T.slice(K,z).join(`
|
|
2647
|
-
`),ee=[];for(let ae of["title","description"]){let Q=new RegExp(`\\b${ae}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(Q)ee.push(`${ae}: ${JSON.stringify(Q[2])}`)}if(ee.length>0)B.push(`useSeoMeta({ ${ee.join(", ")} });`);continue}if(F.startsWith("import ")||F==="import"||F.startsWith("import{")||/^import['"]/.test(F)){let H=F,q=0;while(!Wc(H)&&z+q+1<T.length)q++,H=`${H} ${T[z+q].trim()}`;z+=q;let K=H.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=H.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),ee=H.match(/^import\s*['"](.+?)['"]/),ae=H,Q=(ce)=>{if(ce.startsWith("."))return Gn.resolve(k,ce);if(ce.startsWith("~/")||ce.startsWith("@/"))return Gn.resolve(R,ce.slice(2));try{return Bun.resolveSync(ce,k)}catch{return ce}};if(K){let[,ce,ue]=K,le=Q(ue);B.push(`const ${ce} = (await import('${le}')).default`),B.push(`module.exports.${ce} = ${ce};`)}else if(G){let[,ce,ue]=G,le=Q(ue),pe=[],de=[],Re=l0.has(ue);for(let be of ce.split(",")){let xe=be.trim();if(!xe)continue;let Ie=xe.split(/\s+as\s+/);if(Ie.length===2){let[Me,Ne]=[Ie[0].trim(),Ie[1].trim()];if(Re&&yh.has(Me)){B.push(`const ${Ne} = ${Me};`);continue}pe.push(`${Me}: ${Ne}`),de.push(Ne)}else{if(Re&&yh.has(xe))continue;pe.push(xe),de.push(xe)}}if(pe.length>0)B.push(`const { ${pe.join(", ")} } = await import('${le}')`);for(let be of de)B.push(`module.exports.${be} = ${be};`)}else if(ee){let ce=Q(ee[1]);B.push(`await import('${ce}')`)}else B.push(ae);z++;continue}if(d0.test(F))B.push(T[z]),z++;else if(F.startsWith("export const ")||F.startsWith("export let ")||F.startsWith("export var ")){let H=Sh(T,z),{type:q,name:K,value:G}=H;B.push(`${q} ${K} = ${G};`),B.push(`module.exports.${K} = ${K};`),z=H.nextIndex}else if(F.startsWith("export function ")||F.startsWith("export async function ")){let H=Ou(T,z);B.push(H.functionCode),B.push(`module.exports.${H.name} = ${H.name};`),z=H.nextIndex}else if(F.startsWith("const ")||F.startsWith("let ")||F.startsWith("var ")){let H=Sh(T,z),{type:q,name:K,value:G}=H;B.push(`${q} ${K} = ${G};`),B.push(`module.exports.${K} = ${K};`),z=H.nextIndex}else if(F.startsWith("function ")||F.startsWith("async function ")){let H=Ou(T,z);B.push(H.functionCode),B.push(`module.exports.${H.name} = ${H.name};`),z=H.nextIndex}else if(F.startsWith("export default function ")||F.startsWith("export default async function ")){let H=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...T];q[z]=H;let K=Ou(q,z);if(B.push(K.functionCode),K.name)B.push(`module.exports.default = ${K.name};`);z=K.nextIndex}else if(F.startsWith("export default ")){let H=F.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${H};`),z++}else if(F.startsWith("class ")||F.startsWith("export class ")){let H=F.match(/(?:export\s+)?class\s+(\w+)/);if(H){let q=H[1],K=T[z].replace(/^export\s+/,""),G=0,ee=z;for(;ee<T.length;ee++){let ae=T[ee];for(let Q of ae)if(Q==="{")G++;else if(Q==="}")G--;if(ee>z)K+=`
|
|
2648
|
-
`+ae;if(G<=0&&ee>=z)break}B.push(K),B.push(`module.exports.${q} = ${q};`),z=ee+1}else B.push(F),z++}else if(F.includes("module.exports"))B.push(F),z++;else if(F.trim()&&!F.startsWith("//"))B.push(F),z++;else z++}return f0(B.join(`
|
|
2649
|
-
`),k,R)}function f0(v,_,k){let R=v.length,T="",B=0,z=null,F=!1,H=!1,q=0;while(B<R){let K=v[B],G=v[B+1];if(F){if(T+=K,K===`
|
|
2650
|
-
`)F=!1;B++;continue}if(H){if(T+=K,K==="*"&&G==="/"){T+=G,B+=2,H=!1;continue}B++;continue}if(!z&&K==="/"&&G==="/"){F=!0,T+=K,B++;continue}if(!z&&K==="/"&&G==="*"){H=!0,T+=K,B++;continue}if(z){if(T+=K,K==="\\"){T+=G,B+=2;continue}if(K===z&&z!=="`"){z=null,B++;continue}if(z==="`"){if(K==="$"&&G==="{"){q++,T+=G,B+=2;continue}if(K==="`"){z=null,B++;continue}}B++;continue}if(q>0){if(K==="{")q++;else if(K==="}")q--}if(K==='"'||K==="'"||K==="`"){z=K,T+=K,B++;continue}if(K==="a"&&v.startsWith("await",B)){let ee=p0(v,B);if(ee){let{quote:ae,path:Q,end:ce}=ee;if(Q.startsWith(".")||Q.startsWith("~/")||Q.startsWith("@/")){let ue=Q.startsWith(".")?Gn.resolve(_,Q):Gn.resolve(k,Q.slice(2));T+=`await import(${ae}${ue}${ae})`,B=ce;continue}}}T+=K,B++}return T}function p0(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let R=v[k];if(R!=="'"&&R!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==R)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let B=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:R,path:B,end:k+1}}function Eh(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 Ch(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let R=0,T=0,B="";while(R<k.length){let z=k[R];if(z==="{"||z==="["){let F=T===0?Eh(k,R):null;if(F){_.push(...Ch(F.pattern)),R=F.endPos,B="";continue}T++}else if(z==="}"||z==="]")T--;if(T>0){R++;continue}if(z===","){if(B.trim())_.push(B.trim());B="",R++;continue}if(z===":"){B="",R++;continue}if(z==="="){if(B.trim())_.push(B.trim());B="",R++;while(R<k.length&&k[R]!==","&&T===0){if(k[R]==="{"||k[R]==="[")T++;else if(k[R]==="}"||k[R]==="]")T--;R++}continue}if(/[\w$]/.test(z))B+=z;R++}if(B.trim())_.push(B.trim());return _}function qc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,R=(T)=>T===" "||T==="\t";while(k<v.length&&R(v[k]))k++;if(v[k]===":"){let T=0,B=null;k++;for(;k<v.length;k++){let z=v[k];if(B){if(z==="\\"){k++;continue}if(z===B)B=null;continue}if(z==="'"||z==='"'||z==="`"){B=z;continue}if(z==="("||z==="["||z==="{"||z==="<"){T++;continue}if(z===")"||z==="]"||z==="}"||z===">"){T--;continue}if(z==="="&&T<=0){let F=v[k+1],H=v[k-1];if(F!=="="&&F!==">"&&H!=="="&&H!=="!"&&H!=="<"&&H!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&R(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function wh(v,_,k,R){let T=null,B=!1;for(let z of v){if(B){B=!1;continue}if(z==="\\"){B=!0;continue}if(T){if(z===T)T=null;continue}if(z==="'"||z==='"'||z==="`"){T=z;continue}if(z===_)R++;else if(z===k)R--}return R}function Sh(v,_){let k=v[_].trim(),R=qc(k),T=R?[k,R.type,R.name,R.value]:null;if(!T){let K=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let G=k.slice(K[0].length),ee=_;if(G.startsWith("{")||G.startsWith("[")){let Q=G[0],ce=Q==="{"?"}":"]",ue=wh(G,Q,ce,0),le=G;for(let pe=_+1;pe<v.length&&ue>0;pe++)le+=` ${v[pe].trim()}`,ee=pe,ue=wh(v[pe],Q,ce,ue);if(ue>0)le=G,ee=_;G=le}let ae=Eh(G,0);if(ae){let Q=K[1],ce=ae.pattern,ue=G.slice(ae.endPos).trim();if(ue.startsWith("=")){let le=ue.slice(1).trim(),pe=le,de=Math.max(ee,_);if($h(le)){let Ie=_h(v,de,le);pe=Ie.value,de=Ie.nextIndex}else de=de+1;pe=pe.trim().replace(/;$/,"");let Re=Ch(ce),be=`__stx_src_${_}`,xe=Re.map((Ie)=>`module.exports.${Ie} = ${Ie};`).join(`
|
|
2651
|
-
`);return{type:Q,name:be,value:`${pe}; ${Q} ${ce} = ${be};
|
|
2652
|
-
${xe}`,nextIndex:de}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,B,z,F]=T,H=F,q=_;if($h(F)){let K=_h(v,_,F);H=K.value,q=K.nextIndex}else q=_+1;while(q<v.length){let K=v[q].trim();if(K.startsWith(".")||K.startsWith("?."))H+=`
|
|
2653
|
-
${v[q]}`,q++;else break}return H=H.trim().replace(/;$/,""),{type:B,name:z,value:H,nextIndex:q}}function Ou(v,_){let k=v[_].trim(),R=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!R)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=R,B=k.replace(/^export\s+/,""),z=_;if(g0(k)){let F=m0(v,_,B);B=F.functionCode,z=F.nextIndex}else z=_+1;return{name:T,functionCode:B,nextIndex:z}}function $h(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!Rh(_)}function Rh(v){let _={paren:0,bracket:0,brace:0},k=null,R=0;for(let T=0;T<v.length;T++){let B=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((B==='"'||B==="'")&&!k){k=B;continue}if(B===k&&k!=="`"){k=null;continue}if(B==="`"&&!k){k="`";continue}if(B==="`"&&k==="`"&&R===0){k=null;continue}if(k==="`"&&B==="$"&&v[T+1]==="{"){R++,T++;continue}if(R>0&&B==="{"){R++;continue}if(R>0&&B==="}"){R--;continue}if(k)continue;if(B==="(")_.paren++;else if(B===")")_.paren--;else if(B==="[")_.bracket++;else if(B==="]")_.bracket--;else if(B==="{")_.brace++;else if(B==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function Ah(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function g0(v){let _=Ah(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function _h(v,_,k){let R=k,T=_+1;while(T<v.length&&!Rh(R)){let B=v[T];R+=`
|
|
2654
|
-
${B}`,T++}while(T<v.length){let B=v[T].trim();if(B.startsWith(".")||B.startsWith("?."))R+=`
|
|
2655
|
-
${v[T]}`,T++;else break}return{value:R,nextIndex:T}}function m0(v,_,k){let R=k,T=_+1;while(T<v.length){let B=Ah(R);if(B!==-1){if(S(R,"{","}",B)!==-1)break}let z=v[T];R+=`
|
|
2656
|
-
${z}`,T++}return{functionCode:R,nextIndex:T}}function kh(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...ci.env}})},T=Object.keys(R).filter(lt),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function h0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,F]=B;try{let H=F.trim().replace(/;$/,""),q=kh(H,_);if(q!==void 0)_[z]=q}catch(H){console.warn(`Failed to parse export ${z} in fallback:`,H)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let B of T){let[,,z,F]=B;if(!(z in _))try{let H=F.trim().replace(/;$/,""),q=kh(H,_);if(q!==void 0)_[z]=q}catch{}}}function Ri(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",R=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:R}}function Ai(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Po=new M(500),Ja=new M(1000),ju=new M(2000),Lu=new M(500),Nh=33554432,Bu=Nh;function y0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Bu)return;Bu=_,Ya.setMaxBytes(_)}var Ya=new M(2000,{maxBytes:Nh,sizeOf:(v)=>v.output.length});function x0(v){let _=new WeakSet;try{let k=(R)=>{if(R===void 0)return{__stxType:"undefined"};if(typeof R==="bigint")return{__stxType:"bigint",value:R.toString()};if(typeof R==="function"||typeof R==="symbol")throw TypeError("Non-serializable component input");if(R===null||typeof R!=="object")return R;if(_.has(R))throw TypeError("Circular component input");_.add(R);try{if(R instanceof Date)return{__stxType:"date",value:R.toISOString()};if(Array.isArray(R))return R.map(k);let T=Object.getPrototypeOf(R);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let B={};for(let z of Object.keys(R).sort())B[z]=k(R[z]);return B}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function b0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function Mu(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function el(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function tt(v){return!el(v)}var Ga=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Ga.get(_);if(k)return k;if(Ga.size>=16)Ga.clear();let R=new Bun.Transpiler(v);return Ga.set(_,R),R}var Th=new WeakMap,v0=256;function nt(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=Th.get(_);if(!k)k=new Map,Th.set(_,k);let R=k.get(v);if(R!==void 0)return R;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let B=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(F)=>{let H=B.length;return B.push(F),`"__STX_EXPR_${H}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(F)=>{let H=B.length;return B.push(F),`"__STX_EXPR_${H}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(F)=>{let H=B.length;return B.push(F),`"__STX_EXPR_${H}__"`});let z=_.transformSync(T);for(let F=0;F<B.length;F++)z=z.replace(`"__STX_EXPR_${F}__"`,B[F]),z=z.replace(`'__STX_EXPR_${F}__'`,B[F]);if(k.size>=v0){let F=k.keys().next();if(!F.done)k.delete(F.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function w0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(K)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===K){T++;return}T++}},F=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let K=1;while(T<B&&K>0)if(v[T]==="{")K++,T++;else if(v[T]==="}")K--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")F();else T++;continue}T++}},H=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<B&&v[T]!==`
|
|
2657
|
-
`)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},q=()=>{if(R!==0)return;let K=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let Q=K[2].split(",").map((ce)=>{let ue=ce.trim().split(":");return ue[ue.length-1].trim()});for(let ce of Q)if(ce&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ce)&&!k.has(ce))_.push(ce),k.add(ce);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let Q=G[2];if(!k.has(Q))_.push(Q),k.add(Q);return}let ee=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let Q=ee[1];if(!k.has(Q))_.push(Q),k.add(Q);return}let ae=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ae){let Q=ae[1];if(!k.has(Q))_.push(Q),k.add(Q)}};while(T<B){if(H())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){F();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))q();T++}return _}function S0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function $0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function _0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let H=v[R];if(H==="}")B++;else if(H==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let F=v.slice(z+1,T);for(let H of S0(F)){let q=H.trim();if(!q||q.startsWith("..."))continue;let K=$0(q);if(K===-1)continue;let G=q.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let ee=q.slice(K+1).trim();if(!ee)continue;try{let ae=Object.keys(_).filter(lt),Q=Function(...ae,`"use strict"; return (${ee});`);_[G]=Q(...ae.map((ce)=>_[ce]))}catch{}}}catch{}}var k0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function tl(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let R=k[2].toLowerCase();if(!k0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=te(v,(q,K)=>(T.lastIndex=K,T.exec(q)?.index===K?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,F=!1;for(let q of B){if(z+=q.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(q.end).trim())return null;F=!0;break}}if(!F)return null;let H=k[0].length;return v.slice(0,H)+_+v.slice(H)}async function fr(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(be)=>be.split("-").map((xe)=>xe.charAt(0).toUpperCase()+xe.slice(1)).join(""),F=k.__importedComponents;if(F){for(let be of[B,B.toLowerCase(),z(B),pn(B)])if(F.has(be))return!0}let H=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${pn(B)}.stx`])],q=typeof T.root==="string"?pt.resolve(T.root):void 0,K=q??pt.dirname(R),G=[],ee=(be)=>{if(be&&!G.includes(be))G.push(be)},ae=k.__originalFilePath;if(ae)ee(pt.join(pt.dirname(ae),"components"));ee(_),ee(T._rootComponentsDir),ee(pt.join(pt.dirname(R),"components")),ee(T.componentsDir);let Q=T._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===B.toLowerCase());if(!Q)for(let be of T._targetComponentDirs??[])ee(be);if(q)ee(pt.resolve(q,"resources/views/components")),ee(pt.resolve(q,"resources/components")),ee(pt.resolve(q,"src/components")),ee(pt.resolve(q,"components"));for(let be of T._layerComponentDirs??[])ee(be);let ce=T._pluginComponentDirs;if(Array.isArray(ce))for(let be of ce)ee(typeof be==="string"?be:null);if(ee(T.fallbackComponentsDir),Q)for(let be of T._targetComponentDirs??[])ee(be);if(B.startsWith("./")||B.startsWith("../"))return r(pt.resolve(pt.dirname(R),`${B}.stx`));let ue=Ih(pt.resolve(import.meta.dir,"components")),le=G.map((be)=>pt.isAbsolute(be)?be:pt.resolve(K,be)),pe=`${H.join("\x00")}\x00\x00${le.join("\x00")}`,de=ju.get(pe);if(de!==void 0)return de;let Re=!1;e:for(let be of le){if(Ih(be)===ue)continue;for(let xe of H)if(await r(pt.join(be,xe))){Re=!0;break e}}return ju.set(pe,Re),Re}function Ih(v){let _=Lu.get(v);if(_!==void 0)return _;let k=v;try{k=Mh.realpathSync(v)}catch{}return Lu.set(v,k),k}function nl(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function Ni(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 E0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let F=String(z);if(/<\/style/i.test(F))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return F};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var Ph=new Set;function Dh(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&Ph.has(T))return;Ph.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",F=k.length>0?`
|
|
2658
|
-
searched:
|
|
2659
|
-
${k.map((H)=>` - ${H}`).join(`
|
|
2660
|
-
`)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${F}`)}function Oh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fs(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function rt(v,_,k,R,T,B,z,F=new Set,H,q=Ar(T),K,G=v){let{extractVariables:ee}=await kt("stx/variable-extractor",()=>import("./chunk-t9ww2z0r.js")),ae=F??new Set;if(ae.has(v))return`[Circular component reference: ${v}]`;let Q=new Set(ae);Q.add(v);let ce=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ue=ce&&ce!=="load"&&nl(ce)?ce:"";try{let le=(ut)=>ut.split("-").map((ht)=>ht.charAt(0).toUpperCase()+ht.slice(1)).join(""),pe=G.endsWith(".stx")?G.slice(0,-4):G,de=null,Re=T.__importedComponents;if(Re){let ut=[pe,pe.toLowerCase(),le(pe),pn(pe)];for(let ht of ut)if(Re.has(ht)){de=Re.get(ht);break}}let be=[];if(!de){let ut=[`${pe}.stx`,`${le(pe)}.stx`,`${pn(pe)}.stx`],ht=[...new Set(ut)],Rt=T.__originalFilePath,ct=[];if(ct.push(...z._layerComponentDirs??[]),Rt){let Pt=pt.join(pt.dirname(Rt),"components");ct.push(Pt)}if(R)ct.push(R);let Gt=z._rootComponentsDir;if(typeof Gt==="string"&&!ct.includes(Gt))ct.push(Gt);let Qt=pt.join(pt.dirname(B),"components");if(!ct.includes(Qt))ct.push(Qt);if(z.componentsDir&&z.componentsDir!==R&&!ct.includes(z.componentsDir))ct.push(z.componentsDir);let $r=z._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(pe),ss=(K?.events??[]).map((Pt)=>Pt.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Er=Object.hasOwn(_,"checked")||Boolean(K?.reactiveProps?.includes("checked")),is=Object.hasOwn(_,"value")||Boolean(K?.reactiveProps?.includes("value")),jo=!ss.includes("valuechange")&&(Er||ss.includes("change")&&!is),Lo=z._targetComponentFallbackNames?.some((Pt)=>Pt.toLowerCase()===pe.toLowerCase())&&(!$r||jo);for(let Pt of Lo?[]:z._targetComponentDirs??[])if(Pt&&!ct.includes(Pt))ct.push(Pt);let Wn=typeof z.root==="string"?pt.resolve(z.root):void 0,Bo=Wn??pt.dirname(B),Qn=[];if(Wn)Qn.push(pt.resolve(Wn,"resources/views/components")),Qn.push(pt.resolve(Wn,"resources/components")),Qn.push(pt.resolve(Wn,"src/components")),Qn.push(pt.resolve(Wn,"components"));Qn.push(pt.resolve(import.meta.dir,"components"));for(let Pt of Qn)if(!ct.includes(Pt))ct.push(Pt);let ji=z._pluginComponentDirs;if(Array.isArray(ji)){for(let Pt of ji)if(typeof Pt==="string"&&!ct.includes(Pt))ct.push(Pt)}if(z.fallbackComponentsDir&&!ct.includes(z.fallbackComponentsDir))ct.push(z.fallbackComponentsDir);if(Lo){for(let Pt of z._targetComponentDirs??[])if(Pt&&!ct.includes(Pt))ct.push(Pt)}let zi=[...new Set(ct.map((Pt)=>{if(!Pt)return Pt;return pt.isAbsolute(Pt)?Pt:pt.resolve(Bo,Pt)}))];ct.length=0,ct.push(...zi);let os=`${pe}\x00${B}\x00${zi.join("\x00")}`,nc=Ja.get(os);if(nc)if(await r(nc))de=nc;else Ja.delete(os);if(!de&&(pe.startsWith("./")||pe.startsWith("../")))de=pt.resolve(pt.dirname(B),`${pe}.stx`),be.push(de);else if(!de)for(let Pt of ct){if(!Pt)continue;for(let zo of ht){let Wo=pt.join(Pt,zo);if(be.push(Wo),await r(Wo)){de=Wo;break}}if(de)break;if(!de)try{let zo=await import("fs");if(!zo.statSync(Pt,{throwIfNoEntry:!1})?.isDirectory())continue;let Fh=8,rc=[{path:Pt,depth:0}];while(rc.length>0&&!de){let Fo=rc.pop();if(Fo.depth>=Fh)continue;let Wu;try{Wu=zo.readdirSync(Fo.path,{withFileTypes:!0})}catch{continue}for(let Vo of Wu){if(!Vo.isDirectory())continue;if(Vo.name==="node_modules"||Vo.name.startsWith("."))continue;let Fu=pt.join(Fo.path,Vo.name);for(let Vh of ht){let sc=pt.join(Fu,Vh);if(be.push(sc),await r(sc)){de=sc;break}}if(de)break;rc.push({path:Fu,depth:Fo.depth+1})}}}catch{}if(de)break}if(de)Ja.set(os,de)}if(!de||!await r(de))return Dh(v,B,be),Oh(v);H.add(de);let xe;if(Po.has(de))xe=Po.get(de);else try{xe=await Bun.file(de).text(),Po.set(de,xe)}catch(ut){let ht=ut instanceof Error?ut.message:String(ut);return Dh(v,B,[de],ht),Oh(v)}if(K)for(let ut of new Set([...Object.keys(_),...K.reactiveProps??[]])){let ht=ut.toLowerCase();if(ht.startsWith("aria-")||ht.startsWith("data-"))continue;let Rt=ut.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Rt}\\b`).test(xe))K.declaredProps.add(ut);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Rt}\\b|\\[\\s*['"]${Rt}['"]\\s*\\])`).test(xe)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Rt}['"]`).test(xe))K.consumedProps?.add(ut)}let Ie=new Set(["__originalFilePath","__importedComponents",Go,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Me={};for(let[ut,ht]of Object.entries(T))if(!ut.startsWith("__")||Ie.has(ut))Me[ut]=ht;let Ne=q.length>0?{[aa]:[...q]}:{},je=k;if(k.includes("@include")){let{processIncludes:ut}=await kt("stx/includes",()=>import("./chunk-n6ek151q.js"));je=await ut(k,T,B,z,H)}if(/<[A-Z][\w.-]*[\s/>]/.test(je)){let{processComponents:ut}=await kt("stx/component-renderer",()=>import("./chunk-apaqfgsx.js"));je=await ut(je,{...T,__processedComponents:ae,...Ne},B,z,H)}let Le=[];if(Ni(je)){let{processExpressions:ut}=await kt("stx/expressions",()=>import("./chunk-1peszdcc.js")),ht=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ne}:q.length>0?{...T,...Ne}:T;je=ut(je,ht,B);for(let Rt of je.matchAll(/\{\{([\s\S]*?)\}\}/g))Le.push(Rt[1].trim())}let De=hn(je),ze=[],Fe=De.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ut,ht)=>{let Rt=De.scripts[Number(ht)]||"",ct=Rt.match(/^<script\b([^>]*)>/i)?.[1]||"",Gt=ct.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qt=!Gt||["module","text/javascript","application/javascript"].includes(Gt),$r=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${ct}`);if(!/\bserver\b/i.test(ct)&&Qt&&!$r)return ze.push(Rt),"";return Rt}),{extractSlotContent:Ve}=await kt("stx/slots",()=>import("./chunk-k5kj93g7.js")),Be=Ve(Fe),He={};if(Be.defaultSlot?.trim())He.default=Be.defaultSlot;for(let[ut,ht]of Be.namedSlots)He[ut]=ht.content;let vt=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},Et=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++vt.n}_${vt.key}`,ft={...Me,$uid:Et,..._,props:_,slot:Fe,$slots:He,__processedComponents:Q,__sections:{},__stx_signals_gate:Ce(xe)||Ni(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Le]};_0(xe,ft);let wt=xe,Ct=se(wt);if(Ct)wt=Ct.content.trim();let yt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,dt=[...xe.matchAll(yt)];for(let[,ut,ht]of dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ut))Ze(ht,de,z.strict);let $t=[],xt=null,Kt=dt.some((ut)=>/\bserver\b/.test(ut[1]||"")&&/\bcache\b/.test(ut[1]||"")),Vn=null,jn=null,St=null,gt=0,_t=null;if(y0(z),Kt&&Bu>0){let ut=x0({props:_,slot:je,slotContext:k.trim()?b0(Me):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...q].sort(),layers:z._layerGraph?.layers.map((ht)=>ht.configFile),uid:Et});if(ut!==null){Vn=`${de}\x00${h(xe)}\x00${ut}`;let ht=Ya.get(Vn);if(ht){for(let Rt of ht.dependencies)H.add(Rt);if(Dd(T,ht.clientFactories),vt.n+=ht.uidsConsumed,ht.preservedClientExpressions.length>0){let Rt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ct of ht.preservedClientExpressions)Rt.add(ct);T.__stx_preserved_client_expressions=[...Rt]}return ht.output}jn=new Set(H),St=Id(T),gt=vt.n,_t=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Ut=new Set;for(let ut of dt){let ht=ut[1]||"",Rt=ut[2]||"",ct=ht.includes("server");if(tt(ht)&&Rt.trim())Rt=nt(Rt);if(ct&&Rt){for(let Qt of ge(Rt))Ut.add(Qt);try{await ee(Rt,ft,de,{onFailure:(Qt)=>{if(Qt.kind!=="unknown")xt=Qt.kind}})}catch(Qt){}}if(!ct){let Qt=Rt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$r=Qt.includes("{{")&&Qt.includes("}}"),ss=Qt.includes("{!!")&&Qt.includes("!!}");if($r||ss)Qt=ws(Qt,ft,de);let Er=ht.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");$t.push(`<script${Er}>${Qt}</script>`)}}let tn=hn(xe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=tn?tn[1]:"",Qa=tn?tn[2]:"",Jn="",ec=fn&&/\bscoped\b/i.test(fn);if(tn)Jn=`<style${fn}>${E0(Qa,ft,de)}</style>`;let Ue=wt;if(Ue=Ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),tn)Ue=Ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ut=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ht=[];if(Ue=Ue.replace(ut,(Rt,ct)=>{let Gt=ct.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Gt)ht.push(`<style${Gt[1]}>${Gt[2]}</style>`);return""}),Ue=Ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ht.length>0)Jn=`${Jn}${ht.join(`
|
|
2661
|
-
`)}`}if(k&&Ue.includes("{{ text || slot }}"))Ue=Ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:it}=await kt("stx/slots",()=>import("./chunk-k5kj93g7.js")),{defaultSlot:mt,namedSlots:At}=Be,qt=$t.some((ut)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ut)),on=(ut)=>qt?nh(ut,Et):ut,ns=new Map([...At].map(([ut,ht])=>[ut,{...ht,content:on(ht.content)}]));Ue=await it(Ue,on(mt),ns,ft);let tc=Fs($t),Oo=(Array.isArray(ft.__stx_client_signal_names)?ft.__stx_client_signal_names:[]).filter((ut)=>!Ut.has(ut));if(tc.length>0||Oo.length>0)ft.__stx_client_signal_names=[...new Set([...Oo,...tc])];else delete ft.__stx_client_signal_names;let Mo=q.filter((ut)=>!Ut.has(ut)&&!(ut in _));if(Mo.length>0)ft[aa]=Mo;let No={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:pt.dirname(de),skipSignalsRuntime:!0,skipEventDirectives:z._nativeHostAttrs===!0||qt||$t.length===0,defaultLayout:void 0};ft.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let Sr=await n(Ue,ft,de,No,H),rs=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ut of Sr.matchAll(/\{\{([\s\S]*?)\}\}/g))rs.add(ut[1].trim());if(rs.size>0)T.__stx_preserved_client_expressions=[...rs];let Yn=Et,un=Sr;if(qt){let ut="";if(Object.keys(_).length>0)try{ut=` data-stx-props="${Mu(JSON.stringify(_))}"`}catch{}let ht=ue?` stx-hydrate="${Mu(ue)}"`:"",Rt=Object.fromEntries(Object.entries(He).map(([Er,is])=>[Er,Boolean(is)])),ct=Object.keys(Rt).length>0?` data-stx-slots="${Mu(JSON.stringify(Rt))}"`:"",Gt=` data-stx-scope="${Yn}"${ut}${ct}${ht}`,Qt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Sr),$r=Qt?"span":"div";un=tl(Sr,Gt)??`<${$r}${Gt} data-stx-component-wrapper${Qt?' style="display:contents"':""}>${Sr}</${$r}>`;let ss=await Promise.all($t.map(async(Er)=>{let is=Er.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!is)return Er;let[,jo,Lo]=is,Wn=await A0(Lo,de,z.buildMode==="compile"),Bo=bn(Wn.clientCode,Se(ft)),{vendorStyleTags:Qn}=Wn,ji=Bo?`function(__scopeId) {
|
|
2662
|
-
${Bo}
|
|
2663
|
-
return (${Wn.factoryBody})(__scopeId);
|
|
2664
|
-
}`:Wn.factoryBody,zi=ue?null:fc(T,ji),os=zi?`window.__stxComponentFactories[${JSON.stringify(zi)}](${JSON.stringify(Yn)});`:`(${ji})(${JSON.stringify(Yn)});`;if(ue)return`${Qn}<script type="stx/island" data-stx-island="${Yn}" data-stx-scoped data-stx-owner="${Yn}"${jo}>${os}</script>`;return`${Qn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Yn}"${jo}>${os}</script>`}));if(un=un+`
|
|
2665
|
-
`+ss.join(`
|
|
2666
|
-
`),Jn)un+=`
|
|
2667
|
-
`+Jn}else{if(Jn)un+=`
|
|
2668
|
-
`+Jn;if($t.length>0){let ut=ft.__stx_event_bindings||[],ht=Se(ft),Rt=await Promise.all($t.map(async(ct)=>{let Gt=ct.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Gt)return ct;return await ke(Gt[1],{eventBindings:ut,templateContent:un,filePath:de,projectRoot:process.cwd(),serverData:ht,instanceId:Et})}));un+=`
|
|
2669
|
-
`+Rt.join(`
|
|
2670
|
-
`),ft.__stx_event_bindings=[]}}if(ec){let ut=pa(un,de);if(ut.hasScoped)un=ut.html}if(Vn&&jn){let ut=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Ya.set(Vn,{output:un,dependencies:[...H].filter((ht)=>!jn.has(ht)),clientFactories:St?Pd(T,St):[],uidsConsumed:vt.n-gt,preservedClientExpressions:_t?ut.filter((ht)=>!_t.has(ht)):[]})}if(xt)un=`<!--stx-render-failed:${xt}-->${un}`;return ze.length>0?`${un}
|
|
2671
|
-
${ze.join(`
|
|
2672
|
-
`)}`:un}catch(le){if(le instanceof W)throw le;return`[Error processing component: ${le instanceof Error?le.message:String(le)}]`}finally{ae.delete(v)}}async function r(v){return Bun.file(v).exists()}function zu(v,_){let k=pt.resolve(_),R=pt.resolve(v),T=k.endsWith(pt.sep)?k:k+pt.sep;if(R===k||R.startsWith(T))return R;return null}async function C0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=pt.join(v,T);for(let z of B.endsWith(".stx")?[B]:[B,`${B}.stx`])if(await r(z)){if(R)console.log(`Found layout in ${v}: ${z}`);return k?.add(z),z}return null}async function gr(v,_,k,R){let T=await R0(v,_,k,R);if(T===null)return null;let B=zu(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((F)=>typeof F==="string"&&F.length>0);for(let F of z){let H=pt.isAbsolute(F)?F:pt.resolve(process.cwd(),F);if(zu(T,H))return pt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function R0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=pt.dirname(_),B=process.cwd();if(v.startsWith("/")){let ee=pt.join(B,v),ae=zu(ee,B);if(!ae)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ae}`);if(await r(ae)&&R)R.add(ae);return ae}let z=pt.join(T,v);if(await r(z)){if(k.debug)console.log(`Found direct path: ${z}`);if(R)R.add(z);return z}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let ee of[".stx",".tsx",".jsx"]){let ae=`${z}${ee}`;if(await r(ae)){if(k.debug)console.log(`Found direct path with extension: ${ae}`);if(R)R.add(ae);return ae}}let F=[];if(F.push(...k._layerLayoutDirs??[]),k.layoutsDir)F.push(pt.isAbsolute(k.layoutsDir)?k.layoutsDir:pt.resolve(process.cwd(),k.layoutsDir));let H=pt.resolve(T),q=process.cwd();for(let ee=0;ee<10;ee++){let ae=pt.join(H,"layouts"),Q=!1;try{Q=Mh.statSync(ae,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(Q){F.push(ae);break}let ce=pt.dirname(H);if(ce===H||ce.length<q.length)break;H=ce}for(let ee of F){let ae=await C0(ee,v,R,k.debug);if(ae)return ae}if(k.fallbackLayoutsDir){let ee=pt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:pt.resolve(process.cwd(),k.fallbackLayoutsDir),ae=v.startsWith("layouts/")?v.slice(8):v,Q=[pt.join(ee,ae)];if(!v.endsWith(".stx"))Q.push(`${Q[0]}.stx`);for(let ce of Q)if(await r(ce)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${ce}`);if(R)R.add(ce);return ce}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let ee=v.split("layouts/"),ae=pt.join(k.partialsDir||T,"layouts",ee[1]);if(await r(ae)){if(k.debug)console.log(`Found in layouts path: ${ae}`);if(R)R.add(ae);return ae}if(!ae.endsWith(".stx")){let Q=`${ae}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in layouts path with extension: ${Q}`);if(R)R.add(Q);return Q}}}if(k.partialsDir){let ee=pt.join(k.partialsDir,"layouts");if(await r(ee)){let ae=pt.join(ee,v);if(await r(ae)){if(k.debug)console.log(`Found in partials layouts dir: ${ae}`);if(R)R.add(ae);return ae}if(!v.endsWith(".stx")){let Q=`${ae}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${Q}`);if(R)R.add(Q);return Q}}}}let K=k.partialsDir||pt.join(process.cwd(),"views"),G=pt.join(K,v);if(await r(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(R)R.add(G);return G}if(!v.endsWith(".stx")){let ee=`${G}.stx`;if(await r(ee)){if(k.debug)console.log(`Found in views path with extension: ${ee}`);if(R)R.add(ee);return ee}}if(T.includes("temp")){let ee=pt.join(pt.dirname(T),"layouts",v);if(await r(ee)){if(k.debug)console.log(`Found in temp layouts dir: ${ee}`);if(R)R.add(ee);return ee}if(!v.endsWith(".stx")){let ae=`${ee}.stx`;if(await r(ae)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ae}`);if(R)R.add(ae);return ae}}}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 Di(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
|
|
2673
|
-
`),F=0;for(let H=0;H<z.length;H++)if(F+=z[H].length+1,F>=_){R=H+1,T=z[H].trim();let q=Math.max(0,H-2),K=Math.min(z.length,H+3);B=z.slice(q,K).map((G,ee)=>{let ae=q+ee+1;return`${ae===R?"> ":" "}${ae}: ${G}`}).join(`
|
|
2674
|
-
`);break}}else if(k){let z=v.indexOf(k);if(z>=0)return Di(v,z)}}catch{}return{lineNumber:R,lineContent:T,context:B}}var Tt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(v,_,k,R,T,B){let{lineNumber:z,context:F}=Di(R,T,B),H=k.split("/").pop(),q=0;if(typeof T==="number"&&T>=0&&R){let G=R.lastIndexOf(`
|
|
2675
|
-
`,Math.max(0,T-1));q=T-(G+1)+1}let K="";if(z>0)K+=`
|
|
2676
|
-
${k}:${z}${q>0?`:${q}`:""}: ${v.toLowerCase()} error: ${_}
|
|
2677
|
-
`;if(K+=`
|
|
2678
|
-
${Tt.bold}${Tt.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Tt.reset}
|
|
2679
|
-
`,K+=`${Tt.bold}${Tt.red}\u2502${Tt.reset} ${Tt.bold}${Tt.bgRed} ERROR ${Tt.reset} ${Tt.red}${v} Error${Tt.reset}${" ".repeat(Math.max(0,43-v.length))}${Tt.bold}${Tt.red}\u2502${Tt.reset}
|
|
2680
|
-
`,K+=`${Tt.bold}${Tt.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Tt.reset}
|
|
2681
|
-
`,K+=`
|
|
2682
|
-
${Tt.cyan}${Tt.bold}File:${Tt.reset} ${Tt.dim}${H}${Tt.reset}`,z>0)K+=` ${Tt.gray}(line ${z}${q>0?`, col ${q}`:""})${Tt.reset}`;if(K+=`
|
|
2683
|
-
${Tt.yellow}${Tt.bold}Message:${Tt.reset} ${_}
|
|
2684
|
-
`,F)K+=`
|
|
2685
|
-
${Tt.blue}${Tt.bold}Context:${Tt.reset}
|
|
2686
|
-
${Tt.dim}${F}${Tt.reset}
|
|
2687
|
-
`;return K}function oe(){Po.clear(),Ja.clear(),ju.clear(),Lu.clear(),Ya.clear()}function vd(){return{size:Po.size,maxSize:500}}var Nu=m(128);async function A0(v,_,k){let R=h(v,_,k),T=Nu.get(R);if(T){if(sr(T.deps))return T;Nu.delete(R)}let B=hs(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,F=ys(B.styles);z=Ot(z).code;let{hasUserImports:H,bundleClientScript:q}=await kt("stx/client-script-bundler",()=>import("./chunk-f0ghgkxs.js")),K=[],G=!1;if(H(z)){let le=z;z=await q(le,_,{projectRoot:process.cwd(),minify:k,collectInputs:K}),G=z===le}let{stripStxRuntimeImports:ee}=await kt("stx/signal-processing",()=>import("./chunk-mmqt6qkf.js"));z=ee(z);let ae=I(z),Q=w0(ae),ce=`function(__scopeId) {
|
|
2688
|
-
${Wt("const",[...Qi,...Q],ae)}
|
|
2689
|
-
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2690
|
-
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
2691
|
-
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
2692
|
-
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
2693
|
-
const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
|
|
2694
|
-
// A clone the runtime is setting up may not be in the document yet (rows
|
|
2695
|
-
// a loop builds inside a closed :if), where a lookup cannot see it, so the
|
|
2696
|
-
// runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
|
|
2697
|
-
const __setupRoot = window.__STX_SETUP_ROOT__;
|
|
2698
|
-
const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
2699
|
-
__scopeVars.$slots = Object.create(null);
|
|
2700
|
-
if (__componentElement) {
|
|
2701
|
-
try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
|
|
2702
|
-
catch {}
|
|
2703
|
-
}
|
|
2704
|
-
window.__STX_CURRENT_ELEMENT__ = __componentElement;
|
|
2705
|
-
let __componentProps = __componentElement && __componentElement.__stx_props;
|
|
2706
|
-
if (!__componentProps && __componentElement) {
|
|
2707
|
-
try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
|
|
2708
|
-
catch { __componentProps = {}; }
|
|
2709
|
-
}
|
|
2710
|
-
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
2711
|
-
|
|
2712
|
-
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
2713
|
-
// hook lists keep what setup registered, because a component behind an :if
|
|
2714
|
-
// unmounts at each hide and mounts again at each show (signals.ts,
|
|
2715
|
-
// suspendSubtreeScopes).
|
|
2716
|
-
if (__scopeVars.__suspended && !__scopeVars.__mounted) {
|
|
2717
|
-
// Set up again after an :if hid it -- a <template :if> clones the
|
|
2718
|
-
// component afresh on every show, and the clone's script runs. This run's
|
|
2719
|
-
// hooks close over this run's state, so they replace the ones the hide
|
|
2720
|
-
// kept for a re-show rather than queueing beside them.
|
|
2721
|
-
__scopeVars.__mountCallbacks = [];
|
|
2722
|
-
__scopeVars.__destroyCallbacks = [];
|
|
2723
|
-
__scopeVars.__mountHooks = [];
|
|
2724
|
-
__scopeVars.__destroyHooks = [];
|
|
2725
|
-
}
|
|
2726
|
-
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
2727
|
-
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
2728
|
-
__scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
|
|
2729
|
-
__scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
|
|
2730
|
-
let __registeringSetupHooks = true;
|
|
2731
|
-
const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
|
|
2732
|
-
const onDestroy = (fn) => {
|
|
2733
|
-
__scopeVars.__destroyCallbacks.push(fn);
|
|
2734
|
-
// A teardown registered inside onMount belongs to this mount alone.
|
|
2735
|
-
// Replaying it AND registering the next mount's teardown doubles cleanup.
|
|
2736
|
-
if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
|
|
2737
|
-
};
|
|
2738
|
-
|
|
2739
|
-
try {
|
|
2740
|
-
${ae}
|
|
2741
|
-
|
|
2742
|
-
// Register all defined signals and functions in this scope
|
|
2743
|
-
const __localVars = {};
|
|
2744
|
-
try {
|
|
2745
|
-
${Q.map((le)=>`if (typeof ${le} !== 'undefined') __localVars['${le}'] = ${le};`).join(`
|
|
2746
|
-
`)}
|
|
2747
|
-
}
|
|
2748
|
-
catch (e) {}
|
|
2749
|
-
Object.assign(__scopeVars, __localVars);
|
|
2750
|
-
}
|
|
2751
|
-
finally {
|
|
2752
|
-
__registeringSetupHooks = false;
|
|
2753
|
-
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2754
|
-
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
2755
|
-
}
|
|
2756
|
-
}`,ue={vendorStyleTags:F,factoryBody:ce,clientCode:ae,deps:yn([...K,...B.styles.map((le)=>le.resolvedPath)])};if(!G&&B.unresolved.length===0)Nu.set(R,ue);return ue}var T0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function I0(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 P0(v,_){let k=_;while(!0){let R=ts.join(k,"node_modules",v,"package.json");if(Do.existsSync(R))return ts.dirname(R);let T=ts.dirname(k);if(T===k)return null;k=T}}function D0(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let R=null;for(let T of Object.keys(v)){let B=T.indexOf("*");if(B===-1)continue;let z=T.slice(0,B),F=T.slice(B+1);if(!_.startsWith(z)||!_.endsWith(F))continue;if(_.length<z.length+F.length)continue;if(!R||z.length>R.prefix.length)R={pattern:T,prefix:z,suffix:F}}if(R){let T=_.slice(R.prefix.length,_.length-R.suffix.length),B=k(v[R.pattern]);if(B)return B.replace("*",T)}return null}function O0(v,_){let k=I0(v);if(!k||!k.subpath)return null;let R=P0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(Do.readFileSync(ts.join(R,"package.json"),"utf8"))}catch{return null}let B=`.${k.subpath}`,z=D0(T.exports,B);if(!z)return null;let F=ts.resolve(R,z);return Do.existsSync(F)?F:null}function hs(v,_){let k=_.filePath?ts.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,B=[],z=[];return{code:v.replace(T0,(H,q)=>{let K;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(K=q.startsWith("/")?q:ts.resolve(k,q),!Do.existsSync(K))throw Error(`file not found: ${K}`)}else{let G=null;try{G=Bun.resolveSync(q,R)}catch{G=O0(q,R)}if(!G)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);K=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${_.filePath||"<unknown>"}): ${G?.message||G}`),z.push(q),""}if(T.has(K))return"";T.add(K);try{let G=Do.readFileSync(K,"utf8");B.push({source:q,resolvedPath:K,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${K}: ${G?.message||G}`),z.push(q)}return""}),styles:B,unresolved:z}}function M0(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ys(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${M0(_.source)}" data-stx-layer="vendor">
|
|
2757
|
-
@layer vendor {
|
|
2758
|
-
${_.contents}
|
|
2759
|
-
}
|
|
2760
|
-
</style>`).join(`
|
|
2761
|
-
`)}
|
|
2762
|
-
`}var xc=y,jh=m(256);function Ot(v){let _=h(v),k=jh.get(_);if(!k)k=N0(v),jh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function N0(v){let _=s(v),k=new Set;for(let F of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of F[1].split(",")){let q=H.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)k.add(q)}let R=Ho(_),T=J.filter((F)=>{if(k.has(F)||R.has(F))return!1;return bs(_,F,!0)}),B=Wh(_).filter((F)=>!k.has(F)&&!R.has(F));if(T.length===0&&B.length===0)return{code:v,imports:T,models:B};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",B.length>0?"import '@stacksjs/browser'":"",B.length>0?`const { ${B.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2763
|
-
`)}
|
|
2764
|
-
${v}`,imports:T,models:B}}var j0=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 Wh(v){let _=new Set,k=lc(v),R=Ho(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let B of k.code.matchAll(T)){let z=B[1];if(j0.has(z)||R.has(z)||z.length<3)continue;if(k.shadows(z,B.index??0))continue;_.add(z)}return Array.from(_)}function L0(v){return Ho(v)}var Lh=m(128);function li(v){let _=h(v),k=Lh.get(_);if(!k)k=B0(v),Lh.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function B0(v){let _=new Set,k=new Set,R=v;R=R.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,B=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,z;while((z=B.exec(v))!==null){let G=z[1],ee=z[2];if(z[0].includes("import type"))continue;let ae=[];for(let ce of G.split(",")){let ue=ce.trim();if(!ue||ue.startsWith("type "))continue;let le=ue.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!le)continue;let pe=le[1],de=le[2]||pe;if(T.add(pe),T.add(de),ee==="stx"||ee==="@stacksjs/stx")_.add(pe);else k.add(pe);if(de!==pe)ae.push(`${de} = ${pe}`)}let Q=ae.length>0?`var ${ae.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(z[0],Q)}let F=L0(R);for(let G of xc){if(T.has(G)||F.has(G))continue;if(bs(R,G,!0))_.add(G)}let H=s(R),q=new Set;for(let G of R.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let ee of G[1].split(",")){let ae=ee.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Q of ae){let ce=Q.trim();if(ce)q.add(ce)}}for(let G of J){if(T.has(G)||F.has(G)||q.has(G))continue;if(bs(H,G))k.add(G)}let K=Wh(H);for(let G of K)if(!T.has(G)&&!F.has(G))k.add(G);return{code:R,stxImports:Array.from(_),browserImports:Array.from(k)}}function bs(v,_,k=!1){let R=lc(v);v=R.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let B of v.matchAll(T)){let z=B.index??0;if(R.shadows(_,z))continue;let F=z+_.length,H=z-1;while(H>=0&&/\s/.test(v[H]))H--;if(v[H]==="."&&v.slice(Math.max(0,H-2),H+1)!=="...")continue;let q=F;while(q<v.length&&/\s/.test(v[q]))q++;if(v[q]===":"&&v[q+1]!==":"&&(v[H]==="{"||v[H]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(F)))continue;if(z0(v,F))continue;return!0}return!1}function z0(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let R=0;for(;k<v.length;k++){let T=v[k];if(T==="(")R++;else if(T===")"){if(R--,R===0)break}}if(R!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function ui(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
|
|
2765
|
-
${k.join(`
|
|
2766
|
-
`)}
|
|
2767
|
-
${W0(v,_)}`;return""}function Yu(v,_=[]){let{browserImports:k}=li(v),R=new Set(_);return ui([],k.filter((T)=>!R.has(T)))}function W0(v,_){let k=[...v.map((R)=>`['${R}', typeof ${R}, 'stx']`),..._.map((R)=>`['${R}', typeof ${R}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
2768
|
-
[${k.join(", ")}].forEach(function (e) {
|
|
2769
|
-
if (e[1] !== 'undefined') return;
|
|
2770
|
-
console.error(
|
|
2771
|
-
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
2772
|
-
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
2773
|
-
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2774
|
-
);
|
|
2775
|
-
});
|
|
2776
|
-
`}function Se(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let R={};for(let T in _){let B=_[T];if(typeof B==="function")continue;R[T]=B}return R.__stxDeclaredPayload=!0,R}let k={};for(let R in v){if(R.startsWith("__")||R.startsWith("$"))continue;let T=v[R];if(typeof T==="function")continue;k[R]=T}return k}var F0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Bh=new Set;function V0(v,_){let k=F0.test(v),R=_.length>32768;if(!k&&!R)return;if(Bh.has(v))return;if(Bh.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(R)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function bn(v,_){if(!_)return"";let k=It(v,new Set(Object.keys(_))),R=_.__stxDeclaredPayload===!0,T=[],B=Object.entries(_).sort(([z],[F])=>z<F?-1:z>F?1:0);for(let[z,F]of B){if(!/^[A-Za-z_$][\w$]*$/.test(z))continue;if(z.startsWith("__")||z.startsWith("$"))continue;if(!R&&!k.has(z))continue;if(Ui(v,z)){if(R)console.warn(`[stx] defineClientPayload declares "${z}", but this client block also declares "${z}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${z}" from defineClientPayload.`);continue}let H;try{H=JSON.stringify(F)}catch{continue}if(H===void 0)continue;V0(z,H),T.push(` var ${z} = ${H.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2777
|
-
${T.join(`
|
|
2778
|
-
`)}
|
|
2779
|
-
`}var U0={left:0,middle:1,right:2};function H0(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((R)=>`$event.key === '${R}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=U0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function q0(v,_){let{elementId:k,event:R,modifiers:T}=v,B=oc(v.handler),z=H0(T),F=[];if(T.once)F.push("once: true");if(T.capture)F.push("capture: true");if(ic(R,T))F.push("passive: true");let H=F.length>0?`, { ${F.join(", ")} }`:"",q="";if(z)q+=`${z}; `;let K=B.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
|
|
2780
|
-
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2781
|
-
};`;function ee(ae){if(/\$emit\s*\(/.test(ae))return`${G}
|
|
2782
|
-
${ae}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
2783
|
-
if (scope && scope.__stx_execute) {
|
|
2784
|
-
scope.__stx_execute('${K}', $event, $el);
|
|
2785
|
-
}
|
|
2786
|
-
else {
|
|
2787
|
-
${ae}
|
|
2788
|
-
}`}if(T.debounce!==null)return` ;(function() {
|
|
2789
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
2790
|
-
var $el = document.getElementById('${k}')
|
|
2791
|
-
if (!$el) return
|
|
2792
|
-
var __timer
|
|
2793
|
-
$el.addEventListener('${R}', function($event) {
|
|
2794
|
-
${z?z+"; ":""}clearTimeout(__timer)
|
|
2795
|
-
__timer = setTimeout(function() { ${ee(B)} }, ${T.debounce})
|
|
2796
|
-
}${H})
|
|
2797
|
-
})()`;if(T.throttle!==null)return` ;(function() {
|
|
2798
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
2799
|
-
var $el = document.getElementById('${k}')
|
|
2800
|
-
if (!$el) return
|
|
2801
|
-
var __last = 0
|
|
2802
|
-
$el.addEventListener('${R}', function($event) {
|
|
2803
|
-
${z?z+"; ":""}var __now = Date.now()
|
|
2804
|
-
if (__now - __last >= ${T.throttle}) {
|
|
2805
|
-
__last = __now
|
|
2806
|
-
${ee(B)}
|
|
2807
|
-
}
|
|
2808
|
-
}${H})
|
|
2809
|
-
})()`;if(/\$emit\s*\(/.test(B))return` var $el = document.getElementById('${k}')
|
|
2810
|
-
if ($el) $el.addEventListener('${R}', function($event) {
|
|
2811
|
-
${q}${G}
|
|
2812
|
-
${B}
|
|
2813
|
-
}${H})`;return` var $el = document.getElementById('${k}')
|
|
2814
|
-
if ($el) $el.addEventListener('${R}', function($event) {
|
|
2815
|
-
${q}var scope = $el.closest('[data-stx-scope]');
|
|
2816
|
-
if (scope && scope.__stx_execute) {
|
|
2817
|
-
scope.__stx_execute('${K}', $event, $el);
|
|
2818
|
-
}
|
|
2819
|
-
else {
|
|
2820
|
-
${B}
|
|
2821
|
-
}
|
|
2822
|
-
}${H})`}function K0(v){if(v.length===0)return"";return`
|
|
2823
|
-
// STX: auto-generated event bindings
|
|
2824
|
-
${v.map((k,R)=>q0(k,R)).join(`
|
|
2825
|
-
`)}`}function zh(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let F=R[z];if(F==="'"||F==='"'||F==="`"){let H=F;if(z++,H==="`"){let q=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&q===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){q++,z+=2;continue}if(R[z]==="}"&&q>0){q--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===H){z++;break}z++}continue}if(F==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
|
|
2826
|
-
`)z++;continue}if(F==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(F==="{"){T++,z++;continue}if(F==="}"){T--,z++;continue}if(T===0){let H=R.slice(z),q=H.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let ee=q[1];if(!ee.startsWith("_")&&!k.has(ee))_.push(ee),k.add(ee);z+=q[0].length;continue}let K=H.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((ee)=>{let ae=ee.trim(),Q=ae.indexOf(":"),ce=Q>=0?ae.slice(Q+1).trim().split(/[\s=]/)[0]:ae.split(/[\s=]/)[0];if(ce&&!ce.startsWith("_")&&!k.has(ce))_.push(ce),k.add(ce)}),z+=K[0].length;continue}let G=H.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let ee=G[1];if(!ee.startsWith("_")&&!k.has(ee))_.push(ee),k.add(ee);z+=G[0].length;continue}}z++}return _}var X0=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Z0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(ee){let ae;while((ae=k.exec(ee))!==null){let Q=ae[0];if(!X0.has(Q))_.add(Q)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let F=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=F.exec(v))!==null)R(B[1]);let H=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=q.exec(v))!==null)R(B[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((B=K.exec(v))!==null)R(B[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=G.exec(v))!==null)R(B[1]);return _}async function ke(v,_={}){let k=v,R="",T=!1,B=[],z=hs(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let F=ys(z.styles),H=Ot(k);k=H.code,B=[...H.imports,...H.models];let{hasUserImports:q,bundleClientScript:K}=await kt("stx/client-script-bundler",()=>import("./chunk-f0ghgkxs.js"));if(q(k))k=await K(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let de=li(k);k=de.code,R=ui(de.stxImports,de.browserImports.filter((Re)=>!B.includes(Re)))}if(R=`${bn(k,_.serverData)}${R}`,k=I(k),!T&&tt(_.attrs||""))k=nt(k);let G=K0(_.eventBindings||[]),ee=(_.attrs||"").trim(),ae=/\btype\s*=\s*["']module["']/i.test(ee),Q=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ae){let de=ee.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Re=`type="module" data-stx-scoped${Q}${de?` ${de}`:""}`;return`${F}<script ${Re}>
|
|
2827
|
-
${oi(`${R}${k}
|
|
2828
|
-
${G}`)}
|
|
2829
|
-
</script>`}let ce=ro(v),ue=/function __stx_setup_/.test(k),le=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function pe(de){let Re=de.length>0?`
|
|
2830
|
-
return { ${de.join(", ")} };`:"",be=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${F}<script data-stx-scoped data-stx-run="always"${Q}>
|
|
2831
|
-
window.stx.mount(function() {
|
|
2832
|
-
'use strict';
|
|
2833
|
-
try {
|
|
2834
|
-
${oi(`${R}${k}
|
|
2835
|
-
${G}${Re}`)}
|
|
2836
|
-
} catch (error) {
|
|
2837
|
-
console.error(${be}, error);
|
|
2838
|
-
return {};
|
|
2839
|
-
}
|
|
2840
|
-
})</script>`}if(!le&&!ue){if(ce)return pe(zh(v));if(_.templateContent){let de=zh(v);if(de.length>0){let Re=Z0(_.templateContent);if(de.some((xe)=>Re.has(xe)))return pe(de)}}}return`${F}<script data-stx-scoped data-stx-run="always"${Q}>
|
|
2841
|
-
;(function() {
|
|
2842
|
-
'use strict';
|
|
2843
|
-
try {
|
|
2844
|
-
${oi(`${R}${k}
|
|
2845
|
-
${G}`)}
|
|
2846
|
-
} catch (error) {
|
|
2847
|
-
console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
|
|
2848
|
-
}
|
|
2849
|
-
})()</script>`}
|
|
2850
|
-
export{rr,We,It,M,X,m,h,yn,sr,J,w,qe,hs,ys,xc,Ot,li,bs,ui,Yu,Se,bn,ke,di,pi,fi,vs,V,Ge,te,Nt,ne,or,Sc,Zu,kc,Qu,Cc,ir,b,Dt,Ce,_c,ws,Ec,ed,Y,Tc,td,x,nd,$c,rd,sd,od,id,Rc,Ac,ad,cd,gi,ld,vn,wn,ar,Ke,_e,re,Mt,fe,xn,Sn,Ee,e,ud,mi,dd,hi,Pc,Ic,Lt,kn,pd,Oc,Nc,fd,f,Xe,jt,Je,Ye,yi,cr,Ze,se,xs,Ss,ks,gd,lr,md,Cn,Qe,Cs,_s,Dc,ge,bi,vi,wi,xi,ur,Es,Si,ki,Ci,Mc,Ts,L,me,Z,hd,Lc,$s,Rs,_i,Ei,As,Ps,dr,jc,Ti,$i,Bc,et,_n,pr,Bt,Fc,zc,Hc,Vc,Uc,u,Wc,Is,qc,Ri,Ai,Os,Pi,Gc,yd,Kc,Te,Ii,bd,Ns,Ds,Ms,Oi,Ls,js,Bs,n,Xc,Jc,Yc,Zc,Qc,el,tt,j,nt,tl,fr,nl,Ni,Fs,rt,r,gr,Di,g,oe,vd,mr,A,rl,zs,o,P,wd,xd,he};
|