@stacksjs/stx 0.2.388 → 0.2.389
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-059sx1ky.js +2 -0
- package/dist/{chunk-9wbbga8w.js → chunk-0daceza4.js} +1 -1
- package/dist/{chunk-mt1axsam.js → chunk-1c5w4nq4.js} +1 -1
- package/dist/chunk-23nncxaw.js +2 -0
- package/dist/chunk-2efz2s54.js +2 -0
- package/dist/chunk-2xj61qk5.js +2 -0
- package/dist/chunk-3664d5sf.js +2 -0
- package/dist/{chunk-55nfsjep.js → chunk-3dhwsptb.js} +2 -2
- package/dist/{chunk-ha0a1hpx.js → chunk-3ha78evt.js} +2 -2
- package/dist/{chunk-wk6xx6zz.js → chunk-3rf705aq.js} +2 -2
- package/dist/{chunk-1emtk9xm.js → chunk-3rg4ykrh.js} +1 -1
- package/dist/{chunk-254zfk5e.js → chunk-3tde530g.js} +1 -1
- package/dist/{chunk-p5ktexx3.js → chunk-3wa1ybzj.js} +1 -1
- package/dist/{chunk-jfznqexg.js → chunk-3x2y5rwr.js} +321 -174
- package/dist/{chunk-mh64v613.js → chunk-426j6ap5.js} +2 -2
- package/dist/{chunk-9qtnemsa.js → chunk-4dj5b57q.js} +1 -1
- package/dist/{chunk-mhjbkwjg.js → chunk-54323c6n.js} +1 -1
- package/dist/chunk-57ezrxxc.js +2 -0
- package/dist/{chunk-pdx4yh32.js → chunk-5mnj5ttg.js} +1 -1
- package/dist/chunk-5q7e83tn.js +2 -0
- package/dist/chunk-5x8x8g4j.js +2 -0
- package/dist/{chunk-fk82d606.js → chunk-6xwjtznh.js} +1 -1
- package/dist/{chunk-8x918j4p.js → chunk-71p0emwf.js} +1 -1
- package/dist/{chunk-h4xy2yd9.js → chunk-78m27g3h.js} +5 -5
- package/dist/{chunk-zn9v6jpb.js → chunk-89tp5zsn.js} +1 -1
- package/dist/{chunk-aa8015mk.js → chunk-8hqayvjh.js} +1 -1
- package/dist/{chunk-w8k5nd3c.js → chunk-8np6m7vv.js} +1 -1
- package/dist/{chunk-efyskaw7.js → chunk-8ph7mee2.js} +2 -2
- package/dist/{chunk-4qdbd2bt.js → chunk-9aj6v538.js} +1 -1
- package/dist/chunk-9dn9mbjc.js +2 -0
- package/dist/chunk-9dr0s6qa.js +2 -0
- package/dist/chunk-9nh7vyxt.js +2 -0
- package/dist/chunk-9q58ez22.js +2 -0
- package/dist/{chunk-rww8skhq.js → chunk-9wbys24b.js} +1 -1
- package/dist/chunk-a62080cs.js +2 -0
- package/dist/{chunk-fc29fgjq.js → chunk-am2ypjk5.js} +1 -1
- package/dist/{chunk-b1372rpb.js → chunk-apqq86bx.js} +1 -1
- package/dist/{chunk-1jfcd66s.js → chunk-b9tzp38b.js} +1 -1
- package/dist/{chunk-wz6ghx4c.js → chunk-bbh827hr.js} +1 -1
- package/dist/{chunk-0j0re4xx.js → chunk-bkhxfr92.js} +1 -1
- package/dist/chunk-bqajw5yd.js +2 -0
- package/dist/chunk-br3vfsyp.js +12 -0
- package/dist/chunk-c41zj3zg.js +2 -0
- package/dist/chunk-cfskf6ag.js +2 -0
- package/dist/{chunk-bdahs78b.js → chunk-cm5v3eep.js} +1 -1
- package/dist/{chunk-5vezz2e3.js → chunk-cnbnff7q.js} +1 -1
- package/dist/{chunk-0edew5bc.js → chunk-d3afhcqs.js} +2 -2
- package/dist/{chunk-b32ch8nh.js → chunk-dcfm9543.js} +2 -2
- package/dist/chunk-dckr11ex.js +2 -0
- package/dist/{chunk-e5dg9z8x.js → chunk-dct8xw04.js} +1 -1
- package/dist/{chunk-s0ftf1h4.js → chunk-dfp7c7g2.js} +1 -1
- package/dist/chunk-dyb826w8.js +2 -0
- package/dist/{chunk-x9xfgta8.js → chunk-e7bh3mpf.js} +2 -2
- package/dist/{chunk-67wmfv2q.js → chunk-efsr5fbm.js} +1 -1
- package/dist/chunk-eqag54ry.js +2 -0
- package/dist/{chunk-5yxs9aa6.js → chunk-es9jp0c7.js} +1 -1
- package/dist/{chunk-21ev9jk2.js → chunk-fc8471kb.js} +2 -2
- package/dist/{chunk-bkd4dgry.js → chunk-fjwzyvwy.js} +1 -1
- package/dist/{chunk-5c18cs23.js → chunk-fkbk8ccj.js} +1 -1
- package/dist/{chunk-cwba6q7v.js → chunk-hestqebq.js} +1 -1
- package/dist/chunk-hnkgw20q.js +2 -0
- package/dist/{chunk-gsztv352.js → chunk-hp7m9xz7.js} +1 -1
- package/dist/chunk-hr9g4ahv.js +2 -0
- package/dist/chunk-hs73jbhj.js +2 -0
- package/dist/{chunk-ze2ng3ym.js → chunk-j8jteztt.js} +1 -1
- package/dist/chunk-jnq140p3.js +2 -0
- package/dist/{chunk-6xq290yk.js → chunk-jqq0h9sd.js} +1 -1
- package/dist/{chunk-hsdp2z03.js → chunk-k1dt0dcy.js} +1 -1
- package/dist/{chunk-h92qqvb3.js → chunk-k7f7391g.js} +1 -1
- package/dist/{chunk-csk3ww26.js → chunk-kj3ab19w.js} +1 -1
- package/dist/{chunk-ytxd63t6.js → chunk-kwz3tfdm.js} +2 -2
- package/dist/{chunk-af8xbswf.js → chunk-m8z5450r.js} +1 -1
- package/dist/{chunk-2djxvm1a.js → chunk-mayprgb9.js} +1 -1
- package/dist/{chunk-3sz8w1cy.js → chunk-mnc5bj10.js} +3 -3
- package/dist/{chunk-xttnjemt.js → chunk-mrnk4hbx.js} +1 -1
- package/dist/{chunk-25tfm9t5.js → chunk-mvnjpwes.js} +1 -1
- package/dist/{chunk-wjbfget1.js → chunk-n0hrb3ek.js} +1 -1
- package/dist/{chunk-10q0m99z.js → chunk-n6fcg584.js} +1 -1
- package/dist/{chunk-h3r7wcxk.js → chunk-n98anpe9.js} +1 -1
- package/dist/{chunk-fq8mj9f8.js → chunk-nptdshhw.js} +1 -1
- package/dist/{chunk-gzw5xbpx.js → chunk-pas5rdzj.js} +1 -1
- package/dist/{chunk-da5jnb8w.js → chunk-pv2trpk9.js} +1 -1
- package/dist/{chunk-xqd45z0h.js → chunk-pzhk6186.js} +1 -1
- package/dist/chunk-pzsfjvbd.js +2 -0
- package/dist/{chunk-jwwyq1a8.js → chunk-q01hqekk.js} +1 -1
- package/dist/{chunk-38ykv2gd.js → chunk-q9zsjgpf.js} +1 -1
- package/dist/{chunk-pg3phc81.js → chunk-qgfrxefd.js} +1 -1
- package/dist/chunk-qryhs758.js +2 -0
- package/dist/{chunk-hyzjprnz.js → chunk-qsq1eha8.js} +2 -2
- package/dist/{chunk-pxgkj5yv.js → chunk-qvjhzwm8.js} +1 -1
- package/dist/{chunk-zs97h4k1.js → chunk-ra9hbqx4.js} +1 -1
- package/dist/{chunk-zzwtcfht.js → chunk-rzp3bagj.js} +1 -1
- package/dist/{chunk-2t84w57n.js → chunk-s7t37c7w.js} +1 -1
- package/dist/chunk-sbwkx6y5.js +2 -0
- package/dist/chunk-sm3d4kbn.js +2 -0
- package/dist/chunk-t0a8b1ny.js +2 -0
- package/dist/{chunk-9xej4h3f.js → chunk-tdn55vs4.js} +1 -1
- package/dist/{chunk-rs7k6kst.js → chunk-tegrvgyn.js} +1 -1
- package/dist/{chunk-fjy42mxa.js → chunk-tjqjqn87.js} +1 -1
- package/dist/{chunk-21qe79s4.js → chunk-tr02vys6.js} +1 -1
- package/dist/chunk-vzt8h4vw.js +2 -0
- package/dist/{chunk-hg7nc4qz.js → chunk-w94p102g.js} +12 -12
- package/dist/{chunk-758a92ey.js → chunk-wf45k2yw.js} +1 -1
- package/dist/{chunk-62xtj75m.js → chunk-wgyhjhj7.js} +1 -1
- package/dist/{chunk-k0y5zd86.js → chunk-wpxz7340.js} +1 -1
- package/dist/{chunk-xsch7b7f.js → chunk-x45kj2fa.js} +1 -1
- package/dist/{chunk-6sh05w6b.js → chunk-xhpjh1ja.js} +1 -1
- package/dist/{chunk-pzpdep20.js → chunk-xswa3v5f.js} +2 -2
- package/dist/{chunk-vbyxgwz5.js → chunk-y33pm4g5.js} +1 -1
- package/dist/{chunk-kkzrrd4g.js → chunk-y3vgzvwn.js} +1 -1
- package/dist/{chunk-veky1cte.js → chunk-y70wabha.js} +1 -1
- package/dist/{chunk-zxfejz72.js → chunk-y9f2csr0.js} +1 -1
- package/dist/chunk-ydrp2ydg.js +2 -0
- package/dist/{chunk-3kdq9tqp.js → chunk-zbxjq5jw.js} +1 -1
- package/dist/{chunk-rtfwn4cm.js → chunk-zn70s4gs.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/composables/index.d.ts +9 -0
- package/dist/composables/index.js +4 -0
- package/dist/composables/use-offline.d.ts +9 -0
- package/dist/composables/use-offline.js +9 -0
- package/dist/composables/use-outbox.d.ts +63 -0
- package/dist/composables/use-outbox.js +203 -0
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/offline/app-service-worker.d.ts +41 -0
- package/dist/offline/app-service-worker.js +159 -0
- package/dist/process.js +3 -0
- package/dist/pwa.js +2 -2
- package/dist/signals.js +4 -4
- package/dist/ssg.js +2 -2
- package/dist/types/config-types.d.ts +6 -0
- package/dist/unresolved-identifiers.js +2 -0
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-2np2xan7.js +0 -2
- package/dist/chunk-4frha7mr.js +0 -2
- package/dist/chunk-4kpxe6vv.js +0 -2
- package/dist/chunk-7yqty1cx.js +0 -2
- package/dist/chunk-8t8canty.js +0 -2
- package/dist/chunk-abhahcyp.js +0 -2
- package/dist/chunk-axr54zr9.js +0 -2
- package/dist/chunk-b55jjzqm.js +0 -2
- package/dist/chunk-bnajpkrk.js +0 -2
- package/dist/chunk-bqswa7k4.js +0 -2
- package/dist/chunk-cvcw84hb.js +0 -12
- package/dist/chunk-d5mmmjd8.js +0 -2
- package/dist/chunk-ffmqdmsg.js +0 -2
- package/dist/chunk-khtw32kk.js +0 -2
- package/dist/chunk-ma6etynw.js +0 -2
- package/dist/chunk-nbd53e3v.js +0 -2
- package/dist/chunk-nnnn6pcb.js +0 -2
- package/dist/chunk-qjtkqv7h.js +0 -2
- package/dist/chunk-rgnykws0.js +0 -2
- package/dist/chunk-shtm9a7r.js +0 -2
- package/dist/chunk-sm2b174g.js +0 -2
- package/dist/chunk-stdswr2p.js +0 -2
- package/dist/chunk-tfmcae6a.js +0 -2
- package/dist/chunk-ty8qet83.js +0 -2
- package/dist/chunk-v6xz3fkh.js +0 -2
- package/dist/chunk-vehfsgtr.js +0 -2
- package/dist/chunk-vhfwxpm6.js +0 -2
- package/dist/chunk-xeb8cm9b.js +0 -2
- package/dist/chunk-xzk6z427.js +0 -2
- package/dist/chunk-ywh4xqgw.js +0 -2
- package/dist/chunk-z472e3nj.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{bs as a8,fs as t8,ps as p4,qs as i4}from"./chunk-fc8471kb.js";import{vs as Q0,ws as q2}from"./chunk-89tp5zsn.js";import{As as H9,Bs as U9,ys as r4,zs as a4}from"./chunk-y33pm4g5.js";import{Hs as z9}from"./chunk-q9zsjgpf.js";import{$s as f0,Ms as r1,Ns as N1,Os as ZZ,Ps as S1,Rs as U1,Ss as GJ,Ts as zJ,Us as U2,Vs as J9,Ws as y9,Xs as g2,Ys as P8,Zs as R8,_s as O1,at as B2,et as JZ,ft as c9,st as XZ}from"./chunk-mnc5bj10.js";import{tt as n4,vt as s4,wt as o4,yt as R2}from"./chunk-n98anpe9.js";import{At as E7,Bt as y7,Ct as b7,Ft as S7,Gt as P7}from"./chunk-y70wabha.js";import{Lt as p9}from"./chunk-e7bh3mpf.js";import{Nt as mZ,Ot as dZ,Pt as lZ,Qt as cZ,Rt as pZ,Tt as $Z}from"./chunk-hestqebq.js";import{Ut as GZ,Vt as zZ,Wt as KZ,Xt as qZ,Yt as t4,Zt as e4}from"./chunk-qsq1eha8.js";import{eu as m5,fu as M0,hu as d5,iu as V7,ku as L7,ru as YZ,vu as iZ,xu as nZ}from"./chunk-3rf705aq.js";import{Nu as D0,Vu as h2,Yu as s8,_u as N0,cv as u2,dv as o8,fv as o0,gv as r8,nv as c3,ov as w6,qv as X0,rv as B0,sv as d0,tv as E9,uv as z2,vv as U0,wv as b9}from"./chunk-3ha78evt.js";import{xv as e0}from"./chunk-y9f2csr0.js";import{Av as QZ}from"./chunk-mvnjpwes.js";import{Bv as p3,Cv as Q2,Dv as QJ,Ev as o1,Iv as jJ,Jv as N3,Kv as w8,Mv as e7,Pv as z6}from"./chunk-8hqayvjh.js";import{Ew as e8,Gw as pz,Hw as R5,Kw as O2,dw as c$,gw as Y8,nw as b$}from"./chunk-kwz3tfdm.js";import{Pw as $7}from"./chunk-zn70s4gs.js";import{Rw as S2,Sw as l3,Tw as P2,Uw as q5}from"./chunk-8ph7mee2.js";import{Yw as x}from"./chunk-n0hrb3ek.js";import v1 from"path";import p2 from"fs";var wJ=new Set(["touchstart","touchmove","wheel","mousewheel"]);function J5($,Z){if(Z.passive)return!0;if(Z.prevent||Z.nonpassive)return!1;return wJ.has($.toLowerCase())}var _3=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"]),w3={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"},RJ=new Set(["ctrl","alt","shift","meta"]),M3={left:0,middle:1,right:2};function R3($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(X==="nonpassive")Z.nonpassive=!0;else if(RJ.has(X))Z.systemKeys.push(X);else if(X in M3)Z.mouse=X;else if(X in w3||/^[a-z]$/.test(X))Z.keys.push(w3[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function A3($,Z=""){let J=[],X=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[G,z,K]=Q,q=Q.index,W=q+G.length,H=`__stx_evt_${Z}${X++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=j.exec(K))!==null){let[,F,O]=B,_=F.split("."),L=_[0];if(!_3.has(L))continue;U.push({attribute:`@${F}`,event:L,handler:O,modifiers:R3(_.slice(1)),elementId:H})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=V.exec(K))!==null){let[,F,O]=B,_=F.split("."),L=_[0];if(!_3.has(L))continue;U.push({attribute:`@${F}`,event:L,handler:O,modifiers:R3(_.slice(1)),elementId:H})}if(U.length>0)J.push({originalTag:G,elementId:H,events:U,startIndex:q,endIndex:W})}return J}function DJ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=M3[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function NJ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function X5($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function MJ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=DJ($),Y=NJ(X5($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(J5($.event,Z))Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${J}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -108,11 +108,11 @@ else {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Event listeners
|
|
111
|
-
${$.map(
|
|
111
|
+
${$.map(MJ).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function
|
|
115
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
114
|
+
</script>`}function AJ($,Z=""){let J=A3($,Z);if(J.length===0)return{template:$,bindings:[]};let X=$,Y=[];for(let Q=J.length-1;Q>=0;Q--){let G=J[Q],z=G.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let K=z.match(/id=["']([^"']+)["']/);if(K)for(let q of G.events)q.elementId=K[1]}for(let K of G.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");z=z.replace(W,""),z=z.replace(H,"")}X=X.slice(0,G.startIndex)+z+X.slice(G.endIndex),Y.push(...G.events)}return{template:X,bindings:Y}}function D3($){let Z=$.$uid;return typeof Z==="string"&&Z?`${Z}_`:""}function I3($,Z,J){if(N3($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:K}=AJ($,D3(Z)),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...K],z}let X=A3($,D3(Z));if(X.length===0)return $;let Y=$;for(let z=X.length-1;z>=0;z--){let K=X[z],q=K.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let W=q.match(/id=["']([^"']+)["']/);if(W)for(let H of K.events)H.elementId=W[1]}for(let W of K.events){let H=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${H}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${H}\\s*=\\s*'[^']*'`,"g");q=q.replace(U,""),q=q.replace(j,"")}Y=Y.slice(0,K.startIndex)+q+Y.slice(K.endIndex)}let Q=Y5(X.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
115
|
+
`+Y.slice(G);else Y+=Q;return Y}function mq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function T3($,Z){let J=new Set;for(let X of $.split(",")){let Y=X.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))J.add(Y)}return J}function r2($,Z){let J=Q0($),{depths:X,balanced:Y}=q2(J),Q=(z)=>!Y||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let K=(z.index??0)+z[0].length-z[1].length;if(Q(K))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Q(z.index??0)&&T3(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&T3(z[1],!1).has(Z))return!0;return!1}import KJ from"fs";import g from"path";import{createHash as IJ}from"crypto";var a2="__stx_component_client_factories";function t2($){let Z=$[a2];return Z instanceof Map?Z:null}function E3($){$[a2]=new Map}function Q5($,Z){let J=t2($);if(!J)return null;let X=IJ("sha256").update(Z).digest("hex").slice(0,16),Y=J.get(X);if(Y)Y.instances++;else J.set(X,{body:Z,instances:1});return X}function y3($,Z){let J=t2(Z);if(!J?.size)return $;let X=new Map;for(let[W,H]of J)if(H.instances===1)X.set(W,H.body);let Y=[];if(X.size>0){let W=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),H=new RegExp(`window\\.__stxComponentFactories\\[(${W})\\]\\(("[^"]+")\\);`,"g"),U=H.exec($);while(U!==null){let j=X.get(JSON.parse(U[1]));if(j!==void 0)Y.push({start:U.index,end:U.index+U[0].length,replacement:`(${j})(${U[2]});`});U=H.exec($)}}let Q=[...J].filter(([,W])=>W.instances>1);if(Q.length===0)return k3($,Y);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
116
|
(function() {
|
|
117
117
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
118
118
|
${Q.map(([W,H])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${H.body}; }
|
|
@@ -120,8 +120,8 @@ ${Q.map(([W,H])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
|
|
|
120
120
|
`)}
|
|
121
121
|
})();
|
|
122
122
|
</script>`,K=$.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),q=K<0?0:K;return Y.push({start:q,end:q,replacement:`${z}
|
|
123
|
-
`}),k3($,Y)}function k3($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function b3($){let Z=t2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function C3($,Z){let J=t2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function S3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)Q5($,J)}q5();import f3 from"fs";var P3=0,e2=new Map;function iq(){P3=0,e2.clear()}function $9($,Z){let J=P3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return e2.set(X,{type:$,expression:Z}),X}function nq(){let $={};for(let[Z,J]of e2)$[Z]={type:J.type,expression:J.expression};return $}function sq($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=e2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function oq($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function rq($){return $.includes("<!--__STX_")}var IJ=/@(?=[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 TJ($){return Array.from({length:$},()=>"{").join("⁠")}function v3($){return $.replace(/\{{2,}/g,(Z)=>TJ(Z.length)).replace(/\{(?=!)/g,"{⁠").replace(IJ,"@")}var kJ=/^(?:javascript|vbscript|livescript|mocha|view-source):/,EJ=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,yJ=/^data:(?:text\/html|application\/xhtml\+xml)/,bJ=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function CJ($){return $.replace(bJ,"").toLowerCase()}function SJ($){let Z=$.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(Z))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(Z))return"fetched";return null}function x3($,Z="navigable"){let J=CJ($);if(kJ.test(J))return!0;return Z==="navigable"?EJ.test(J):yJ.test(J)}function W2($,Z="navigable"){return x3($,Z)?"unsafe:"+$:$}function PJ($){let Z=$.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!Z)return null;if(Z[3].trim()!=="")return null;return SJ(Z[1])}function G5($,Z,J=256){if(Z<=J)return $.slice(0,Z);let X=$.slice(Z-J,Z),Y=X.search(/[\s"'`/]/);return Y===-1?"":X.slice(Y)}function z5($,Z,J=Z){let X=PJ($);return X&&x3(Z,X)?"unsafe:"+J:J}var j2={},g3=new Map;function vJ($){let Z=g3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),g3.set($,Z)}return Z.lastIndex=0,Z}var X9={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return H5(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let K of Q){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([K,q])=>{z=z.replace(vJ(K),String(q))}),z},t:($,Z,J={})=>{return X9.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function xJ($,Z){if($ in X9)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);j2[$]=Z}function WW($){for(let[Z,J]of Object.entries($))xJ(Z,J)}function fJ(){return{...X9,...j2}}function HW(){for(let $ of Object.keys(j2))delete j2[$]}function gJ($,Z,J=2){let X=0,Y=null;for(let Q=Z+J;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="{"){X++;continue}if(G==="}"){if(X>0){X--;continue}let z=0;while($[Q+z]==="}")z++;if(z>=J)return Q}}return-1}function Z9($,Z,J=2){let X="{".repeat(J);if(!$.includes(X))return $;let Y="",Q=0;for(;;){let G=$.indexOf(X,Q);if(G===-1)break;let z=gJ($,G,J);if(z===-1)break;Y+=$.slice(Q,G)+Z($.slice(G,z+J),$.slice(G+J,z),G),Q=z+J}return Q===0?$:Y+$.slice(Q)}function W5($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function H5($){return v3(W5($))}function X1($,Z){let{scripts:J}=f0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(p3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function hJ($){let Z=[],J=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let X=J.exec($);X;X=J.exec($)){let Y=X[1].toLowerCase(),Q=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(X[3]);if(!Q)continue;let G=new Set([Q[1],...Q[2]?[Q[2]]:[]]),z=X.index+X[0].length;if(X[0].endsWith("/>")){Z.push({start:X.index,end:z,names:G});continue}let K=new RegExp(`<(/?)${Y}\\b[^>]*?(/?)>`,"gi");K.lastIndex=z;let q=1,W=$.length;for(let H=K.exec($);H;H=K.exec($)){if(H[2]==="/")continue;if(q+=H[1]==="/"?-1:1,q===0){W=H.index+H[0].length;break}}Z.push({start:X.index,end:W,names:G})}return Z}function uJ($,Z,J){let X=Q0(J);for(let Y of $){if(Z<Y.start||Z>=Y.end)continue;for(let Q of Y.names)if(new RegExp(`(?<![.#\\w$])${Q.replace(/\$/g,"\\$")}(?![\\w$])`).test(X))return!0}return!1}function h3($,Z){let J=["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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let q=0;q<X.length;q++){let W=X[q];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[q+1]==="{"){G++,q++,Y+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Y+=W;continue}continue}Y+=W}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=z.exec(X))!==null){let q=K[1];if(!X.substring(0,K.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function mJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=Q0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}var u3=new Set;function m3($){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test($.trim())}function d3($,Z){let J=`${Z??"<unknown>"}\x00${$}`;if(process.env.STX_DEBUG||!u3.has(J))u3.add(J),console.warn(`[stx] {{ ${$} }} in a <script> in ${Z??"<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 U5($,Z,J){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let G=S0(Q,Z);if(G===void 0)return m3(Q)?d3(Q.trim(),J):Y;return G===null?"":String(G)}catch{return Y}}),X=Z9(X,(Y,Q,G)=>{let z=Q.trim();if(/^__[A-Z_]+__$/.test(z))return Y;try{let K=S0(Q,Z);if(K===void 0)return m3(z)?d3(z,J):Y;return JSON.stringify(K).replace(/</g,"\\u003c")}catch{return Y}}),X}function dJ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=S0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=Z9(J,(X,Y,Q)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return X;try{let z=S0(Y,Z);if(z===void 0)return X;if(z===null)return"";let K=String(z);return z5(G5(J,Q),K,H5(K))}catch{return X}}),J}function UW($,Z,J={}){let{output:X,scripts:Y}=f0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!z||!K||q===-1)return G;let W=z[1],H=z[2];if(/\bdata-raw\b/.test(W))return G;if(J.skipServer&&/\bserver\b/.test(W))return G;let j=`<script${dJ(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+H+G.slice(q);return j+U5(H,Z)+G.slice(q)});return B2(X,Q)}function F1($,Z,J){let X=$,Y=(U,j)=>{let B=J9(U,j);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,B))?-1:B},Q=(U,j,B,V)=>{let F=B.length,{output:O,tokens:_}=O1(U,j,(L,w)=>V(F+w));return B.push(..._),O},G=[];X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let z=[];X=Q(X,U2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let K=Z?.__stx_signals_gate===!0||X1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),W=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=Z9(X,(U,j,B)=>{try{let V=S0(j,Z,!1,(F)=>K5(F,U,J,$));return V!==void 0&&V!==null?String(V):""}catch(V){let F=V instanceof Error?V.message:String(V);return O0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${F}`,J,$,B,U)}},3),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,B)=>{try{let V=S0(j,Z,!1,(F)=>K5(F,U,J,$));if(V===void 0&&Z.__stx_buildMode==="compile")return $9("raw",j.trim());return V!==void 0&&V!==null?String(V):""}catch(V){if(Z.__stx_buildMode==="compile")return $9("raw",j.trim());let F=V instanceof Error?V.message:String(V);return O0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${F}`,J,$,B,U)}}),X=Q(X,U2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let H=K?hJ(X):[];if(X=Z9(X,(U,j,B)=>{let V=j.trim();if(H.length>0&&uJ(H,B,V))return U;if(W.has(V))return U;let F=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=V.match(O)?.[1],w=L&&((L in Z)||F.includes(L)),R=Boolean(L&&q.has(L)),D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=V.match(D),T=N&&!F.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(V))return"";let M;try{let I=S0(j,Z,!1,(A)=>{M=A});if(R)return U;if(K&&!h3(V,Z))return U;if(M)K5(M,U,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(I===void 0||mJ(V,Z)))return $9("expr",V);if(I===void 0||I===null)return"";let k=String(I);return z5(G5(X,B),k,H5(k))}catch(I){if(R)return U;if(K&&!h3(V,Z))return U;if(T)return U;let k=I instanceof Error?I.message:String(I);return O0("Expression",`Error evaluating: {{ ${V} }}: ${k}`,J,$,B,U)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(U,j)=>z[Number(j)]??U);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(U,j)=>G[Number(j)]??U);return X}function lJ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=j2[G]||X9[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(fJ()).join(", ")}`);let K=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let W=q[1].trim();try{let H=Number(W);K=[Number.isNaN(H)?W:H]}catch{K=[W]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,W=1;while(q>0&&W<Y.length){if(Y[W]==="(")q++;if(Y[W]===")")q--;W++}if(q===0){let H=Y.substring(1,W-1).trim();if(H)try{if(H.startsWith("{")&&H.endsWith("}"))K=[S0(`(${H})`,J,!0)];else{let U=[],j="",B=null,V=0,F=0,O=0,_=!1;for(let L=0;L<H.length;L++){let w=H[L];if(_){j+=w,_=!1;continue}if(w==="\\"){j+=w,_=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&V===0&&F===0&&O===0){U.push(j),j="";continue}j+=w}if(j)U.push(j);K=U.map((L)=>{let w=L.trim();return S0(w,J,!0)})}}catch{K=[H]}Y=Y.substring(W).trim()}}try{X=z(X,J,...K)}catch(q){let W=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${W}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function cJ($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let K=$[z],q=$[z+1];if(Z&&G){G=!1;continue}if(Z&&K==="\\"){G=!0;continue}if(G=!1,(K==='"'||K==="'"||K==="`")&&!G){if(!Z)Z=!0,J=K;else if(K===J)Z=!1,J="";continue}if(Z&&J==="`"&&K==="$"&&q==="{"){let W=1;z+=2;while(z<$.length&&W>0){if($[z]==="{")W++;else if($[z]==="}")W--;if(W>0)z++}continue}if(Z)continue;if(K==="(")X++;else if(K===")")X--;else if(K==="[")Y++;else if(K==="]")Y--;else if(K==="{")Q++;else if(K==="}")Q--;if(K==="|"&&X===0&&Y===0&&Q===0){if(q==="|"){z++;continue}if(q==="="){z++;continue}return z}}return-1}var H2=new Set,pJ=1000;function jW(){H2.clear()}function K5($,Z,J,X){if(!l3())return;let Y=`${J}\x00${$.expression}`;if(H2.has(Y))return;if(H2.size>=pJ)H2.clear();H2.add(Y);let Q=J,G=X;try{if(J&&f3.existsSync(J))G=f3.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Q=`${J}:${G.slice(0,z).split(`
|
|
124
|
-
`).length}`;console.warn(`${Q}: stx warning: ${Z} rendered as an empty string. The safe evaluator rejected \`${$.expression}\` (${$.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function S0($,Z,J=!1,X){try{let Y=$.trim(),Q=
|
|
123
|
+
`}),k3($,Y)}function k3($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function b3($){let Z=t2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function C3($,Z){let J=t2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function S3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)Q5($,J)}q5();import f3 from"fs";var P3=0,e2=new Map;function nq(){P3=0,e2.clear()}function $9($,Z){let J=P3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return e2.set(X,{type:$,expression:Z}),X}function sq(){let $={};for(let[Z,J]of e2)$[Z]={type:J.type,expression:J.expression};return $}function oq($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=e2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function rq($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function aq($){return $.includes("<!--__STX_")}var TJ=/@(?=[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 kJ($){return Array.from({length:$},()=>"{").join("⁠")}function v3($){return $.replace(/\{{2,}/g,(Z)=>kJ(Z.length)).replace(/\{(?=!)/g,"{⁠").replace(TJ,"@")}var EJ=/^(?:javascript|vbscript|livescript|mocha|view-source):/,yJ=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,bJ=/^data:(?:text\/html|application\/xhtml\+xml)/,CJ=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function SJ($){return $.replace(CJ,"").toLowerCase()}function PJ($){let Z=$.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(Z))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(Z))return"fetched";return null}function x3($,Z="navigable"){let J=SJ($);if(EJ.test(J))return!0;return Z==="navigable"?yJ.test(J):bJ.test(J)}function W2($,Z="navigable"){return x3($,Z)?"unsafe:"+$:$}function vJ($){let Z=$.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!Z)return null;if(Z[3].trim()!=="")return null;return PJ(Z[1])}function G5($,Z,J=256){if(Z<=J)return $.slice(0,Z);let X=$.slice(Z-J,Z),Y=X.search(/[\s"'`/]/);return Y===-1?"":X.slice(Y)}function z5($,Z,J=Z){let X=vJ($);return X&&x3(Z,X)?"unsafe:"+J:J}var j2={},g3=new Map;function xJ($){let Z=g3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),g3.set($,Z)}return Z.lastIndex=0,Z}var X9={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return H5(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let K of Q){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([K,q])=>{z=z.replace(xJ(K),String(q))}),z},t:($,Z,J={})=>{return X9.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function fJ($,Z){if($ in X9)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);j2[$]=Z}function HW($){for(let[Z,J]of Object.entries($))fJ(Z,J)}function gJ(){return{...X9,...j2}}function UW(){for(let $ of Object.keys(j2))delete j2[$]}function hJ($,Z,J=2){let X=0,Y=null;for(let Q=Z+J;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="{"){X++;continue}if(G==="}"){if(X>0){X--;continue}let z=0;while($[Q+z]==="}")z++;if(z>=J)return Q}}return-1}function Z9($,Z,J=2){let X="{".repeat(J);if(!$.includes(X))return $;let Y="",Q=0;for(;;){let G=$.indexOf(X,Q);if(G===-1)break;let z=hJ($,G,J);if(z===-1)break;Y+=$.slice(Q,G)+Z($.slice(G,z+J),$.slice(G+J,z),G),Q=z+J}return Q===0?$:Y+$.slice(Q)}function W5($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function H5($){return v3(W5($))}function X1($,Z){let{scripts:J}=f0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(p3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function uJ($){let Z=[],J=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let X=J.exec($);X;X=J.exec($)){let Y=X[1].toLowerCase(),Q=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(X[3]);if(!Q)continue;let G=new Set([Q[1],...Q[2]?[Q[2]]:[]]),z=X.index+X[0].length;if(X[0].endsWith("/>")){Z.push({start:X.index,end:z,names:G});continue}let K=new RegExp(`<(/?)${Y}\\b[^>]*?(/?)>`,"gi");K.lastIndex=z;let q=1,W=$.length;for(let H=K.exec($);H;H=K.exec($)){if(H[2]==="/")continue;if(q+=H[1]==="/"?-1:1,q===0){W=H.index+H[0].length;break}}Z.push({start:X.index,end:W,names:G})}return Z}function mJ($,Z,J){let X=Q0(J);for(let Y of $){if(Z<Y.start||Z>=Y.end)continue;for(let Q of Y.names)if(new RegExp(`(?<![.#\\w$])${Q.replace(/\$/g,"\\$")}(?![\\w$])`).test(X))return!0}return!1}function h3($,Z){let J=["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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let q=0;q<X.length;q++){let W=X[q];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[q+1]==="{"){G++,q++,Y+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Y+=W;continue}continue}Y+=W}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=z.exec(X))!==null){let q=K[1];if(!X.substring(0,K.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function dJ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=Q0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}var u3=new Set;function m3($){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test($.trim())}function d3($,Z){let J=`${Z??"<unknown>"}\x00${$}`;if(process.env.STX_DEBUG||!u3.has(J))u3.add(J),console.warn(`[stx] {{ ${$} }} in a <script> in ${Z??"<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 U5($,Z,J){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let G=S0(Q,Z);if(G===void 0)return m3(Q)?d3(Q.trim(),J):Y;return G===null?"":String(G)}catch{return Y}}),X=Z9(X,(Y,Q,G)=>{let z=Q.trim();if(/^__[A-Z_]+__$/.test(z))return Y;try{let K=S0(Q,Z);if(K===void 0)return m3(z)?d3(z,J):Y;return JSON.stringify(K).replace(/</g,"\\u003c")}catch{return Y}}),X}function lJ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=S0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=Z9(J,(X,Y,Q)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return X;try{let z=S0(Y,Z);if(z===void 0)return X;if(z===null)return"";let K=String(z);return z5(G5(J,Q),K,H5(K))}catch{return X}}),J}function jW($,Z,J={}){let{output:X,scripts:Y}=f0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!z||!K||q===-1)return G;let W=z[1],H=z[2];if(/\bdata-raw\b/.test(W))return G;if(J.skipServer&&/\bserver\b/.test(W))return G;let j=`<script${lJ(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+H+G.slice(q);return j+U5(H,Z)+G.slice(q)});return B2(X,Q)}function F1($,Z,J){let X=$,Y=(U,j)=>{let B=J9(U,j);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,B))?-1:B},Q=(U,j,B,V)=>{let F=B.length,{output:O,tokens:_}=O1(U,j,(L,w)=>V(F+w));return B.push(..._),O},G=[];X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let z=[];X=Q(X,U2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let K=Z?.__stx_signals_gate===!0||X1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),W=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=Z9(X,(U,j,B)=>{try{let V=S0(j,Z,!1,(F)=>K5(F,U,J,$));return V!==void 0&&V!==null?String(V):""}catch(V){let F=V instanceof Error?V.message:String(V);return O0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${F}`,J,$,B,U)}},3),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,B)=>{try{let V=S0(j,Z,!1,(F)=>K5(F,U,J,$));if(V===void 0&&Z.__stx_buildMode==="compile")return $9("raw",j.trim());return V!==void 0&&V!==null?String(V):""}catch(V){if(Z.__stx_buildMode==="compile")return $9("raw",j.trim());let F=V instanceof Error?V.message:String(V);return O0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${F}`,J,$,B,U)}}),X=Q(X,U2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let H=K?uJ(X):[];if(X=Z9(X,(U,j,B)=>{let V=j.trim();if(H.length>0&&mJ(H,B,V))return U;if(W.has(V))return U;let F=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=V.match(O)?.[1],w=L&&((L in Z)||F.includes(L)),R=Boolean(L&&q.has(L)),D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=V.match(D),T=N&&!F.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(V))return"";let M;try{let I=S0(j,Z,!1,(A)=>{M=A});if(R)return U;if(K&&!h3(V,Z))return U;if(M)K5(M,U,J,$);if(Z.__stx_buildMode==="compile"&&!K&&(I===void 0||dJ(V,Z)))return $9("expr",V);if(I===void 0||I===null)return"";let k=String(I);return z5(G5(X,B),k,H5(k))}catch(I){if(R)return U;if(K&&!h3(V,Z))return U;if(T)return U;let k=I instanceof Error?I.message:String(I);return O0("Expression",`Error evaluating: {{ ${V} }}: ${k}`,J,$,B,U)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(U,j)=>z[Number(j)]??U);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(U,j)=>G[Number(j)]??U);return X}function cJ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=j2[G]||X9[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(gJ()).join(", ")}`);let K=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let W=q[1].trim();try{let H=Number(W);K=[Number.isNaN(H)?W:H]}catch{K=[W]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,W=1;while(q>0&&W<Y.length){if(Y[W]==="(")q++;if(Y[W]===")")q--;W++}if(q===0){let H=Y.substring(1,W-1).trim();if(H)try{if(H.startsWith("{")&&H.endsWith("}"))K=[S0(`(${H})`,J,!0)];else{let U=[],j="",B=null,V=0,F=0,O=0,_=!1;for(let L=0;L<H.length;L++){let w=H[L];if(_){j+=w,_=!1;continue}if(w==="\\"){j+=w,_=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&V===0&&F===0&&O===0){U.push(j),j="";continue}j+=w}if(j)U.push(j);K=U.map((L)=>{let w=L.trim();return S0(w,J,!0)})}}catch{K=[H]}Y=Y.substring(W).trim()}}try{X=z(X,J,...K)}catch(q){let W=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${W}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function pJ($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let K=$[z],q=$[z+1];if(Z&&G){G=!1;continue}if(Z&&K==="\\"){G=!0;continue}if(G=!1,(K==='"'||K==="'"||K==="`")&&!G){if(!Z)Z=!0,J=K;else if(K===J)Z=!1,J="";continue}if(Z&&J==="`"&&K==="$"&&q==="{"){let W=1;z+=2;while(z<$.length&&W>0){if($[z]==="{")W++;else if($[z]==="}")W--;if(W>0)z++}continue}if(Z)continue;if(K==="(")X++;else if(K===")")X--;else if(K==="[")Y++;else if(K==="]")Y--;else if(K==="{")Q++;else if(K==="}")Q--;if(K==="|"&&X===0&&Y===0&&Q===0){if(q==="|"){z++;continue}if(q==="="){z++;continue}return z}}return-1}var H2=new Set,iJ=1000;function BW(){H2.clear()}function K5($,Z,J,X){if(!l3())return;let Y=`${J}\x00${$.expression}`;if(H2.has(Y))return;if(H2.size>=iJ)H2.clear();H2.add(Y);let Q=J,G=X;try{if(J&&f3.existsSync(J))G=f3.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Q=`${J}:${G.slice(0,z).split(`
|
|
124
|
+
`).length}`;console.warn(`${Q}: stx warning: ${Z} rendered as an empty string. The safe evaluator rejected \`${$.expression}\` (${$.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function S0($,Z,J=!1,X){try{let Y=$.trim(),Q=pJ(Y);if(Q>0){let z=Y.substring(0,Q).trim(),K=Y.substring(Q+1).trim(),q=S0(z,Z,!0,X);return cJ(q,K,Z)}let G=c3(Y);if(G!==null){X?.({expression:Y,rule:G});return}try{let z=Object.keys(Z),K=Object.values(Z);return U0(Y,z)(...K)}catch{return X0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let G=Q[1],z=nJ(G,Object.keys(Z));if(z&&z!==G)Y.message=`${Y.message} \u2014 did you mean '${z}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function nJ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=sJ($,Y);if(J===null||Q<J.dist)J={key:Y,dist:Q}}if(!J)return null;let X=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/X<=0.35)return J.key;return null}function sJ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,X]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)Y[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let z=1;z<=J.length;z++){let K=J[z-1]===X[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+K)}for(let z=0;z<=J.length;z++)Y[z]=Q[z]}return Y[J.length]}function VW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import iz from"fs";import C0 from"path";var j5=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],i3=/<body\b([^>]*)>/gi;function n0($){let Z=0,J,X=j5.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)i3.lastIndex=Z,J=i3.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let K=0;K<j5.length;K++){let q=j5[K],W=X[K];if(W===void 0||W!==null&&W.index<Z)q.open.lastIndex=Z,W=q.open.exec($),X[K]=W;if(!W)continue;if(W.index<Y&&(Q===-1||W.index<Q))Q=W.index,G=q.close}if(Q===-1||!G)return{index:Y,tag:J[0],attrs:J[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function x1($,Z){let J=n0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var n3=/<style\b[^>]*>/iy,s3=/<\/style>/gi,o3=/<script\b[^>]*>/iy,r3=/<template(?=[\s>/])[^>]*>/iy,a3=/<\/template\s*>/iy;function V2($){let Z=0,J=0,X=-1;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y+4);Z=K===-1?$.length:K+3;continue}n3.lastIndex=Y;let Q=n3.exec($);if(Q){s3.lastIndex=Y+Q[0].length;let K=s3.exec($);Z=K===null?$.length:K.index+8;continue}r3.lastIndex=Y;let G=r3.exec($);if(G){if(J===0)X=Y;J++,Z=Y+G[0].length;continue}a3.lastIndex=Y;let z=a3.exec($);if(z){if(J>0)J--;Z=Y+z[0].length;continue}if(o3.lastIndex=Y,o3.test($))return J>0?X:Y;Z=Y+1}return-1}var t3=null;function oJ($){if(!t3)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return t3}function _W($){let Z=oJ("onUpdate");if(Z)Z.updateHooks.push($)}function e3(){return`
|
|
125
125
|
// STX Lifecycle Runtime
|
|
126
126
|
(function() {
|
|
127
127
|
if (typeof window === 'undefined') return;
|
|
@@ -469,7 +469,7 @@ else {
|
|
|
469
469
|
|
|
470
470
|
console.log('[stx] Lifecycle runtime initialized');
|
|
471
471
|
})();
|
|
472
|
-
`}function B5($){return Symbol($)}var
|
|
472
|
+
`}function B5($){return Symbol($)}var wW=B5("theme"),RW=B5("router"),DW=B5("i18n");import*as Z4 from"crypto";function $4($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function rJ(){return`stx-${Z4.randomBytes(4).toString("hex")}`}function aJ($){return/\$\w+\./.test($)}function tJ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(X,(Q,G,z,K)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],W=!1,H=z,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(U)];for(let F of j){let O=F[0],_=F[1],L=F[2];if(aJ(L)){W=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(q.push({attr:_,expr:R,fullMatch:O,originalAttr:_}),$4(R).forEach((N)=>J.add(N)),_==="text")H=H.replace(O,"");else if(_==="class")H=H.replace(O,'class=""');else if(_==="disabled"||_==="hidden")H=H.replace(O,"");else H=H.replace(O,`${_}=""`)}}}if(!W)return Q;let B=H.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=rJ(),H=` id="${V}"${H}`;for(let F of q)Z.push({elementId:V,attribute:F.attr,expression:F.expr,stores:$4(F.expr)});return`<${G}${H}${K}`}),{html:Y,bindings:Z,stores:J}}function eJ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
|
|
473
473
|
<script>
|
|
474
474
|
(function() {
|
|
475
475
|
'use strict';
|
|
@@ -627,10 +627,10 @@ else {
|
|
|
627
627
|
}
|
|
628
628
|
})();
|
|
629
629
|
</script>
|
|
630
|
-
`,X}function J4($){let{html:Z,bindings:J,stores:X}=
|
|
630
|
+
`,X}function J4($){let{html:Z,bindings:J,stores:X}=tJ($);if(J.length===0)return $;let Y=eJ(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function X4($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return $X(Z);case"google-analytics":return ZX(Z);case"plausible":return JX(Z);case"self-hosted":return XX(Z);case"custom":return YX(Z);default:return""}}function $X($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Y=[`data-site="${x0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${x0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
|
|
631
631
|
<!-- Fathom Analytics -->
|
|
632
632
|
<script src="${x0(J)}" ${Y.join(" ")}${X}></script>
|
|
633
|
-
`}function
|
|
633
|
+
`}function ZX($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=x0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
|
|
634
634
|
<!-- Google Analytics -->
|
|
635
635
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
|
|
636
636
|
<script>
|
|
@@ -640,10 +640,10 @@ else {
|
|
|
640
640
|
gtag('config', '${J}');
|
|
641
641
|
${X}
|
|
642
642
|
</script>
|
|
643
|
-
`}function
|
|
643
|
+
`}function JX($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${x0(Z.domain)}"`],Y=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
644
644
|
<!-- Plausible Analytics -->
|
|
645
645
|
<script defer data-domain="${x0(Z.domain)}" src="${x0(Y)}"></script>
|
|
646
|
-
`}function
|
|
646
|
+
`}function XX($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=x0(Z.siteId),X=x0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
647
647
|
d.addEventListener('click',function(e){
|
|
648
648
|
var a=e.target.closest('a');
|
|
649
649
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -676,7 +676,7 @@ else {
|
|
|
676
676
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
677
677
|
})();
|
|
678
678
|
</script>
|
|
679
|
-
`}function
|
|
679
|
+
`}function YX($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
680
680
|
<!-- Custom Analytics -->
|
|
681
681
|
<script>
|
|
682
682
|
${Z.inlineScript}
|
|
@@ -684,7 +684,7 @@ ${Z.inlineScript}
|
|
|
684
684
|
`;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${x0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))J.push(`${x0(Y)}="${x0(Q)}"`);return`
|
|
685
685
|
<!-- Custom Analytics -->
|
|
686
686
|
<script${J.length>0?` ${J.join(" ")}`:""} src="${x0(Z.scriptUrl)}" defer></script>
|
|
687
|
-
`}function Y4($,Z){let J=X4(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function x0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var
|
|
687
|
+
`}function Y4($,Z){let J=X4(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function x0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var AW={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return X4(Y)}};var QX={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 Q4($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...QX,...Z};return`
|
|
688
688
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
689
689
|
<script>
|
|
690
690
|
(function() {
|
|
@@ -1067,7 +1067,7 @@ else {
|
|
|
1067
1067
|
};
|
|
1068
1068
|
})();
|
|
1069
1069
|
</script>
|
|
1070
|
-
`}function G4($,Z){let J=Q4(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var z4={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=
|
|
1070
|
+
`}function G4($,Z){let J=Q4(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var z4={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=GX(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return Q4(Y)}};function GX($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Y,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class K4{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let J of this.sessions.values())if(J.page===$)Z.push(...J.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),J=new Map;for(let X of Z)if(X.depth!==void 0)J.set(X.depth,(J.get(X.depth)||0)+1);return Array.from(J.entries()).map(([X,Y])=>({depth:X,count:Y})).sort((X,Y)=>X.depth-Y.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Y=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Y.clicks++;else if(X.type==="move")Y.hovers++;Z.set(X.zone,Y)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of J){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);X[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of X)for(let G of Q)Y=Math.max(Y,G);return X.map((Q,G)=>Q.map((z,K)=>({x:K,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function TW(){return new K4}var zX;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(zX||={});var KX;((X)=>{X.In="in";X.Out="out";X.Both="both"})(KX||={});var qX;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(qX||={});var a0={duration:300,delay:0,ease:"ease",direction:"both"};function WX($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...a0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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);"}
|
|
1071
1071
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1072
1072
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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);"}
|
|
1073
1073
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1077,7 +1077,7 @@ else {
|
|
|
1077
1077
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1078
1078
|
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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);"}
|
|
1079
1079
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1080
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
1080
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function HX(){return`
|
|
1081
1081
|
<script data-stx-scoped data-stx-run="once">
|
|
1082
1082
|
// Motion preferences handling
|
|
1083
1083
|
(function() {
|
|
@@ -1105,7 +1105,7 @@ else {
|
|
|
1105
1105
|
});
|
|
1106
1106
|
})();
|
|
1107
1107
|
</script>
|
|
1108
|
-
`}function
|
|
1108
|
+
`}function UX($){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((J)=>J.test($))}function jX($=0.1,Z="0px"){return`
|
|
1109
1109
|
<script data-stx-scoped data-stx-run="always">
|
|
1110
1110
|
// Intersection Observer for scroll animations
|
|
1111
1111
|
(function() {
|
|
@@ -1148,7 +1148,7 @@ else {
|
|
|
1148
1148
|
}
|
|
1149
1149
|
})();
|
|
1150
1150
|
</script>
|
|
1151
|
-
`}function
|
|
1151
|
+
`}function BX(){return`
|
|
1152
1152
|
<style id="stx-animation-base">
|
|
1153
1153
|
:root {
|
|
1154
1154
|
--stx-transition-duration: 300ms;
|
|
@@ -1263,7 +1263,7 @@ else {
|
|
|
1263
1263
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1264
1264
|
}
|
|
1265
1265
|
</style>
|
|
1266
|
-
`}function
|
|
1266
|
+
`}function VX($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
|
|
1267
1267
|
<script data-stx-scoped data-stx-run="always">
|
|
1268
1268
|
// Animation Group: ${$}
|
|
1269
1269
|
(function() {
|
|
@@ -1300,21 +1300,21 @@ else {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
})();
|
|
1302
1302
|
</script>
|
|
1303
|
-
`}var V5={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||a0.duration:a0.duration,G=Z.length>2?Z[2]||a0.ease:a0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||a0.delay:a0.delay,K=Z.length>4?Z[4]||a0.direction:a0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=
|
|
1304
|
-
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},L5={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,K=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,H="stx-transition stx-observe stx-out";if(Y==="fade")H+=" stx-fade";else if(Y==="slide-up"||Y==="slide")H+=" stx-from-bottom";else if(Y==="slide-down")H+=" stx-from-top";else if(Y==="slide-left")H+=" stx-from-right";else if(Y==="slide-right")H+=" stx-from-left";else if(Y==="scale")H+=" stx-scale";else if(Y.includes("-"))H+=` stx-${Y}`;else H+=` stx-${Y}`;return`<div id="${q}" class="${H}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},O5={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,z=J.sequence||!0,K=
|
|
1305
|
-
${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},F5={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=
|
|
1306
|
-
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let K=
|
|
1307
|
-
`+Y.slice(q)}}return Y}var q4={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function
|
|
1303
|
+
`}var V5={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||a0.duration:a0.duration,G=Z.length>2?Z[2]||a0.ease:a0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||a0.delay:a0.delay,K=Z.length>4?Z[4]||a0.direction:a0.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=WX(Y,{duration:Q,delay:z,ease:G,direction:K}),H="stx-transition",U="";if(Y==="fade")U="stx-fade";else if(Y==="slide")U="stx-slide";else if(Y==="scale")U="stx-scale";else if(Y==="flip")U="stx-flip";else if(Y==="rotate")U="stx-rotate";return`<div id="${q}" class="${H} ${U} ${K==="out"?"stx-out":""}"
|
|
1304
|
+
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},L5={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,K=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,H="stx-transition stx-observe stx-out";if(Y==="fade")H+=" stx-fade";else if(Y==="slide-up"||Y==="slide")H+=" stx-from-bottom";else if(Y==="slide-down")H+=" stx-from-top";else if(Y==="slide-left")H+=" stx-from-right";else if(Y==="slide-right")H+=" stx-from-left";else if(Y==="scale")H+=" stx-scale";else if(Y.includes("-"))H+=` stx-${Y}`;else H+=` stx-${Y}`;return`<div id="${q}" class="${H}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},O5={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,z=J.sequence||!0,K=VX(Y,Q,{staggerDelay:G,sequence:z});return`${$}
|
|
1305
|
+
${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},F5={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=HX();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function W4($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!UX(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=BX();Y=Y.replace("</head>",`${z}
|
|
1306
|
+
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let K=jX(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+K+`
|
|
1307
|
+
`+Y.slice(q)}}return Y}var q4={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function LX($,Z){let J=Z.map((X)=>{let Y=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
|
|
1308
1308
|
`);return`@keyframes ${$} {
|
|
1309
1309
|
${J}
|
|
1310
|
-
}`}var
|
|
1310
|
+
}`}var OX={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",K=Z[4]?.replace(/['"`]/g,"")||"normal",q=Z[5]?.replace(/['"`]/g,"")||"forwards",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,H=`
|
|
1311
1311
|
animation-name: ${Y};
|
|
1312
1312
|
animation-duration: ${Q}ms;
|
|
1313
1313
|
animation-timing-function: ${G};
|
|
1314
1314
|
animation-iteration-count: ${z};
|
|
1315
1315
|
animation-direction: ${K};
|
|
1316
1316
|
animation-fill-mode: ${q};
|
|
1317
|
-
`.trim().replace(/\s+/g," ");return`<div id="${W}" style="${H}">${$}</div>`},description:"Applies a keyframe animation to an element"};function
|
|
1317
|
+
`.trim().replace(/\s+/g," ");return`<div id="${W}" style="${H}">${$}</div>`},description:"Applies a keyframe animation to an element"};function FX($,Z,J,X,Y){return`
|
|
1318
1318
|
<script data-stx-scoped data-stx-run="always">
|
|
1319
1319
|
(function() {
|
|
1320
1320
|
const container = document.getElementById('${$}');
|
|
@@ -1328,7 +1328,7 @@ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1328
1328
|
child.classList.add('${Y}');
|
|
1329
1329
|
});
|
|
1330
1330
|
})();
|
|
1331
|
-
</script>`}var
|
|
1331
|
+
</script>`}var _X={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",K=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,q="stx-stagger-item";if(z==="fade")q+=" stx-fade";else if(z==="slide")q+=" stx-from-bottom";else if(z==="scale")q+=" stx-scale";let W=FX(K,Y,G,Q,q);return`${`
|
|
1332
1332
|
<style>
|
|
1333
1333
|
#${K} .stx-stagger-item {
|
|
1334
1334
|
opacity: 0;
|
|
@@ -1338,12 +1338,12 @@ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1338
1338
|
from { opacity: 0; transform: translateY(10px); }
|
|
1339
1339
|
to { opacity: 1; transform: translateY(0); }
|
|
1340
1340
|
}
|
|
1341
|
-
</style>`}<div id="${K}" class="stx-stagger-container">${$}</div>${W}`},description:"Applies staggered animations to child elements"};function
|
|
1341
|
+
</style>`}<div id="${K}" class="stx-stagger-container">${$}</div>${W}`},description:"Applies staggered animations to child elements"};function wX($){let{stiffness:Z,damping:J}=$,X=J/(2*Math.sqrt(Z));if(X<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(X<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var RX={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(q4[Y])Q=q4[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,K=wX(Q),q=`
|
|
1342
1342
|
transition: all ${G}ms ${K};
|
|
1343
1343
|
--stx-spring-stiffness: ${Q.stiffness};
|
|
1344
1344
|
--stx-spring-damping: ${Q.damping};
|
|
1345
1345
|
--stx-spring-mass: ${Q.mass};
|
|
1346
|
-
`.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${q}">${$}</div>`},description:"Applies spring physics animations to an element"};function
|
|
1346
|
+
`.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${q}">${$}</div>`},description:"Applies spring physics animations to an element"};function EW($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
|
|
1347
1347
|
<script data-stx-scoped data-stx-run="always">
|
|
1348
1348
|
(function() {
|
|
1349
1349
|
const timeline = ${JSON.stringify($)};
|
|
@@ -1380,7 +1380,7 @@ else {
|
|
|
1380
1380
|
runTimeline();
|
|
1381
1381
|
}
|
|
1382
1382
|
})();
|
|
1383
|
-
</script>`}function
|
|
1383
|
+
</script>`}function yW($,Z,J){let X=LX($,Z),Y=`
|
|
1384
1384
|
.${$}-animation {
|
|
1385
1385
|
animation-name: ${$};
|
|
1386
1386
|
animation-duration: ${J.duration}ms;
|
|
@@ -1390,7 +1390,7 @@ else {
|
|
|
1390
1390
|
animation-direction: ${J.direction||"normal"};
|
|
1391
1391
|
animation-fill-mode: ${J.fill||"forwards"};
|
|
1392
1392
|
}`;return`${X}
|
|
1393
|
-
${Y}`}function
|
|
1393
|
+
${Y}`}function bW($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Y=Z[X];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(X===0)J.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else J.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))J.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))J.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))J.fill=Y;else J.easing=Y}return J}function CW(){return`
|
|
1394
1394
|
<script data-stx-scoped data-stx-run="once">
|
|
1395
1395
|
window.__stxAnimation = {
|
|
1396
1396
|
// Registry of animations
|
|
@@ -1462,7 +1462,7 @@ else {
|
|
|
1462
1462
|
);
|
|
1463
1463
|
}
|
|
1464
1464
|
};
|
|
1465
|
-
</script>`}function
|
|
1465
|
+
</script>`}function SW($){let Z=$.customDirectives||[];return Z.push(V5),Z.push(O5),Z.push(F5),Z.push(L5),Z.push(OX),Z.push(_X),Z.push(RX),{...$,customDirectives:Z}}function H4($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function U4($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var DX=100,NX=599,w5="__stxResponseStatus",L2="__stxResponseHeaders";function Y9($){return typeof $==="number"&&Number.isInteger($)&&$>=DX&&$<=NX}function fW($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let J=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!J)continue;let X=Number(J[1]);if(Y9(X))return X}return}function _5($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!Y9(J))return!1;return $[w5]=J,!0}function MX($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[L2]={...$[L2],[X]:String(J)}}function AX($){let Z=$?.[w5];return Y9(Z)?Z:void 0}function IX($){let Z=$?.[L2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Y])=>[X,String(Y)]);return J.length>0?Object.fromEntries(J):void 0}function gW($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=AX($);if(J!==void 0)Z[w5]=J;let X=IX($);if(X)Z[L2]={...Z[L2],...X}}function j4($){return{setResponseStatus:(Z)=>{_5($,Z)},notFound:(Z=404)=>{let J=Y9(Z)&&Z>=400?Z:404;_5($,J)},setResponseHeader:(Z,J)=>{MX($,Z,J)}}}function B4($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Y}=J,Q=Y==="compile",G="",z=0,K=/@status\s*\(/g,q;while((q=K.exec($))!==null){let W=TX($,q.index+q[0].length-1);if(W<0)break;let H=$.slice(q.index+q[0].length,W).trim(),U=/^\d+$/.test(H)?Number(H):X0(H,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${H})${j} 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(${H}) from <script server> instead \u2014 that runs per request.`);else if(!_5(Z,U))console.warn(`[stx] @status(${H})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,q.index),z=W+1+($.slice(W+1).match(/^[^\S\n]*\n?/)?.[0].length??0),K.lastIndex=z}return z===0?$:G+$.slice(z)}function TX($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}var kX=0,EX=0;function V4($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function yX($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Y,Q,G]=X,z=X.index,K=V4(G,"x-data");if(!K)continue;let q=`__stx_scope_${kX++}`,W=V4(G,"x-init"),H=bX($,Q,z+Y.length),U=$.slice(z,H.endIndex),j=CX(U);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:K,initExpr:W,bindings:[],refs:j})}return Z}function bX($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let K=Q.exec($),q=G.exec($),W=z.exec($);if(W&&W.index<(K?.index??1/0)){Y=W.index+W[0].length;continue}if(!q)return{endIndex:$.length};if(K&&K.index<q.index)X++,Y=K.index+K[0].length;else{if(X--,X===0)return{endIndex:q.index+q[0].length};Y=q.index+q[0].length}}return{endIndex:$.length}}function CX($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=X.exec(J))!==null){let[,Q,G]=Y,z=SX(Q);Z.set(G,z)}return Z}function SX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${EX++}`}function PX(){return`
|
|
1466
1466
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1467
1467
|
(function() {
|
|
1468
1468
|
var style = document.createElement('style');
|
|
@@ -1669,7 +1669,7 @@ window.__stx_reactive = (function() {
|
|
|
1669
1669
|
|
|
1670
1670
|
return { initScope: initScope, reactive: reactive };
|
|
1671
1671
|
})();
|
|
1672
|
-
`}function L4($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,K)=>{try{let q=S0(K,Z,!0);if(q===void 0)return z;return String(q)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let K=J.indexOf("}}",Y+2);if(K!==-1){let q=J.slice(Y,K+2);X+=G(J.slice(Y+2,K),q,Q),Y=K+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,K,q){let W;try{W=S0(z,Z,!0)}catch{return K}if(W===void 0)return K;if(q){let H=String(W).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?H.replace(/\$\{/g,"\\${"):H}if(typeof W==="string"){let H=W.trim();if(H.startsWith("{")&&H.endsWith("}")||H.startsWith("[")&&H.endsWith("]"))try{return JSON.parse(H),H}catch{}}return JSON.stringify(W)}}function
|
|
1672
|
+
`}function L4($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,K)=>{try{let q=S0(K,Z,!0);if(q===void 0)return z;return String(q)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let K=J.indexOf("}}",Y+2);if(K!==-1){let q=J.slice(Y,K+2);X+=G(J.slice(Y+2,K),q,Q),Y=K+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,K,q){let W;try{W=S0(z,Z,!0)}catch{return K}if(W===void 0)return K;if(q){let H=String(W).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?H.replace(/\$\{/g,"\\${"):H}if(typeof W==="string"){let H=W.trim();if(H.startsWith("{")&&H.endsWith("}")||H.startsWith("[")&&H.endsWith("]"))try{return JSON.parse(H),H}catch{}}return JSON.stringify(W)}}function vX($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=L4(X.stateExpr,Z),G=X.initExpr?L4(X.initExpr,Z):null,z=JSON.stringify(Q),K=G?JSON.stringify(G):"null";return`
|
|
1673
1673
|
(function() {
|
|
1674
1674
|
var scopeEl = document.querySelector('${X.selector}');
|
|
1675
1675
|
if (!scopeEl) return;
|
|
@@ -1678,10 +1678,10 @@ window.__stx_reactive = (function() {
|
|
|
1678
1678
|
})();`}).join(`
|
|
1679
1679
|
`);return`
|
|
1680
1680
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1681
|
-
${
|
|
1681
|
+
${PX()}
|
|
1682
1682
|
${J}
|
|
1683
|
-
</script>`}function O4($,Z,J){if(!
|
|
1684
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
1683
|
+
</script>`}function O4($,Z,J){if(!fX($))return $;let X=yX($);if(X.length===0)return $;let Y=xX($,X),Q=vX(X,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
1684
|
+
`+Y.slice(G);else Y+=Q;return Y}function xX($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[J++];if(!z)return Y;let K=/data-stx-scope="([^"]*)"/.exec(G);if(K)return z.id=K[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),X=X.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),X}function fX($){return/x-data\s*=\s*["']/.test($)}import AY from"fs";import g5 from"path";import{createHighlighter as IY}from"ts-syntax-highlighter";import j9 from"fs";import P0 from"path";import{loadConfigWithResult as FY}from"bunfig";O2();async function gX($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=R5();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var F4={name:"stxRouter",handler:gX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Y1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function _4($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function w4($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Y=$.slice(J[0].length),Q={};for(let G of X.split(`
|
|
1685
1685
|
`)){let z=G.trim();if(!z||z.startsWith("#"))continue;let K=z.indexOf(":");if(K===-1)continue;let q=z.slice(0,K).trim(),W=z.slice(K+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[q]=W}return{data:Q,content:Y.trim()}}function F2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(W,H,U)=>{let j=Q.length,B=H?` class="language-${Y1(H)}"`:"";return Q.push(`<pre><code${B}>${Y1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(W,H)=>`<code>${Y1(H)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,H,U)=>{return`<img src="${_4(U)?Y1(U):""}" alt="${Y1(H)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,H,U)=>{return`<a href="${_4(U)?Y1(U):""}">${H}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1686
1686
|
`),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),J)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,H,U)=>{let B=`<tr>${H.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${Y1(F)}</th>`).join("")}</tr>`,V=U.trim().split(`
|
|
1687
1687
|
`).map((F)=>{return`<tr>${F.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<td>${Y1(_)}</td>`).join("")}</tr>`}).join(`
|
|
@@ -1700,8 +1700,8 @@ ${V}
|
|
|
1700
1700
|
`)}</p>`);if(Y=z.join(`
|
|
1701
1701
|
`),X)Y=Y.replace(/\n/g,`<br />
|
|
1702
1702
|
`);for(let W=0;W<Q.length;W++)Y=Y.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function R4($,Z,J=""){let X=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,K=G[0].match(/@markdown\(([^)]*)\)/),q=K?K[1]:"",W=z+G[0].length,H=1,U=W,j=-1;while(H>0&&U<$.length){let F=$.indexOf("@markdown",U),O=$.indexOf("@endmarkdown",U);if(O===-1)break;if(F!==-1&&F<O&&F!==z){let _=$[F+9];if(_==="("||_===`
|
|
1703
|
-
`||_==="\r"||_===" "||_===void 0)H++;U=F+9}else{if(H--,H===0){j=O;break}U=O+12}}if(j===-1)continue;let B=$.slice(W,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:q,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:K,content:q,index:W}of Y)try{let H={};if(K)K.split(",").forEach((B)=>{let V=B.trim();if(V)H[V]=!0});let U={gfm:H.gfm??!0,breaks:H.breaks??!1},j=F2(q.trim(),U);X=X.split(z).join(j)}catch(H){let U=H instanceof Error?H.message:String(H),j=O0("Markdown Directive",`Error processing markdown: ${U}`,J,$,W,z);X=X.split(z).join(j)}return X}async function D4($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),F2($.trim(),Y)}var _1=[320,480,640,768,1024,1280,1536,1920,2560],N4=[1,1.5,2,3],f1=["avif","webp","jpeg"],M4={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},
|
|
1704
|
-
`)}function
|
|
1703
|
+
`||_==="\r"||_===" "||_===void 0)H++;U=F+9}else{if(H--,H===0){j=O;break}U=O+12}}if(j===-1)continue;let B=$.slice(W,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:q,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:K,content:q,index:W}of Y)try{let H={};if(K)K.split(",").forEach((B)=>{let V=B.trim();if(V)H[V]=!0});let U={gfm:H.gfm??!0,breaks:H.breaks??!1},j=F2(q.trim(),U);X=X.split(z).join(j)}catch(H){let U=H instanceof Error?H.message:String(H),j=O0("Markdown Directive",`Error processing markdown: ${U}`,J,$,W,z);X=X.split(z).join(j)}return X}async function D4($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),F2($.trim(),Y)}var _1=[320,480,640,768,1024,1280,1536,1920,2560],N4=[1,1.5,2,3],f1=["avif","webp","jpeg"],M4={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},hX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function _2($,Z=_1,J={},X){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Q1($,{...J,w:Y,fm:X})} ${Y}w`}).join(", ")}function aW($,Z=320,J=2560,X=0.08,Y={},Q){let G=uX(Z,J,X);return _2($,G,Y,Q)}function uX($,Z,J=0.08){let X=[],Y=$;while(Y<Z)X.push(Math.round(Y)),Y*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function D5($,Z,J=N4,X={},Y){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q1($,{...X,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function tW($,Z,J=N4,X=80,Y={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return J.sort((z,K)=>z-K).map((z)=>{let K=Math.round(Z*z),q=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${Q1($,{...Y,w:K,q,dpr:z,fm:Q})} ${z}x`}).join(", ")}function N5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return X.push(Z),X.join(", ")}function eW($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return X.push(Z),X.join(", ")}var $H={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Q1($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let X=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${X}`}function ZH($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function JH($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:z={}}=$,K=[];for(let q of Q){let W,H;if(Y!==void 0&&X)W=D5(Z,Y,X,z,q),H=X.map((U)=>({path:"",url:Q1(Z,{...z,w:Math.round(Y*U),fm:q}),width:Math.round(Y*U),height:0,format:q,size:0,dpr:U}));else{let U=J||_1;W=_2(Z,U,z,q),H=U.map((j)=>({path:"",url:Q1(Z,{...z,w:j,fm:q}),width:j,height:0,format:q,size:0}))}K.push({srcset:W,format:q,mimeType:M4[q],variants:H})}return K}function XH($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
|
|
1704
|
+
`)}function YH($,Z){if($.length===0)return;let J=[...$].sort((Y,Q)=>Y.width-Q.width),X=J.find((Y)=>Y.width>=Z);if(X)return X;return J[J.length-1]}function M5($){return M4[$]||"application/octet-stream"}function QH($){return hX[$]||$}function GH($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var mX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},A5=`
|
|
1705
1705
|
.stx-img-placeholder {
|
|
1706
1706
|
position: relative;
|
|
1707
1707
|
overflow: hidden;
|
|
@@ -1730,9 +1730,9 @@ ${V}
|
|
|
1730
1730
|
filter: blur(0);
|
|
1731
1731
|
transform: scale(1);
|
|
1732
1732
|
}
|
|
1733
|
-
`.trim();async function I5(){try{return await import("ts-images")}catch{return null}}async function A4($,Z={}){let J={...
|
|
1733
|
+
`.trim();async function I5(){try{return await import("ts-images")}catch{return null}}async function A4($,Z={}){let J={...mX,...Z},X=await I5();if(X)try{return await dX($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return I4($,J)}async function dX($,Z,J){let{generatePlaceholder:X,generateThumbHash:Y}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function I4($,Z){let J=Z.width||20,X=Z.height||J,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${X}" viewBox="0 0 ${J} ${X}"><rect fill="#e5e7eb" width="${J}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function KH($){let Z=await I5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await I4($,{strategy:"thumbhash",width:32,height:32})).dataURL}function qH($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,K=(z>>3&63)/63,q=(z>>9&63)/63,W=z>>15!==0,H=Math.max(3,W?G?5:7:G?5:7),U=Math.max(3,W?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),F=Math.max(0,Math.min(255,Math.round(J*255))),O=Math.max(0,Math.min(255,Math.round((J-X)*255))),_=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
1734
1734
|
<rect fill="rgb(${V},${F},${O})" width="32" height="32"/>
|
|
1735
|
-
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(_)}`}async function
|
|
1735
|
+
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(_)}`}async function WH($,Z=20,J=50){return A4($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function HH($){let Z=await I5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function UH($,Z=1,J=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}"><rect fill="${$}" width="${Z}" height="${J}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function T4($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
|
|
1736
1736
|
#${$} {
|
|
1737
1737
|
--stx-img-transition-duration: ${X}ms;
|
|
1738
1738
|
--stx-img-transition-easing: ${Y};
|
|
@@ -1749,8 +1749,8 @@ ${V}
|
|
|
1749
1749
|
#${$}.stx-img-loaded img {
|
|
1750
1750
|
opacity: 1;
|
|
1751
1751
|
}
|
|
1752
|
-
`.trim()}function
|
|
1753
|
-
`):void 0,script:$0}}async function
|
|
1752
|
+
`.trim()}function jH($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var g1=new Map;async function k4($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(g1.has(J))return g1.get(J);let X=await A4($,Z);return g1.set(J,X),X}function BH(){g1.clear()}function VH(){return{size:g1.size,keys:Array.from(g1.keys())}}async function lX(){try{return await import("./chunk-tegrvgyn.js")}catch($){if(!E4)console.warn("[stx-media] Image processor not available, some features disabled:",$),E4=!0;return null}}var E4=!1,T5=80,Q9="async",G9="lazy",y4=!1;async function w2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return sX(X,J)}if(J.processedResult?.processed)return y5($,J.processedResult,Z);if(J.responsiveVariants)return S4($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=_1,dpr:W,formats:H=f1,quality:U=T5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:F=!0,priority:O=!1,loading:_=O?"eager":G9,decoding:L=Q9,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,k=$.id,A=$.data||{},{isDev:E=!1,baseUrl:S=""}=Z;if(E&&!Z.optimize)return iX($);let b,y,P=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{b=await k4(Y,{strategy:B,...V}),y=T4(P,b,V)}catch{}let h=W!==void 0&&G!==void 0,p;if(h)p=pX($,P,b,Z);else p=await cX($,P,b,Z);let u;if(O){let Y0=H.includes("webp")?"webp":H[0],i=_2(Y,q,{...j,q:U},Y0),q0=typeof K==="object"?N5(K):K||"100vw";u=`<link rel="preload" as="image" imagesrcset="${i}" imagesizes="${q0}" />`}let o=[];if(!y4&&B!=="none")o.push(A5),y4=!0;if(y)o.push(y);let $0=F?C4(P):void 0;return{html:p,preloadLink:u,css:o.length>0?o.join(`
|
|
1753
|
+
`):void 0,script:$0}}async function cX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:K,widths:q=_1,formats:W=f1,quality:H=T5,params:U={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":G9,decoding:F=Q9,fetchpriority:O,objectFit:_,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,N=$.style,T=$.data||{},M=typeof K==="object"?N5(K):K||"100vw",I=[];for(let E of W){let S=_2(Y,q,{...U,q:H},E),b=M5(E);if(j&&!B)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let k=k5({src:Q1(Y,{...U,q:H}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:F,fetchpriority:B?"high":O,objectFit:_,objectPosition:L,crossorigin:w,referrerpolicy:R,className:b4(D,J),style:E5(N,_,L,J),lazy:j&&!B,data:T}),A;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;A=`<div id="${Z}" class="stx-img-placeholder" style="${E}">
|
|
1754
1754
|
<picture>
|
|
1755
1755
|
${I.join(`
|
|
1756
1756
|
`)}
|
|
@@ -1760,9 +1760,9 @@ ${I.join(`
|
|
|
1760
1760
|
${I.join(`
|
|
1761
1761
|
`)}
|
|
1762
1762
|
<img ${k} />
|
|
1763
|
-
</picture>`;return A}function
|
|
1763
|
+
</picture>`;return A}function pX($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:K=[1,2,3],quality:q=T5,params:W={},lazy:H=!0,priority:U=!1,loading:j=U?"eager":G9,decoding:B=Q9,fetchpriority:V,objectFit:F,objectPosition:O,crossorigin:_,referrerpolicy:L}=$,w=$.class,R=$.style,D=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=D5(Y,N,K,{...W,q}),M=k5({src:Q1(Y,{...W,w:N,q}),alt:Q,width:G,height:z,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":V,objectFit:F,objectPosition:O,crossorigin:_,referrerpolicy:L,className:b4(w,J),style:E5(R,F,O,J),lazy:H&&!U,data:D}),I=H&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
|
|
1764
1764
|
<img ${M} ${I} />
|
|
1765
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function
|
|
1765
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function iX($){let{src:Z,alt:J,width:X,height:Y,loading:Q=G9,decoding:G=Q9,fetchpriority:z,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:H,priority:U=!1}=$,j=$.class,B=$.style,V=$.id,F=$.data||{};return{html:`<img ${k5({src:Z,alt:J,width:X,height:Y,loading:U?"eager":Q,decoding:G,fetchpriority:U?"high":z,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:H,className:j,style:E5(B,K,q),id:V,data:F})} />`}}function k5($){let Z=[];if($.lazy)Z.push(`data-src="${m0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${m0($.src)}"`);if(Z.push(`alt="${m0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${m0($.className)}"`);if($.style)Z.push(`style="${m0($.style)}"`);if($.id)Z.push(`id="${m0($.id)}"`);if($.data)for(let[J,X]of Object.entries($.data))Z.push(`data-${J}="${m0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function b4($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function E5($,Z,J,X){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(J)Y.push(`object-position: ${J}`);if(X)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function m0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function C4($){return`
|
|
1766
1766
|
(function() {
|
|
1767
1767
|
const container = document.getElementById('${$}');
|
|
1768
1768
|
if (!container) return;
|
|
@@ -1799,7 +1799,7 @@ ${I.join(`
|
|
|
1799
1799
|
|
|
1800
1800
|
observer.observe(container);
|
|
1801
1801
|
})();
|
|
1802
|
-
`.trim()}function
|
|
1802
|
+
`.trim()}function nX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(J))!==null){let[,G,z,K,q,W]=Q,H=K??q??W??!0;if(G===":"&&typeof H==="string")try{X[z]=JSON.parse(H)}catch{X[z]=H}else switch(z){case"src":X.src=String(H);break;case"alt":X.alt=String(H);break;case"width":X.width=Number(H)||H;break;case"height":X.height=Number(H)||H;break;case"sizes":X.sizes=String(H);break;case"quality":X.quality=Number(H);break;case"placeholder":X.placeholder=H;break;case"lazy":X.lazy=H===!0||H==="true";break;case"priority":X.priority=H===!0||H==="true";break;case"class":X.class=String(H);break;case"style":X.style=String(H);break;case"id":X.id=String(H);break;case"loading":X.loading=H;break;case"decoding":X.decoding=H;break;case"fetchpriority":X.fetchpriority=H;break;case"objectFit":X.objectFit=H;break;case"objectPosition":X.objectPosition=String(H);break;case"crossorigin":X.crossorigin=H;break}}if(!X.src||!X.alt)return null;return X}async function _H($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Y=[],Q=[],G=$,z=[],K;while((K=J.exec($))!==null)z.push({match:K[0],index:K.index});for(let q=z.length-1;q>=0;q--){let{match:W}=z[q],H=nX(W);if(H){let U=await w2(H,Z);if(G=G.replace(W,U.html),U.preloadLink)X.push(U.preloadLink);if(U.css)Y.push(U.css);if(U.script)Q.push(U.script)}}return{html:G,preloadLinks:X,styles:Y,scripts:Q}}async function sX($,Z){let J=await lX();if(!J)return w2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,X);if(Q)return S4($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return y5($,Q,Z)}return w2({...$,process:!1},Z)}async function y5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:K,objectPosition:q,crossorigin:W,referrerpolicy:H}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},F=Z.variants||[],O=F.find((y)=>y.format==="jpeg")||F.find((y)=>y.format==="webp")||F[0],_=O?.url||$.src,L=F.filter((y)=>y.format===(O?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of F){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let R=[],D=["avif","webp","jpeg","png"];for(let y of D){let P=w.get(y);if(P&&P.length>0){let h=P.map((u)=>`${u.url} ${u.width}w`).join(", "),p=M5(y);if(G&&!z)R.push(` <source type="${p}" data-srcset="${h}" />`);else R.push(` <source type="${p}" srcset="${h}" />`)}}let N=[];if(G&&!z){if(N.push(`data-src="${m0(_)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)N.push(`data-srcset="${L}"`)}else if(N.push(`src="${m0(_)}"`),L)N.push(`srcset="${L}"`);N.push(`alt="${m0(X)}"`);let T=Y||Z.originalWidth,M=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!z)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),z)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(H)N.push(`referrerpolicy="${H}"`);let I=[];if(K)I.push(`object-fit: ${K}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)N.push(`style="${I.join("; ")}"`);let k=[];if(U)k.push(U);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!z)N.push("data-stx-lazy");for(let[y,P]of Object.entries(V))N.push(`data-${y}="${m0(P)}"`);let A;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;A=`<div id="${B}" class="stx-img-placeholder" style="${y}">
|
|
1803
1803
|
<picture>
|
|
1804
1804
|
${R.join(`
|
|
1805
1805
|
`)}
|
|
@@ -1810,10 +1810,10 @@ ${R.join(`
|
|
|
1810
1810
|
`)}
|
|
1811
1811
|
<img ${N.join(" ")} />
|
|
1812
1812
|
</picture>`;let E=[];if(Z.placeholder)E.push(A5);let S=G?C4(B):void 0,b;if(z&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:A,preloadLink:b,css:E.length>0?E.join(`
|
|
1813
|
-
`):void 0,script:S}}async function S4($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return y5($,X,J)}function
|
|
1813
|
+
`):void 0,script:S}}async function S4($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return y5($,X,J)}function oX(){return z9({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Y,alt:Q,options:G}=rX($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||_1,formats:G.formats||f1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},K=J.__isDev||!1,q=await w2(z,{isDev:K}),W=q.html;if(q.preloadLink)W=q.preloadLink+`
|
|
1814
1814
|
`+W;if(q.css)W+=`
|
|
1815
1815
|
<style>${q.css}</style>`;if(q.script)W+=`
|
|
1816
|
-
<script>${q.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
1816
|
+
<script>${q.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function rX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=aX(X),Q=b5(Y[0],J)||"",G=b5(Y[1],J)||"",z={};if(Y[2]){let K=b5(Y[2],J);if(typeof K==="object"&&K!==null)z=K;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function aX($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function b5($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var P4=oX();async function x4(){try{return await import("./chunk-tr02vys6.js")}catch($){if(!v4)console.warn("[stx-media] Video processor not available, some features disabled:",$),v4=!0;return null}}var v4=!1,f4=!0,g4="metadata",tX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function K9($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return XY(X,J)}if(J.processedResult?.processed)return u4($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await YY(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:K,controls:q=f4,autoplay:W=!1,muted:H=!1,loop:U=!1,preload:j=g4,playsinline:B=!0,lazy:V=!0,player:F="native",type:O,width:_,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,N=Y||z,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return $Y($,Z);if(O&&O!=="video")return eX(Q||"",O,$);let k=G.length>0?G:Q?[{src:Q,type:h4(Q)}]:[],A=[`id="${I}"`];if(q)A.push("controls");if(W)A.push("autoplay");if(H)A.push("muted");if(U)A.push("loop");if(B)A.push("playsinline");if(R)A.push("disablepictureinpicture");if(D)A.push("disableremoteplayback");if(w)A.push(`crossorigin="${w}"`);if(V){if(A.push(`data-preload="${j}"`),A.push('preload="none"'),N)A.push(`data-poster="${k0(N)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${j}"`),N)A.push(`poster="${k0(N)}"`);if(_)A.push(`width="${_}"`);if(L)A.push(`height="${L}"`);if(T)A.push(`class="${k0(T)}"`);if(M)A.push(`style="${k0(M)}"`);let E=k.map((y)=>{return` <source ${V?`data-src="${k0(y.src)}"`:`src="${k0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
|
|
1817
1817
|
`),S=`<video ${A.join(" ")}>
|
|
1818
1818
|
${E}
|
|
1819
1819
|
Your browser does not support the video tag.
|
|
@@ -1852,9 +1852,9 @@ ${E}
|
|
|
1852
1852
|
|
|
1853
1853
|
observer.observe(video);
|
|
1854
1854
|
})();
|
|
1855
|
-
`.trim();return{html:S,script:b}}function
|
|
1855
|
+
`.trim();return{html:S,script:b}}function eX($,Z,J){let{width:X=640,height:Y=360}=J,Q=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,q=null;switch(Z){case"youtube":q=ZY($),K=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=JY($),K=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",K=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=$}let W=[`id="${z}"`,`src="${k0(K)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${k0(Q)}"`);if(G)W.push(`style="${k0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1856
1856
|
<iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1857
|
-
</div>`}}function
|
|
1857
|
+
</div>`}}function $Y($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:K=!1,preload:q="metadata",playsinline:W=!0,lazy:H=!0,width:U,height:j}=$,B=$.class,V=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:X.length>0?X:J,autoplay:G,loop:K,muted:z,playsinline:W,preload:q,poster:Y,controls:Q,title:$.title},_=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",V||""].filter(Boolean).join("; "),L=`
|
|
1858
1858
|
<div
|
|
1859
1859
|
id="${F}"
|
|
1860
1860
|
class="ts-video-player${B?" "+k0(B):""}"
|
|
@@ -1891,7 +1891,7 @@ ${E}
|
|
|
1891
1891
|
|
|
1892
1892
|
// Load ts-video-player from CDN
|
|
1893
1893
|
var script = document.createElement('script');
|
|
1894
|
-
script.src = '${
|
|
1894
|
+
script.src = '${tX}';
|
|
1895
1895
|
script.onload = initPlayer;
|
|
1896
1896
|
script.onerror = function() {
|
|
1897
1897
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -2021,7 +2021,7 @@ else {
|
|
|
2021
2021
|
.ts-video-player__play-button svg {
|
|
2022
2022
|
margin-left: 4px;
|
|
2023
2023
|
}
|
|
2024
|
-
`.trim();return{html:L,script:w,css:R}}function h4($){switch($.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
|
|
2024
|
+
`.trim();return{html:L,script:w,css:R}}function h4($){switch($.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 ZY($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let X=$.match(J);if(X)return X[1]}return null}function JY($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function k0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function AH($,Z,J){if(Z.src)return{src:String(Z.src),...Z};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=X.indexOf(",");if(Y===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Q=X.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function XY($,Z){let J=await x4();if(!J)return K9({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return u4($,Y,Z);return K9({...$,process:!1},Z)}async function YY($,Z){let J=await x4();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Y.outputDir,Y.baseUrl||"/videos"))?.url}function u4($,Z,J){let{controls:X=f4,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=g4,playsinline:K=!0,lazy:q=!0,width:W,height:H,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,F=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,_=$.src,L=h4(_);if(Z.transcoded)_=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)_=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)_=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${O}"`];if(X)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(K)D.push("playsinline");if(j)D.push("disablepictureinpicture");if(B)D.push("disableremoteplayback");if(U)D.push(`crossorigin="${U}"`);if(q){if(D.push(`data-preload="${z}"`),D.push('preload="none"'),R)D.push(`data-poster="${k0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${z}"`),R)D.push(`poster="${k0(R)}"`);let N=W||Z.metadata?.width,T=H||Z.metadata?.height;if(N)D.push(`width="${N}"`);if(T)D.push(`height="${T}"`);if(V)D.push(`class="${k0(V)}"`);if(F)D.push(`style="${k0(F)}"`);let I=` <source ${q?`data-src="${k0(_)}"`:`src="${k0(_)}"`} type="${L}" />`,k=`<video ${D.join(" ")}>
|
|
2025
2025
|
${I}
|
|
2026
2026
|
Your browser does not support the video tag.
|
|
2027
2027
|
</video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${k0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
@@ -2070,9 +2070,9 @@ ${k}
|
|
|
2070
2070
|
width: 100%;
|
|
2071
2071
|
height: auto;
|
|
2072
2072
|
}
|
|
2073
|
-
`.trim();return{html:k,script:A,css:E}}function m4(){return z9({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=
|
|
2073
|
+
`.trim();return{html:k,script:A,css:E}}function m4(){return z9({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=QY($,Z,J);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},K={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},q=await K9(G,K),W=q.html;if(q.css)W+=`
|
|
2074
2074
|
<style>${q.css}</style>`;if(q.script)W+=`
|
|
2075
|
-
<script>${q.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
2075
|
+
<script>${q.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function QY($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=GY(X),Q=d4(Y[0],J)||"",G={};if(Y[1]){let z=d4(Y[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function GY($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],q=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&q!=="\\"){if(!X)X=!0,Y=K;else if(K===Y)X=!1,Y="";else J+=K;continue}if(!X){if(K==="{")Q++;if(K==="}")Q--;if(K==="[")G++;if(K==="]")G--;if(K===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=K}if(J.trim())Z.push(J.trim());return Z}function d4($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var C5=m4();import zY from"fs";import g0 from"path";async function vH($,Z){if(!$.webComponents?.enabled)return[];let J=$.webComponents.components||[],X=[];if(J.length>0){if($.debug)console.log(`Building ${J.length} web components...`);for(let Y of J)try{let Q=await KY(Y,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return X}async function KY($,Z,J){let{name:X,file:Y,tag:Q,extends:G}=$;if(!X||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(g0.isAbsolute(Y)&&await e(Y))z=Y;else if(Z.componentsDir){let V=g0.join(Z.componentsDir,Y);if(await e(V))z=V}if(!z)z=await q9(Y,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let K=await Bun.file(z).text();J.add(z);let W=($.outputFormat||"js")==="ts",H=W?WY({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):qY({name:X,tag:Q,baseElement:G,source:K,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),U=Z.webComponents?.outputDir||"dist/web-components";await zY.promises.mkdir(U,{recursive:!0});let j=W?"ts":"js",B=g0.join(U,`${Q}.${j}`);if(await Bun.write(B,H),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function qY($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[]}=$,q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)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 W="";if(z)W=`<link rel="stylesheet" href="${z}">`;return`/**
|
|
2076
2076
|
* ${Z} Web Component
|
|
2077
2077
|
* Auto-generated from stx component
|
|
2078
2078
|
*/
|
|
@@ -2164,7 +2164,7 @@ class ${Z.replace(/\W/g,"")} extends ${X} {
|
|
|
2164
2164
|
|
|
2165
2165
|
// Register the web component
|
|
2166
2166
|
customElements.define('${J}', ${Z.replace(/\W/g,"")})
|
|
2167
|
-
`}function
|
|
2167
|
+
`}function WY($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:K=[],attributeTypes:q={}}=$,W=Z.replace(/\W/g,""),H=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)H=H.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),H=H.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),H=H.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),H=H.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");H=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let U=z?`<link rel="stylesheet" href="${z}">`:"",j=(R)=>{switch(q[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(R)=>R.replace(/-([a-z])/g,(D,N)=>N.toUpperCase()),V=K.map((R)=>` private _${B(R)}: ${j(R)} | null = null;`).join(`
|
|
2168
2168
|
`),F=K.map((R)=>{let D=j(R),N=B(R);return`
|
|
2169
2169
|
get ${N}(): ${D} | null {
|
|
2170
2170
|
return this._${N};
|
|
@@ -2319,9 +2319,9 @@ declare global {
|
|
|
2319
2319
|
|
|
2320
2320
|
// Register the web component
|
|
2321
2321
|
customElements.define('${J}', ${W});
|
|
2322
|
-
`}var S5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function P5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function
|
|
2322
|
+
`}var S5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function P5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function HY($,Z,J={}){let X={...S5,...J},Y=P5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return jY($,X.prefix||Z,X.preserveOriginal);case"attribute":return UY($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return BY($,Z,X.preserveOriginal);default:return $}}function UY($,Z,J,X){let Y=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${Y}`:`${G}${Y}`}${z}`})}function jY($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Y)=>{if(Y.startsWith(Z))return X;let Q=`${Z}__${Y}`;return J?`.${Q}`:`.${Q}`})}function BY($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return Y}let G=`${X}__${Q}`;return J?`.${G}`:`.${G}`})}function VY($,Z,J={}){let X={...S5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=P5(Z),G=`${X.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,K,q)=>{if(/^(?:script|style|!--)$/i.test(K))return z;let W=q.trimEnd().endsWith("/"),H=W?q.slice(0,-1):q;return`<${K}${H} ${G}${W?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Y=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((K)=>{if(!K)return K;if(K.startsWith(Y))return K;return`${Y}__${K}`}).join(" ")}"`})}return $}function xH($,Z={}){let J={...S5,...Z},X=P5($);return`${J.attributeName||"data-v"}-${X}`}function fH($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,K)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${HY(K,Z,J)}
|
|
2323
2323
|
`;else X+=`${K}
|
|
2324
|
-
`;return""});return{html:
|
|
2324
|
+
`;return""});return{html:VY(Y,Z,J),css:X.trim()}}function h1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function gH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:W={},state:H={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||h1(T)),V=j.map((T)=>{let M=z[T],I=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
|
|
2325
2325
|
`),F=j.map((T)=>{let M=z[T],I=M.attribute!==!1?M.attribute||h1(T):null,k=M.reflect&&I?`
|
|
2326
2326
|
if (value !== null && value !== undefined) {
|
|
2327
2327
|
${M.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
|
|
@@ -2523,7 +2523,7 @@ customElements.define('${J}', ${U});
|
|
|
2523
2523
|
// Export for module usage
|
|
2524
2524
|
export { ${U} };
|
|
2525
2525
|
export default ${U};
|
|
2526
|
-
`}function
|
|
2526
|
+
`}function hH($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:K={},events:q={},methods:W={},state:H={}}=$,U=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((M)=>z[M].attribute!==!1).map((M)=>z[M].attribute||h1(M)),V=(M)=>{switch(M){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},F=j.length>0?`
|
|
2527
2527
|
/**
|
|
2528
2528
|
* Props interface for ${Z}
|
|
2529
2529
|
*/
|
|
@@ -2775,7 +2775,7 @@ declare global {
|
|
|
2775
2775
|
customElements.define('${J}', ${U});
|
|
2776
2776
|
|
|
2777
2777
|
export default ${U};
|
|
2778
|
-
`}function
|
|
2778
|
+
`}function uH(){return`/**
|
|
2779
2779
|
* ReactiveElement Mixin
|
|
2780
2780
|
* Adds reactive properties and lifecycle management to web components
|
|
2781
2781
|
*/
|
|
@@ -2897,7 +2897,7 @@ else {
|
|
|
2897
2897
|
|
|
2898
2898
|
export { ReactiveElement };
|
|
2899
2899
|
export default ReactiveElement;
|
|
2900
|
-
`}function
|
|
2900
|
+
`}function mH(){return`/**
|
|
2901
2901
|
* stx Reactive Web Components Runtime
|
|
2902
2902
|
* Provides base classes and utilities for reactive web components
|
|
2903
2903
|
*/
|
|
@@ -3114,7 +3114,7 @@ else {
|
|
|
3114
3114
|
};
|
|
3115
3115
|
|
|
3116
3116
|
})(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
|
|
3117
|
-
`}function
|
|
3117
|
+
`}function LY($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let H=X.match(/export\s+default\s+({[\s\S]*})/);if(H)try{let U=H[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let V=U.match(/shadowDOM\s*:\s*(true|false)/);if(V)G=V[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=z?z[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=q?q[1].trim():"";return{tag:Y,props:Q,template:K,styles:W,script:X,shadowDOM:G}}function OY($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((H)=>H.charAt(0).toUpperCase()+H.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((H)=>`'${H}'`).join(", "),W=J.map((H)=>`
|
|
3118
3118
|
get ${H}() {
|
|
3119
3119
|
return this.getAttribute('${H}') || '';
|
|
3120
3120
|
}
|
|
@@ -3165,12 +3165,12 @@ ${W}
|
|
|
3165
3165
|
}
|
|
3166
3166
|
|
|
3167
3167
|
customElements.define('${Z}', ${G});
|
|
3168
|
-
`}async function l4($,Z,J,X){if(Z.length<1)return N0("WebComponent","@webcomponent directive requires at least the tag name parameter",D0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)]:[g0.join(g0.dirname(X),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)],K=null;for(let H of z)if(await e(H)){K=await Bun.file(H).text();break}if(!K)return N0("WebComponent",`Component file not found: ${Y}.stx`,D0.FILE_NOT_FOUND);let q=
|
|
3169
|
-
${
|
|
3170
|
-
</script>`}var v5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:n4,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:D4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:l4,hasEndTag:!1,description:"Include a web component in the template"},p4,i4,t4,e4,V5,O5,F5,L5,F4,z4,P4,C5,...$7],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 FY($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=P0.join(Y,"resources","views"),G=P0.join(Y,"resources","layouts");if(j9.existsSync(Q)&&j9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=P0.join(Y,"resources","views","pages");if(j9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var c4=new Set,B9=["partialsDir","componentsDir","layoutsDir"],x5=new WeakMap;function _Y($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function wY($,Z){let J=!$.root,X=FY($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!c4.has(Y))c4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!x5.has($)){let Y={};for(let Q of B9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}x5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of B9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(P0.isAbsolute(G)||_Y(G,Y))continue;$[Q]=P0.join(Y,G)}}for(let Y of B9){let Q=$[Y];if(typeof Q!=="string"||!Q||P0.isAbsolute(Q))continue;$[Y]=P0.resolve(Z,Q)}return $}function RY($,Z){let J=x5.get($);for(let X of B9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=P0.isAbsolute(Y)?Y:P0.join(Z,Y);if(j9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function DY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function NY($){if(s4($.stateDir),$.stateDir=o4(),$.cachePath=R2($.cachePath),$.build)$.build.cacheDir=R2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=R2($.media.cache.directory);if($.story)$.story.outDir=R2($.story.outDir)}var G1=null,w1=new Map,W9=new Map,D2=null;async function f5($){let Z=$?P0.resolve($):process.cwd(),J=W9.get(Z);if(J&&J.signature!==H9(J.graph)){let Q=w1.get(Z);if(w1.delete(Z),W9.delete(Z),!$)G1=null,D2=null;let{clearComponentCache:G}=await import("./chunk-rgnykws0.js"),{partialsCache:z}=await import("./chunk-axr54zr9.js");if(G(),z.clear(),Q&&J.configSignature===U9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await a4(W,Z),W9.set(Z,{graph:W,signature:H9(W),configSignature:U9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return w1.set(Z,K),K}}if(!$){if(G1)return G1;if(D2)return D2}let X=w1.get(Z);if(X)return X;let Y=(async()=>{let G=(await OY({name:"stx",alias:"ui",cwd:Z,defaultConfig:v5,verbose:!1})).config;if(G.extends!==void 0||J){let W=await r4(Z,v5);G=W.config,W9.set(Z,{graph:W.graph,signature:H9(W.graph),configSignature:U9(W.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:W}=await import("./chunk-da5jnb8w.js");W(G.runtimeConfig,{});let{generateRuntimeConfigTypes:H}=await import("./chunk-ffmqdmsg.js");await H(Z,G.runtimeConfig)}DY(G),NY(G),wY(G,Z),RY(G,Z);let z=[],K=new Set((G.plugins??[]).map((W)=>typeof W==="string"?W:W[0]));for(let W of G.componentPackages??["@stacksjs/components"]){let H=`${W}/stx-plugin`;if(K.has(H)||K.has(W))continue;try{x.resolve(H,{paths:[Z]}),z.push(H)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:W}=await import("./chunk-5yxs9aa6.js"),H=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=P0.dirname(L)}catch{let L=P0.resolve(Z,B);F=await import(L),O=P0.dirname(L)}let _=F.default||F;if(!W.has(_.name))await W.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)H.push(P0.resolve(O,w))}if(_.pages){let L=P0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,R)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=R},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=H,G._pluginPageDirs=U}return G})();if(w1.set(Z,Y),Y.catch(()=>{if(w1.get(Z)===Y)w1.delete(Z)}),!$)D2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var Z7=new Proxy(v5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!D2)f5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function XU($){return $}function YU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var h5=new Map;async function IY($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await MY.promises.stat($)).mtime.getTime();if(Z.cache&&h5.has($)){let H=h5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=w4(Y),z=Z.markdown||Z7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=F2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await TY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)h5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var V9=null;async function TY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!V9)try{V9=await AY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!V9.getSupportedLanguages().includes(U))return z;return(await V9.highlight(H,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function J7($,Z,J="",X={}){return await kY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!g5.isAbsolute(z))W=g5.resolve(g5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);H[R]=D}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await IY(W,X),B={...Z,...j,...H},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return O0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function kY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=EY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function EY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function yY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function R1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function X7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",H=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(yY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}W="elseif",H=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function N2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=X7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function L9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=R1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function u5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function CY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=SY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function SY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function PY($){let Z=d5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=vY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function vY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=G7(G);return{name:X,args:z}}function G7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function xY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function fY($){let Z=[],X=new m5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=Y7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=Q7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=Y7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=Q7(X,U+1)}}}else Y++}return Z}function Y7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function Q7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function gY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=u5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&B0(H.value))U=U0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=X0(H.value,Z);if(K===U){q=H.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=N0("Switch",`Error evaluating @switch expression: ${q}`,D0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function hY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function uY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=hY($);return uY(mY(X,Z,J),Y)}function mY($,Z,J){let X=$;X=gY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,W=R1(X,"unless","endunless",q);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let H=X.slice(q,W),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),F=H.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=c5(X,Z,J),X=p5(X,Z,J),X=l5(X,Z);let Y=()=>{let Q=N2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=N0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,D0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=N0("If",`Error processing @if block: ${U}`,D0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function z7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function l5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)H++,U=O+V[0].length;else if(_<1/0){if(H--,H===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+5),j=z7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+6),j=z7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${K}(?![a-z])`,"g"),D=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(O))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(O))!==null)T.push({pos:M.index,type:"close"});while((M=D.exec(O))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(O))!==null)T.push({pos:M.index,type:"else"});T.sort((b,y)=>b.pos-y.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)_.push(b)}let I=[],k=0;for(let b=0;b<_.length;b++){let y=_[b];if(I.push({content:O.slice(k,y.pos),ability:void 0}),y.type==="elseDirective"){let P=O.slice(y.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(k,y.pos)},k=y.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[b+1],u=p?p.pos:O.length;I.push({content:O.slice(k,u),ability:h.ability,type:h.type,id:h.id}),k=u}}else k=y.pos+5}if(k<O.length){let b=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,S="";if(E)S=I[0]?.content||"";else{let b=!1;for(let y=1;y<I.length;y++){let P=I[y];if(P.isFinalElse){S=P.content,b=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){S=P.content,b=!0;break}}}if(!b&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)S=y.content}}J=J.substring(0,U)+S+J.substring(F+`@${K}`.length),W=!0}}return J}function c5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=R1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=K(_.trim()),N;if(L!==-1){let T=O.slice(0,L),M=O.slice(L+5);N=D?T:M}else N=D?O:"";Q=Q.substring(0,j)+N+Q.substring(F+`@${z}`.length),W=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=N0(q,`Error processing @${G} directive: ${N}`,D0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function p5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,R=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),S=A?A.index:1/0,b=E?E.index:1/0;if(S<b)L++,w=S+A[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+E[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let D=B.substring(_,R),N=-1,T=0,M=0;while(M<D.length){let A=D.indexOf("@",M);if(A===-1)break;let E=D.substring(A);if(U.test(E)){T++,M=A+1;continue}if(j.test(E)){T--,M=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){N=A;break}M=A+1}let I;if(N!==-1){let A=D.slice(0,N),E=D.slice(N+5);I=q?A:E}else I=q?D:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var i5=new WeakMap;function K7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function D1($,Z){if(!$)return Z?.nonceGenerator?.()??K7();let J=i5.get($);if(!J)J=Z?.nonceGenerator?.()??K7(),i5.set($,J);return J}function yU($){i5.delete($)}function q7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function s5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${q7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var dY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},n5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},lY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},cY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function bU($){return{enabled:!0,directives:{strict:dY,moderate:n5,relaxed:lY,api:cY}[$]||n5,useNonce:$==="strict",addMetaTag:!0}}function CU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function W7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?D1(J,Z):void 0,Y=s5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3171
|
-
${Y}`)}function H7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function U7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(Z,Q):void 0;return s5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return D1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=D1(Z,Q);return Y}var pY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(J,Q):void 0;return s5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},iY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return D1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function SU(){return[pY,iY]}function PU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function nY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function vU($,Z){if(!$.enabled)return{};let J=$.useNonce?D1(Z,$):void 0,X=q7($.directives,J);return{[nY($.reportOnly)]:X}}var xU={enabled:!1,reportOnly:!1,directives:n5,useNonce:!1,addMetaTag:!0};import sY from"crypto";var oY=40,j7="_token",o5=null;function rY($=oY){let Z=sY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return o5=Z,Z}function aY(){if(!o5)rY();return o5}function tY($=j7){let Z=aY();return`<input type="hidden" name="${$}" value="${Z}">`}function B7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return tY(X||j7)})}async function O7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await eY(Y,Q,Z,J,X);else Y=await $Q(Y,Q,Z,J,X)}return Y}async function eY($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=N1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),H=[],U=W.exec(q);while(U!==null){let[j,B="",V=""]=U,F=U.index||0;try{let O=B?F7(Z,B):[],_=V.trim(),L=await G(_,O,J,X);H.push({original:j,processed:L,startIndex:F})}catch(O){let _=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);H.push({original:j,processed:N0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${_}`,D0.EVALUATION_ERROR),startIndex:F})}U=W.exec(q)}for(let j=H.length-1;j>=0;j--){let{original:B,processed:V}=H[j];q=q.replace(B,V)}return q}async function $Q($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of V7(z,N1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=N1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=F7(Z,j),F=await G("",V,J,X);K.push({original:U,processed:F,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:N0("CustomDirective",`Error in @${Q}(${j}): ${F}`,D0.EVALUATION_ERROR),startIndex:B})}let W=N1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[U]=H,j=H.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:N0("CustomDirective",`Error in @${Q}: ${V}`,D0.EVALUATION_ERROR),startIndex:j})}H=W.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function F7($,Z){return $.rawParams?L7(Z):ZQ(Z)}function ZQ($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var _7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,w7=/^[A-Za-z_$][\w$]*$/,JQ=new Set(["light","dark","system"]);function M1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function XQ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(M1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(M1(J.key,"appearance.key"),M1(J.attribute,"appearance.attribute"),M1(J.default,"appearance.default"),M1(X.key,"colorMode.key"),M1(X.attribute,"colorMode.attribute"),M1(X.default,"colorMode.default"),!w7.test(J.key)||!w7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!_7.test(J.attribute)||!_7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!JQ.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function YQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function QQ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YQ($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function GQ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function R7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=GQ(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=X0(`(${z})`,Z),q=QQ(XQ(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import zQ from"crypto";function A0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var a5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function KQ($){return{...a5,...$.forms?.classes}}function O9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function u1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${A0(Z)}"`}function r5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${A0(`${h0($)}-error`)}"`;return X}function qQ(){return zQ.randomUUID()}function sU($,Z,J,X){let Y=KQ(X),Q=$;return Q=HQ(Q,Z),Q=I2(Q,Z),Q=t5(Q,Z,Y),Q=e5(Q,Z,Y),Q}function I2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=qQ();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${A0(Q)}">`;return X}),J}function t5($,Z,J=a5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",H=z||K||"",U=q1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${A0(B)}" action="${A0(H)}"${U?` ${U}`:""}>`;if(V+=`
|
|
3168
|
+
`}async function l4($,Z,J,X){if(Z.length<1)return N0("WebComponent","@webcomponent directive requires at least the tag name parameter",D0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)]:[g0.join(g0.dirname(X),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(X),`${Y}.stx`)],K=null;for(let H of z)if(await e(H)){K=await Bun.file(H).text();break}if(!K)return N0("WebComponent",`Component file not found: ${Y}.stx`,D0.FILE_NOT_FOUND);let q=LY(K,Y);return`<script type="module">
|
|
3169
|
+
${OY(q)}
|
|
3170
|
+
</script>`}var v5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:n4,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:D4,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:l4,hasEndTag:!1,description:"Include a web component in the template"},p4,i4,t4,e4,V5,O5,F5,L5,F4,z4,P4,C5,...$7],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 _Y($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=P0.join(Y,"resources","views"),G=P0.join(Y,"resources","layouts");if(j9.existsSync(Q)&&j9.existsSync(G))return{root:"resources",pagesDir:"views"};let z=P0.join(Y,"resources","views","pages");if(j9.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var c4=new Set,B9=["partialsDir","componentsDir","layoutsDir"],x5=new WeakMap;function wY($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function RY($,Z){let J=!$.root,X=_Y($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!c4.has(Y))c4.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!x5.has($)){let Y={};for(let Q of B9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}x5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of B9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(P0.isAbsolute(G)||wY(G,Y))continue;$[Q]=P0.join(Y,G)}}for(let Y of B9){let Q=$[Y];if(typeof Q!=="string"||!Q||P0.isAbsolute(Q))continue;$[Y]=P0.resolve(Z,Q)}return $}function DY($,Z){let J=x5.get($);for(let X of B9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=P0.isAbsolute(Y)?Y:P0.join(Z,Y);if(j9.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,K=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(K?`, resolved under root "${z}".`:"."))}}function NY($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function MY($){if(s4($.stateDir),$.stateDir=o4(),$.cachePath=R2($.cachePath),$.build)$.build.cacheDir=R2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=R2($.media.cache.directory);if($.story)$.story.outDir=R2($.story.outDir)}var G1=null,w1=new Map,W9=new Map,D2=null;async function f5($){let Z=$?P0.resolve($):process.cwd(),J=W9.get(Z);if(J&&J.signature!==H9(J.graph)){let Q=w1.get(Z);if(w1.delete(Z),W9.delete(Z),!$)G1=null,D2=null;let{clearComponentCache:G}=await import("./chunk-9q58ez22.js"),{partialsCache:z}=await import("./chunk-059sx1ky.js");if(G(),z.clear(),Q&&J.configSignature===U9(J.graph)){let K=Q.then(async(q)=>{let W={...J.graph};await a4(W,Z),W9.set(Z,{graph:W,signature:H9(W),configSignature:U9(W)});let H={...q,_layerGraph:W};if(!$)G1=H;return H});return w1.set(Z,K),K}}if(!$){if(G1)return G1;if(D2)return D2}let X=w1.get(Z);if(X)return X;let Y=(async()=>{let G=(await FY({name:"stx",alias:"ui",cwd:Z,defaultConfig:v5,verbose:!1})).config;if(G.extends!==void 0||J){let W=await r4(Z,v5);G=W.config,W9.set(Z,{graph:W.graph,signature:H9(W.graph),configSignature:U9(W.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:W}=await import("./chunk-pv2trpk9.js");W(G.runtimeConfig,{});let{generateRuntimeConfigTypes:H}=await import("./chunk-23nncxaw.js");await H(Z,G.runtimeConfig)}NY(G),MY(G),RY(G,Z),DY(G,Z);let z=[],K=new Set((G.plugins??[]).map((W)=>typeof W==="string"?W:W[0]));for(let W of G.componentPackages??["@stacksjs/components"]){let H=`${W}/stx-plugin`;if(K.has(H)||K.has(W))continue;try{x.resolve(H,{paths:[Z]}),z.push(H)}catch{}}let q=[...G.plugins??[],...z];if(q.length>0){let{pluginManager:W}=await import("./chunk-es9jp0c7.js"),H=[],U=[];for(let j of q){let B=typeof j==="string"?j:j[0],V=typeof j==="string"?{}:j[1]||{};try{let F,O;try{let L=x.resolve(B,{paths:[Z]});F=await import(L),O=P0.dirname(L)}catch{let L=P0.resolve(Z,B);F=await import(L),O=P0.dirname(L)}let _=F.default||F;if(!W.has(_.name))await W.register(_,G);if(_.components){let L=Array.isArray(_.components)?_.components:[_.components];for(let w of L)H.push(P0.resolve(O,w))}if(_.pages){let L=P0.resolve(O,_.pages),w=V.path||"/";U.push({dir:L,prefix:w})}if(_.setup){let L={addDirective:(w)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(w)},addRoute:(w,R)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[w]=R},addMiddleware:(w)=>{G.middleware=G.middleware||[],G.middleware.push(w)},pluginDir:O,config:G};await _.setup(V,L)}console.log(`[stx] Plugin loaded: ${_.name||B}`)}catch(F){console.warn(`[stx] Failed to load plugin ${B}:`,F.message)}}G._pluginComponentDirs=H,G._pluginPageDirs=U}return G})();if(w1.set(Z,Y),Y.catch(()=>{if(w1.get(Z)===Y)w1.delete(Z)}),!$)D2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var Z7=new Proxy(v5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!D2)f5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function YU($){return $}function QU($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var h5=new Map;async function TY($,Z={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let X=(await AY.promises.stat($)).mtime.getTime();if(Z.cache&&h5.has($)){let H=h5.get($);if(H.updatedAt>=X)return{content:H.content,data:H.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=w4(Y),z=Z.markdown||Z7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=F2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)q=await kY(q,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:q,data:Q||{}};if(Z.cache)h5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:O0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var V9=null;async function kY($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!V9)try{V9=await IY({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,K,q,W)=>{let H=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),U=q||(J?"text":"");if(!U)return z;try{if(!V9.getSupportedLanguages().includes(U))return z;return(await V9.highlight(H,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[K,q,W,H]=z,U=await Y(K,q,W,H);Q=Q.replace(K,U)}return Q}async function J7($,Z,J="",X={}){return await EY($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,q)=>{try{let W=z;if(!g5.isAbsolute(z))W=g5.resolve(g5.dirname(J),z);let H={};if(K)try{try{H=JSON.parse(K)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let _=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of _){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);H[R]=D}}}}catch(O){if(X.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:U,data:j}=await TY(W,X),B={...Z,...j,...H},V=U,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(O,_)=>{let L=_.trim();return B[L]!==void 0?String(B[L]):O}),V}catch(W){let H=W instanceof Error?W.message:String(W);return O0("Markdown File",`Error including markdown file: ${H}`,J,$,q,G)}})}async function EY($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],K=Y.index,q=Y;X.push(J(...q).then((W)=>({match:z,replacement:W,index:K})))}let Q=await Promise.all(X);Q.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of Q)G=G.replace(z,()=>K);return G}function z1($,Z){try{let J=$.trim();if(B0(J))return U0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}function K1($,Z){let J=yY($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function yY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=M0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function bY($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function R1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let K=G.exec($),q=z.exec($),W=K?K.index:1/0,H=q?q.index:1/0;if(W<H)Y++,Q=W+K[0].length;else if(H<1/0){if(Y--,Y===0)return H;Q=H+q[0].length}else break}return-1}function X7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W="if",H=Y.expression,U=0,j=0;while(q<z.length){let B=z.indexOf("@",q);if(B===-1)break;q=B;let V=z.substring(B);if(bY(z,B)){q++;continue}if(/^@if\s*\(/.test(V)){j++,q++;continue}if(/^@endif(?![a-z])/.test(V)){j--,q+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q});let O=q+F[0].length,_=K1(z,O);if(!_){q++;continue}W="elseif",H=_.expression,q=_.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(V)){K.push({type:W,condition:H,content:z.substring(U,q),start:Q+U,end:Q+q}),W="else",H=void 0,q+=5,U=q;continue}}q++}return K.push({type:W,condition:H,content:z.slice(U),start:Q+U,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function N2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=X7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function L9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,K=z+Q[0].length-1,q=M0($,"(",")",K);if(q===-1){Q=Y.exec($);continue}let W=$.slice(K+1,q),H=q+1,U=R1($,Z,J,H);if(U===-1){Q=Y.exec($);continue}let j=$.slice(H,U),B=U+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function u5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=K1($,X);if(!Y)return null;let Q=Y.endPos,G=R1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),K=[],q=0,W=null,H=0;while(q<z.length){let U=z.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(H++,W)W.content+=j[0];q+=j[0].length;continue}if(B){if(H--,W)W.content+=B[0];q+=B[0].length;continue}if(H>0){if(W)W.content+=z[q];q++;continue}let V=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),O=U.match(/^@break(?![a-z])/);if(V&&U.startsWith("@case")){if(W)K.push(W);let _=q+V[0].length,L=K1(z,_);if(!L){q++;continue}W={type:"case",value:L.expression,content:""},q=L.endPos}else if(F&&U.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},q+=F[0].length}else if(O&&U.startsWith("@break"))q+=O[0].length;else{if(W)W.content+=z[q];q++}}if(W)K.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:K,start:Z,end:G+10}}function SY($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",K=Q?z==="{{{"?"}}}":"!!}":"}}",q=G+z.length,W=PY($,q,K);if(W===-1){J=G+1;continue}let H=$.slice(q,W).trim(),U=W+K.length;Z.push({fullMatch:$.slice(G,U),expression:H,start:G,end:U,isRaw:Q}),J=U}return Z}function PY($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function vY($){let Z=d5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=xY(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function xY($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=M0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=G7(G);return{name:X,args:z}}function G7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function fY($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=M0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function gY($){let Z=[],X=new m5($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let K=z.value;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let H=Y<X.length?X[Y].start:$.length,U=Y7(X,Y,$);Y=U.nextIndex,Z.push({type:"variable",name:W,value:$.slice(H,U.endPos),exported:G,start:z.start,end:U.endPos})}}else if(q.type==="PUNCTUATION"&&(q.value==="{"||q.value==="[")){let W=q.start,H=q.value==="{"?"}":"]",U=M0($,q.value,H,W);if(U!==-1){let j=$.slice(W,U+1);if(Y=Q7(X,U+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=Y7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${K} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let K=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let q=X[Y];if(q.type==="IDENTIFIER"){let W=q.value;Y++;let H=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){H=X[Y].start;break}Y++}if(H!==-1){let U=M0($,"{","}",H);if(U!==-1)Z.push({type:"function",name:W,value:$.slice(K,U+1).replace(/^export\s+/,""),exported:G,start:K,end:U+1}),Y=Q7(X,U+1)}}}else Y++}return Z}function Y7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function Q7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function hY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=u5(X,G);if(!z)break;try{let K;if(B0(z.expression))K=U0(z.expression,Object.keys(Z))(...Object.values(Z));else K=X0(z.expression,Z);let q="",W=!1;for(let H of z.cases)if(H.type==="default"){if(!W)q=H.content.trim()}else try{let U;if(H.value&&B0(H.value))U=U0(H.value,Object.keys(Z))(...Object.values(Z));else if(H.value)U=X0(H.value,Z);if(K===U){q=H.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+q+X.substring(z.end),Y=!0}catch(K){let q=K instanceof Error?K.message:String(K),W=N0("Switch",`Error evaluating @switch expression: ${q}`,D0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function uY($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function mY($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function t0($,Z,J){let{masked:X,scripts:Y}=uY($);return mY(dY(X,Z,J),Y)}function dY($,Z,J){let X=$;X=hY(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=K1(X,z+7);if(!K)break;let q=K.endPos,W=R1(X,"unless","endunless",q);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let H=X.slice(q,W),U=K.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,L=[],w;while((w=F.exec(H))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(H))!==null)L.push({pos:w.index,type:"close"});while((w=_.exec(H))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=H.slice(0,j),F=H.slice(j+5);B=`@if (${U})${F}@else ${V}@endif`}else B=`@if (!(${U}))${H}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=c5(X,Z,J),X=p5(X,Z,J),X=l5(X,Z);let Y=()=>{let Q=N2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let q=Q.length-1;q>=0;q--){let W=Q[q];try{let H="",U=!1;for(let j of W.branches){if(U)break;if(j.type==="else")H=j.content,U=!0;else try{let B;if(j.condition&&B0(j.condition))B=U0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=X0(j.condition,Z);if(B)H=j.content,U=!0}catch(B){H=N0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,D0.EVALUATION_ERROR),U=!0}}G[q]=H}catch(H){let U=H instanceof Error?H.message:String(H);G[q]=N0("If",`Error processing @if block: ${U}`,D0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),K=0;for(let q=0;q<Q.length;q++){let W=Q[q];z[q*2]=X.slice(K,W.start),z[q*2+1]=G[q],K=W.end}return z[Q.length*2]=X.slice(K),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function z7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function l5($,Z){let J=$;function X(z,K,q,W){let H=1,U=W,j=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<z.length&&H>0){j.lastIndex=U,B.lastIndex=U;let V=j.exec(z),F=B.exec(z),O=V?V.index:1/0,_=F?F.index:1/0;if(O<_)H++,U=O+V[0].length;else if(_<1/0){if(H--,H===0)return _;U=_+F[0].length}else break}return-1}function Y(z,K,q){let W=0,H=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=H.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=U.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,O)=>F.pos-O.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let K=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+5),j=z7(U);if(j)W=j.value,H=q+5+j.consumed;else H=q+5;let B=X(J,"auth","endauth",H);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"auth","endauth"),O;if(!Z.auth)O=!1;else O=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let K=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let q=K.index,W,H,U=J.slice(q+6),j=z7(U);if(j)W=j.value,H=q+6+j.consumed;else H=q+6;let B=X(J,"guest","endguest",H);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(H,B),F=Y(V,"guest","endguest"),O;if(!Z.auth)O=!0;else O=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let _;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);_=O?L:w}else _=O?V:"";J=J.substring(0,q)+_+J.substring(B+9),z=!0}}function Q(z,K,q){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(K)W.push(K);if(q){let H=z1(q,Z);W.push(H)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,q=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let H=J.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let U=H.index,j=J.slice(U+`@${z}`.length),B=G(j);if(!B)break;let V=U+`@${z}`.length+B.paramsEnd,F=X(J,z,K,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${U} has no matching @${K} \u2014 the block was skipped.`);break}let O=J.slice(V,F),_=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${K}(?![a-z])`,"g"),D=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(O))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(O))!==null)T.push({pos:M.index,type:"close"});while((M=D.exec(O))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(O))!==null)T.push({pos:M.index,type:"else"});T.sort((b,y)=>b.pos-y.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)_.push(b)}let I=[],k=0;for(let b=0;b<_.length;b++){let y=_[b];if(I.push({content:O.slice(k,y.pos),ability:void 0}),y.type==="elseDirective"){let P=O.slice(y.pos+`@${q}`.length),h=G(P);if(h){I[I.length-1]={content:O.slice(k,y.pos)},k=y.pos+`@${q}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let p=_[b+1],u=p?p.pos:O.length;I.push({content:O.slice(k,u),ability:h.ability,type:h.type,id:h.id}),k=u}}else k=y.pos+5}if(k<O.length){let b=I[I.length-1];if(_.length>0&&_[_.length-1].type==="else")I.push({content:O.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:O.slice(k)})}let A=Q(B.ability,B.type,B.id),E=z==="can"?A:!A,S="";if(E)S=I[0]?.content||"";else{let b=!1;for(let y=1;y<I.length;y++){let P=I[y];if(P.isFinalElse){S=P.content,b=!0;break}if(P.ability){let h=Q(P.ability,P.type,P.id);if(z==="can"?h:!h){S=P.content,b=!0;break}}}if(!b&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)S=y.content}}J=J.substring(0,U)+S+J.substring(F+`@${K}`.length),W=!0}}return J}function c5($,Z,J){let X=$;function Y(Q,G,z,K,q){let W=!0;while(W){W=!1;let H=new RegExp(`@${G}\\s*\\(`),U=Q.match(H);if(!U||U.index===void 0)break;let j=U.index,B=K1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=R1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let O=Q.slice(V,F),_=B.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=K(_.trim()),N;if(L!==-1){let T=O.slice(0,L),M=O.slice(L+5);N=D?T:M}else N=D?O:"";Q=Q.substring(0,j)+N+Q.substring(F+`@${z}`.length),W=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=N0(q,`Error processing @${G} directive: ${N}`,D0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function p5($,Z,J){let X=$,Y="development";function Q(G,z,K,q){let W=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${K}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let O=F.index,_=O+F[0].length;if(z==="env"){let A=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!A)break;_+=A[0].length,q=Y===A[2]}let L=1,w=_,R=-1;while(L>0&&w<B.length){W.lastIndex=w,H.lastIndex=w;let A=W.exec(B),E=H.exec(B),S=A?A.index:1/0,b=E?E.index:1/0;if(S<b)L++,w=S+A[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+E[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let D=B.substring(_,R),N=-1,T=0,M=0;while(M<D.length){let A=D.indexOf("@",M);if(A===-1)break;let E=D.substring(A);if(U.test(E)){T++,M=A+1;continue}if(j.test(E)){T--,M=A+1;continue}if(T===0&&/^@else(?![a-z])/.test(E)){N=A;break}M=A+1}let I;if(N!==-1){let A=D.slice(0,N),E=D.slice(N+5);I=q?A:E}else I=q?D:"";let k=`@${K}`.length;B=B.substring(0,O)+I+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var i5=new WeakMap;function K7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function D1($,Z){if(!$)return Z?.nonceGenerator?.()??K7();let J=i5.get($);if(!J)J=Z?.nonceGenerator?.()??K7(),i5.set($,J);return J}function bU($){i5.delete($)}function q7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function s5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${q7($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var lY={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},n5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},cY={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},pY={"default-src":["'none'"],"frame-ancestors":["'none'"]};function CU($){return{enabled:!0,directives:{strict:lY,moderate:n5,relaxed:cY,api:pY}[$]||n5,useNonce:$==="strict",addMetaTag:!0}}function SU($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],K=[...new Set([...z,...Y])];J[Q]=K}}return J}function W7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?D1(J,Z):void 0,Y=s5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3171
|
+
${Y}`)}function H7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function U7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(Z,Q):void 0;return s5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return D1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=D1(Z,Q);return Y}var iY={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(J,Q):void 0;return s5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},nY={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return D1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function PU(){return[iY,nY]}function vU($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function sY($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function xU($,Z){if(!$.enabled)return{};let J=$.useNonce?D1(Z,$):void 0,X=q7($.directives,J);return{[sY($.reportOnly)]:X}}var fU={enabled:!1,reportOnly:!1,directives:n5,useNonce:!1,addMetaTag:!0};import oY from"crypto";var rY=40,j7="_token",o5=null;function aY($=rY){let Z=oY.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return o5=Z,Z}function tY(){if(!o5)aY();return o5}function eY($=j7){let Z=tY();return`<input type="hidden" name="${$}" value="${Z}">`}function B7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return eY(X||j7)})}async function O7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await $Q(Y,Q,Z,J,X);else Y=await ZQ(Y,Q,Z,J,X)}return Y}async function $Q($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,K=`@end${Q}`,q=$,W=N1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),H=[],U=W.exec(q);while(U!==null){let[j,B="",V=""]=U,F=U.index||0;try{let O=B?F7(Z,B):[],_=V.trim(),L=await G(_,O,J,X);H.push({original:j,processed:L,startIndex:F})}catch(O){let _=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);H.push({original:j,processed:N0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${_}`,D0.EVALUATION_ERROR),startIndex:F})}U=W.exec(q)}for(let j=H.length-1;j>=0;j--){let{original:B,processed:V}=H[j];q=q.replace(B,V)}return q}async function ZQ($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,K=[],q=[];if(Z.rawParams){for(let U of V7(z,N1(`(?<![\\w$@])@${Q}\\s*\\(`,"g")))if(U.end!==-1)q.push({fullMatch:U.call,paramString:U.args,startIndex:U.start})}else{let U=N1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");U.lastIndex=0;let j=U.exec(z);while(j!==null)q.push({fullMatch:j[0],paramString:j[1]??"",startIndex:j.index||0}),j=U.exec(z)}for(let{fullMatch:U,paramString:j,startIndex:B}of q)try{let V=F7(Z,j),F=await G("",V,J,X);K.push({original:U,processed:F,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:U,processed:N0("CustomDirective",`Error in @${Q}(${j}): ${F}`,D0.EVALUATION_ERROR),startIndex:B})}let W=N1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[U]=H,j=H.index||0;try{let B=await G("",[],J,X);K.push({original:U,processed:B,startIndex:j})}catch(B){let V=B instanceof Error?B.message:String(B);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,B);K.push({original:U,processed:N0("CustomDirective",`Error in @${Q}: ${V}`,D0.EVALUATION_ERROR),startIndex:j})}H=W.exec(z)}for(let U=K.length-1;U>=0;U--){let{original:j,processed:B}=K[U];z=z.replace(j,B)}return z}function F7($,Z){return $.rawParams?L7(Z):JQ(Z)}function JQ($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var _7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,w7=/^[A-Za-z_$][\w$]*$/,XQ=new Set(["light","dark","system"]);function M1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function YQ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(M1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(M1(J.key,"appearance.key"),M1(J.attribute,"appearance.attribute"),M1(J.default,"appearance.default"),M1(X.key,"colorMode.key"),M1(X.attribute,"colorMode.attribute"),M1(X.default,"colorMode.default"),!w7.test(J.key)||!w7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!_7.test(J.attribute)||!_7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!XQ.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function QQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function GQ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${QQ($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function zQ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function R7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=zQ(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),K=X0(`(${z})`,Z),q=GQ(YQ(K));J=J.slice(0,Y.index)+q+J.slice(G+1),X.lastIndex=Y.index+q.length}return J}import KQ from"crypto";function A0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var a5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function qQ($){return{...a5,...$.forms?.classes}}function O9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function u1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${A0(Z)}"`}function r5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${A0(`${h0($)}-error`)}"`;return X}function WQ(){return KQ.randomUUID()}function oU($,Z,J,X){let Y=qQ(X),Q=$;return Q=UQ(Q,Z),Q=I2(Q,Z),Q=t5(Q,Z,Y),Q=e5(Q,Z,Y),Q}function I2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=WQ();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${A0(Q)}">`;return X}),J}function t5($,Z,J=a5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"POST",H=z||K||"",U=q1(q),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${A0(B)}" action="${A0(H)}"${U?` ${U}`:""}>`;if(V+=`
|
|
3172
3172
|
${I2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
|
|
3173
|
-
${I2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"",H=z||K||"",U=q1(q),j=M2(W,Z),B=j!==void 0&&j!==null?j:H||"",V=U.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",O=A2(W,Z),_=U.match(/class=['"]([^'"]+)['"]/i),L=O9(_?_[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(F)}" name="${A0(W)}"${u1(U,h0(W))} value="${A0(B)}" class="${L}"${r5(W,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=M2(Q,Z)||z.trim(),W=A2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=O9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(Q)}"${u1(K,h0(Q))} class="${U}"${r5(Q,W,K)}${j?` ${j}`:""}>${A0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=M2(Q,Z),W=A2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=O9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${A0(Q)}"${u1(K,h0(Q))} class="${U}"${r5(Q,W,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?h0(Q):`${h0(Q)}-${h0(K)}`,W=q1(z),H=M2(Q,Z),U=H!==void 0&&(Array.isArray(H)?H.some((F)=>String(F)===K):H===!0||String(H)===K),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(Q)}"${u1(W,q)} value="${A0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=M2(Q,Z),W=q!==void 0&&q===G,H=K.match(/class=['"]([^'"]+)['"]/i),U=H?H[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(Q)}"${u1(K,`${h0(Q)}-${h0(G)}`)} value="${A0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",W=z.includes("multiple"),H=A2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=O9(U?U[1]:"",J.input,H,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${A0(Q)}"${u1(z,h0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${A0(q)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),W=q?q[1]:J.label,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(h0(Q))}" class="${W}"${H?` ${H}`:""}>${z}</label>`}),X}function e5($,Z,J=a5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(A2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return D7(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return D7(Y,Z)}let q=K.trim();if(B0(q)){let W=X0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return`<div id="${A0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function A2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function D7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function M2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var N7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function oU($,Z){N7[$]=Z}function $$($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function WQ($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=$$(G),K=N7[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function rU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=WQ(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function HQ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=$$(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var M7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function aU($){M7[$.name]=$}function UQ($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=$$(Q),z=M7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function tU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=UQ($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function eU($,Z){let J=JSON.stringify(Z);return`
|
|
3173
|
+
${I2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,K,q="")=>{let W=Q||G||"",H=z||K||"",U=q1(q),j=M2(W,Z),B=j!==void 0&&j!==null?j:H||"",V=U.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",O=A2(W,Z),_=U.match(/class=['"]([^'"]+)['"]/i),L=O9(_?_[1]:"",J.input,O,J.inputError),w=U.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(F)}" name="${A0(W)}"${u1(U,h0(W))} value="${A0(B)}" class="${L}"${r5(W,O,U)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let K=q1(G),q=M2(Q,Z)||z.trim(),W=A2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=O9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(Q)}"${u1(K,h0(Q))} class="${U}"${r5(Q,W,K)}${j?` ${j}`:""}>${A0(q)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let K=q1(G),q=M2(Q,Z),W=A2(Q,Z),H=K.match(/class=['"]([^'"]+)['"]/i),U=O9(H?H[1]:"",J.input,W,J.inputError),j=K.replace(/class=['"][^'"]+['"]/i,""),B=z;if(q!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,O)=>{if((Array.isArray(q)?q.some((L)=>String(L)===O):String(q)===O)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${A0(Q)}"${u1(K,h0(Q))} class="${U}"${r5(Q,W,K)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=G===void 0?"1":G,q=G===void 0?h0(Q):`${h0(Q)}-${h0(K)}`,W=q1(z),H=M2(Q,Z),U=H!==void 0&&(Array.isArray(H)?H.some((F)=>String(F)===K):H===!0||String(H)===K),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(Q)}"${u1(W,q)} value="${A0(K)}" class="${B}"${U?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let K=q1(z),q=M2(Q,Z),W=q!==void 0&&q===G,H=K.match(/class=['"]([^'"]+)['"]/i),U=H?H[1]:J.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(Q)}"${u1(K,`${h0(Q)}-${h0(G)}`)} value="${A0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=q1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),q=K?K[1]:"",W=z.includes("multiple"),H=A2(Q,Z),U=z.match(/class=['"]([^'"]+)['"]/i),j=O9(U?U[1]:"",J.input,H,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${A0(Q)}"${u1(z,h0(Q))}`,`class="${j}"`];if(q)V.push(`accept="${A0(q)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let K=q1(G),q=K.match(/class=['"]([^'"]+)['"]/i),W=q?q[1]:J.label,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(h0(Q))}" class="${W}"${H?` ${H}`:""}>${z}</label>`}),X}function e5($,Z,J=a5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(A2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return D7(Y,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return D7(Y,Z)}let q=K.trim();if(B0(q)){let W=X0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return`<div id="${A0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function A2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function D7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function M2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function q1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var N7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function rU($,Z){N7[$]=Z}function $$($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function HQ($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=$$(G),K=N7[z.name];if(!K){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let q=K(Z,z.params||[],$);if(q)Y.push(z.message||q)}return{field:$,valid:Y.length===0,errors:Y}}function aU($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=HQ(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function UQ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((K)=>K.trim()),z=[];for(let K of G){let q=$$(K);switch(q.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),q.name==="integer")z.push('step="1"');break;case"min":if(q.params?.[0])z.push(`minlength="${q.params[0]}"`);break;case"max":if(q.params?.[0])z.push(`maxlength="${q.params[0]}"`);break;case"regex":if(q.params?.[0])z.push(`pattern="${q.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var M7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function tU($){M7[$.name]=$}function jQ($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=$$(Q),z=M7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let K=z.validate($,G.params||[],J);if(K!==!0)X.push(K)}return{valid:X.length===0,errors:X}}function eU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=jQ($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function $j($,Z){let J=JSON.stringify(Z);return`
|
|
3174
3174
|
<script>
|
|
3175
3175
|
(function() {
|
|
3176
3176
|
const form = document.getElementById('${$}');
|
|
@@ -3222,19 +3222,19 @@ catch { return 'Please enter a valid URL'; } },
|
|
|
3222
3222
|
}
|
|
3223
3223
|
});
|
|
3224
3224
|
})();
|
|
3225
|
-
</script>`.trim()}var T2=/<\/?template\b[^>]*>/gi,jQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function BQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return jQ.test(Z)}function F9($){T2.lastIndex=0;let Z;while((Z=T2.exec($))!==null){if(Z[0].startsWith("</")||BQ(Z[0]))continue;let J=Z.index,X=T2.lastIndex,Y=1,Q;while((Q=T2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:T2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import z0 from"path";import{existsSync as sQ}from"fs";q5();import _9 from"fs";import V0 from"path";var A7=new Map;function w9($,Z=!0){let J=A7.get($);if(Z&&J)return J;let X=new Map,Y=[V0.join($,"src"),V0.join($,"dist"),$];function Q(G,z){if(z>6)return;let K;try{K=_9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of K){let W=V0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,z+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let H=q.name.slice(0,-4);if(!X.has(H))X.set(H,W);let U=H.toLowerCase();if(!X.has(U))X.set(U,W);let j=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,W)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)A7.set($,X);return X}function R9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=V0.join(J,"node_modules",$);try{if(_9.statSync(X).isDirectory())return X}catch{}let Y=V0.dirname(J);if(Y===J)return null;J=Y}}function D9($,Z,J={}){return[V0.resolve(V0.dirname(Z),`${$}.stx`),V0.resolve(V0.dirname(Z),$),V0.resolve(J.componentsDir||"components",`${$}.stx`),V0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function I7($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function Z$($,Z){let[J,X,Y]=I7($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*J$($,Z,J={},X){let Y=I7($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield V0.resolve(V0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((K)=>`${K}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[V0.join(V0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],V0.join(V0.dirname(Z),"components"),V0.resolve(G,"src/components"),V0.resolve(G,"components"),...import.meta.dir?[V0.resolve(import.meta.dir,"components")]:[]];for(let K of new Set(z)){for(let q of Q)yield V0.join(K,q);try{for(let q of _9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let W of Q)yield V0.join(K,q.name,W)}catch{}}}function T7($,Z,J={},X){let Y=Z$($,X);if(Y!==void 0)return Y;for(let Q of J$($,Z,J,X))try{if(_9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class k7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=Z$($,X);if(Y!==void 0)return Y;for(let Q of J$($,Z,J,X))if(await e(Q))return Q;return null}}var m1=new k7;function T0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var A1="\x00stx-boolean-attribute";function X$($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function d1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(T0(Q));continue}if(Y===A1){J.push(T0(Q));continue}J.push(`${T0(Q)}="${T0(X$(String(Y)))}"`)}return J}function l1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(T0(Q));continue}if(typeof Y==="object")continue;J.push(`${T0(Q)}="${T0(X$(String(Y)))}"`)}return J}function c1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function VQ($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var Y$={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=VQ($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,K=[];if(X.reactive)K.push(`:href="${c1(X.value)}"`);else K.push(`href="${c1(W2(X.value,"navigable"))}"`);if(Y)K.push(`class="${c1(Y)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${c1(Q)}"`),K.push(`data-stx-exact-active-class="${c1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${c1(q)}"`);let W=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...d1($,W)),K.push(...l1($,W)),`<a ${K.join(" ")}>${Z}</a>`}};import p1 from"fs";import Q$ from"path";var LQ=new Set([".jpg",".jpeg",".png",".webp",".avif"]),s0=new Map,I1=!1;function G$($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return s0.get(Z)}function wj(){return I1}function Rj(){s0.clear(),I1=!1}function Dj($,Z){s0.set($,Z),I1=!0}function OQ($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function FQ($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function _Q($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let K=Math.floor(z*Z/X),q=Math.max(K+1,Math.floor((z+1)*Z/X)),W=Math.floor(G*J/Y),H=Math.max(W+1,Math.floor((G+1)*J/Y)),U=0,j=0,B=0,V=0;for(let O=W;O<H;O++)for(let _=K;_<q;_++){let L=(O*Z+_)*4;U+=$[L],j+=$[L+1],B+=$[L+2],V++}let F=(O)=>Math.round(O/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(U)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function wQ($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function RQ($){try{return JSON.parse(p1.readFileSync($,"utf8"))}catch{return{}}}function DQ($,Z){try{p1.mkdirSync(Q$.dirname($),{recursive:!0}),p1.writeFileSync($,JSON.stringify(Z))}catch{}}function C7($,Z,J=[]){let X;try{X=p1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=Q$.join($,Y.name);if(Y.isDirectory()){C7(Q,`${Z}/${Y.name}`,J);continue}if(!LQ.has(Q$.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function Nj($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000,offThread:Q}=Z;if(!$||!p1.existsSync($))return I1=!0,s0.size;if(Q){let U=await b7("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Y}});if(U!==y7){for(let[j,B]of U.placeholders)s0.set(j,B);return I1=!0,s0.size}}let G;try{G=await import("ts-images")}catch{return I1=!0,s0.size}let z=J?RQ(J):{},K=!1,q=C7($,"").slice(0,Y),W=8,H=async([U,j])=>{let B;try{B=p1.statSync(j)}catch{return}if(B.size>X)return;let V=z[U];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let F=V.transparent;if(typeof F!=="boolean"&&E7(j)==="none")F=!1,z[U]={...V,transparent:F},K=!0;if(typeof F==="boolean"){s0.set(U,{dataUrl:V.dataUrl,color:V.color,transparent:F});return}}try{let{hash:F}=await G.generateThumbHash(j);if(!F)return;let{rgba:O,w:_,h:L}=G.thumbHashToRGBA(F),w={dataUrl:wQ(_Q(O,_,L)),color:FQ(O),transparent:OQ(O)};s0.set(U,w),z[U]={mtimeMs:B.mtimeMs,size:B.size,...w},K=!0}catch{}};for(let U=0;U<q.length;U+=W)await Promise.all(q.slice(U,U+W).map(H));if(J&&K)DQ(J,z);return I1=!0,s0.size}var NQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z$=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function N9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function MQ($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function K$($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=NQ[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function q$($,Z,J,X){return Z.map((Y)=>`${k2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function AQ($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${k2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function k2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function IQ($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function TQ($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var W$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Y=S7(X),Q=E0($,"alt")||"",G=E0($,"width")||(Y?String(Y.source.width):void 0),z=E0($,"height")||(Y?String(Y.source.height):void 0),K=E0($,"sizes"),q=E0($,"srcset"),W=E0($,"densities"),H=E0($,"format"),U=P7(X)||G$(X)?.transparent===!0,j=E0($,"placeholder")||(Y&&!U?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),F=E0($,"class")||E0($,"className")||"",O=E0($,"style")||"",_=E0($,"quality"),L=N9($,"lazy",!0),w=N9($,"preload",!1),R=N9($,"priority",!1),D=E0($,"loading"),N=E0($,"decoding")||"async",T=!!Y||N9($,"picture",!1)||!!H,M=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,k=q||"",A="";if(Y)k=Y.sources[Y.fallback.format]||"",A=K?K$(K):"100vw";else if(!k&&K&&V&&V!=="local"&&V!=="static")k=q$(X,z$,V,H),A=K$(K);else if(!k&&W){let $0=W.split(/\s+/).map((Y0)=>Number.parseFloat(Y0.replace("x","")));k=AQ(X,$0,M,V,H)}else if(K)A=K$(K);let E=[];if(O)E.push(O);if(M&&I)E.push(`aspect-ratio:${M}/${I}`);let S=[],b=j==="blur"||j==="color"||j==="thumbhash";if(b&&!U){let $0=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:G$(X);if($0&&j==="color")E.push(`background-color:${$0.color}`),S.push("backgroundColor");else if($0)E.push(`background-color:${$0.color}`),E.push(`background-image:url(${$0.dataUrl})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),S.push("backgroundColor","backgroundImage");else{let Y0=TQ(M||16,I||9,B);E.push(`background-image:url(${Y0})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),S.push("backgroundImage")}}else if(!b&&j&&j!=="empty"&&j!=="none")E.push(`background-image:url(${F0(j)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),S.push("backgroundImage");let y=Y?.fallback.url||k2(X,M,I,V,H),P=[];if(P.push(`src="${F0(W2(y,"fetched"))}"`),P.push(`alt="${F0(Q)}"`),G)P.push(`width="${F0(G)}"`);if(z)P.push(`height="${F0(z)}"`);let h=D||(R||w?"eager":L?"lazy":"");if(h)P.push(`loading="${F0(h)}"`);if(R)P.push('fetchpriority="high"');if(P.push(`decoding="${F0(N)}"`),F)P.push(`class="${F0(F)}"`);if(E.length>0)P.push(`style="${F0(E.join(";"))}"`);if(k)P.push(`srcset="${F0(W2(k,"fetched"))}"`);if(A)P.push(`sizes="${F0(A)}"`);let p=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(S.length>0){let $0=typeof $.static.onload==="string"?$.static.onload:"",Y0=IQ(S)+($0?`;${$0}`:"");P.push(`onload="${F0(Y0)}"`),p.add("onload")}P.push(...d1($,p)),P.push(...l1($,p));let u=`<img ${P.join(" ")} />`,o="";if(w){let Y0=H==="webp"?"image/webp":H==="avif"?"image/avif":"";o=`<link rel="preload" as="image" href="${F0(y)}"${Y0?` type="${Y0}"`:""}${k?` imagesrcset="${F0(k)}"`:""}${A?` imagesizes="${F0(A)}"`:""} />
|
|
3226
|
-
`}if(T){let $0=[];if(Y)for(let Y0 of
|
|
3225
|
+
</script>`.trim()}var T2=/<\/?template\b[^>]*>/gi,BQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function VQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return BQ.test(Z)}function F9($){T2.lastIndex=0;let Z;while((Z=T2.exec($))!==null){if(Z[0].startsWith("</")||VQ(Z[0]))continue;let J=Z.index,X=T2.lastIndex,Y=1,Q;while((Q=T2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:T2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import z0 from"path";import{existsSync as oQ}from"fs";q5();import _9 from"fs";import V0 from"path";var A7=new Map;function w9($,Z=!0){let J=A7.get($);if(Z&&J)return J;let X=new Map,Y=[V0.join($,"src"),V0.join($,"dist"),$];function Q(G,z){if(z>6)return;let K;try{K=_9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of K){let W=V0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,z+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let H=q.name.slice(0,-4);if(!X.has(H))X.set(H,W);let U=H.toLowerCase();if(!X.has(U))X.set(U,W);let j=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,W)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)A7.set($,X);return X}function R9($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=V0.join(J,"node_modules",$);try{if(_9.statSync(X).isDirectory())return X}catch{}let Y=V0.dirname(J);if(Y===J)return null;J=Y}}function D9($,Z,J={}){return[V0.resolve(V0.dirname(Z),`${$}.stx`),V0.resolve(V0.dirname(Z),$),V0.resolve(J.componentsDir||"components",`${$}.stx`),V0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function I7($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function Z$($,Z){let[J,X,Y]=I7($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*J$($,Z,J={},X){let Y=I7($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield V0.resolve(V0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((K)=>`${K}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[V0.join(V0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],V0.join(V0.dirname(Z),"components"),V0.resolve(G,"src/components"),V0.resolve(G,"components"),...import.meta.dir?[V0.resolve(import.meta.dir,"components")]:[]];for(let K of new Set(z)){for(let q of Q)yield V0.join(K,q);try{for(let q of _9.readdirSync(K,{withFileTypes:!0}))if(q.isDirectory())for(let W of Q)yield V0.join(K,q.name,W)}catch{}}}function T7($,Z,J={},X){let Y=Z$($,X);if(Y!==void 0)return Y;for(let Q of J$($,Z,J,X))try{if(_9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class k7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=Z$($,X);if(Y!==void 0)return Y;for(let Q of J$($,Z,J,X))if(await e(Q))return Q;return null}}var m1=new k7;function T0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var A1="\x00stx-boolean-attribute";function X$($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function d1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(T0(Q));continue}if(Y===A1){J.push(T0(Q));continue}J.push(`${T0(Q)}="${T0(X$(String(Y)))}"`)}return J}function l1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(T0(Q));continue}if(typeof Y==="object")continue;J.push(`${T0(Q)}="${T0(X$(String(Y)))}"`)}return J}function c1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function LQ($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var Y$={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=LQ($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,K=[];if(X.reactive)K.push(`:href="${c1(X.value)}"`);else K.push(`href="${c1(W2(X.value,"navigable"))}"`);if(Y)K.push(`class="${c1(Y)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${c1(Q)}"`),K.push(`data-stx-exact-active-class="${c1(G)}"`),z)K.push("data-stx-prefetch");let q=typeof $.static.activeMatch==="string"?$.static.activeMatch.trim():"";if(q)K.push(`data-stx-active-match="${c1(q)}"`);let W=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return K.push(...d1($,W)),K.push(...l1($,W)),`<a ${K.join(" ")}>${Z}</a>`}};import p1 from"fs";import Q$ from"path";var OQ=new Set([".jpg",".jpeg",".png",".webp",".avif"]),s0=new Map,I1=!1;function G$($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return s0.get(Z)}function Rj(){return I1}function Dj(){s0.clear(),I1=!1}function Nj($,Z){s0.set($,Z),I1=!0}function FQ($){for(let Z=3;Z<$.length;Z+=4)if($[Z]<255)return!0;return!1}function _Q($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function wQ($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let K=Math.floor(z*Z/X),q=Math.max(K+1,Math.floor((z+1)*Z/X)),W=Math.floor(G*J/Y),H=Math.max(W+1,Math.floor((G+1)*J/Y)),U=0,j=0,B=0,V=0;for(let O=W;O<H;O++)for(let _=K;_<q;_++){let L=(O*Z+_)*4;U+=$[L],j+=$[L+1],B+=$[L+2],V++}let F=(O)=>Math.round(O/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(U)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function RQ($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function DQ($){try{return JSON.parse(p1.readFileSync($,"utf8"))}catch{return{}}}function NQ($,Z){try{p1.mkdirSync(Q$.dirname($),{recursive:!0}),p1.writeFileSync($,JSON.stringify(Z))}catch{}}function C7($,Z,J=[]){let X;try{X=p1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=Q$.join($,Y.name);if(Y.isDirectory()){C7(Q,`${Z}/${Y.name}`,J);continue}if(!OQ.has(Q$.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function Mj($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000,offThread:Q}=Z;if(!$||!p1.existsSync($))return I1=!0,s0.size;if(Q){let U=await b7("placeholders",{publicDir:$,options:{cachePath:J,maxBytes:X,limit:Y}});if(U!==y7){for(let[j,B]of U.placeholders)s0.set(j,B);return I1=!0,s0.size}}let G;try{G=await import("ts-images")}catch{return I1=!0,s0.size}let z=J?DQ(J):{},K=!1,q=C7($,"").slice(0,Y),W=8,H=async([U,j])=>{let B;try{B=p1.statSync(j)}catch{return}if(B.size>X)return;let V=z[U];if(V&&V.mtimeMs===B.mtimeMs&&V.size===B.size){let F=V.transparent;if(typeof F!=="boolean"&&E7(j)==="none")F=!1,z[U]={...V,transparent:F},K=!0;if(typeof F==="boolean"){s0.set(U,{dataUrl:V.dataUrl,color:V.color,transparent:F});return}}try{let{hash:F}=await G.generateThumbHash(j);if(!F)return;let{rgba:O,w:_,h:L}=G.thumbHashToRGBA(F),w={dataUrl:RQ(wQ(O,_,L)),color:_Q(O),transparent:FQ(O)};s0.set(U,w),z[U]={mtimeMs:B.mtimeMs,size:B.size,...w},K=!0}catch{}};for(let U=0;U<q.length;U+=W)await Promise.all(q.slice(U,U+W).map(H));if(J&&K)NQ(J,z);return I1=!0,s0.size}var MQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z$=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function N9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function AQ($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function K$($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=MQ[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function q$($,Z,J,X){return Z.map((Y)=>`${k2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function IQ($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${k2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function k2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function TQ($){return`var s=this.style;${$.map((Z)=>`s.${Z}=''`).join(";")}`}function kQ($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var W$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=E0($,"src")||"",Y=S7(X),Q=E0($,"alt")||"",G=E0($,"width")||(Y?String(Y.source.width):void 0),z=E0($,"height")||(Y?String(Y.source.height):void 0),K=E0($,"sizes"),q=E0($,"srcset"),W=E0($,"densities"),H=E0($,"format"),U=P7(X)||G$(X)?.transparent===!0,j=E0($,"placeholder")||(Y&&!U?"thumbhash":void 0),B=E0($,"placeholderColor")||"#e5e7eb",V=E0($,"provider"),F=E0($,"class")||E0($,"className")||"",O=E0($,"style")||"",_=E0($,"quality"),L=N9($,"lazy",!0),w=N9($,"preload",!1),R=N9($,"priority",!1),D=E0($,"loading"),N=E0($,"decoding")||"async",T=!!Y||N9($,"picture",!1)||!!H,M=G?Number.parseInt(G):void 0,I=z?Number.parseInt(z):void 0,k=q||"",A="";if(Y)k=Y.sources[Y.fallback.format]||"",A=K?K$(K):"100vw";else if(!k&&K&&V&&V!=="local"&&V!=="static")k=q$(X,z$,V,H),A=K$(K);else if(!k&&W){let $0=W.split(/\s+/).map((Y0)=>Number.parseFloat(Y0.replace("x","")));k=IQ(X,$0,M,V,H)}else if(K)A=K$(K);let E=[];if(O)E.push(O);if(M&&I)E.push(`aspect-ratio:${M}/${I}`);let S=[],b=j==="blur"||j==="color"||j==="thumbhash";if(b&&!U){let $0=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:G$(X);if($0&&j==="color")E.push(`background-color:${$0.color}`),S.push("backgroundColor");else if($0)E.push(`background-color:${$0.color}`),E.push(`background-image:url(${$0.dataUrl})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),S.push("backgroundColor","backgroundImage");else{let Y0=kQ(M||16,I||9,B);E.push(`background-image:url(${Y0})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),S.push("backgroundImage")}}else if(!b&&j&&j!=="empty"&&j!=="none")E.push(`background-image:url(${F0(j)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat"),S.push("backgroundImage");let y=Y?.fallback.url||k2(X,M,I,V,H),P=[];if(P.push(`src="${F0(W2(y,"fetched"))}"`),P.push(`alt="${F0(Q)}"`),G)P.push(`width="${F0(G)}"`);if(z)P.push(`height="${F0(z)}"`);let h=D||(R||w?"eager":L?"lazy":"");if(h)P.push(`loading="${F0(h)}"`);if(R)P.push('fetchpriority="high"');if(P.push(`decoding="${F0(N)}"`),F)P.push(`class="${F0(F)}"`);if(E.length>0)P.push(`style="${F0(E.join(";"))}"`);if(k)P.push(`srcset="${F0(W2(k,"fetched"))}"`);if(A)P.push(`sizes="${F0(A)}"`);let p=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(S.length>0){let $0=typeof $.static.onload==="string"?$.static.onload:"",Y0=TQ(S)+($0?`;${$0}`:"");P.push(`onload="${F0(Y0)}"`),p.add("onload")}P.push(...d1($,p)),P.push(...l1($,p));let u=`<img ${P.join(" ")} />`,o="";if(w){let Y0=H==="webp"?"image/webp":H==="avif"?"image/avif":"";o=`<link rel="preload" as="image" href="${F0(y)}"${Y0?` type="${Y0}"`:""}${k?` imagesrcset="${F0(k)}"`:""}${A?` imagesizes="${F0(A)}"`:""} />
|
|
3226
|
+
`}if(T){let $0=[];if(Y)for(let Y0 of AQ(Y))$0.push(`<source type="image/${Y0.format}" srcset="${F0(Y0.srcset)}"${A?` sizes="${F0(A)}"`:""} />`);if(!Y&&(H==="avif"||H==="auto")){let Y0=k2(X,M,I,V,"avif"),i=k?q$(X,z$,V,"avif"):`${Y0}`;$0.push(`<source type="image/avif" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}if(!Y&&(H==="webp"||H==="auto")){let Y0=k2(X,M,I,V,"webp"),i=k?q$(X,z$,V,"webp"):`${Y0}`;$0.push(`<source type="image/webp" srcset="${F0(i)}"${A?` sizes="${F0(A)}"`:""} />`)}return`${o}<picture>
|
|
3227
3227
|
${$0.join(`
|
|
3228
3228
|
`)}
|
|
3229
3229
|
${u}
|
|
3230
|
-
</picture>`}return`${o}${u}`}};var v7="/images/safe-image-default.svg";function E2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var
|
|
3230
|
+
</picture>`}return`${o}${u}`}};var v7="/images/safe-image-default.svg";function E2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function i1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var EQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${v7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,H$={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=i1($,"src")||"",Y=i1($,"alt")||"",Q=i1($,"fallback")||v7,G=i1($,"class")||i1($,"className")||"",z=i1($,"fallbackClassName")||"",K=[];if(K.push(`src="${E2(X)}"`),K.push(`alt="${E2(Y)}"`),G)K.push(`class="${E2(G)}"`);if(K.push(`data-fallback="${E2(Q)}"`),z)K.push(`data-fallback-class="${E2(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...d1($,q)),K.push(...l1($,q));let W=`<img ${K.join(" ")} />`,H=J.context;if(!H.__safeImageHandlerEmitted)return H.__safeImageHandlerEmitted=!0,`${EQ}${W}`;return W}};function U$($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function y2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function M9($,Z,J){let X=y2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var j$={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=U$(y2($,"color")||"#6366f1"),Y=U$(y2($,"initialColor")||y2($,"initial-color")||""),Q=U$(y2($,"height")||"3px"),G=M9($,"duration",2000),z=M9($,"throttle",200),K=M9($,"zIndex",999999)||M9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
|
|
3231
3231
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${q};z-index:${K};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
3232
3232
|
<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>
|
|
3233
3233
|
</div>
|
|
3234
3234
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
3235
3235
|
<script>
|
|
3236
3236
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
3237
|
-
</script>`}};function f7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function
|
|
3237
|
+
</script>`}};function f7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function yQ($,Z,J){let X=f7($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var x7={"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%)"},B$={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=T0(f7($,"position")||"top-right"),Y=yQ($,"max",5),Q=x7[X]||x7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
3238
3238
|
<style>
|
|
3239
3239
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
3240
3240
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -3260,7 +3260,7 @@ ${u}
|
|
|
3260
3260
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
3261
3261
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3262
3262
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3263
|
-
</style>`}};import{existsSync as
|
|
3263
|
+
</style>`}};import{existsSync as bQ,readFileSync as CQ}from"fs";var T1=new Map,u7=new Set;function m7($){if(u7.has($))return;u7.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function d7($){let Z=process.cwd();for(let J of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(bQ(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function SQ($){if(T1.has($))return T1.get($);let Z=d7($);if(!Z)return m7($),null;try{let J=JSON.parse(CQ(Z,"utf8"));return T1.set($,J.icons),J.icons}catch{return null}}async function PQ($,Z=!1){if(T1.has($))return T1.get($);let J=d7($);if(!J){if(!Z)m7($);return null}try{let X=await Bun.file(J).json();return T1.set($,X.icons),X.icons}catch{return null}}function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var O$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=s1($,"name")??s1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let _=X.split(":");Y=_[0],Q=_[1]}let G=T0(s1($,"size")||"24"),z=T0(s1($,"color")||"currentColor"),K=T0(s1($,"class")||""),q=T0(s1($,"style")||""),W=T1.get(Y)??SQ(Y);if(!W)return`<!-- Icon: collection "${Y}" not loaded -->`;let H=W[Q];if(!H)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let U=H.width||24,j=H.height||24,B=`0 0 ${U} ${j}`,V=H.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let F=K?` class="${K}"`:"",O=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${O}>${V}</svg>`}};async function vQ($="lucide",Z={}){await PQ($,Z.speculative??!0)}function F$(){return`
|
|
3264
3264
|
(function(){
|
|
3265
3265
|
var tip=null,hideTimer=null,currentEl=null;
|
|
3266
3266
|
|
|
@@ -3363,9 +3363,9 @@ document.addEventListener("focusout",function(e){
|
|
|
3363
3363
|
if(el) hideTip();
|
|
3364
3364
|
});
|
|
3365
3365
|
})();
|
|
3366
|
-
`}function l7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function c7($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var _$={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=c7(Z,"fallback"),Y=X.rest,Q=c7(Y,"error"),G=Q.rest,z=X.region??l7($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??l7($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function I9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var w$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(I9($,"name")||"v").replace(/["'<>]/g,""),Y=(I9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=I9($,"class"),G=I9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function p7($=m1){$.registerBuiltin(Y$),$.registerBuiltin(W$),$.registerBuiltin(H$),$.registerBuiltin(j$),$.registerBuiltin(B$),$.registerBuiltin(V$),$.registerBuiltin(L$),$.registerBuiltin(O$),$.registerBuiltin(_$),$.registerBuiltin(w$)}function T9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var i7=new Map;function
|
|
3367
|
-
`||M==="\t")_++;L=N+F.length}else{if(_--,_===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+O.length;X.push({fullMatch:$.slice(G,D),tagName:q,attributes:V,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return X}function r7($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function a7($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function R$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function t7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(R$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var xQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),fQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||fQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let W=1,H=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(W--,W===0){H=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))W++;Z.push([Q,H])}return Z}function $6($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>$6(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function Z6($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...D$($));function G(H){return Y.some(([U,j])=>H>=U&&H<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,K=[],q=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let H=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,F=!1;while((B=j.exec(U))!==null){let O=B[1],_=B[2];if(e7(O))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),R=_.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!L.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let D=JSON.stringify([L,_]),N=q.get(D);if(!N){if(N=Function(...L,`return (${_})`),q.size>=W)q.clear();q.set(D,N)}let T=N(...w);if(O==="class"){let M=$6(T);if(M){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${M}"`);else V=V.replace(B[0],` class="${M}"`)}else V=V.replace(B[0],"");F=!0;continue}if(xQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let M=String(T).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");V=V.replace(B[0],` ${O}="${M}"`)}F=!0}catch{continue}}if(F){let O=Q[3]?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+H.length,replacement:L})}}if(K.length>0){let H=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:F}=K[j];H[j*2]=J.slice(U,B),H[j*2+1]=F,U=V}H[K.length*2]=J.slice(U),J=H.join("")}return J}import J6 from"fs";import X6 from"path";var b2=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 C2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...b2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return b2.has($)||/[A-Z]/.test($)}var Y6=!1;function gQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let H=Q0(W),U=H.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Q.has(U))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(H))return!0}return!1},z=new Set(z6),K=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(H,U)=>U.toUpperCase())},q=(W,H)=>{let U=K(W);if(Y.static[U]=H,U!==W)Y.staticNames[U]=W};for(let[W,H]of Object.entries($)){let U=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(U.startsWith("@")){Y.events[U]=H;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=a7(H,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=H===A1?j:H;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!B0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=U0(B,V)(...Object.values(Z));if(O===void 0){let _=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(E9(B).some((w)=>!_.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=O,j!==U.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=U.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof H==="string"&&H.includes("{{")&&H.includes("}}")){let j=H.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(B0(B)){let F=U0(B,Object.keys(Z))(...Object.values(Z));q(U,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,H)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,H)}else{let B=H,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(H))!==null)try{let O=F[1];if(!B0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=U0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,H===A1?"true":r7(H))}return Y}var hQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function uQ($,Z,J){if(!$.includes("@"))return $;if(!hQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,J)}catch{return $}}function mQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=R$($,J),J+=Q.length;let G=t7(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=A1}return Z}function Q6($){return Object.entries($).map(([Z,J])=>J===A1?Z:`${Z}="${dQ(J)}"`).join(" ")}function dQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function lQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(m1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function cQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=X6.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of $.matchAll(K)){let[U,j,B]=H,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,O,_=[];while((O=V.exec(B))!==null){let[L,w,R,D]=O,N=null,T=null;if(D.startsWith(".")||D.startsWith("/")){let k=X6.resolve(G,D);if(k.endsWith(".stx"))T=k;else{let A=`${k}.stx`;try{if(J6.statSync(A).isFile())T=A}catch{try{if(J6.statSync(k).isDirectory())N=k}catch{}}}}else N=R9(D,G);if(!N&&!T)continue;let M=!1,I=(k,A)=>{Q.set(k,A),Q.set(k.toLowerCase(),A);let E=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,A),Y.add(A)};if(R&&T)I(R,T),M=!0;else if(w){let k=w.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let S=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S)return{source:S[1],local:S[2]};return{source:E,local:E}}),A=N?w9(N):null;for(let{source:E,local:S}of k){let b=null;if(T)b=T;else if(A)b=A.get(E)??A.get(E.toLowerCase())??A.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)I(S,b),M=!0}}if(M)_.push({start:O.index,end:O.index+L.length})}if(_.length===0)continue;for(let L=_.length-1;L>=0;L--)F=F.slice(0,_[L].start)+F.slice(_[L].end);z.push({start:H.index,end:H.index+U.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let q=[],W=0;for(let H of z)q.push($.slice(W,H.start),H.value),W=H.end;return q.push($.slice(W)),q.join("")}async function pQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,W]=K,H=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of H){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,_=D9(U,J,X);for(let L of _)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(F,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function iQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let W=q.index,H=W+q[0].length-1,U=1,j=H+1;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Q.substring(H+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){K.lastIndex=0;continue}let O=F[1],_,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)_=L.slice(w[0].length).trim();let R={};if(_)try{R=d0(_,Z)}catch(k){let A=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${A}]`);continue}let D="",N=V,M=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(M)D=M[1].trim(),N=V+M[0].length;let I=await k1(O,R,D,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(N),K.lastIndex=0}return Q}async function nQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=f0(Q);Q=K.output;let q=D$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,s7(b2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,b2),Q=K.restore(Q),Q;async function j(B,V,F,O){if(!B)return B;let _=B,L=o7(_,V,O),w=new Map;for(let N=L.length-1;N>=0;N--){let T=L[N],M=F?T9(T.tagName):T.tagName,I=mQ(uQ(T.attributes,Z,J)),k=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=gQ(I,Z,X,k),E=m1.getBuiltin(T.tagName),S=E?await k9(M,G,Z,J,X):!1;if(E&&!S){let h={context:Z,filePath:J,options:X,dependencies:Y},p=E.render(A,T.content,h);if(Object.keys(A.events).length>0){let u=Q6(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${u}`)}if(Object.keys(A.clientReactive).length>0)p=G6(p,A.clientReactive);w.set(N,p);continue}if(!F&&T.tagName.includes("-")&&!await k9(M,G,Z,J,X))continue;let b={};for(let[h,p]of Object.entries(A.static))b[h]=p;for(let[h,p]of Object.entries(A.serverDynamic))b[h]=p;let P=await k1(M,b,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=K6(P);if(h){let p=Q6(A.events),u=Object.keys(A.events).map((o)=>o.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${u}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=G6(P,A.clientReactive);w.set(N,P)}if(w.size===0)return _;let R="",D=0;for(let N=0;N<L.length;N++){let T=w.get(N);if(T===void 0)continue;R+=_.slice(D,L[N].startIndex),R+=T,D=L[N].endIndex}return R+=_.slice(D),R}}function G6($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>T9(W)).join(" "),G=$,z=Y.length>0?K6(G):null;if(z){let W=Y.map(([U,j])=>`:${T9(U)}="${j.replace(/"/g,""")}"`).join(" "),H=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${H} ${W}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function K6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function N$($,Z,J,X,Y){if(!Y6)p7(m1),Y6=!0;let Q=await cQ($,Z,J,X,Y);Q=await pQ(Q,Z,J,X,Y),Q=await iQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=O1(Q,y9,(H,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let W=Q;if(Q=await nQ(q.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=lQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function M$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function oQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let W=X.substring(z+1,q-1),H=`${J}(${W})`;X=X.substring(0,G)+H+X.substring(q),Y.lastIndex=G+H.length,Q=Y.exec(X)}return X}function rQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function U6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(H)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===H){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let H=1;while(Q<G&&H>0)if(Z[Q]==="{")H++,Q++;else if(Z[Q]==="}")H--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3368
|
-
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(Y!==0)return;let H=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!X.has(B))J.push(B),X.add(B);return}let U=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return J.join(", ")}function
|
|
3366
|
+
`}function l7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function c7($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var _$={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=c7(Z,"fallback"),Y=X.rest,Q=c7(Y,"error"),G=Q.rest,z=X.region??l7($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=Q.region??l7($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function I9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var w$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(I9($,"name")||"v").replace(/["'<>]/g,""),Y=(I9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=I9($,"class"),G=I9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function p7($=m1){$.registerBuiltin(Y$),$.registerBuiltin(W$),$.registerBuiltin(H$),$.registerBuiltin(j$),$.registerBuiltin(B$),$.registerBuiltin(V$),$.registerBuiltin(L$),$.registerBuiltin(O$),$.registerBuiltin(_$),$.registerBuiltin(w$)}function T9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var i7=new Map;function xQ($){let Z=i7.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),i7.set($.source,Z);return Z}var n7=new WeakMap;function s7($){let Z=n7.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),n7.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function o7($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=xQ(Z);z.lastIndex=G+1;let K=z.exec($);if(!K){Y=G+1;continue}let q=K[1];if(Q&&Q(q)){let F=G+1+q.length;while(F<$.length&&$[F]!==">")F++;Y=F+1;continue}let W=G+1+q.length,H=null,U=W,j=-1,B=!1;while(W<$.length){let F=$[W];if(H){if(F==="\\"&&W+1<$.length){W+=2;continue}if(F===H)H=null;W++;continue}if(F==='"'||F==="'"){H=F,W++;continue}if(F==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(F===">"){j=W+1;break}W++}if(j===-1){Y=G+1;continue}let V=$.slice(U,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:q,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let F=`<${q}`,O=`</${q}>`,_=1,L=j,w=-1;while(_>0&&L<$.length){let N=$.indexOf(F,L),T=$.indexOf(O,L);if(T===-1)break;if(N!==-1&&N<T){let M=$[N+F.length];if(M===" "||M===">"||M==="/"||M===`
|
|
3367
|
+
`||M==="\t")_++;L=N+F.length}else{if(_--,_===0){w=T;break}L=T+O.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+O.length;X.push({fullMatch:$.slice(G,D),tagName:q,attributes:V,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return X}function r7($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function a7($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function R$($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function t7($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(R$(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var fQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),gQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||gQ.has(z)){Z.push([Q,G]);continue}let K=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=G;let W=1,H=G,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(W--,W===0){H=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))W++;Z.push([Q,H])}return Z}function $6($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>$6(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function Z6($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...D$($));function G(H){return Y.some(([U,j])=>H>=U&&H<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,K=[],q=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let H=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=U,F=!1;while((B=j.exec(U))!==null){let O=B[1],_=B[2];if(e7(O))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),R=_.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!L.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let D=JSON.stringify([L,_]),N=q.get(D);if(!N){if(N=Function(...L,`return (${_})`),q.size>=W)q.clear();q.set(D,N)}let T=N(...w);if(O==="class"){let M=$6(T);if(M){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${M}"`);else V=V.replace(B[0],` class="${M}"`)}else V=V.replace(B[0],"");F=!0;continue}if(fQ.has(O)){if(T)V=V.replace(B[0],` ${O}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let M=String(T).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");V=V.replace(B[0],` ${O}="${M}"`)}F=!0}catch{continue}}if(F){let O=Q[3]?" /":"",L=`<${Q[1]}${V}${O}>`;K.push({start:Q.index,end:Q.index+H.length,replacement:L})}}if(K.length>0){let H=Array(K.length*2+1),U=0;for(let j=0;j<K.length;j++){let{start:B,end:V,replacement:F}=K[j];H[j*2]=J.slice(U,B),H[j*2+1]=F,U=V}H[K.length*2]=J.slice(U),J=H.join("")}return J}import J6 from"fs";import X6 from"path";var b2=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 C2($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...b2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return b2.has($)||/[A-Z]/.test($)}var Y6=!1;function hQ($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let H=Q0(W),U=H.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(U&&Q.has(U))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(H))return!0}return!1},z=new Set(z6),K=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(H,U)=>U.toUpperCase())},q=(W,H)=>{let U=K(W);if(Y.static[U]=H,U!==W)Y.staticNames[U]=W};for(let[W,H]of Object.entries($)){let U=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(U.startsWith("@")){Y.events[U]=H;continue}if(U.startsWith("__stx_")){let j=K(U.slice(6));Y.serverDynamic[j]=a7(H,J);continue}if(U.startsWith(":")){let j=K(U.slice(1)),B=H===A1?j:H;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!B0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),O=U0(B,V)(...Object.values(Z));if(O===void 0){let _=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(E9(B).some((w)=>!_.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=O,j!==U.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=U.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof H==="string"&&H.includes("{{")&&H.includes("}}")){let j=H.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(B0(B)){let F=U0(B,Object.keys(Z))(...Object.values(Z));q(U,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${U}: ${B}`);q(U,H)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${U}:`,B);q(U,H)}else{let B=H,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(H))!==null)try{let O=F[1];if(!B0(O)){if(J.debug)console.error(`Unsafe expression in ${U}: ${O}`);continue}let L=U0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(O){if(J.debug)console.error(`Error evaluating expression in ${U}:`,O)}q(U,B)}continue}q(U,H===A1?"true":r7(H))}return Y}var uQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function mQ($,Z,J){if(!$.includes("@"))return $;if(!uQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,J)}catch{return $}}function dQ($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=R$($,J),J+=Q.length;let G=t7(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=A1}return Z}function Q6($){return Object.entries($).map(([Z,J])=>J===A1?Z:`${Z}="${lQ(J)}"`).join(" ")}function lQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function cQ($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(m1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function pQ($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=X6.dirname(J),z=[],K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of $.matchAll(K)){let[U,j,B]=H,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,O,_=[];while((O=V.exec(B))!==null){let[L,w,R,D]=O,N=null,T=null;if(D.startsWith(".")||D.startsWith("/")){let k=X6.resolve(G,D);if(k.endsWith(".stx"))T=k;else{let A=`${k}.stx`;try{if(J6.statSync(A).isFile())T=A}catch{try{if(J6.statSync(k).isDirectory())N=k}catch{}}}}else N=R9(D,G);if(!N&&!T)continue;let M=!1,I=(k,A)=>{Q.set(k,A),Q.set(k.toLowerCase(),A);let E=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,A),Y.add(A)};if(R&&T)I(R,T),M=!0;else if(w){let k=w.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let S=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S)return{source:S[1],local:S[2]};return{source:E,local:E}}),A=N?w9(N):null;for(let{source:E,local:S}of k){let b=null;if(T)b=T;else if(A)b=A.get(E)??A.get(E.toLowerCase())??A.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)I(S,b),M=!0}}if(M)_.push({start:O.index,end:O.index+L.length})}if(_.length===0)continue;for(let L=_.length-1;L>=0;L--)F=F.slice(0,_[L].start)+F.slice(_[L].end);z.push({start:H.index,end:H.index+U.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let q=[],W=0;for(let H of z)q.push($.slice(W,H.start),H.value),W=H.end;return q.push($.slice(W)),q.join("")}async function iQ($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(Q))!==null){let[q,W]=K,H=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of H){let j=U.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),O=null,_=D9(U,J,X);for(let L of _)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(F,O),G.set(V,O),G.set(V.toLowerCase(),O);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),X.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${U}`)}Q=Q.replace(q,""),z.lastIndex=0}return Q}async function nQ($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,q;while((q=K.exec(Q))!==null){let W=q.index,H=W+q[0].length-1,U=1,j=H+1;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=Q.substring(H+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){K.lastIndex=0;continue}let O=F[1],_,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)_=L.slice(w[0].length).trim();let R={};if(_)try{R=d0(_,Z)}catch(k){let A=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${A}]`);continue}let D="",N=V,M=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(M)D=M[1].trim(),N=V+M[0].length;let I=await k1(O,R,D,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(N),K.lastIndex=0}return Q}async function sQ($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=f0(Q);Q=K.output;let q=D$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,s7(b2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,b2),Q=K.restore(Q),Q;async function j(B,V,F,O){if(!B)return B;let _=B,L=o7(_,V,O),w=new Map;for(let N=L.length-1;N>=0;N--){let T=L[N],M=F?T9(T.tagName):T.tagName,I=dQ(mQ(T.attributes,Z,J)),k=q.some(([h,p])=>T.startIndex>=h&&T.startIndex<p),A=hQ(I,Z,X,k),E=m1.getBuiltin(T.tagName),S=E?await k9(M,G,Z,J,X):!1;if(E&&!S){let h={context:Z,filePath:J,options:X,dependencies:Y},p=E.render(A,T.content,h);if(Object.keys(A.events).length>0){let u=Q6(A.events);p=p.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${u}`)}if(Object.keys(A.clientReactive).length>0)p=G6(p,A.clientReactive);w.set(N,p);continue}if(!F&&T.tagName.includes("-")&&!await k9(M,G,Z,J,X))continue;let b={};for(let[h,p]of Object.entries(A.static))b[h]=p;for(let[h,p]of Object.entries(A.serverDynamic))b[h]=p;let P=await k1(M,b,K.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(A.events).length>0){let h=K6(P);if(h){let p=Q6(A.events),u=Object.keys(A.events).map((o)=>o.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,h.insertPos)+` data-stx-parent-events="${u}" ${p}`+P.substring(h.insertPos)}}if(Object.keys(A.clientReactive).length>0)P=G6(P,A.clientReactive);w.set(N,P)}if(w.size===0)return _;let R="",D=0;for(let N=0;N<L.length;N++){let T=w.get(N);if(T===void 0)continue;R+=_.slice(D,L[N].startIndex),R+=T,D=L[N].endIndex}return R+=_.slice(D),R}}function G6($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>T9(W)).join(" "),G=$,z=Y.length>0?K6(G):null;if(z){let W=Y.map(([U,j])=>`:${T9(U)}="${j.replace(/"/g,""")}"`).join(" "),H=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${H} ${W}`+G.substring(z.insertPos)}let K=Z.if;if(K)G=`<template :if="${K.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function K6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,K=$.toLowerCase().indexOf(z,J+Q[0].length);if(K===-1)return null;J=K+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function N$($,Z,J,X,Y){if(!Y6)p7(m1),Y6=!0;let Q=await pQ($,Z,J,X,Y);Q=await iQ(Q,Z,J,X,Y),Q=await nQ(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let K=G.length,q=O1(Q,y9,(H,U)=>`\x00STX_COMPONENT_COMMENT_${K+U}\x00`,`STX_COMPONENT_COMMENT:${K}`);G.push(...q.tokens);let W=Q;if(Q=await sQ(q.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,K)=>G[Number(K)]??"");if(X.debug){let z=cQ(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function M$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function rQ($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")")K--;q++}if(K!==0)break;let W=X.substring(z+1,q-1),H=`${J}(${W})`;X=X.substring(0,G)+H+X.substring(q),Y.lastIndex=G+H.length,Q=Y.exec(X)}return X}function aQ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function U6($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(H)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===H){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let H=1;while(Q<G&&H>0)if(Z[Q]==="{")H++,Q++;else if(Z[Q]==="}")H--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3368
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(Y!==0)return;let H=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!X.has(B))J.push(B),X.add(B);return}let U=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return J.join(", ")}function tQ($,Z=""){let J=U6($).split(",").map((X)=>X.trim()).filter(Boolean);return`
|
|
3369
3369
|
(function() {
|
|
3370
3370
|
${o1("var",J)}
|
|
3371
3371
|
var __destroyHooks = [];
|
|
@@ -3374,7 +3374,7 @@ document.addEventListener("focusout",function(e){
|
|
|
3374
3374
|
|
|
3375
3375
|
${$}
|
|
3376
3376
|
${Z}})();
|
|
3377
|
-
`}function
|
|
3377
|
+
`}function eQ($,Z){let Y=U6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
3378
3378
|
`);return`
|
|
3379
3379
|
// Register scope variables for STX runtime
|
|
3380
3380
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
@@ -3386,7 +3386,7 @@ ${Y}
|
|
|
3386
3386
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
3387
3387
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
3388
3388
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
3389
|
-
`}function
|
|
3389
|
+
`}function $G($,Z){return $.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(J,X)=>X===Z?J:'<script data-stx-scoped data-stx-run="always"')}function q6($,Z){let J=eQ($,Z);return ZG(tQ($,J),Z)}function ZG($,Z){let J=`
|
|
3390
3390
|
(function() {
|
|
3391
3391
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
3392
3392
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -3403,25 +3403,25 @@ ${Y}
|
|
|
3403
3403
|
} finally {
|
|
3404
3404
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3405
3405
|
}
|
|
3406
|
-
})();`}function
|
|
3407
|
-
`;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-
|
|
3408
|
-
`}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-
|
|
3406
|
+
})();`}function JG($,Z){if(n0($)){let Y=n0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:x1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],K=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var W6=0,A$=new Set;function ZV(){A$.clear()}function H6($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var JV=new r1(500),j6=new Set;function XV(){j6.clear()}function XG($){if($.__onceStore instanceof Set)return $.__onceStore;return j6}async function I$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||z0.join(z0.dirname(J),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let z=rQ($,"@partial","@include"),K=XG(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,O)=>{let _=F.trim(),L=`${J}:${_}`;if(K.has(L))return"";return K.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(_+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){V.lastIndex=w;continue}let N=D[1],T=q(N,G,J),M="";if(T&&await Bun.file(T).exists())Y.add(T),M=`@include(${R})`;z=z.substring(0,O)+M+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=O.exec(z))!==null){let L=_.index,w=L+_[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let N=z.substring(w+1,D-1),T=M$(N,0);if(T===-1){O.lastIndex=D;continue}let M=N.substring(0,T).trim(),I=N.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let A=k[1],E=I.substring(k[0].length),S,b=M$(E,0);if(b!==-1)S=E.substring(b+1).trim();try{let y=`Boolean(${M})`,P;if(B0(y)){let u=U0(y,Object.keys(Z));P=Boolean(u(...Object.values(Z)))}else P=Boolean(X0(y,Z));let h=F?!P:P,p="";if(h){let u=q(A,G,J);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${A}'${S?`, ${S}`:""})`}z=z.substring(0,L)+p+z.substring(D),O.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),h=O0("Include",`Error evaluating ${V} condition: ${P}`,J,$,L);z=z.substring(0,L)+h+z.substring(D),O.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(_+1,w),D=z.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){V.lastIndex=0,z=z.replace(D,"");continue}let[,T,M,I,k]=N;try{let A,E=M.trim();if(B0(E))A=U0(E,Object.keys(Z))(...Object.values(Z));else A=X0(E,Z);let S="";if(Array.isArray(A)&&A.length>0)for(let b of A){let y={...Z,[I]:b},P=await U(T,y,$,O);S+=P}else if(k)S=await U(k,{},$,O);z=z.substring(0,O)+S+z.substring(w+1),V.lastIndex=0}catch(A){let E=A instanceof Error?A.message:String(A);z=z.substring(0,O)+O0("Each",`Error in @each: ${E}`,J,$,O)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let O=F.index,_=O+F[0].length-1,L=1,w=_+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(_+1,w),D=z.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){V.lastIndex=0,z=z.replace(D,"");continue}let T=N[1],M=R.slice(N[0].length),I,k=M.match(/^\s*,\s*\{/);if(k){M=M.slice(k[0].length-1);let S=1,b=1;while(b<M.length&&S>0){if(M[b]==="{")S++;else if(M[b]==="}"){if(S--,S===0)break}b++}I=M.substring(0,b+1),M=M.slice(b+1)}let A,E=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)A=E[1];try{let S=JSON.parse(T.replace(/'/g,'"')),b={};if(I)try{b=d0(I,Z)}catch(P){let h=P instanceof Error?P.message:String(P);if(X.debug){let p=O0("Include",`Error parsing includeFirst variables: ${h}`,J,$,O,D);z=z.replace(D,()=>p)}else z=z.replace(D,()=>A||"");continue}let y=!1;for(let P of S){let h=q(P,G,J);if(!h)continue;if(await e(h)){let p=await U(P,b,$,O);z=z.replace(D,()=>p),y=!0;break}}if(!y)if(A!==void 0)z=z.replace(D,()=>A);else if(X.debug){let P=O0("Include",`None of the includeFirst paths exist: ${T}`,J,$,O,D);z=z.replace(D,()=>P)}else z=z.replace(D,"")}catch(S){let b=S instanceof Error?S.message:String(S),y=O0("Include",`Error processing @includeFirst: ${b}`,J,$,O,D);z=z.replace(D,()=>y)}V.lastIndex=0}}function q(V,F,O){try{let _=V;if(!V.endsWith(".stx"))_=`${V}.stx`;let L=z0.resolve(F),w=z0.resolve(z0.dirname(O)),R;if(!_.startsWith("./")&&!_.startsWith("../")){for(let k of X._layerPartialDirs??[]){let A=z0.resolve(k,_);if(A.startsWith(`${z0.resolve(k)}${z0.sep}`)&&oQ(A))return A}R=z0.resolve(F,_)}else R=z0.resolve(w,_);let D=z0.normalize(R),N=D.startsWith(L+z0.sep)||D===L,T=D.startsWith(w+z0.sep)||D===w,M=!1,I=z0.dirname(w);if(D.startsWith(I+z0.sep)){if(!z0.relative(I,D).split(z0.sep).some((S)=>S.startsWith(".")&&S!=="."&&S!==".."))M=!0}if(!N&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(_){return console.error(`Error resolving path ${V}: ${_}`),null}}let W=z0.resolve(J);Q.add(W);function H(V,F,O,_){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),O0("Include",F,J,O,_)}async function U(V,F={},O,_){let L=q(V,G,J);if(!L)return H(V,`Could not resolve path for include: ${V}`,O,_);let w=z0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return H(V,`Circular include detected: ${R}`,O,_)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(i){let q0=i instanceof Error?i.message:String(i);return H(V,`Error loading include file ${V}: ${q0}`,O,_)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:i}=await import("./chunk-t0a8b1ny.js");R=i(R,Z)}if(R&&(X.debug||!S2()&&!P2()))try{let{warnUnbalancedTags:i}=await import("./chunk-a62080cs.js");i(R,L)}catch{}let D=R;try{let{processESImports:i}=await import("./chunk-jnq140p3.js");await i(R,Z,L,X,Y)}catch(i){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,i instanceof Error?i.message:i)}let N=F9(D);if(N)D=N.content.trim();let M=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(M)I=`<style${M[1]}>${M[2]}</style>`;let k=[];D=D.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(i,q0,r)=>{if(!H6(q0))return"";return k.push({attrs:q0,body:r}),`__STX_DATA_BLOCK_${k.length-1}__`}),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...Z};A.__stx_signals_gate=X1(R,L);for(let[i,q0]of Object.entries(F))A[i]=q0;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(E)],b="",y=null,P=!1;for(let i of S){let q0=i[1]||"",r=i[2]||"";if(H6(q0))continue;let L0=q0.includes("server"),c0=E1(q0);if(!L0&&r.trim()){let{interpolateScriptExpressions:f}=await import("./chunk-9nh7vyxt.js");r=f(r,A,V)}let p0="";try{let{extractAndStripCssImports:f,renderVendorStyleTags:l}=await import("./chunk-hr9g4ahv.js"),J0=f(r,{filePath:L,projectRoot:process.cwd()});r=J0.code,p0=l(J0.styles)}catch(f){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,f instanceof Error?f.message:f)}if(c0&&r.trim())r=y1(r);if(!L0){try{let{injectBrowserCoreAutoImports:l}=await import("./chunk-hr9g4ahv.js");r=l(r).code;let{hasUserImports:J0,bundleClientScript:j0}=await import("./chunk-cfskf6ag.js");if(J0(r))r=await j0(r,L,{projectRoot:process.cwd()})}catch(l){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,l instanceof Error?l.message:l)}let{stripStxRuntimeImports:f}=await import("./chunk-9dr0s6qa.js");r=f(r)}let B1=aQ(r);if(B1&&!L0){P=!0,y=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++W6}`;let f=e0(r),l=q6(f,y);b+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${y}">${l}</script>
|
|
3407
|
+
`;continue}if(L0)try{let{extractVariables:f}=await import("./chunk-sm3d4kbn.js");await f(r,A,L)}catch(f){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,f)}if(!L0&&!B1){let f=q0.replace(/\bclient\b/i,"").trim();y=`stx_scope_${z0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++W6}`;let l=e0(r),J0=q6(l,y);b+=`${p0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${y}"${f?` ${f}`:""}>${J0}</script>
|
|
3408
|
+
`}}if(k.length>0){let{interpolateScriptExpressions:i}=await import("./chunk-9nh7vyxt.js");D=D.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q0,r)=>{let L0=k[Number(r)];return`<script${L0.attrs}>${i(L0.body,A,V)}</script>`})}if(y){let i=JG(D,y);if(D=i.html,i.mergedIntoExisting){let r=y,L0=i.mergedIntoExisting;b=b.split(`'${r}'`).join(`'${L0}'`).split(`"${r}"`).join(`"${L0}"`),y=L0}else if(!i.stamped&&P&&!A$.has(L))A$.add(L),console.warn(`[stx] ${z0.relative(process.cwd(),L)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let q0=i.stamped&&i.root!==null&&C2(i.root);b=$G(b,q0?y:null)}if(D.includes("@include")||D.includes("@partial"))D=await I$(D,A,L,X,Y,Q);let{processLoops:h,reportDeferredLoopWarnings:p}=await import("./chunk-9dn9mbjc.js"),u=h(D,A,L,void 0,!0);u=t0(u,A,L),u=p(u);let{processMetaDirectives:o,processSeoDirective:$0,processStructuredData:Y0}=await import("./chunk-apqq86bx.js");if(u=o(u,A,L,X),u=Y0(u,A,L),u=$0(u,A,L,X),u=F1(u,A,L),I)u+=`
|
|
3409
3409
|
`+I;if(b)u+=`
|
|
3410
3410
|
`+b;return u}catch(R){let D=R instanceof Error?R.message:String(R);return H(V,`Error processing include ${V}: ${D}`,O,_)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,O=1,_=F+1;while(_<z.length&&O>0){if(z[_]==="(")O++;else if(z[_]===")")O--;_++}if(O!==0)break;let L=z.substring(V,_),w=z.substring(F+1,_-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=_;continue}let D=R[1],N,T=w.substring(R[0].length),M=M$(T,0);if(M!==-1)N=T.substring(M+1).trim();let I={};if(N)try{I=d0(N,Z)}catch(A){let E=A instanceof Error?A.message:String(A);z=z.replace(L,O0("Include",`Error parsing include variables for ${D}: ${E}`,J,$,V)),j.lastIndex=0;continue}let k=await U(D,I,$,V);z=z.substring(0,V)+k+z.substring(_),j.lastIndex=0}return z}function T$($,Z){let J=$;function X(Y,Q,G,z){let K=Y,q=!0;while(q){q=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),H=K.match(W);if(!H||H.index===void 0)break;let U=H.index,j=H[1],B=U+H[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),O=1,_=B,L=-1;while(O>0&&_<K.length){let R=K.slice(_),D=R.match(V),N=R.match(F),T=D?_+D.index:1/0,M=N?_+N.index:1/0;if(T<M)O++,_=T+(D[0].length||1);else if(M<1/0){if(O--,O===0){L=M;break}_=M+G.length+1}else break}if(L===-1)break;let w=K.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);K=K.substring(0,U)+K.substring(L+`@${G}`.length),q=!0}return K}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function k$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
3411
3411
|
`)})}import*as E$ from"path";async function B6($,Z,J=""){if(E$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return L6($,Z,J,"@js","@endjs")}async function V6($,Z,J=""){if(E$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return L6($,Z,J,"@ts","@endts")}async function L6($,Z,J,X,Y){let Q=$,G=N1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:q,content:W,index:H}of z)try{let U={...Z,global:Z},j=Object.keys(U),B=Object.values(U),V=W.trim();if(X==="@ts")V=V.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 O=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),_=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
|
|
3412
3412
|
${V}
|
|
3413
3413
|
${_}
|
|
3414
|
-
`,R=Function(...j,L)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(q,"")}catch(U){console.error(`Error executing ${X} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=O0(`${X} Directive`,`Error executing code: ${j}`,J,$,H,q);console.error(B),Q=Q.replace(q,"")}return Q}function a1($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}var XG=1000,YG=!1;function QG($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),K=M0($,"(",")",z);if(K===-1)continue;let q=$.slice(G,K).trim();if(!q)continue;if(!Object.keys(Z).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let H;try{let U=d0(q,Z);if(!U||typeof U!=="object")continue;H=JSON.stringify(U)}catch{continue}X+=$.slice(Y,G)+H,Y=K,J.lastIndex=K}return Y===0?$:X+$.slice(Y)}function GG($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")"){if(K--,K===0)break}q++}if(K!==0)continue;let W=X.substring(z+1,q),H=q+1,U=W.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=W.slice(U[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let F=B.slice(V[0].length).trim();if(!F)continue;try{let O=d0(F,Z),_=JSON.stringify(O),L=`@component('${j}', ${_})`;Q.push({start:G,end:H,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];X=X.substring(0,z)+q+X.substring(K)}return X}function C9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1,W=null,H=!1;while(q<X.length&&K>0){let B=X[q];if(H){H=!1,q++;continue}if(B==="\\"&&W){H=!0,q++;continue}if(W){if(B===W)W=null;q++;continue}if(B==='"'||B==="'"||B==="`"){W=B,q++;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=X.substring(z+1,q),j=J(U);X=X.substring(0,G)+j+X.substring(q+1)}return X}function zG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);w6(Q);let q=U0(Q,G)(...z),W=JSON.stringify(q);if(W===void 0){if(!E9(Q).some((j)=>!(j in Z)))return"";return X}let H=Buffer.from(W,"utf8").toString("base64");return`__stx_${Y}="${H}"`}catch(G){return X}}),J}var S9="<!--__STX_BREAK__-->",P9="<!--__STX_CONTINUE__-->";function KG($,Z){let J=$;return J=C9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?S9:""}catch{return""}}),J=C9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?P9:""}catch{return""}}),J}function qG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,S9),Z=Z.replace(/@continue(?!\()/g,P9),Z}function O6($){let Z=$.includes(S9),J=Z?$.substring(0,$.indexOf(S9)):$;return{hasBreak:Z,content:J}}function F6($){let Z=$.includes(P9),J=Z?$.substring(0,$.indexOf(P9)):$;return{hasContinue:Z,content:J}}function R6($){let Z=$;return Z=C9(Z,"@break",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=C9(Z,"@continue",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function WG($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,H)=>W.pos-H.pos);let z=[],K=0;for(let W of X)K+=W.delta,z.push({pos:W.pos,depth:K});function q(W){let H=0,U=z.length-1,j=0;while(H<=U){let B=H+U>>1;if(z[B].pos<=W)j=z[B].depth,H=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let W=J.index,H=J.index+J[0].length-1,U=1,j=H+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(H+1,B),F=a1(V);if(!F)continue;let{arrayExpr:O,itemVar:_}=F,L=B+1,w=1,R=L,D=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){D.lastIndex=R,N.lastIndex=R;let S=D.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)w++,R=S.index+S[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let M=$.substring(L,T),I=T+11,k=-1,A=0,E=0;while(E<M.length){let S=M.indexOf("@",E);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))A++,E=S+1;else if(b.startsWith("@endforelse"))A--,E=S+11;else if(A===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){k=S;break}E=S+1}else E=S+1}if(k===-1)continue;return{start:W,end:I,arrayExpr:O,itemVar:_,foreachContent:M.substring(0,k),emptyContent:M.substring(k+6)}}return null}function _6($,Z){let J=$;while(!0){let X=WG(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let W;if(B0(G))W=U0(G,Object.keys(Z))(...Object.values(Z));else W=X0(G,Z);let H;if(!Array.isArray(W)||W.length===0)H=q;else H=`@foreach (${G} as ${z})${K}@endforeach`;J=J.substring(0,Y)+H+J.substring(Q)}catch(W){let H=W instanceof Error?W.message:String(W),U=N0("Forelse",`Error in @forelse(${G} as ${z}): ${H}`,D0.EVALUATION_ERROR);J=J.substring(0,Y)+U+J.substring(Q)}}return J}var D6="<!--stx:foreach-not-iterable:",HG=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function UG($,Z){return`${D6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function jG($,Z){console.warn(`[stx] @foreach(${$}) in ${Z}: ${$} 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 y$($){if(!$.includes(D6))return $;return $.replace(HG,(Z,J,X)=>{return jG(decodeURIComponent(J),decodeURIComponent(X)),""})}function N6($,Z,J,X,Y=!1){let Q=$;Q=_6(Q,Z);function G(q){let W=/@foreach\s*\(/g,H;while((H=W.exec(q))!==null){let U=H.index,j=H.index+H[0].length-1,B=1,V=j+1,F=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){F=V;break}}V++}if(F===-1)continue;let O=q.substring(j+1,F),_=a1(O);if(!_)continue;let L=U,{arrayExpr:w,itemVar:R}=_,D=F+1,N=1,T=D,M=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&T<q.length){M.lastIndex=T,I.lastIndex=T;let k=M.exec(q),A=I.exec(q);if(!A)break;if(k&&k.index<A.index)N++,T=k.index+k[0].length;else{if(N--,N===0){let E=q.substring(D,A.index),S=A.index+11;return{start:L,end:S,arrayExpr:w,itemVar:R,content:E}}T=A.index+11}}}return null}function z(q,W){let H=q;while(!0){let U=G(H);if(!U)break;let{start:j,end:B,arrayExpr:V,itemVar:F,content:O}=U;try{let _=V.trim(),L;if(B0(_))L=U0(_,Object.keys(W))(...Object.values(W));else L=X0(_,W);let w=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),w=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),w=!0;else{let A=UG(_,J)+N0("Foreach",`Error in @foreach: ${_} is not iterable`,D0.TYPE_ERROR);H=H.substring(0,j)+A+H.substring(B);continue}let R=X?.loops?.useAltLoopVariable??YG,D=F.trim(),N=null,T,M=!1;if(D.includes("=>")){let A=D.split("=>").map((E)=>E.trim());if(A.length===2&&A[0]&&A[1])N=A[0],T=A[1];else T=D}else if(!D.startsWith("[")&&!D.startsWith("{")&&D.includes(",")){let A=D.split(",").map((E)=>E.trim());if(A.length===2&&A[0]&&A[1])T=A[0],N=A[1],M=!0;else T=D}else T=D;let I="",k=L;for(let A=0;A<k.length;A++){let E=k[A],S={index:A,iteration:A+1,first:A===0,last:A===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(T.startsWith("[")&&T.endsWith("]")){let p=T.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(E))p.forEach((u,o)=>{if(u)b[u]=E[o]});else b[T]=E}else if(T.startsWith("{")&&T.endsWith("}")){let p=T.slice(1,-1).split(",").map((u)=>u.trim()).filter(Boolean);if(E!==null&&typeof E==="object")p.forEach((u)=>{let o=u.indexOf(":"),$0=(o===-1?u:u.slice(0,o)).trim(),Y0=o===-1?$0:u.slice(o+1).trim();if($0&&Y0)b[Y0]=E[$0]});else b[T]=E}else b[T]=E;if(N)if(!M&&w&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[T]=E[1];else b[N]=A;let y=KG(O,b),P=F6(y);if(P.hasContinue){I+=P.content;continue}let h=O6(y);if(h.hasBreak){I+=h.content;break}if(y=_6(y,b),y=z(y,b),y=t0(y,b,J),y=qG(y),h=O6(y),h.hasBreak){I+=h.content;break}if(P=F6(y),P.hasContinue){I+=P.content;continue}y=F1(y,b,J),y=zG(y,b),y=GG(y,b),y=QG(y,b),I+=y}H=H.substring(0,j)+I+H.substring(B)}catch(_){let L=N0("Foreach",`Error in @foreach(${V.trim()} as ${F.trim()}): ${_ instanceof Error?_.message:String(_)}`,D0.EVALUATION_ERROR);H=H.substring(0,j)+L+H.substring(B)}}return H}Q=z(Q,Z),Q=A6(Q,Z,J,X);let K=X?.loops?.maxWhileIterations??XG;return Q=OG(Q,Z,K),Y?Q:y$(Q)}function BG($){let Z=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec($);if(!Z||/^(?:const|let|var)$/.test(Z[2]))return $;return`${Z[1]}let ${$.slice(Z[1].length)}`}function M6($){return b9($)}function A6($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,q=M0(Y,"(",")",K);if(q===-1)break;let W=BG(Y.slice(K+1,q)),H=q+1,U=L9(Y.slice(z),"for","endfor");if(U.length===0)break;let j=U[0].content,B=z+U[0].end;if(!M6(W)){let V=N0("For",`Unsafe expression in @for: ${W}`,D0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=VG(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&F){let D=LG({forExpr:W,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+D+Y.substring(B),Q=!0;continue}let O=Object.keys(Z),_=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,N)=>{return`\${${N}}`});L=R6(L);let R=Function(...O,`
|
|
3414
|
+
`,R=Function(...j,L)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(q,"")}catch(U){console.error(`Error executing ${X} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=O0(`${X} Directive`,`Error executing code: ${j}`,J,$,H,q);console.error(B),Q=Q.replace(q,"")}return Q}function a1($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}var YG=1000,QG=!1;function GG($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),K=M0($,"(",")",z);if(K===-1)continue;let q=$.slice(G,K).trim();if(!q)continue;if(!Object.keys(Z).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let H;try{let U=d0(q,Z);if(!U||typeof U!=="object")continue;H=JSON.stringify(U)}catch{continue}X+=$.slice(Y,G)+H,Y=K,J.lastIndex=K}return Y===0?$:X+$.slice(Y)}function zG($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,K=1,q=z+1;while(q<X.length&&K>0){if(X[q]==="(")K++;else if(X[q]===")"){if(K--,K===0)break}q++}if(K!==0)continue;let W=X.substring(z+1,q),H=q+1,U=W.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=W.slice(U[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let F=B.slice(V[0].length).trim();if(!F)continue;try{let O=d0(F,Z),_=JSON.stringify(O),L=`@component('${j}', ${_})`;Q.push({start:G,end:H,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];X=X.substring(0,z)+q+X.substring(K)}return X}function C9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,K=1,q=z+1,W=null,H=!1;while(q<X.length&&K>0){let B=X[q];if(H){H=!1,q++;continue}if(B==="\\"&&W){H=!0,q++;continue}if(W){if(B===W)W=null;q++;continue}if(B==='"'||B==="'"||B==="`"){W=B,q++;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=X.substring(z+1,q),j=J(U);X=X.substring(0,G)+j+X.substring(q+1)}return X}function KG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);w6(Q);let q=U0(Q,G)(...z),W=JSON.stringify(q);if(W===void 0){if(!E9(Q).some((j)=>!(j in Z)))return"";return X}let H=Buffer.from(W,"utf8").toString("base64");return`__stx_${Y}="${H}"`}catch(G){return X}}),J}var S9="<!--__STX_BREAK__-->",P9="<!--__STX_CONTINUE__-->";function qG($,Z){let J=$;return J=C9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?S9:""}catch{return""}}),J=C9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(B0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?P9:""}catch{return""}}),J}function WG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,S9),Z=Z.replace(/@continue(?!\()/g,P9),Z}function O6($){let Z=$.includes(S9),J=Z?$.substring(0,$.indexOf(S9)):$;return{hasBreak:Z,content:J}}function F6($){let Z=$.includes(P9),J=Z?$.substring(0,$.indexOf(P9)):$;return{hasContinue:Z,content:J}}function R6($){let Z=$;return Z=C9(Z,"@break",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=C9(Z,"@continue",(J)=>{let X=J.trim();if(!b9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function HG($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,H)=>W.pos-H.pos);let z=[],K=0;for(let W of X)K+=W.delta,z.push({pos:W.pos,depth:K});function q(W){let H=0,U=z.length-1,j=0;while(H<=U){let B=H+U>>1;if(z[B].pos<=W)j=z[B].depth,H=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let W=J.index,H=J.index+J[0].length-1,U=1,j=H+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(H+1,B),F=a1(V);if(!F)continue;let{arrayExpr:O,itemVar:_}=F,L=B+1,w=1,R=L,D=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){D.lastIndex=R,N.lastIndex=R;let S=D.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)w++,R=S.index+S[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let M=$.substring(L,T),I=T+11,k=-1,A=0,E=0;while(E<M.length){let S=M.indexOf("@",E);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))A++,E=S+1;else if(b.startsWith("@endforelse"))A--,E=S+11;else if(A===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){k=S;break}E=S+1}else E=S+1}if(k===-1)continue;return{start:W,end:I,arrayExpr:O,itemVar:_,foreachContent:M.substring(0,k),emptyContent:M.substring(k+6)}}return null}function _6($,Z){let J=$;while(!0){let X=HG(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:q}=X;try{let W;if(B0(G))W=U0(G,Object.keys(Z))(...Object.values(Z));else W=X0(G,Z);let H;if(!Array.isArray(W)||W.length===0)H=q;else H=`@foreach (${G} as ${z})${K}@endforeach`;J=J.substring(0,Y)+H+J.substring(Q)}catch(W){let H=W instanceof Error?W.message:String(W),U=N0("Forelse",`Error in @forelse(${G} as ${z}): ${H}`,D0.EVALUATION_ERROR);J=J.substring(0,Y)+U+J.substring(Q)}}return J}var D6="<!--stx:foreach-not-iterable:",UG=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function jG($,Z){return`${D6}${encodeURIComponent($)}|${encodeURIComponent(Z)}-->`}function BG($,Z){console.warn(`[stx] @foreach(${$}) in ${Z}: ${$} 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 y$($){if(!$.includes(D6))return $;return $.replace(UG,(Z,J,X)=>{return BG(decodeURIComponent(J),decodeURIComponent(X)),""})}function N6($,Z,J,X,Y=!1){let Q=$;Q=_6(Q,Z);function G(q){let W=/@foreach\s*\(/g,H;while((H=W.exec(q))!==null){let U=H.index,j=H.index+H[0].length-1,B=1,V=j+1,F=-1;while(V<q.length&&B>0){if(q[V]==="(")B++;else if(q[V]===")"){if(B--,B===0){F=V;break}}V++}if(F===-1)continue;let O=q.substring(j+1,F),_=a1(O);if(!_)continue;let L=U,{arrayExpr:w,itemVar:R}=_,D=F+1,N=1,T=D,M=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&T<q.length){M.lastIndex=T,I.lastIndex=T;let k=M.exec(q),A=I.exec(q);if(!A)break;if(k&&k.index<A.index)N++,T=k.index+k[0].length;else{if(N--,N===0){let E=q.substring(D,A.index),S=A.index+11;return{start:L,end:S,arrayExpr:w,itemVar:R,content:E}}T=A.index+11}}}return null}function z(q,W){let H=q;while(!0){let U=G(H);if(!U)break;let{start:j,end:B,arrayExpr:V,itemVar:F,content:O}=U;try{let _=V.trim(),L;if(B0(_))L=U0(_,Object.keys(W))(...Object.values(W));else L=X0(_,W);let w=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),w=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),w=!0;else{let A=jG(_,J)+N0("Foreach",`Error in @foreach: ${_} is not iterable`,D0.TYPE_ERROR);H=H.substring(0,j)+A+H.substring(B);continue}let R=X?.loops?.useAltLoopVariable??QG,D=F.trim(),N=null,T,M=!1;if(D.includes("=>")){let A=D.split("=>").map((E)=>E.trim());if(A.length===2&&A[0]&&A[1])N=A[0],T=A[1];else T=D}else if(!D.startsWith("[")&&!D.startsWith("{")&&D.includes(",")){let A=D.split(",").map((E)=>E.trim());if(A.length===2&&A[0]&&A[1])T=A[0],N=A[1],M=!0;else T=D}else T=D;let I="",k=L;for(let A=0;A<k.length;A++){let E=k[A],S={index:A,iteration:A+1,first:A===0,last:A===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(T.startsWith("[")&&T.endsWith("]")){let p=T.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(E))p.forEach((u,o)=>{if(u)b[u]=E[o]});else b[T]=E}else if(T.startsWith("{")&&T.endsWith("}")){let p=T.slice(1,-1).split(",").map((u)=>u.trim()).filter(Boolean);if(E!==null&&typeof E==="object")p.forEach((u)=>{let o=u.indexOf(":"),$0=(o===-1?u:u.slice(0,o)).trim(),Y0=o===-1?$0:u.slice(o+1).trim();if($0&&Y0)b[Y0]=E[$0]});else b[T]=E}else b[T]=E;if(N)if(!M&&w&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[T]=E[1];else b[N]=A;let y=qG(O,b),P=F6(y);if(P.hasContinue){I+=P.content;continue}let h=O6(y);if(h.hasBreak){I+=h.content;break}if(y=_6(y,b),y=z(y,b),y=t0(y,b,J),y=WG(y),h=O6(y),h.hasBreak){I+=h.content;break}if(P=F6(y),P.hasContinue){I+=P.content;continue}y=F1(y,b,J),y=KG(y,b),y=zG(y,b),y=GG(y,b),I+=y}H=H.substring(0,j)+I+H.substring(B)}catch(_){let L=N0("Foreach",`Error in @foreach(${V.trim()} as ${F.trim()}): ${_ instanceof Error?_.message:String(_)}`,D0.EVALUATION_ERROR);H=H.substring(0,j)+L+H.substring(B)}}return H}Q=z(Q,Z),Q=A6(Q,Z,J,X);let K=X?.loops?.maxWhileIterations??YG;return Q=FG(Q,Z,K),Y?Q:y$(Q)}function VG($){let Z=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec($);if(!Z||/^(?:const|let|var)$/.test(Z[2]))return $;return`${Z[1]}let ${$.slice(Z[1].length)}`}function M6($){return b9($)}function A6($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,q=M0(Y,"(",")",K);if(q===-1)break;let W=VG(Y.slice(K+1,q)),H=q+1,U=L9(Y.slice(z),"for","endfor");if(U.length===0)break;let j=U[0].content,B=z+U[0].end;if(!M6(W)){let V=N0("For",`Unsafe expression in @for: ${W}`,D0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=LG(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&F){let D=OG({forExpr:W,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+D+Y.substring(B),Q=!0;continue}let O=Object.keys(Z),_=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,N)=>{return`\${${N}}`});L=R6(L);let R=Function(...O,`
|
|
3415
3415
|
let result = '';
|
|
3416
3416
|
for (${W}) {
|
|
3417
3417
|
result += \`${L}\`;
|
|
3418
3418
|
}
|
|
3419
3419
|
return result;
|
|
3420
|
-
`)(..._);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(V){let F=N0("For",`Error in @for(${W}): ${V instanceof Error?V.message:String(V)}`,D0.EVALUATION_ERROR);Y=Y.substring(0,z)+F+Y.substring(B),Q=!0}}return Y}function
|
|
3420
|
+
`)(..._);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(V){let F=N0("For",`Error in @for(${W}): ${V instanceof Error?V.message:String(V)}`,D0.EVALUATION_ERROR);Y=Y.substring(0,z)+F+Y.substring(B),Q=!0}}return Y}function LG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((z)=>{let K=z.trim();if(!K)return"";let q=K.indexOf(":");if(q>=0&&Q.startsWith("{")){let U=K.slice(q+1).trim(),j=U.indexOf("=");return(j>=0?U.slice(0,j):U).trim()}let W=K.indexOf("="),H=(W>=0?K.slice(0,W):K).trim();return/^[A-Za-z_$][\w$]*$/.test(H)?H:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function OG($){let{forExpr:Z,content:J,iterVarNames:X,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),K=Object.values(Y),q=Function(...z,"__pushIter",`
|
|
3421
3421
|
for (${Z}) {
|
|
3422
3422
|
__pushIter([${X.join(", ")}])
|
|
3423
3423
|
}
|
|
3424
|
-
`),W=[];q(...K,(j)=>{W.push(j)});let H=Q??"inline.stx",U="";for(let j of W){let B={...Y};X.forEach((F,O)=>{B[F]=j[O]});let V=A6(J,B,Q,G);V=t0(V,B,H),V=F1(V,B,H),U+=V}return U}function
|
|
3424
|
+
`),W=[];q(...K,(j)=>{W.push(j)});let H=Q??"inline.stx",U="";for(let j of W){let B={...Y};X.forEach((F,O)=>{B[F]=j[O]});let V=A6(J,B,Q,G);V=t0(V,B,H),V=F1(V,B,H),U+=V}return U}function FG($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,K=M0(X,"(",")",z);if(K===-1)break;let q=X.slice(z+1,K),W=L9(X.slice(G),"while","endwhile");if(W.length===0)break;let H=W[0].content,U=G+W[0].end;if(!M6(q)){let j=N0("While",`Unsafe expression in @while: ${q}`,D0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(U),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(_,L)=>{return`\${${L}}`});V=R6(V);let O=Function(...j,`
|
|
3425
3425
|
let result = '';
|
|
3426
3426
|
let maxIterations = ${J}; // Configurable safety limit
|
|
3427
3427
|
let counter = 0;
|
|
@@ -3433,25 +3433,172 @@ ${Y}
|
|
|
3433
3433
|
result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3434
3434
|
}
|
|
3435
3435
|
return result;
|
|
3436
|
-
`)(...B);X=X.substring(0,G)+O+X.substring(U),Y=!0}catch(j){let B=N0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,D0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(U),Y=!0}}return X}function
|
|
3436
|
+
`)(...B);X=X.substring(0,G)+O+X.substring(U),Y=!0}catch(j){let B=N0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,D0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(U),Y=!0}}return X}function _G($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function I6($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return _G(X,Q||"_method")})}async function T6($,Z,J,X,Y){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let K=await z.handler(Q,Z,J,X);if(typeof K==="string")Q=K;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(K){if(X.debug)console.error(`Error in middleware ${z.name}:`,K);if(X.debug){let q=O0("Middleware",`Error in middleware '${z.name}': ${K instanceof Error?K.message:String(K)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
3437
3437
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${W5(q)}</div>
|
|
3438
|
-
`)}}}return Q}async function k6($,Z,J,X){return T6($,Z,J,X,"before")}async function E6($,Z,J,X){return T6($,Z,J,X,"after")}O2();O2();function y6($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?d0(Y,{}):{};return b$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function
|
|
3438
|
+
`)}}}return Q}async function k6($,Z,J,X){return T6($,Z,J,X,"before")}async function E6($,Z,J,X){return T6($,Z,J,X,"after")}O2();O2();function y6($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?d0(Y,{}):{};return b$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function EV($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function yV($,Z){let J=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:J,callback:Z})}async function b6($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(l0.exact[$])for(let X of l0.exact[$])await Promise.resolve(X(Z,$));if(l0.exact[J])for(let X of l0.exact[J])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Y}of l0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Y(Z,$))}function bV(){l0.patterns=[],l0.exact={}}var wG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),RG=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 C1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let X=J.exec($);if(!X)return null;let Y=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&wG.has(X[1]),Q=Y?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:Y,start:X.index,end:X.index+X[0].length}}function DG($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),K=G.exec($);if(!K)return-1;if(z&&z.index<K.index)X++,Y=z.index+z[0].length;else{if(X--,X===0)return K.index+K[0].length;Y=K.index+K[0].length}}return-1}function b1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=DG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function C6($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function v2($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function W1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function t1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function NG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function MG($){let Z=$,J=0;while(J<Z.length){let X=C1(Z,J);if(!X)break;let Y=v2(X.attrs,"v-for");if(Y===null){J=X.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=X.end;continue}let G=Q[1].trim(),z=Q[2].trim(),K;if(G.includes(",")){let F=G.split(",").map((L)=>L.trim()),O=F[0],_=F[1];K=`${z} as ${_} => ${O}`}else K=`${z} as ${G}`;let q=W1(X.attrs,"v-for"),W=W1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),H=b1(Z,X),U=Z.slice(H.outerStart,H.outerEnd),j=t1(U,{...X,start:0,end:X.end-X.start},W),B=`@foreach(${K})
|
|
3439
3439
|
`,V=`${B}${j}
|
|
3440
|
-
@endforeach`;Z=Z.slice(0,H.outerStart)+V+Z.slice(H.outerEnd),J=H.outerStart+B.length}return Z}function
|
|
3440
|
+
@endforeach`;Z=Z.slice(0,H.outerStart)+V+Z.slice(H.outerEnd),J=H.outerStart+B.length}return Z}function AG($){let Z=$,J=0;while(J<Z.length){let X=C1(Z,J);if(!X)break;let Y=v2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=b1(Z,X),z=W1(X.attrs,"v-if"),K=t1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:K,parsedTag:X});let q=G.outerEnd,W=!0;while(W){let V=Z.slice(q).match(/^\s*/),F=V?V[0].length:0,O=C1(Z,q+F);if(!O){W=!1;break}let _=v2(O.attrs,"v-else-if"),L=C6(O.attrs,"v-else");if(_!==null){let w=b1(Z,O),R=W1(O.attrs,"v-else-if"),D=t1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else-if",expr:_,outerStart:q,outerEnd:w.outerEnd,element:D,parsedTag:O}),q=w.outerEnd}else if(L){let w=b1(Z,O),R=W1(O.attrs,"v-else"),D=t1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:D,parsedTag:O}),W=!1}else W=!1}let H=[];for(let V of Q)if(V.type==="if")H.push(`@if(${V.expr})
|
|
3441
3441
|
${V.element}`);else if(V.type==="else-if")H.push(`@elseif(${V.expr})
|
|
3442
3442
|
${V.element}`);else H.push(`@else
|
|
3443
3443
|
${V.element}`);H.push("@endif");let U=H.join(`
|
|
3444
|
-
`),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function
|
|
3444
|
+
`),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function IG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function TG($){let Z=$,J=0;while(J<Z.length){let X=C1(Z,J);if(!X)break;let Y=RG.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,K,q)=>{let W=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(K);if(!W||!q||!/^["']/.test(q))return z;let H=W[1]||"modelValue",U=W[2];if(Y&&!W[1])return`@model${U}=${q}`;let j=q[0],B=q.slice(1,-1),V=`:${H}=${q} @update:${H}=${j}${B} = $event${j}`;if(U){let F=W[1]?`${H}Modifiers`:"modelModifiers",O=U.slice(1).split(".").map((_)=>`${_}: true`).join(", ");V+=` :${F}="{ ${O} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=t1(X.full,{...X,start:0,end:X.full.length},Q);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function kG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function EG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function yG($){let Z=$,J=0;while(J<Z.length){let X=C1(Z,J);if(!X)break;let Y=v2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=b1(Z,X),G=W1(X.attrs,"v-html"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{!! ${Y} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function bG($){let Z=$,J=0;while(J<Z.length){let X=C1(Z,J);if(!X)break;let Y=v2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=b1(Z,X),G=W1(X.attrs,"v-text"),z=X.selfClosing?" /":"",K=`<${X.tag}${G}${z}>{{ ${Y} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function CG($){return $.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 SG($){let Z=$,J=0;while(J<Z.length){let X=C1(Z,J);if(!X)break;if(!C6(X.attrs,"v-once")){J=X.end;continue}let Y=W1(X.attrs,"v-once"),Q=b1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),K=`@once
|
|
3445
3445
|
${t1(G,{...X,start:0,end:X.end-X.start},Y)}
|
|
3446
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function
|
|
3447
|
-
${X}${$.slice(J)}`}var P$=x2,
|
|
3448
|
-
${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function l6($){return nG(
|
|
3449
|
-
${Z[0]}${X.slice(Y)}`}var
|
|
3450
|
-
<meta name="stx-build" content="${Z}">`}
|
|
3451
|
-
|
|
3446
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+K+Z.slice(Q.outerEnd),J=Q.outerStart+K.length}return Z}function PG($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function vG($){return $.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 S6($){if(!NG($))return $;let Z=$;return Z=MG(Z),Z=AG(Z),Z=SG(Z),Z=kG(Z),Z=EG(Z),Z=TG(Z),Z=IG(Z),Z=vG(Z),Z=yG(Z),Z=bG(Z),Z=CG(Z),Z=PG(Z),Z}function v9($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var C$=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"]),xG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function P6($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=X0(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return C$.has(Q)?Q:null}function v6($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function x6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(xG.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function f6($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let q=z.length-1;q>=0;q--){let W=z[q];try{let H=P6(W.expr,Z);if(!H||typeof H!=="string"){let _=`<!-- dynamic component: could not resolve "${v9(v6(W.expr))}" -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length);continue}if(C$.has(H)){let _=x6(H,W.attrs,W.slotContent);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length);continue}let U=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,V;while((V=B.exec(U))!==null){let _=V[1]||V[2],L=V[3];if(V[1])try{j[_]=X0(L,Z)}catch{j[_]=L}else j[_]=L}let F=X.componentsDir||"components",O=await k1(H,j,W.slotContent,F,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length)}catch(H){let U=H instanceof Error?H.message:String(H),j=`<!-- dynamic component error: ${v9(U)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q=await fG(Q,Z,J,X,Y),Q}async function fG($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],K;while((K=G.exec(Q))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let q=z.length-1;q>=0;q--){let W=z[q];try{let H=P6(W.expr,Z);if(!H||typeof H!=="string"){let B=`<!-- dynamic component: could not resolve "${v9(v6(W.expr))}" -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}if(C$.has(H)){let B=x6(H,W.attrs,"");Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}let U=X.componentsDir||"components",j=await k1(H,{},"",U,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}catch(H){let U=H instanceof Error?H.message:String(H),j=`<!-- dynamic component error: ${v9(U)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q}function S$(){return{afterOpen:[],beforeClose:[]}}function gG($){return $.afterOpen.length>0||$.beforeClose.length>0}function h6($,Z){if(!gG(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?x2($):null,G=X&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${J}${$.slice(Q,G)}${X}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${J}${$.slice(Q)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var g6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function x2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;g6.lastIndex=J;let X=g6.exec($);return X?J+X[0].length:J}var v$="data-stx-color-mode-boot",hG="__STX_COLOR_MODE__",uG=new Set(["light","dark","auto","system"]),mG=new Set(["auto","system"]),dG=/^[a-z][\w:-]*$/i,lG=/^[\w-]+$/;function cG($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!uG.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!lG.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!dG.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!mG.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:X,attribute:Y,autoValue:Q}}function pG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function x$($={}){let Z=cG($),X=`(function(){"use strict";var c=${pG(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${hG}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${v$}>${X}</script>`}function d6($,Z={}){if($.includes(v$))return $;let J=P$($);if(J===null)return $;let X=x$(Z);return`${$.slice(0,J)}
|
|
3447
|
+
${X}${$.slice(J)}`}var P$=x2,iG=new RegExp(`<script\\b[^>]*\\b${v$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),u6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,m6=/<\/head>/gi;function nG($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;m6.lastIndex=J;let X=m6.exec($),Y=X?X.index:$.length;u6.lastIndex=J;let Q=u6.exec($);if(!Q||Q.index>=Y)return $;if($.slice(J,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,J)}
|
|
3448
|
+
${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function l6($){return sG(nG($))}function sG($){let Z=iG.exec($);if(!Z)return $;let J=P$($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=P$(X);if(Y===null)return $;return`${X.slice(0,Y)}
|
|
3449
|
+
${Z[0]}${X.slice(Y)}`}var mV="stx-build",dV="X-STX-Build",f2=Symbol.for("stx.buildId");function c6(){let $=globalThis;if(!$[f2])$[f2]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return $[f2]}function lV($){let Z=globalThis;if($===null)delete Z[f2];else Z[f2]=$}function cV($,Z=c6()){let J=f$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Y=X.index+X[0].length;return`${$.slice(0,Y)}${J}${$.slice(Y)}`}function f$($,Z=c6()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
|
|
3450
|
+
<meta name="stx-build" content="${Z}">`}var iV="/_stx/sw.js",p6="<script data-stx-offline>if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('/_stx/sw.js',{scope:'/'}).catch(function(){})})}</script>";function nV($,Z){let J={build:String(Z||"dev"),pages:Array.from(new Set(($.pages||[]).filter((X)=>typeof X==="string"&&X.startsWith("/")))),api:$.apiPrefix||"/api/",timeout:Math.max(500,Number($.networkTimeoutMs)||3500),fallback:$.fallback||$.pages&&$.pages[0]||null,exclude:["/_stx/hmr","/_stx/sw.js",...$.exclude||[]]};return`/* stx offline worker, build ${J.build} */
|
|
3451
|
+
'use strict';
|
|
3452
|
+
var S = ${JSON.stringify(J)};
|
|
3453
|
+
var SHELL = 'stx-shell-' + S.build;
|
|
3454
|
+
var ASSETS = 'stx-assets';
|
|
3455
|
+
var DATA = 'stx-data';
|
|
3456
|
+
var FRAGMENT = 'X-STX-Router';
|
|
3457
|
+
|
|
3458
|
+
function variantUrl(url, fragment) {
|
|
3459
|
+
var u = new URL(url, self.location.origin);
|
|
3460
|
+
u.hash = '';
|
|
3461
|
+
if (fragment) u.searchParams.set('__stx_fragment', '1');
|
|
3462
|
+
return u.toString();
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
function isFragment(request) {
|
|
3466
|
+
return request.headers.get(FRAGMENT) === 'true';
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
function withTimeout(promise, ms) {
|
|
3470
|
+
return new Promise(function (resolve, reject) {
|
|
3471
|
+
var timer = setTimeout(function () { reject(new Error('timeout')); }, ms);
|
|
3472
|
+
promise.then(function (value) { clearTimeout(timer); resolve(value); }, function (error) { clearTimeout(timer); reject(error); });
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
function hashOf(text) {
|
|
3477
|
+
if (!text) return Promise.resolve('anon');
|
|
3478
|
+
return crypto.subtle.digest('SHA-256', new TextEncoder().encode(text)).then(function (buffer) {
|
|
3479
|
+
return Array.from(new Uint8Array(buffer)).slice(0, 12).map(function (byte) { return byte.toString(16).padStart(2, '0'); }).join('');
|
|
3480
|
+
});
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
function precache() {
|
|
3484
|
+
return caches.open(SHELL).then(function (cache) {
|
|
3485
|
+
return Promise.all(S.pages.map(function (page) {
|
|
3486
|
+
return Promise.all([false, true].map(function (fragment) {
|
|
3487
|
+
var headers = fragment ? { 'X-STX-Router': 'true', 'Accept': 'text/html' } : { 'Accept': 'text/html' };
|
|
3488
|
+
return fetch(page, { headers: headers, credentials: 'same-origin' }).then(function (response) {
|
|
3489
|
+
if (response.ok && !response.redirected) return cache.put(variantUrl(page, fragment), response);
|
|
3490
|
+
}).catch(function () {});
|
|
3491
|
+
}));
|
|
3492
|
+
}));
|
|
3493
|
+
});
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3496
|
+
self.addEventListener('install', function (event) {
|
|
3497
|
+
event.waitUntil(precache().then(function () { return self.skipWaiting(); }));
|
|
3498
|
+
});
|
|
3499
|
+
|
|
3500
|
+
self.addEventListener('activate', function (event) {
|
|
3501
|
+
event.waitUntil(caches.keys().then(function (keys) {
|
|
3502
|
+
return Promise.all(keys.filter(function (key) { return key.indexOf('stx-shell-') === 0 && key !== SHELL; }).map(function (key) { return caches.delete(key); }));
|
|
3503
|
+
}).then(function () { return self.clients.claim(); }));
|
|
3504
|
+
});
|
|
3505
|
+
|
|
3506
|
+
self.addEventListener('message', function (event) {
|
|
3507
|
+
if (event.data && event.data.type === 'stx:clear-offline-data') {
|
|
3508
|
+
event.waitUntil(caches.delete(DATA));
|
|
3509
|
+
}
|
|
3510
|
+
});
|
|
3511
|
+
|
|
3512
|
+
function pageResponse(request) {
|
|
3513
|
+
var fragment = isFragment(request);
|
|
3514
|
+
var key = variantUrl(request.url, fragment);
|
|
3515
|
+
var network = fetch(request).then(function (response) {
|
|
3516
|
+
// Only a page that is what was asked for: a redirect (to a sign-in page)
|
|
3517
|
+
// or an error is not kept as this screen.
|
|
3518
|
+
if (response.ok && !response.redirected && response.type === 'basic') {
|
|
3519
|
+
var copy = response.clone();
|
|
3520
|
+
caches.open(SHELL).then(function (cache) { cache.put(key, copy); });
|
|
3521
|
+
}
|
|
3522
|
+
return response;
|
|
3523
|
+
});
|
|
3524
|
+
return withTimeout(network, S.timeout).catch(function () {
|
|
3525
|
+
return caches.open(SHELL).then(function (cache) {
|
|
3526
|
+
return cache.match(key).then(function (hit) {
|
|
3527
|
+
if (hit) return hit;
|
|
3528
|
+
// Slower than the timeout but still coming: wait for it rather than fail.
|
|
3529
|
+
return network.catch(function () {
|
|
3530
|
+
if (!S.fallback || fragment) return Response.error();
|
|
3531
|
+
return cache.match(variantUrl(S.fallback, false)).then(function (fallback) { return fallback || Response.error(); });
|
|
3532
|
+
});
|
|
3533
|
+
});
|
|
3534
|
+
});
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
function assetResponse(request) {
|
|
3539
|
+
return caches.open(ASSETS).then(function (cache) {
|
|
3540
|
+
return cache.match(request).then(function (hit) {
|
|
3541
|
+
var network = fetch(request).then(function (response) {
|
|
3542
|
+
if (response.ok && response.type === 'basic') cache.put(request, response.clone());
|
|
3543
|
+
return response;
|
|
3544
|
+
});
|
|
3545
|
+
if (hit) {
|
|
3546
|
+
network.catch(function () {});
|
|
3547
|
+
return hit;
|
|
3548
|
+
}
|
|
3549
|
+
return network;
|
|
3550
|
+
});
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
function apiResponse(request) {
|
|
3555
|
+
return hashOf(request.headers.get('Authorization') || '').then(function (who) {
|
|
3556
|
+
var u = new URL(request.url);
|
|
3557
|
+
u.searchParams.set('__stx_who', who);
|
|
3558
|
+
var key = u.toString();
|
|
3559
|
+
var network = fetch(request).then(function (response) {
|
|
3560
|
+
if (response.ok) {
|
|
3561
|
+
var copy = response.clone();
|
|
3562
|
+
caches.open(DATA).then(function (cache) { cache.put(key, copy); });
|
|
3563
|
+
}
|
|
3564
|
+
return response;
|
|
3565
|
+
});
|
|
3566
|
+
return withTimeout(network, S.timeout).catch(function () {
|
|
3567
|
+
return caches.open(DATA).then(function (cache) {
|
|
3568
|
+
return cache.match(key).then(function (hit) {
|
|
3569
|
+
return hit || network;
|
|
3570
|
+
});
|
|
3571
|
+
});
|
|
3572
|
+
});
|
|
3573
|
+
});
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
self.addEventListener('fetch', function (event) {
|
|
3577
|
+
var request = event.request;
|
|
3578
|
+
if (request.method !== 'GET') return;
|
|
3579
|
+
var url = new URL(request.url);
|
|
3580
|
+
if (url.origin !== self.location.origin) return;
|
|
3581
|
+
for (var i = 0; i < S.exclude.length; i++) {
|
|
3582
|
+
if (url.pathname.indexOf(S.exclude[i]) === 0) return;
|
|
3583
|
+
}
|
|
3584
|
+
if (url.pathname.indexOf(S.api) === 0) {
|
|
3585
|
+
event.respondWith(apiResponse(request));
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
if (url.pathname.indexOf('/_stx/') === 0 || url.pathname.indexOf('/assets/') === 0 || /\\.(?:js|css|woff2?|png|jpe?g|webp|avif|svg|ico)$/.test(url.pathname)) {
|
|
3589
|
+
event.respondWith(assetResponse(request));
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
var accept = request.headers.get('Accept') || '';
|
|
3593
|
+
if (request.mode === 'navigate' || isFragment(request) || accept.indexOf('text/html') !== -1) {
|
|
3594
|
+
event.respondWith(pageResponse(request));
|
|
3595
|
+
}
|
|
3596
|
+
});
|
|
3597
|
+
`}import{AsyncLocalStorage as oG}from"async_hooks";var i6=new oG;function g$($){return $.__stx_server_data??={pending:new Map,values:new Map}}function n6($,Z){return i6.run(g$($),Z)}async function s6($,Z){let J=i6.getStore();if(!J)throw Error("useServerData must run inside a <script server> render");if(typeof $!=="string"||!$.trim())throw TypeError("useServerData requires a non-empty string key");let X=J.pending.get($);if(X)return X;let Y=Promise.resolve().then(Z).then((Q)=>{let G=JSON.stringify(Q,(K,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($)}) 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($)}) requires JSON-serializable data`);return q}),z=JSON.parse(G);return J.values.set($,z),z}).catch((Q)=>{throw J.pending.delete($),Q});return J.pending.set($,Y),Y}function o6($){let Z=$.__stx_server_data;if(!Z?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(Z.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var t6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",x9="data-stx-html-attrs",f9="data-stx-html-class",e6=/^[A-Za-z_:][\w:.-]*$/;function $1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function rG($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function $2($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function e1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${$1(String(X))}"`).join(" ")}function aG($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,K]of Object.entries($||{})){if(K==null)continue;let q=z.trim();if(!e6.test(q))continue;let W=q.toLowerCase();if(W==="lang"){Q=String(K);continue}if(W==="class"){Y=String(K).trim();continue}J.push(` ${q}="${$1(String(K))}"`),X.push(q)}let G=` lang="${$1(Q)}"`;if(Y)G+=` class="${$1(Y)}"`;if(G+=J.join(""),Y)G+=` ${f9}="${$1(Y)}"`;if(X.length)G+=` ${x9}="${$1(X.join(" "))}"`;return G}function $8($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Y))X.push(Y);J.class=X.join(" ")}return J}function Z8($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let W=G[1];if(!(W in X))Y.push(W);X[W]=G[2]??G[3]??G[4]??""}let z=[],K=[];for(let[W,H]of Object.entries(Z)){if(H==null)continue;let U=W.trim();if(!e6.test(U))continue;let j=U.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(H).split(/\s+/).filter(Boolean))if(!B.includes(V))B.push(V),z.push(V);if(!("class"in X))Y.push("class");X.class=B.join(" ");continue}if(!(U in X))Y.push(U);if(X[U]=String(H),j!=="lang")K.push(U)}if(z.length){if(!(f9 in X))Y.push(f9);X[f9]=z.join(" ")}if(K.length){if(!(x9 in X))Y.push(x9);X[x9]=K.join(" ")}let q=Y.map((W)=>` ${W}="${$1(X[W])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function tV($){let Z=m$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function m$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${t6}
|
|
3598
|
+
`}function tG($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let H=$.indexOf("-->",J);if(H===-1)break;J=H+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let H=$.toLowerCase().indexOf("</script>",J+z[0].length);if(H===-1)break;J=H+9;continue}let K=Q.match(/^<link\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){Z.push(W[0]),J+=W[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Y=0;while(Y<$.length&&Y<J){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&Z.includes(K[0])){Y+=K[0].length;continue}X+=$[Y],Y++}return X+=$.slice(J),{body:X,hoisted:Z}}function eG($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:K="",htmlAttrs:q={},bodyClass:W="",bodyAttrs:H={}}=Z,U=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map($2).filter(Boolean)),F=[...j.filter((I)=>!B.has($2(I))),...Q].map((I)=>{return` <meta ${e1(I)}>`}).join(`
|
|
3452
3599
|
`),O=G.map((I)=>{return` <link ${e1(I)}>`}).join(`
|
|
3453
3600
|
`),_=z.map((I)=>{if(I.src)return` <script ${e1(I,(k)=>k==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
|
|
3454
|
-
`),L=
|
|
3601
|
+
`),L=aG(q,Y),w=Object.entries(H).map(([I,k])=>` ${I}="${$1(String(k))}"`).join(""),R=W?` class="${$1(W)}"`:"",{body:D,hoisted:N}=tG($),T=[F,J.colorMode?` ${x$(J.colorMode)}`:"",` <title>${J.titleIsHtml?U:rG(U)}</title>`,` ${t6}`,O,_,K?` ${K}`:"",...(J.styles||[]).map((I)=>` ${I}`),...N.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),M=[D,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3455
3602
|
<html${L}>
|
|
3456
3603
|
<head>
|
|
3457
3604
|
${T.join(`
|
|
@@ -3461,24 +3608,24 @@ ${T.join(`
|
|
|
3461
3608
|
${M.join(`
|
|
3462
3609
|
`)}
|
|
3463
3610
|
</body>
|
|
3464
|
-
</html>`}var h$=/\s+/y,u$=/<(script|style)\b[^>]*>/iy
|
|
3611
|
+
</html>`}var h$=/\s+/y,u$=/<(script|style)\b[^>]*>/iy,$z=/<\/script>/gi,Zz=/<\/style>/gi,r6=/<!DOCTYPE\b/iy,a6=/<html[\s>]/iy;function d$($){let Z=0;while(Z<$.length){if(h$.lastIndex=Z,h$.exec($)){Z=h$.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}u$.lastIndex=Z;let X=u$.exec($);if(X){let Y=X[1].toLowerCase()==="script"?$z:Zz;Y.lastIndex=u$.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(r6.lastIndex=Z,r6.test($))return!0;return a6.lastIndex=Z,a6.test($)}return!1}function l$($){return d$($)}function J8($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,J),K=[];for(let q of X){let W=$2(q);if(W&&z.includes(W))continue;K.push(` <meta ${e1(q)}>`)}for(let q of Y){if(q.href&&z.includes(`href="${q.href}"`))continue;K.push(` <link ${e1(q)}>`)}for(let q of Q)if(q.src){if(z.includes(`src="${q.src}"`))continue;K.push(` <script ${e1(q,(W)=>W==="content")}></script>`)}else if(q.content){if(z.includes(q.content))continue;K.push(` <script>${q.content}</script>`)}if(G&&!z.includes(G))K.push(` ${G}`);if(K.length===0)return $;return`${$.slice(0,J)}${K.join(`
|
|
3465
3612
|
`)}
|
|
3466
|
-
${$.slice(J)}`}function
|
|
3613
|
+
${$.slice(J)}`}function X8($,Z={},J={},X){if(X??l$($))return $;return eG($,Z,J)}var Jz=/<\/(script)/gi;function Z2($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Jz,"<\\/$1")}var H1=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];import G8 from"path";O2();O2();function Q8($,Z={}){return new Y8($,Z).routes}function zL($,Z){let J=c$($,Z);return J?J.params:null}var z8=new Map;async function K8($,Z){let J=$,X=Z;if(!J||!X)try{let z=await f5();J||=z?.pagesDir||"pages",X||=z?.root||"."}catch{J||="pages",X||="."}let Y=G8.isAbsolute(J)?J:G8.join(X,J),Q=z8.get(Y);if(Q)return Q;let G=[];try{G=Q8(".",{pagesDir:Y,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{G=[]}return z8.set(Y,G),G}function Xz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function q8($){return Xz(JSON.stringify($))}function W8($){return $.includes("data-stx-runtime")}function H8($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let X=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}function p$($,Z){let J=V2($),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
|
|
3467
3614
|
`+$.slice(J);let Y=x2($);if(Y!==null)return`${$.slice(0,Y)}
|
|
3468
3615
|
${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3469
3616
|
`+$.slice(G)}if(n0($))return x1($,(G)=>`${G}
|
|
3470
3617
|
${Z}`);return`${Z}
|
|
3471
|
-
${$}`}async function g9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-
|
|
3618
|
+
${$}`}async function g9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-5x8x8g4j.js"),{url:Q}=await Y("runtime",Z.debug===!0);return p$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return p$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-5x8x8g4j.js"),X=await J(Z.debug);return p$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function Yz($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function U8($){if($.includes("data-stx-tooltip-runtime")||!Yz($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${F$()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
|
|
3472
3619
|
${Z}`;return`${$.slice(0,J)}${Z}
|
|
3473
|
-
${$.slice(J)}`}var
|
|
3474
|
-
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-
|
|
3475
|
-
</body>`+$.slice(z+7)}var
|
|
3476
|
-
`)}else{if(!
|
|
3620
|
+
${$.slice(J)}`}var Qz=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Gz($){return Qz.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function zz($,Z){if(!$.includes("</body>"))return $;if(Gz($))return $;let J=Z?.router,X="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.scrollRestoration!==void 0)K.scrollRestoration=J.scrollRestoration;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let q=await K8(Z?.pagesDir,Z?.root);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${q8(K)};</script>
|
|
3621
|
+
`}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-5x8x8g4j.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
|
|
3622
|
+
</body>`+$.slice(z+7)}var j8=Symbol.for("stx.lazy-module-promises");function Kz(){let $=globalThis;return $[j8]??=new Map,$[j8]}function n($,Z){let J=Kz(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var i$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,D8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,qz=65536,Wz=4,u9=new Map;function vL(){u9.clear()}function Hz($){let Z=[];for(let J of g2($,U2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function Uz($,Z={}){let J=$.length>=qz,X=J?u9.get($):void 0;if(X===void 0){if(X=Hz($),J)R8(u9,Wz),u9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function N8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=B8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=B8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function B8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function o$($,Z){return w8($,Z)}function jz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function Bz($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function Vz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${i$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=g2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),K=N8(z?.[1]??z?.[2]??""),q=[K.itemVar,K.indexVar].filter(Boolean);if(q.length===0)continue;let W=G[1],U=/\/\s*>$/.test(Q.token)||m9.has(W.toLowerCase())?Q.end:A8($,Q.start,W,Q.end);if(U!==-1)Y.push({start:Q.start,end:U,vars:new Set(q)})}return Y}var V8=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 Lz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function L8($,Z,J,X){if(!$)return!1;let Y=Lz($),Q=!1,G=!1,z=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(V8.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,H;while((H=W.exec(Y))!==null){let j=H[1];if(Y.slice(0,H.index).trimEnd().endsWith("."))continue;if(V8.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function h9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(D8);if(Q&&Oz(Q[3],Q[1])){let[,G,z,K]=Q;return`<${G}${z}${X}>${K}</${G}>`}return`<template${X}>${Y}</template>`}function Oz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function M8($,Z){let J=Bz($);function X(Y){let Q=Y,G=Vz(Y),z=(H)=>{let U=new Set;for(let j of G)if(H>j.start&&H<j.end)for(let B of j.vars)U.add(B);return U},K=/@if\s*\(/g,q,W=[];while((q=K.exec(Q))!==null){let H=q.index,U=H+q[0].length,j=1,B=U;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(U,B-1).trim(),F=B,O=1,_=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){_=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(F,_-6).trim(),D;if(jz(R)){let N=N2(Q.substring(H,_));if(N.length===0)continue;let T=N[0].branches.filter((A)=>A.type!=="else"),M=z(H);if(!(T.length>0&&T.every((A)=>L8(A.condition,J,Z,M))))continue;D=N[0].branches.map((A)=>{let E=X(A.content);if(A.type==="elseif")return h9(E,"@else-if",A.condition??"");if(A.type==="else")return h9(E,"@else");return h9(E,"@if",A.condition??"")}).join(`
|
|
3623
|
+
`)}else{if(!L8(V,J,Z,z(H)))continue;D=h9(X(R),"@if",V)}W.push({start:H,end:_,replacement:D}),K.lastIndex=_}for(let H=W.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=W[H];Q=Q.substring(0,U)+B+Q.substring(j)}return Q}return X($)}function Fz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var m9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),O8=/<(script|style)\b/iy,_z=/<\/script/gi,wz=/<\/style/gi;function A8($,Z,J,X){if(m9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let K=$.indexOf("<",z);if(K===-1)return-1;if(z=K,$.startsWith("<!--",z)){let U=$.indexOf("-->",z+4);if(U===-1)return-1;z=U+3;continue}O8.lastIndex=z;let q=O8.exec($);if(q){let U=$.indexOf(">",z);if(U===-1)return-1;if($[U-1]==="/"){z=U+1;continue}let j=q[1].toLowerCase()==="script"?_z:wz;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!U){z++;continue}if(U[1].toLowerCase()===Y){if(G--,z+=U[0].length,G===0)return z;continue}z+=U[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let H=$.indexOf(">",z);if(H===-1)return-1;if(W[1].toLowerCase()===Y){let U=$.slice(z,H+1);if(!(/\/\s*>$/.test(U)||m9.has(Y)))G++}z=H+1}return-1}var Rz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Dz($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return Rz.test(Q)}function I8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(H)=>Z.some(([U,j])=>H>=U&&H<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[H,U,j,B,V,F,O]=z,_=Fz(V);if(_===void 0)continue;let L=z.index,w=L+H.length,N=!!O||/\/\s*>$/.test(H)||m9.has(U.toLowerCase())?w:A8($,L,U,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Dz($,N)){Q.lastIndex=w;continue}if(_===!0){let M=`<${U}${j}${F}${O}>`;G.push({start:L,end:w,replacement:M});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((H,U)=>H.start-U.start);let K=[],q=-1;for(let H of G){if(H.start<q)continue;K.push(H),q=H.end}let W=$;for(let H=K.length-1;H>=0;H--){let{start:U,end:j,replacement:B}=K[H];W=W.substring(0,U)+B+W.substring(j)}return W}function r$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],K=Y.index,q=K+Y[0].length,W=1,H=q;while(H<J.length&&W>0){if(J[H]==="(")W++;else if(J[H]===")")W--;H++}if(W!==0)continue;let U=J.substring(q,H-1).trim(),j=H,B=N8(U),V=z==="for"?"@endfor":"@endforeach",F=1,O=j,_=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");_.lastIndex=j;let L;while((L=_.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){O=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:K,end:O,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let k=I.split(/[.[(]/)[0].trim(),A=Z?k in Z:!1,E=G.some((S)=>K>S.start&&K<S.end&&S.vars.includes(k));if(k&&(A||E)){w();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,O-V.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let N=r$(R,D),T=N.match(D8),M;if(T){let[,I,k,A]=T;M=`<${I}${k} @for="${U}">${A}</${I}>`}else M=`<template @for="${U}">${N}</template>`;Q.push({start:K,end:O,replacement:M}),X.lastIndex=O}for(let z=Q.length-1;z>=0;z--){let{start:K,end:q,replacement:W}=Q[z];J=J.substring(0,K)+W+J.substring(q)}return J}function Nz($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let H=X+1;while(H<Q){let U=$[H];if(U==="\\"){H+=2;continue}if(U===W)return H+1;H++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
|
|
3477
3624
|
`)W++;return W},K=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},q=(W)=>{let H=W,U=0;while(H<Q){let j=$[H];if(j==="/"&&$[H+1]==="/"){let B=H+2;while(B<Q&&$[B]!==`
|
|
3478
|
-
`)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var
|
|
3625
|
+
`)B++;H=B;continue}if(j==="/"&&$[H+1]==="*"){let B=H+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;H=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=H+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}H=B;continue}if(j==="("||j==="["||j==="{"){U++,H++;continue}if(j===")"||j==="]"||j==="}"){U--,H++;continue}if(j===";"&&U===0)return H+1;H++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let H=z();J.push($.slice(X,H)),X=H;continue}if(W==="/"&&$[X+1]==="*"){let H=K();J.push($.slice(X,H)),X=H;continue}if(W==='"'||W==="'"||W==="`"){let H=G(W);J.push($.slice(X,H)),X=H;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let H=X>0?$[X-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=q(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var Mz=new Set(["script","style","html","head","meta","link","title","!doctype"]);function n$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function Az($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!n$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function Iz($,Z){if(Az($,"<body",Z)){let Y=new RegExp(`<body(${i$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!n$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${i$})>`,"gi"),X;while((X=J.exec($))!==null){if(n$(X.index,X.index+X[0].length,Z))continue;if(Mz.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function Tz($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,K=(q)=>{if(J!==null&&!z&&J>=G&&J<=q)Y.push($.slice(G,J),Q,$.slice(J,q)),z=!0;else Y.push($.slice(G,q))};for(let q of Z){if(q.start<G)continue;K(q.start),G=q.end}return K($.length),Y.join("")}async function kz($,Z,J){let X=Uz($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await n("stx/client-script-bundler",()=>import("./chunk-cfskf6ag.js"));for(let _ of X){let L=_.body;if(E1(_.attrs))L=y1(L);if(Y.test(L)){Q.push({content:L,start:_.start,end:_.end});continue}if(!G(L))continue;try{let w=await z(J2(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:_.start,end:_.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let K=`${Z??""}\x00${Q.map((_)=>_.content).join("\x00")}`,q=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,W=[];for(let _=0;_<Q.length;_++){let L=Q[_].bundled??J2(Q[_].content).code;if(!Q[_].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=Cz(L);let w=e0(L);W.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
|
|
3479
3626
|
${w}`)}let H=W.join(`
|
|
3480
3627
|
|
|
3481
|
-
`);H=
|
|
3628
|
+
`);H=Nz(H);let U=Ez(H),j=U.split(",").map((_)=>_.trim()).filter(Boolean),B=s$(H,J),V=`
|
|
3482
3629
|
<script data-stx-scoped>
|
|
3483
3630
|
function ${q}() {
|
|
3484
3631
|
${o1("const",j)}
|
|
@@ -3487,19 +3634,19 @@ ${Z2(`${B}${H}`)}
|
|
|
3487
3634
|
}
|
|
3488
3635
|
window.__stx_latestSetup=${q};
|
|
3489
3636
|
if(window.stx)window.stx._latestSetup=${q};
|
|
3490
|
-
</script>`,F=
|
|
3637
|
+
</script>`,F=Iz($,Q);return{output:Tz($,Q,F,q),setupCode:V}}function Ez($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z="",K=()=>{Q++;let B=!1;while(Q<G){let V=Z[Q];if(V==="\\"){Q+=2;continue}if(V==="["&&!B){B=!0,Q++;continue}if(V==="]"&&B){B=!1,Q++;continue}if(V==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(V===`
|
|
3491
3638
|
`)return;Q++}},q=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},W=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},H=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')W(Z[Q]);else if(Z[Q]==="`")H();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3492
|
-
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let L=B[2];if(!X.has(L))J.push(L),X.add(L);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))J.push(N),X.add(N)});return}let F=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))J.push(R),X.add(R)});return}let O=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))J.push(L),X.add(L);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let L=_[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){H(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){K(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function
|
|
3639
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let L=B[2];if(!X.has(L))J.push(L),X.add(L);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))J.push(N),X.add(N)});return}let F=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))J.push(R),X.add(R)});return}let O=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))J.push(L),X.add(L);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let L=_[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){H(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){K(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function T8($,Z,J,X){if(!o$($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await kz(Y,J,X);if(Y=Q,!G){let z=n0(Y);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let K=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Y=Y.slice(0,z.index)+K+Y.slice(z.index+z.tag.length)}}if(Y=await g9(Y,Z),G){let z=F8(Y,/<\/head>/i),K=z===-1?F8(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
|
|
3493
3640
|
${Y.slice(z)}`;else if(K!==-1){let q=/<body[^>]*>/i.exec(Y.slice(K))[0],W=K+q.length;Y=`${Y.slice(0,W)}
|
|
3494
3641
|
${G}${Y.slice(W)}`}else Y=`${Y}
|
|
3495
|
-
${G}`}return Y}function
|
|
3496
|
-
`+" `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 J[
|
|
3642
|
+
${G}`}return Y}function F8($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Y;while((Y=J.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let K=G+z.index;if(!X.some(([W,H])=>K>=W&&K<H))return K;G=K+Math.max(z[0].length,1)}return-1}var _8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function yz($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Y=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return _8;return`var ${Z.join(", ")}; ${_8}`}var bz=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Cz($){return $.replace(bz,(Z,J)=>yz(J))}import Y2 from"path";import k8 from"process";function X2($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(k8.env)){if(!X.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Y),J[X]=Y}return Z["import.meta.env"]=JSON.stringify(J),Z}function gL($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(k8.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function E8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function y8($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Y2.join(Y,$);if(await Bun.file(G).exists())return G;Y=Y2.dirname(Y)}X=Y2.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Y2.resolve(Z,$);else X=Y2.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var b8=Symbol.for("stx.inline-assets.import-meta");function Sz($,Z){if(!$.includes("import.meta"))return;let J=Error(`[stx] ${Z} 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.
|
|
3643
|
+
`+" `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 J[b8]=!0,J}async function C8($,Z,J){let X=$,Y=Y2.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[q,W,H,U]=G;if(E8(H))continue;let j=await y8(H,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),H.endsWith(".ts")||H.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:X2()});if(F.outputs.length>0)B=await F.outputs[0].text(),Sz(B,H)}let V=`<script>
|
|
3497
3644
|
// Source: ${H}
|
|
3498
3645
|
${B}
|
|
3499
|
-
</script>`;X=X.replace(q,V),Q.lastIndex=0}catch(B){if(B?.[
|
|
3646
|
+
</script>`;X=X.replace(q,V),Q.lastIndex=0}catch(B){if(B?.[b8])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=z.exec(X))!==null){let[q,W,H,U]=K,j=W+U;if(E8(H))continue;if(/rel=["']stylesheet["']/.test(j)||H.endsWith(".css")){let V=await y8(H,Y,Z);if(V)try{let F=await Bun.file(V).text();J.add(V);let O=`<style>
|
|
3500
3647
|
/* Source: ${H} */
|
|
3501
3648
|
${F}
|
|
3502
|
-
</style>`;X=X.replace(q,O),z.lastIndex=0}catch(F){}}}return X}function a$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,K=G+1,q=null,W=!1;while(K<J.length&&z>0){let L=J[K];if(W){W=!1,K++;continue}if(L==="\\"&&q){W=!0,K++;continue}if(q){if(L===q)q=null;K++;continue}if(L==='"'||L==="'"||L==="`"){q=L,K++;continue}if(L==="(")z++;else if(L===")"){if(z--,z===0)break}K++}if(z!==0)break;let H=J.substring(G+1,K).trim(),U=J.substring(Q,K+1),j=-1,B=0,V=null,F=!1;for(let L=0;L<H.length;L++){let w=H[L];if(F){F=!1;continue}if(w==="\\"&&V){F=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=L;break}}let O=j>=0?H.substring(0,j).trim():H,_=j>=0?H.substring(j+1).trim():void 0;try{let L=O.trim(),w;if(B0(L))w=U0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(_==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+D+J.substring(K+1),X.lastIndex=Q+D.length}catch(L){o0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+U.length}}return J}function t$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function
|
|
3649
|
+
</style>`;X=X.replace(q,O),z.lastIndex=0}catch(F){}}}return X}function a$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,K=G+1,q=null,W=!1;while(K<J.length&&z>0){let L=J[K];if(W){W=!1,K++;continue}if(L==="\\"&&q){W=!0,K++;continue}if(q){if(L===q)q=null;K++;continue}if(L==='"'||L==="'"||L==="`"){q=L,K++;continue}if(L==="(")z++;else if(L===")"){if(z--,z===0)break}K++}if(z!==0)break;let H=J.substring(G+1,K).trim(),U=J.substring(Q,K+1),j=-1,B=0,V=null,F=!1;for(let L=0;L<H.length;L++){let w=H[L];if(F){F=!1;continue}if(w==="\\"&&V){F=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=L;break}}let O=j>=0?H.substring(0,j).trim():H,_=j>=0?H.substring(j+1).trim():void 0;try{let L=O.trim(),w;if(B0(L))w=U0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(_==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+D+J.substring(K+1),X.lastIndex=Q+D.length}catch(L){o0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+U.length}}return J}function t$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function v8($){let Z=$,J=/@memo\s*\(/g,X,Y=[];while((X=J.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,z=1,K=G;while(K<Z.length&&z>0){if(Z[K]==="(")z++;else if(Z[K]===")")z--;K++}if(z!==0)continue;let q=Z.slice(G,K-1).trim(),W=K,H=Z.slice(W),U=H.indexOf("@endmemo");if(U===-1)continue;let j=H.slice(0,U),B=W+U+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=V?V[0].length:0,O=j.slice(F),_=j.match(/(\s*)$/),L=_?_[0].length:0,w=O.slice(0,O.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[N,T,M="",I]=R,k=`<${T}${M} data-stx-memo="${q}"${I}>`;D=j.slice(0,F)+k+w.slice(N.length)+j.slice(F+w.length)}else D=`${j.slice(0,F)}<div data-stx-memo="${q}">${w}</div>${j.slice(F+w.length)}`;Y.push({start:Q,end:B,replacement:D}),J.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function e$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function x8($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=g2($,(K,q)=>{J.lastIndex=q;let W=J.exec(K);if(!W||/^(?:script|style)$/i.test(W[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:K,end:q,token:W}of X){let H=/^<\/?([\w-]+)/.exec(W)[1].toLowerCase();if(W.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===H)break}continue}let U=/\sdata-stx-scope\s*=/.test(W);if(!Q&&!U&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(W)&&!/\sdata-stx-ref-caller\s*=/.test(W))z.push($.slice(G,K),W.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=q;if(!f8.has(H)&&!/\/>$/.test(W)){if(Y.push({name:H,scoped:U}),U)Q++}}return z.push($.slice(G)),z.join("")}var f8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),g8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,S8=/<\/?\s*([a-z][\w-]*)/iy,Pz=/\s/;function vz($,Z){let J=Z-1;while(J>=0&&Pz.test($[J]))J--;return J>=0&&$[J]==="/"}function xz($,Z){let J=!1,X=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(J){if(Q==="'")J=!1}else if(X){if(Q==='"')X=!1}else if(Q==="'")J=!0;else if(Q==='"')X=!0;else if(Q===">")return Y}return-1}function fz($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Y=!1,Q=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),K=z===-1?$.length:z;if(K>X){if(J===0)while(X<K){let H=$.indexOf(Q?"}":"{",X);if(H===-1||H>=K){if(Q)G=!1;else Y=!1;break}if(H>X)if(Q)G=!1;else Y=!1;if(Q){if(G)return!0;G=!0}else if(Y)Q=!0,G=!1;else Y=!0;X=H+1}X=K;continue}if($.startsWith("<!--",X)){let H=$.indexOf("-->",X);X=H===-1?$.length:H+3;continue}let q=xz($,X);if(q===-1)break;S8.lastIndex=X;let W=S8.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!vz($,q)&&!f8.has(W))J++;X=q+1}return!1}function h8($){if($.length>=32768&&!P8($))return $;let J=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"),X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index,z=G+Q[0].length,K=!1,q=!1,W=-1;while(z<$.length){let U=$[z];if(K){if(U==="'")K=!1}else if(q){if(U==='"')q=!1}else if(U==="'")K=!0;else if(U==='"')q=!0;else if(U===">"){W=z;break}z++}if(W===-1)continue;let H=$.slice(G,W+1);if(g8.test(H))continue;if(H.includes("x-cloak"))continue;if(fz($,W+1))X+=$.slice(Y,W)+" x-cloak>",Y=W+1}return X+=$.slice(Y),X}var gz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,hz=/<\/script>/gi,uz=/<\/style>/gi;function u8($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?hz:uz;B.lastIndex=Q;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Q+Y[0].length,K=!1,q=!1,W=-1;while(z<$.length){let B=$[z];if(K){if(B==="'")K=!1}else if(q){if(B==='"')q=!1}else if(B==="'")K=!0;else if(B==='"')q=!0;else if(B===">"){W=z;break}z++}if(W===-1)continue;let H=$.slice(Q+Y[0].length,W);if(g8.test(H))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(H))continue;if(!gz.test(H))continue;let U=$[W-1]==="/",j=U?W-1:W;J+=`${$.slice(X,j)} x-cloak${U?" ":""}`,X=j}return J+=$.slice(X),J}var $3=S1(256),mz=[{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 @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{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"}];function Z3($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=U1($,Z,X,JSON.stringify(Y)),G=$3.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],K=[],q=Q0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of mz){if(z.some((O)=>/\w/.test(O)&&B.includes(O)))continue;j.lastIndex=0;let F=q.match(j);if(F&&F.length>0){let O=q.split(`
|
|
3503
3650
|
`),_=$.split(`
|
|
3504
3651
|
`),L=[];O.forEach((N,T)=>{if(j.lastIndex=0,j.test(N))L.push(T+1)});let w=L.length>0?` (script line${L.length>1?"s":""} ${L.join(", ")})`:"",R=L.slice(0,3).map((N)=>` ${N} | ${(_[N-1]??"").trim().slice(0,100)}`).join(`
|
|
3505
3652
|
`),D=R?`
|
|
@@ -3507,40 +3654,40 @@ ${R}`:"";K.push(` \u2717 ${B}${w}
|
|
|
3507
3654
|
\u2192 ${V}${D}`)}}if(K.length===0){$3.set(Q,"");return}let W=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},U=`[STX] DOM API violation in ${X&&X!==Z?`${W(X)} (composed into ${W(Z)})`:W(Z)}:
|
|
3508
3655
|
${K.join(`
|
|
3509
3656
|
`)}
|
|
3510
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if($3.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}q5();
|
|
3657
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if($3.set(Q,U),Y.failOnViolation)throw Error(U);else console.warn(U)}q5();pz();import J3 from"path";var dz=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,lz=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function cz($,Z){if(!Z||!$.includes("/"))return $;let J=J3.dirname(Z);return $.replace(dz,(X,Y,Q,G)=>{let z=J3.resolve(J,G);return`${Y}${Q}${z.split(J3.sep).join("/")}${Q}`})}function m8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(lz,(J,X,Y,Q)=>`${X}${cz(Y,Z)}${Q}`)}var P1="<!--PARENT_CONTENT_PLACEHOLDER-->";function d8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function WZ($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
|
|
3511
3658
|
`,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let K=$.indexOf("*/",X+2);if(K===-1)return-1;X=K+2,Y=!0;continue}if(z==="/"&&Y){let K=X+1,q=!1;while(K<J){let W=$[K];if(W==="\\"){K+=2;continue}if(W==="[")q=!0;else if(W==="]")q=!1;else if(W==="/"&&!q){K++;break}else if(W===`
|
|
3512
3659
|
`){K=-1;break}K++}if(K===-1){X++,Y=!1;continue}while(K<J&&/[a-z]/.test($[K]))K++;X=K,Y=!1;continue}if(z==="'"||z==='"'){let K=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===K){X++;break}if($[X]===`
|
|
3513
|
-
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function
|
|
3660
|
+
`)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function HZ($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}async function l8($,Z,J){try{let{registeredModuleIdsIn:X,buildModuleRegistryScript:Y}=await n("stx/client-module-registry",()=>import("./chunk-xswa3v5f.js")),Q=[],G=await Y(X(...$),{minify:Z.buildMode==="compile",collectInputs:Q});for(let z of Q)J?.add(z);if(!G)return null;if(Z.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-5x8x8g4j.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(G)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${G.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function nz($,Z=""){let J=HZ($,"data-stx-runtime");if(!J)return $;let X=V2($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
|
|
3514
3661
|
`+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=V2(Q);if(G===-1)return Y+Z+`
|
|
3515
3662
|
`+Q;return Q.slice(0,G)+Y+Z+`
|
|
3516
|
-
`+Q.slice(G)}async function Y3($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;g$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await p9(Z,J,X.runtimeConfig);if(Q)E3(Z),Z.__stx_head_injections=S$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!S2()&&!P2())&&J&&J.endsWith(".stx"))
|
|
3517
|
-
`),...q.htmlAttrs&&{htmlAttrs
|
|
3518
|
-
<meta name="stx-layout" content="${
|
|
3519
|
-
<meta name="stx-layout-group" content="${
|
|
3520
|
-
${j}`).join("");G=
|
|
3521
|
-
`+G.slice(q)}}if(Q)G=l6(G);if(Q&&Z.__stx_inject_css!==!1)G=await
|
|
3663
|
+
`+Q.slice(G)}async function Y3($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;g$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await p9(Z,J,X.runtimeConfig);if(Q)E3(Z),Z.__stx_head_injections=S$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!S2()&&!P2())&&J&&J.endsWith(".stx"))QZ($,J);try{return await ZZ.timeAsync("template-processing",async()=>{let G=await sz($,Z,J,X,Y);if(Q)G=e$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},q=(Z.__stx_runtime_head||null)??YZ(),W=(Z.__stx_head_raw||"").trim(),H,U=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)H=U[1].trim(),W=W.replace(U[0],"").trim();let j=Z.__sections?.title,B=q.title||H||j,V=!q.title&&(!!H||!!j),F=q.meta||[],O=new Set(F.map((N)=>$2(N)).filter(Boolean)),_={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((N)=>!O.has($2(N))),...F],link:[...z.link||[],...q.link||[]],script:[...z.script||[],...q.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
|
|
3664
|
+
`),...q.htmlAttrs&&{htmlAttrs:$8(z.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...q.bodyAttrs}}},L=l$(G);if(G=X8(G,_,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=J8(G,z),G=Z8(G,_.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=e8(N);G=G.replace(/<head\b[^>]*>/i,(M)=>`${M}
|
|
3665
|
+
<meta name="stx-layout" content="${d8(N)}">
|
|
3666
|
+
<meta name="stx-layout-group" content="${d8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?n0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=x1(G,(T,M)=>`<body${M} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){let z=Z.__stx_head_injections??S$(),K=m$(G);if(K!==null)z.beforeClose.push(K);let q=f$(G);if(q!==null)z.afterOpen.push(q);if(X.offline?.enabled&&!G.includes("data-stx-offline"))z.beforeClose.push(p6);G=h6(G,z);let W=X.app?.colorMode;if(W)G=d6(G,W)}if(Q)if(HZ(G,"data-stx-runtime")){let K=null,q=null,W=null,H=null;try{let{getStoreScript:j}=await n("stx/store-loader",()=>import("./chunk-pzsfjvbd.js")),B=X.storesDir,V=await j(B);if(V)q=`<script data-stx-stores>${V}</script>`}catch{}K=await l8([G,q],X,Y);try{let{getFrameworkComposableScript:j}=await n("stx/framework-composables",()=>import("./chunk-br3vfsyp.js"));H=await j(G)}catch{}try{let{getComposableScript:j}=await n("stx/composable-loader",()=>import("./chunk-dckr11ex.js")),B=X.composablesDir,V=[K,q,H].filter((O)=>O!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)W=`<script data-stx-scoped data-stx-run="always" data-stx-composables>${F}</script>`}catch{}let U=[K,q,W,H].filter((j)=>j!==null).map((j)=>`
|
|
3667
|
+
${j}`).join("");G=nz(G,U)}else{let K=await l8([G],X,Y);if(K){let q=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)G=G.slice(0,q)+K+`
|
|
3668
|
+
`+G.slice(q)}}if(Q)G=l6(G);if(Q&&Z.__stx_inject_css!==!1)G=await XZ(G,void 0,X.buildMode==="serve",!0);else if(Q)G=JZ(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=$Z(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=o6(Z);if(z){let K=/<head\b[^>]*>/i.exec(G),q=K?K.index+K[0].length:0;G=G.slice(0,q)+z+G.slice(q)}}return G})}catch(G){if(G instanceof s8)throw G;let z=G instanceof Error?G.message:String(G),K=new h2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(K,{filePath:J,context:Z}),r8.logDetailedError(K,{filePath:J,template:$.substring(0,500)}),X.debug)throw K;return o8.createFallbackContent("Template Processing",K)}}async function sz($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!C0.isAbsolute(X.partialsDir)?C0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!C0.isAbsolute(X.componentsDir)?C0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!C0.isAbsolute(X.layoutsDir)?C0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,K=$;await az(J,Z),rz(Z,z),K=await u2(()=>k6(K,Z,J,z),K,(L)=>{o0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=O1(K,y9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);K=q.output;let W=q.tokens,H=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),U="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,U),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),K=S6(K),K=await C8(K,J,Y);let j={};K=T$(K,j);let B={...Z.__sections||{}},V="",F=U4(H4($)),O=/@nolayout\b/.test(K)||F===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let _=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)V=_[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(K))K=`@section('content')
|
|
3522
3669
|
${K.trim()}
|
|
3523
3670
|
@endsection`}if(!V&&!O&&z.defaultLayout){let L=d$(K),w=/@section\s*\(/.test(K);if(!L||w){let R="",D=C0.dirname(J),N=z.layoutsDir?C0.dirname(z.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=C0.join(D,"_layout.stx");if(await e(M)){R=M;break}let I=C0.dirname(D);if(I===D||I.length<N.length)break;D=I}if(R)V=R;else if(z.layoutsDir){let T=C0.isAbsolute(z.layoutsDir)?z.layoutsDir:C0.resolve(process.cwd(),z.layoutsDir),M=C0.join(T,`${z.defaultLayout}.stx`);if(await e(M))V=M}if(V&&!w)K=`@section('content')
|
|
3524
3671
|
${K.trim()}
|
|
3525
|
-
@endsection`}}if(V&&K.includes("<script")){let L=f0(K),w=L.scripts.map((R)=>
|
|
3672
|
+
@endsection`}}if(V&&K.includes("<script")){let L=f0(K),w=L.scripts.map((R)=>c8(R,J)??R);K=B2(L.output,w)}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return B[w]=R,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=X0(R.trim(),Z);if(D===void 0)return L;return B[w]=String(D??""),""}catch{return L}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",P1);else B[w]=R.trim();return""}),Z.__sections=B,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(K=k$(K,j),V){let L=[],w=f0(K),R=O1(w.output,J9,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(K=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let M=N==="SCRIPT"?c8(w.scripts[Number(T)],J):R.tokens[Number(T)];if(M)L.push(M);return""}),L.length>0){let D=L.join(`
|
|
3526
3673
|
`);B.content=B.content?`${B.content}
|
|
3527
|
-
${D}`:D,Z.__sections=B}}if(V)try{let L;if(C0.isAbsolute(V))L=V,Y.add(V);else L=await u2(()=>q9(V,J,G,Y),null,()=>{throw new h2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let M=(A)=>{if(!A)return[];try{let E=C0.isAbsolute(A)?A:C0.resolve(process.cwd(),A);return
|
|
3528
|
-
${K}`,H(K)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await
|
|
3529
|
-
`;if(Q=I(Q,Z),Q=k(Q,Z,J),Q=y6(Q),Q=l5(Q,Z),Q=B7(Q),Q=I6(Q),Q=await I$(Q,Z,J,G,Y),Q=await N$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=y3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=e$(Q),Q=t0(Q,Z,J),Q=y$(Q),Q=B4(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=c5(Q,Z),Q=p5(Q,Z),Q=I2(Q,Z),Q=t5(Q,Z),Q=e5(Q,Z),Q=await J7(Q,Z,J,G),Q=await R4(Q,Z,J),Q=await
|
|
3674
|
+
${D}`:D,Z.__sections=B}}if(V)try{let L;if(C0.isAbsolute(V))L=V,Y.add(V);else L=await u2(()=>q9(V,J,G,Y),null,()=>{throw new h2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let M=(A)=>{if(!A)return[];try{let E=C0.isAbsolute(A)?A:C0.resolve(process.cwd(),A);return iz.readdirSync(E).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,""))}catch{return[]}},I=[...M(G.layoutsDir),...M(G.fallbackLayoutsDir)].filter((A,E,S)=>S.indexOf(A)===E).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(k),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${k}`),G.debug)throw new h2(k,J);return K}let w=await u2(()=>Bun.file(L).text(),"",()=>{throw new h2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=m8(w,L);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let M={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,S,b)=>{return M[S]=b.trim(),""});for(let[E,S]of Object.entries(M))if(B[E]&&B[E].includes(P1)){let b=B[E].indexOf(P1);B[E]=B[E].slice(0,b)+S+B[E].slice(b+P1.length)}else if(!B[E])B[E]=S;let k={...Z,__sections:B},A=`@layout('${R[1]}')${I}`;return await Y3(A,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=T$(D,j),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,I,k)=>{return T[I]=k.trim(),`@slot('${I}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,I,k)=>{if(B[I]){let A=B[I];if(A.includes(P1)){let E=T[I]||"",S=A.indexOf(P1);A=A.slice(0,S)+E+A.slice(S+P1.length)}return A}return k||""}),N=oz(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=k$(N,j),Z.__originalFilePath=J,K=await n8(N,Z,L,G,Y),K=`<!-- stx-layout: ${V} -->
|
|
3675
|
+
${K}`,H(K)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return H(await n8(K,Z,J,G,Y))}function oz($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function rz($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function az($,Z){await u2(()=>b6($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}var X3="data-stx-source";function c8($,Z){if(!$)return $;let J=/^<script\b([^>]*)>/i.exec($);if(!J||!/\bserver\b/.test(J[1])||J[1].includes(X3))return $;return`<script ${X3}="${encodeURIComponent(Z)}"${$.slice(7)}`}function tz($){let Z=new RegExp(`${X3}="([^"]*)"`).exec($);return Z?decodeURIComponent(Z[1]):void 0}function p8($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function i8($,Z,J){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> ${Z==="module-resolution"?"imports a module that does not resolve":Z==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${p8($)}</span><span style="display:block;margin-top:4px">${p8(J)}</span></div>`}async function ez($,Z,J,X){let{scanScriptTags:Y}=await n("stx/signal-processing",()=>import("./chunk-9dr0s6qa.js")),Q=[],G=!S2()&&!P2();for(let K of Y($)){let q=K.attrs;if(!/\bserver\b/.test(q))continue;let W=K.start+K.fullMatch.indexOf(">")+1,H=WZ($,W);if(H===-1)continue;let U=$.slice(W,H);if(!U.trim())continue;let j=tz(q)??J,B={index:K.start,length:H+9-K.start};try{let{extractVariables:V}=await n("stx/variable-extractor",()=>import("./chunk-sm3d4kbn.js"));await V(U,Z,j,{preserveExisting:!0,onFailure:(F)=>{if(F.kind==="unknown")return;if(X?.onServerScriptError?.({sourcePath:j,kind:F.kind,message:F.message}),!G)return;Q.push({...B,markup:i8(j,F.kind,F.message)})}})}catch(V){let F=V instanceof Error?V:Error(String(V));if(o0.log(F,{filePath:j,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${j}: ${F.message}`),G)Q.push({...B,markup:i8(j,"unknown",F.message)})}}if(Q.length===0)return $;let z=$;for(let K of Q.sort((q,W)=>W.index-q.index))z=z.slice(0,K.index)+K.markup+z.slice(K.index+K.length);return z}async function $K($,Z,J){try{let{interpolateScriptsInTemplate:X}=await n("stx/expressions",()=>import("./chunk-9nh7vyxt.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function n8($,Z,J,X,Y){let Q=$,G=X;if(Q=await ez(Q,Z,J,X),Q=await $K(Q,Z,J),Q=await B6(Q,Z,J),Q=await V6(Q,Z,J),Q=await O7(Q,Z,J,G),X1(Q))Q=M8(Q,Z),Q=r$(Q,Z);Q=I8(Q);let{processStreamDirectives:z}=await n("stx/streaming",()=>import("./chunk-t0a8b1ny.js"));Q=z(Q,Z),Q=N6(Q,Z,J,G,!0),Q=await f6(Q,Z,J,G,Y),Q=await N$(Q,Z,J,G,Y),Q=W4(Q,Z,J,G);let{processDeferDirectives:K}=await n("stx/defer",()=>import("./chunk-c41zj3zg.js"));Q=K(Q,Z,J);let{processTeleportDirectives:q}=await n("stx/teleport",()=>import("./chunk-b9tzp38b.js"));Q=q(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:H}=await n("stx/transitions",()=>import("./chunk-s7t37c7w.js"));Q=W(Q,Z,J),Q=H(Q);let{processErrorBoundaryDirectives:U,stripRenderFailedMarkers:j}=await n("stx/error-boundaries",()=>import("./chunk-rzp3bagj.js"));Q=U(Q,Z,J),Q=j(Q);let{processSuspenseDirectives:B}=await n("stx/suspense",()=>import("./chunk-bkhxfr92.js"));Q=B(Q,Z,J);let{processAsyncDirectives:V}=await n("stx/async-components",()=>import("./chunk-q01hqekk.js"));Q=V(Q,Z,J);let{processKeepAliveDirectives:F}=await n("stx/keep-alive",()=>import("./chunk-4dj5b57q.js"));Q=F(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:_,processInfiniteListDirectives:L}=await n("stx/virtual-scrolling",()=>import("./chunk-n6fcg584.js"));Q=O(Q,Z,J),Q=_(Q,Z,J),Q=L(Q,Z,J);let{processPartialHydrationDirectives:w,processStaticDirectives:R}=await n("stx/partial-hydration",()=>import("./chunk-3rg4ykrh.js"));Q=w(Q,Z,J),Q=R(Q);let{processComputedDirectives:D,processWatchDirectives:N}=await n("stx/computed",()=>import("./chunk-cm5v3eep.js"));Q=D(Q,Z,J),Q=N(Q,Z,J);let{processFormValidationDirectives:T}=await n("stx/forms-validation",()=>import("./chunk-0daceza4.js"));Q=T(Q,Z,J);let{processHeadDirective:M,processTitleDirective:I,processMetaDirective:k,resetHead:A}=await n("stx/head",()=>import("./chunk-tdn55vs4.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)A();let E=M(Q);if(Q=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
|
|
3676
|
+
`;if(Q=I(Q,Z),Q=k(Q,Z,J),Q=y6(Q),Q=l5(Q,Z),Q=B7(Q),Q=I6(Q),Q=await I$(Q,Z,J,G,Y),Q=await N$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=y3(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=e$(Q),Q=t0(Q,Z,J),Q=y$(Q),Q=B4(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=c5(Q,Z),Q=p5(Q,Z),Q=I2(Q,Z),Q=t5(Q,Z),Q=e5(Q,Z),Q=await J7(Q,Z,J,G),Q=await R4(Q,Z,J),Q=await a8(Q,Z,J,G),Q=t8(Q,Z,J,G),Q=GZ(Q,Z,J,G),Q=zZ(Q,Z,J),Q=KZ(Q,Z,J,G),Q=U7(Q,Z,J,G),Q=a$(Q,Z),Q=t$(Q),Q=v8(Q),!G.skipEventDirectives)Q=I3(Q,Z,J);if(Q=O4(Q,Z,J),G.debug){let f=/\bx-data\s*=/.test(Q),l=o$($);if(f&&l)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3530
3677
|
Both work on the same page, but they manage separate scopes.
|
|
3531
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=Z6(Q,Z),Q=await F1(Q,Z,J),Q=
|
|
3678
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=Z6(Q,Z),Q=await F1(Q,Z,J),Q=h8(Q),Q=u8(Q),Q=J4(Q);let{processXElementDirectives:S}=await n("stx/x-element",()=>import("./chunk-qvjhzwm8.js"));Q=S(Q);let b=Z.__originalFilePath||J,y=d9(Z);if(Q=await T8(Q,G,b,y),Q=R7(Q,Z),Q=await E6(Q,Z,J,G),G.media?.image?.autoSiblings){let f=G.publicDir||"public",{rewriteImagesWithSiblings:l}=await n("stx/image-optimization/auto-sibling",()=>import("./chunk-bqajw5yd.js"));Q=await l(Q,{publicDir:f})}if(G.seo?.enabled)Q=qZ(Q,Z,G);let P=(f,l,J0=!0)=>{if(!l)return f;let j0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),_0=f.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(j0&&_0){if(J0)f=f.replace(_0[0],j0[0]);if(l=l.replace(j0[0],"").trim(),!l)return f}if(/<\/head>/i.test(f))return f.replace(/<\/head>/i,`${l}
|
|
3532
3679
|
</head>`);if(/<head\b[^>]*>/i.test(f))return f.replace(/(<head\b[^>]*>)/i,`$1
|
|
3533
3680
|
${l}`);if(/<html\b[^>]*>/i.test(f))return f.replace(/(<html\b[^>]*>)/i,`$1
|
|
3534
3681
|
<head>
|
|
3535
3682
|
${l}
|
|
3536
|
-
</head>`);return f},{renderHead:h,getHead:p}=await n("stx/head",()=>import("./chunk-
|
|
3683
|
+
</head>`);return f},{renderHead:h,getHead:p}=await n("stx/head",()=>import("./chunk-tdn55vs4.js")),o=Z.__stx_runtime_head??p();if(o.title||o.meta?.length||o.link?.length){let f=h(o);if(f)Q=P(Q,f)}if(E.headContent)Q=P(Q,E.headContent,!o.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=W7(Q,G.csp,Z);if(G.analytics?.enabled)Q=Y4(Q,G);if(G.heatmap?.enabled)Q=G4(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await n("stx/pwa/inject",()=>import("./chunk-m8z5450r.js"));Q=f(Q,G)}let $0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),i=/window\.STX\s*=/.test(Q);if($0&&Y0&&!i){let l=`<script data-stx-scoped data-stx-run="once">
|
|
3537
3684
|
${e3()}
|
|
3538
3685
|
</script>`;if(Q.includes("</head>")){let J0=Q.indexOf("</head>"),_0=Q.slice(0,J0).indexOf("<script");if(_0!==-1){let W0=Q.slice(0,_0),i0=Q.slice(_0);Q=W0+l+`
|
|
3539
3686
|
`+i0}else Q=Q.replace("</head>",`${l}
|
|
3540
3687
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3541
3688
|
${l}`);else Q=l+`
|
|
3542
|
-
`+Q}{let{scanScriptTags:f}=await n("stx/signal-processing",()=>import("./chunk-
|
|
3543
|
-
`+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!
|
|
3689
|
+
`+Q}{let{scanScriptTags:f}=await n("stx/signal-processing",()=>import("./chunk-9dr0s6qa.js")),l=[];for(let J0 of f(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let j0=J0.start+J0.fullMatch.indexOf(">")+1,_0=WZ(Q,j0);if(_0===-1)continue;let W0=_0+9;while(W0<Q.length&&/\s/.test(Q[W0]))W0++;l.push({start:J0.start,end:W0})}if(l.length>0){let J0=Array(l.length+1),j0=0;for(let _0=0;_0<l.length;_0++){let{start:W0,end:i0}=l[_0];J0[_0]=Q.slice(j0,W0),j0=i0}J0[l.length]=Q.slice(j0),Q=J0.join("")}}let q0=c9(Q,J);if(q0.hasScoped)Q=q0.html;let r=Z.__stx_event_bindings||[],L0=!1,c0=[],p0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:B1}=await n("stx/signal-processing",()=>import("./chunk-9dr0s6qa.js"));for(let f of B1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))c0.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:l,content:J0}of c0){L0=!0;let j0=J0;Z3(J0,J,X.strict,Z.__originalFilePath);let _0=await l9(J0,{eventBindings:r,attrs:l,hasColonDirectives:p0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});Q=Q.replace(f,()=>_0)}if(L0)Z.__stx_event_bindings=[];if(!L0&&Z.__stxProcessingDepth===1){let f=Z.__stx_event_bindings||[];if(f.length>0){let l=Y5(f);if(l){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+l:Q.slice(0,J0)+l+`
|
|
3690
|
+
`+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!W8(Q)&&H8(Q))Q=await g9(Q,G);if(Q=U8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=H7(Q,Z.cspNonce);return Q}import IZ from"path";import G3 from"fs";import m2 from"path";function UZ($,Z,J,X){let Y=0;for(let Q=Z;Q<$.length;Q++)if($[Q]===J)Y++;else if($[Q]===X&&!(X===">"&&$[Q-1]==="=")){if(--Y===0)return Q}return-1}function ZK($){let Z=Q0($),J=0,X=0,Y=[];for(let Q=0;Q<Z.length;Q++)if("([{".includes(Z[Q]))J++;else if(")]}".includes(Z[Q]))J--;else if(Z[Q]===","&&J===0)Y.push($.slice(X,Q).trim()),X=Q+1;return Y.push($.slice(X).trim()),Y}function Q3($,Z){let J=Q0($),X=new RegExp(`\\b(?:${Z.map((Y)=>Y.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Y of J.matchAll(X)){let Q=Y.index+Y[0].length,G="";if(J[Q]==="<"){let K=UZ(J,Q,"<",">");if(K<0)continue;G=$.slice(Q+1,K),Q=K+1;while(/\s/.test(J[Q]||"")&&Q<J.length)Q++}if(J[Q]!=="(")continue;let z=UZ(J,Q,"(",")");if(z>=0)return{type:G,args:ZK($.slice(Q+1,z))}}return null}var jZ=`
|
|
3544
3691
|
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;
|
|
3545
3692
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
3546
3693
|
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>;
|
|
@@ -3548,61 +3695,61 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
3548
3695
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
3549
3696
|
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]> };
|
|
3550
3697
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
3551
|
-
`;function
|
|
3698
|
+
`;function BZ($,Z){let J=[],X={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},Y=Q0($),Q=$.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,j,B,V,F)=>{if(Y.slice(F,F+6)!=="import")return U;if(V.endsWith(".stx"))return"";let O=`${Z}Import${J.length}`;if(J.push(`import * as ${O} from ${JSON.stringify(V)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${O};`;if(!j.startsWith("{"))return`import ${j} = ${O}.default;`;return j.slice(1,-1).split(",").map((_)=>{let[L,w=L]=_.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!L)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(V)&&L in X)X[L].push(w);return`import ${w} = ${O}.${L};`}).join(`
|
|
3552
3699
|
`)}),G=Q3($,X.defineProps),z=Q3($,X.defineEmits),K=Q3($,X.withDefaults);if(!G&&!z)return{declarations:"",props:null,events:null};let q=[],W=null,H=null;if(G){q.push(`const __options = (${G.args[0]||"{}"}) as const;`),q.push(`const __defaults = (${K?.args[1]||"{}"});`);let U=G.type||"__StxOptions<typeof __options>";q.push(`export type __StxProps = __StxDefaults<${U}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),W=`${Z}.__StxProps`}if(z)q.push(`const __events = (${z.args[0]||"[]"}) as const;`),q.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),H=`${Z}.__StxEvents`;return{declarations:`${J.join(`
|
|
3553
3700
|
`)}
|
|
3554
3701
|
namespace ${Z} {
|
|
3555
3702
|
${Q}
|
|
3556
3703
|
${q.join(`
|
|
3557
3704
|
`)}
|
|
3558
|
-
}`,props:W,events:H}}function*
|
|
3705
|
+
}`,props:W,events:H}}function*JK($){let Z=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,J;while(J=Z.exec($)){let X=Z.lastIndex,Y=[];while(X<$.length){while(/\s/.test($[X]||""))X++;if($[X]===">"||$.slice(X,X+2)==="/>"){X+=$[X]===">"?1:2;break}let Q=/^[^\s=/>]+/.exec($.slice(X))?.[0];if(!Q){X++;continue}let G=X;X+=Q.length;while(/\s/.test($[X]||""))X++;if($[X]!=="="){Y.push({name:Q,value:!0,offset:G,braced:!1});continue}X++;while(/\s/.test($[X]||""))X++;let z=$[X],K=z==="{",q=z==='"'||z==="'";if(q||K)X++;let W=X;if(K){let H=Q0($.slice(X)),U=1,j=0;for(;j<H.length;j++){if(H[j]==="{")U++;if(H[j]==="}"&&--U===0)break}X+=j}else if(q)while(X<$.length&&$[X]!==z)X++;else while(X<$.length&&!/[\s/>]/.test($[X]))X++;if(Y.push({name:Q,value:$.slice(W,X),offset:W,braced:K}),q||K)X++}Z.lastIndex=X,yield{name:J[1],offset:J.index,attributes:Y}}}function VZ($,Z,J){let X=[],Y=[jZ,"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;'],Q=new Map,G=new Map,z=new Map,K=J.scriptCode($,J.filePath),q=Q0(K);for(let B of K.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(q.slice(B.index,B.index+6)!=="import")continue;let V=B[2],F=m2.isAbsolute(V)||V.startsWith(".")?m2.resolve(m2.dirname(J.filePath),V):R9(V,m2.dirname(J.filePath));if(!F)continue;let O=F.endsWith(".stx")?F:G3.existsSync(`${F}.stx`)?`${F}.stx`:void 0,_=O?null:w9(F,!1),L=B[1].startsWith("{")?B[1].slice(1,-1).split(","):[B[1]];for(let w of L){let[R,D=R]=w.trim().split(/\s+as\s+/),N=O||_?.get(R)||_?.get(R.toLowerCase());if(N)z.set(D,N),z.set(D.toLowerCase(),N),z.set(D.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),N)}}for(let B of Z.matchAll(/@import\s*\(([^)]+)\)/g))for(let V of B[1].matchAll(/['"]([^'"]+)['"]/g)){let F=D9(V[1],J.filePath,J).find((O)=>G3.statSync(O,{throwIfNoEntry:!1})?.isFile());if(F)z.set(m2.basename(V[1]).replace(/\.stx$/,""),F)}let W={__importedComponents:z},H=new Map,U=(B,V,F)=>{let O=$.slice(0,B);return{code:V,offset:B,attribute:F,anchor:!0,kind:"directive",line:O.split(`
|
|
3559
3706
|
`).length,column:B-O.lastIndexOf(`
|
|
3560
|
-
`)}},j=(B,V,F)=>X.push({expression:B,statement:{text:V+B.code+F,prefixLength:V.length}});for(let B of
|
|
3561
|
-
`):"",checks:X,events:Q,dependencies:G}}var
|
|
3707
|
+
`)}},j=(B,V,F)=>X.push({expression:B,statement:{text:V+B.code+F,prefixLength:V.length}});for(let B of JK(Z)){if(C2(B.name)||B.name==="component")continue;let V=T7(B.name,J.filePath,J,W);if(!V)continue;let F=H.get(V);if(!F){let _;try{_=J.readComponent?J.readComponent(V):G3.readFileSync(V,"utf8")}catch{continue}if(_===void 0)continue;G.set(V,_),F=BZ(J.scriptCode(_,V),`__StxComponent${H.size}`),H.set(V,F),Y.push(F.declarations)}let O=[];for(let _ of B.attributes){let{name:L,offset:w}=_,R=_.value===!0?"true":_.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(F.events&&_.value!==!0)Q.set(w,`__StxEvent<${F.events}, ${JSON.stringify(L.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let D=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(L);if(L.startsWith("v-")&&!L.startsWith("v-bind:")&&!D)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(L))continue;let N=(D?D[1]||"modelValue":L.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(I,k)=>k.toUpperCase());if(O.push(N),!F.props)continue;let M=L.startsWith(":")||L.startsWith("v-bind:")||!!D||_.braced?R:_.value!==!0?JSON.stringify(R):"true";j(U(w,M,L),";void ((",`) satisfies __StxProp<${F.props}, ${JSON.stringify(N)}>);`)}if(F.props){let _=[...new Set(O)].map((w)=>`${JSON.stringify(w)}: undefined as any`).join(", "),L=U(B.offset,`<${B.name}>`);X.push({expression:L,statement:{text:`;void ({ ${_} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:H.size?Y.join(`
|
|
3708
|
+
`):"",checks:X,events:Q,dependencies:G}}var LZ=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function XK($){let Z=(J)=>J.replace(/[^\n]/g," ");return $.replace(/<!--[\s\S]*?-->/g,Z).replace(/\{\{--[\s\S]*?--\}\}/g,Z)}function OZ($){let Z=[],J=XK($);LZ.lastIndex=0;let X;while((X=LZ.exec(J))!==null){let Y=(X[1]||"").trim(),Q=(X[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,G=(X[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=X.index+Q,K=X.index+X[0].length-G,q=$.slice(z,K);if(/\bsrc\s*=/.test(Y))continue;let W=Y.match(/\btype\s*=\s*["']([^"']+)["']/i);if(W&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(W[1]))continue;let H=/\bserver\b/.test(Y)?"server":/\bclient\b/.test(Y)?"client":"plain",U=d2($,z);Z.push({kind:H,code:q,startLine:U,startColumn:l2($,z),offset:z,attrs:Y})}return Z}function d2($,Z){let J=1;for(let X=0;X<Z&&X<$.length;X++)if($.charCodeAt(X)===10)J++;return J}function l2($,Z){let J=$.lastIndexOf(`
|
|
3562
3709
|
`,Z-1)+1;return Z-J+1}function i9($){let Z=$.split(""),J=(Y,Q)=>{for(let G=Y;G<Q&&G<Z.length;G++)if(Z[G]!==`
|
|
3563
|
-
`)Z[G]=" "},X=[/<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 Y of X){Y.lastIndex=0;let Q;while((Q=Y.exec($))!==null)J(Q.index,Q.index+Q[0].length)}return Z.join("")}function
|
|
3710
|
+
`)Z[G]=" "},X=[/<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 Y of X){Y.lastIndex=0;let Q;while((Q=Y.exec($))!==null)J(Q.index,Q.index+Q[0].length)}return Z.join("")}function YK($){let Z=0,J="";for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J="";continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{"){Z++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--;continue}if(Y==="|"&&Z===0){if($[X+1]==="|"){X++;continue}if($[X-1]==="|")continue;return $.slice(0,X)}}return $}var TZ=new Set([":for","x-for","v-for"]),n9=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,z3="__stx_interpolated",FZ="__StxElement",kZ="__StxTemplateValue",QK=`type ${kZ}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function _Z($){return $.replace(/\{\{[\s\S]*?\}\}/g,z3).replace(/\{!![\s\S]*?!!\}/g,z3)}function GK($){return $.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(Z)=>{let J=Z.split(`
|
|
3564
3711
|
`).length-1,X=Z.length-J;return`0${" ".repeat(Math.max(0,X-1))}${`
|
|
3565
|
-
`.repeat(J)}`})}var
|
|
3566
|
-
`)}function
|
|
3712
|
+
`.repeat(J)}`})}var zK=["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"],KK=new RegExp(String.raw`^[ \t]*@(?:${zK.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function qK($){return $.replace(KK,(Z)=>Z.replace(/[^\n]/g," "))}var wZ=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function WK($){let Z=i9($),J=[],X=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,Y;while((Y=X.exec(Z))!==null){if(Y[1]||Y[3])continue;let z=Y[2]??Y[4]??"",K=Y[2]!==void 0?2:3,q=YK(z);if(!q.trim())continue;let W=Y.index+K+(q.length-q.trimStart().length);J.push({code:q.trim(),line:d2(Z,W),column:l2(Z,W),offset:W,kind:"interpolation"})}let Q=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((Y=Q.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=0,K=G;for(;K<Z.length;K++){let U=Z[K];if(U==="(")z++;else if(U===")"){if(z--,z===0)break}}if(z!==0)continue;let q=Z.slice(G+1,K),W=q.trim();if(Q.lastIndex=K+1,!W)continue;let H=G+1+(q.length-q.trimStart().length);J.push({code:W,line:d2(Z,H),column:l2(Z,H),offset:Y.index,kind:"condition"})}n9.lastIndex=0;while((Y=n9.exec(Z))!==null){let G=Y[1],z=Y[3]??"",K=G.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(wZ.has(K)||wZ.has(G))continue;if(!z.trim())continue;let q=Y.index+Y[0].indexOf(Y[2],Y[0].indexOf(G)+G.length)+1;if(TZ.has(K)){let H=z.match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;let U=z.slice(H.index+H[0].length),j=H.index+H[0].length+(U.length-U.trimStart().length);J.push({code:_Z(U.trim()),line:d2(Z,q+j),column:l2(Z,q+j),offset:q+j,kind:"directive",attribute:K});continue}let W=z.length-z.trimStart().length;J.push({code:_Z(z.trim()),line:d2(Z,q+W),column:l2(Z,q+W),offset:q+W,kind:"directive",attribute:K})}return J.sort((G,z)=>G.line-z.line||G.column-z.column),J}var HK=2000;function UK($,Z){let J=0,X=Math.min($.length,Z+HK);for(let Y=Z;Y<X;Y++){let Q=$[Y];if(Q==="(")J++;else if(Q===")"){if(J--,J===0)return $.slice(Z+1,Y)}}return null}function jK($){let Z=new Map,J=(z,K)=>{let q=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let W of q){let H=W.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(H))continue;let U=q.length===1?K:void 0,j=Z.get(H);if(!j)Z.set(H,{name:H,iterable:U});else if(j.iterable!==U)j.iterable=void 0}},X=/^\$?[A-Z_$][\w$]*$/i,Y=(z)=>{let K=z.trim();return X.test(K)?K:void 0};for(let z of $.matchAll(/@for(?:each|else)\s*\(/g)){let K=UK($,z.index+z[0].length-1);if(K===null)continue;let q=a1(K);if(!q)continue;J(q.itemVar.replace(/=>/g," "),Y(q.arrayExpr))}for(let z of $.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))J(z[1],z[2]==="of"?Y(z[3]):void 0);for(let z of $.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))J(z[1]);let Q=i9($);n9.lastIndex=0;let G;while((G=n9.exec(Q))!==null){let z=G[1].replace(/\..*$/,"");if(!TZ.has(z))continue;let K=G[3].match(/\s+(?:in|of)\s+/);if(!K||K.index===void 0)continue;J(G[3].slice(0,K.index),Y(G[3].slice(K.index+K[0].length)))}for(let z of $.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let K of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))J(K[1]);return[...Z.values()].sort((z,K)=>z.name.localeCompare(K.name))}function j1($){let Z=new Set;for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))Z.add(J[1]);for(let J of $.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let X of J[1].split(",")){let Y=X.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(Y))Z.add(Y)}return[...Z].sort()}var K3=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],BK={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function kF($=new Set){return[...K3.filter((Z)=>!$.has(Z)).map((Z)=>`declare var ${Z}: any`),...Object.entries(BK).filter(([Z])=>!$.has(Z)).map(([,Z])=>Z)].join(`
|
|
3713
|
+
`)}function EF($){return new Set([...$.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((Z)=>Z[1]))}function EZ($){let Z=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,J,X=!1,Y=new Set,Q=Q0($);while((J=Z.exec(Q))!==null){X=!0;for(let G of VK(J[1])){let z=G.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))Y.add(z)}}return X?[...Y]:null}function VK($){let Z=[],J=0,X="";for(let Y of $){if(Y===","&&J===0){Z.push(X),X="";continue}if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;X+=Y}return Z.push(X),Z.filter((Y)=>Y.trim().length>0)}function LK($){let Z=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,J=[],X=$.replace(Z,(Y)=>{return J.push(Y.trim()),Y.split(`
|
|
3567
3714
|
`).map(()=>"").join(`
|
|
3568
3715
|
`)});return{imports:J.join(`
|
|
3569
|
-
`),body:X}}function
|
|
3570
|
-
`&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,H-40),H)))){q=U===";"?H+1:H;break}}}Y.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Q.lastIndex=q}return Y}function
|
|
3571
|
-
`)}if(J.length===0)return Y.length>0?["",`// ${
|
|
3572
|
-
`):"";let{imports:Q,body:G}=
|
|
3573
|
-
`)}function
|
|
3574
|
-
`)J[Y]=" "}return j1(J.join(""))}function
|
|
3575
|
-
`),Y=Array.from({length:X.length},()=>""),Q=new Map,G=Z.filePath&&Z.templateExpressions!==!1?
|
|
3576
|
-
`)}):void 0,z=new Set,K=[];for(let H of J){let U=
|
|
3577
|
-
`);j.forEach((B,V)=>{let F=H.startLine-1+V;if(F<Y.length)Y[F]=V===0?
|
|
3578
|
-
`).entries())if(Y.push(B),U)Q.set(Y.length,j===0?U:{...U,line:U.line+j,column:1,prefixLength:0})};if(Z.globals!==!1){q("");let H=new Set([...J.flatMap((V)=>j1(V.code)),...J.flatMap((V)=>
|
|
3579
|
-
`))q(U);let H=
|
|
3580
|
-
`),lineMap:Q,sourceLineCount:X.length,componentDependencies:G?.dependencies,referenced:W}}function
|
|
3581
|
-
`);return{line:J.length,column:J[J.length-1].length+1}}function
|
|
3582
|
-
`);for(let Y of X){let Q=J,G=null,z=!1;for(let K=0;K<Y.length;K++){let q=Y[K];if(z){z=!1;continue}if(q==="\\"){z=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&K+1<Y.length&&Y[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let K=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let q=Y.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let H=q[1].slice(1,-1).split(",").map((U)=>{let j=U.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((U)=>/^\w+$/.test(U));Z.push(...H)}}}}return[...new Set(Z)]}function
|
|
3583
|
-
|
|
3584
|
-
`),Z}function
|
|
3716
|
+
`),body:X}}function yZ($){let Z=Q0($),J=Array(Z.length),X=0;for(let z=0;z<Z.length;z++){let K=Z[z];if(K==="}"||K===")"||K==="]")X=Math.max(0,X-1);if(J[z]=X,K==="{"||K==="("||K==="[")X++}let Y=[],Q=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,G;while((G=Q.exec(Z))!==null){if(J[G.index]!==0)continue;let z=G[1],K=G[2],q;if(z==="interface"){let W=Z.indexOf("{",G.index);if(W===-1)continue;let H=0;q=-1;for(let U=W;U<Z.length;U++)if(Z[U]==="{")H++;else if(Z[U]==="}"&&--H===0){q=U+1;break}if(q===-1)continue}else{let W=0;q=Z.length;for(let H=Z.indexOf("=",G.index)+1;H<Z.length;H++){let U=Z[H];if(U==="{"||U==="["||U==="("||U==="<")W++;else if(U==="}"||U==="]"||U===")"||U===">")W--;else if(W<=0&&(U===";"||U===`
|
|
3717
|
+
`&&!/[=|&,<([{]\s*$/.test(Z.slice(Math.max(0,H-40),H)))){q=U===";"?H+1:H;break}}}Y.push({name:K,text:$.slice(G.index,q).replace(/^[ \t]*export[ \t]+/,"")}),Q.lastIndex=q}return Y}function OK($){return new Set(yZ($).map((Z)=>Z.name))}function yF($,Z=""){let J=EZ($),X=OK(Z),Y=yZ($).filter((q)=>!X.has(q.name)).map((q)=>q.text);if(!J){let q=j1($).filter((W)=>!r2(Z,W));if(q.length===0&&Y.length===0)return"";return["",`// ${_K}`,...Y,...q.map((W)=>`declare var ${W}: any`)].join(`
|
|
3718
|
+
`)}if(J.length===0)return Y.length>0?["",`// ${RZ}`,...Y].join(`
|
|
3719
|
+
`):"";let{imports:Q,body:G}=LK($),z=G.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),K=["",`// ${RZ}`];if(Q)K.push(Q);return K.push(...Y),K.push(`async function ${DZ}() {`,z,` return { ${J.join(", ")} }`,"}",`type ${NZ} = Awaited<ReturnType<typeof ${DZ}>>`,...J.map((q)=>`declare var ${q}: ${NZ}[${JSON.stringify(q)}]`)),K.join(`
|
|
3720
|
+
`)}function FK($){let J=Q0($).split(""),X=0;for(let Y=0;Y<J.length;Y++){let Q=J[Y];if(Q==="{"||Q==="("||Q==="["){X++;continue}if(Q==="}"||Q===")"||Q==="]"){X=Math.max(0,X-1);continue}if(X>0&&Q!==`
|
|
3721
|
+
`)J[Y]=" "}return j1(J.join(""))}function bF($,Z){if(EZ($)!==null)return[];let J=Q0(Z),X=new Set(Q2);return FK($).filter((Y)=>{if(X.has(Y))return!1;if(j1(Z).includes(Y))return!1;return new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J)})}var RZ="stx: types for the declared client payload (#1868)",_K="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",DZ="__stxServerScope",NZ="__StxClientPayload";var MZ=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var wK=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function RK($){let Z=new Map,J=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let X of $){let Y=Q0(X),{depths:Q,balanced:G}=q2(Y);if(!G)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let K of Y.matchAll(z)){let q=K.index??0;if(Q[q+K[1].length]!==0)continue;let W=K[2],H=q+K[0].length-K[3].length,U=X.slice(H,q+K[0].length).trim().replace(/;$/,"").trim(),j=K[3],B=J.test(j)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(j)&&!/[,+\-*/%&|?:=]$/.test(U)&&q2(j).balanced;Z.set(W,Z.has(W)||!B?null:U)}}return new Map([...Z].filter((X)=>X[1]!==null))}function bZ($,Z,J=0,X=new Set){if(Z.size===0||J>=5)return $;let Y=Q0($),Q="",G=0;for(let z of Y.matchAll(/[A-Za-z_$][\w$]*/g)){let K=z.index??0,q=z[0],W=Z.get(q);if(!W||X.has(q))continue;let H=Y.slice(0,K).trimEnd(),U=Y.slice(K+q.length).trimStart();if(H.endsWith(".")||/^:(?!:)/.test(U)&&/[{,]$/.test(H))continue;if(K>0&&/[\w$]/.test(Y[K-1]))continue;Q+=`${$.slice(G,K)}(${bZ(W,Z,J+1,new Set([...X,q]))})`,G=K+q.length}return Q+$.slice(G)}function DK($,Z){let J=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,X=[],Y;while((Y=J.exec($))!==null){if(Y.index>Z)break;let Q=Y[1];if(Y.index===Z){if(Q==="elseif"){let z=X[X.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(Q==="endif"||Q==="endunless"){X.pop();continue}let G="";if(Y[2]==="("){let z=0,K=Y.index+Y[0].length-1,q=K+1;for(;K<$.length;K++){let W=$[K];if(W==="(")z++;else if(W===")"){if(z--,z===0)break}}G=$.slice(q,K).trim(),J.lastIndex=K+1}if(Q==="if")X.push({seen:[],current:G});else if(Q==="unless")X.push({seen:[],current:`!(${G})`});else if(Q==="elseif"||Q==="else"){let z=X[X.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=Q==="elseif"?G:null}}return X.flatMap((Q)=>[...Q.seen.map((G)=>`!(${G})`),...Q.current?[Q.current]:[]]).filter(Boolean)}function NK($){let Z=$.code.trim();if(!Z)return null;if($.attribute?.startsWith("@")){if(wK.test(Z))return null;let X=";(($event: any): void => { ";return{text:`${X}${Z} });`,prefixLength:X.length}}let J=";void ((";return{text:`${J}${Z}));`,prefixLength:J.length}}var MK=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function AZ($,Z){if(!Z)return $;return $.replace(MK,(J,X,Y,Q)=>{let G=IZ.resolve(Z,Q).replace(/\\/g,"/");return`${X}${Y}${G}${Y}`})}function AK($){return" ".repeat(Math.max(0,($.startColumn??1)-1))}function IK($){let Z=new Set,J=Q0($);for(let X of J.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let Y=X[1],Q=/\{([^}]*)\}/.exec(Y);for(let q of Q?.[1].split(",")??[]){let W=q.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(W&&/^[A-Z_$][\w$]*$/i.test(W))Z.add(W)}let G=Y.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(G);if(z)Z.add(z[1]);let K=/^\s*([A-Z_$][\w$]*)/i.exec(G);if(K&&K[1]!=="type")Z.add(K[1])}return[...Z].sort()}function CF($,Z={}){let J=OZ($),X=$.split(`
|
|
3722
|
+
`),Y=Array.from({length:X.length},()=>""),Q=new Map,G=Z.filePath&&Z.templateExpressions!==!1?VZ($,i9($),{filePath:Z.filePath,componentsDir:Z.componentsDir,projectRoot:Z.projectRoot,readComponent:Z.readComponent,scriptCode:(H,U)=>OZ(H).map((j)=>AZ(j.code,IZ.dirname(U))).join(`
|
|
3723
|
+
`)}):void 0,z=new Set,K=[];for(let H of J){let U=qK(GK(H.code)),j=AZ(U,Z.originDir??"").split(`
|
|
3724
|
+
`);j.forEach((B,V)=>{let F=H.startLine-1+V;if(F<Y.length)Y[F]=V===0?AK(H)+B:B,z.add(F)}),K.push(H.startLine-1+j.length-1)}for(let H of K){let U=Y[H]?.trim()===""?H:H+1;if(U<Y.length&&Y[U].trim()===""&&(U===H||!z.has(U)))Y[U]=";"}let q=(H,U)=>{for(let[j,B]of H.split(`
|
|
3725
|
+
`).entries())if(Y.push(B),U)Q.set(Y.length,j===0?U:{...U,line:U.line+j,column:1,prefixLength:0})};if(Z.globals!==!1){q("");let H=new Set([...J.flatMap((V)=>j1(V.code)),...J.flatMap((V)=>IK(V.code))]),U=(V)=>{if(!H.has(V))q(`declare var ${V}: any`)};if(Z.runtimeGlobals!==!1){if(!H.has("window"))q("declare var window: any");for(let V of Q2)U(V)}let j=[...new Set([...K3,...H1,...MZ])].filter((V)=>Z.runtimeGlobals!==!1||!Q2.includes(V));if(Z.contextScope==="global"){q("declare global {");for(let V of j)q(` var ${V}: any`);q("}")}else{for(let V of K3)U(V);for(let V of H1)U(V);for(let V of MZ)U(V)}q(`declare var ${z3}: any`);let B=new Set(J.flatMap((V)=>j1(V.code)));q(`type ${FZ}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let V of jK($)){if(B.has(V.name))continue;let F=V.iterable&&B.has(V.iterable)?`${FZ}<typeof ${V.iterable}>`:"any";q(`declare var ${V.name}: ${F}`)}}if(Z.templateExpressions!==!1){if(G?.declarations)for(let U of G.declarations.split(`
|
|
3726
|
+
`))q(U);let H=WK($).map((U)=>{let j=G?.events.get(U.offset??-1);if(j){U.anchor=!0;let B=U.code.trim(),V=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(B),F=V?`void ((${V[2]}) satisfies __StxAssignedValue<typeof ${V[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(B)?`${B} satisfies (($event: ${j}) => unknown)`:B,O=`;(($event: ${j}): void => { `;return{expression:U,statement:{text:`${O}${F} });`,prefixLength:O.length}}}return{expression:U,statement:NK(U)}}).filter((U)=>U.statement!==null);if(H.push(...G?.checks||[]),H.length>0){let U=i9($),j=RK(J.map((O)=>O.code)),V=[...new Set(J.flatMap((O)=>j1(O.code)))].filter((O)=>/^[A-Z_$][\w$]*$/i.test(O)),F=0;if(V.length>0){q(QK);for(let O of V)q(`type __StxT_${O} = ${kZ}<typeof ${O}>`);q(`;((${V.map((O)=>`${O}: __StxT_${O}`).join(", ")}) => {`),F=1}for(let{expression:O,statement:_}of H){let L=" ".repeat(F),w=O.offset===void 0?[]:DK(U,O.offset),R=w.length>0?`${w.map((N)=>`if (${bZ(N,j)}) `).join("")}{ `:"",D=w.length>0?" }":"";q(L+R+_.text+D,{line:O.line,column:O.column,expression:O,prefixLength:_.prefixLength+L.length+R.length,guardPrefixLength:L.length+R.length})}if(F>0)q("});")}}let W=!1;if(Z.reference&&Y[0]!==void 0&&Y[0].trim()==="")Y[0]=`/// <reference path=${JSON.stringify(Z.reference.replace(/\\/g,"/"))} />`,W=!0;return q("export {}"),{text:Y.join(`
|
|
3727
|
+
`),lineMap:Q,sourceLineCount:X.length,componentDependencies:G?.dependencies,referenced:W}}function SF($,Z){if(!$.expression)return!1;return $.inGuard===!0||Z===2774}function PF($,Z,J){let X=$.lineMap.get(Z);if(!X)return Z<=$.sourceLineCount?{line:Z,column:J}:null;let Y=X.expression?.anchor?0:Math.max(0,J-1-(X.prefixLength??0));return{line:X.line,column:X.column+Y,expression:X.expression,inGuard:J<=(X.guardPrefixLength??0)}}var TK=[{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"}],kK=[{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')"}],EK=[{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 yK($){let Z=[],J=[];return bK($,Z),CK($,Z,J),SK($,J),PK($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function bK($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function CK($,Z,J){for(let X of TK){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let K=new RegExp(X.altClose,"g");z+=($.match(K)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function SK($,Z){for(let J of kK)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function PK($,Z){for(let J of EK)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function vK($,Z){let J=$.slice(0,Z).split(`
|
|
3728
|
+
`);return{line:J.length,column:J[J.length-1].length+1}}function xK($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.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(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function fK($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function gK($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import r0 from"path";import G2 from"process";var q3=["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 CZ=new Set(q3),hK=new Set(["props","$props","defineProps"]),uK=new Set(["stx","@stacksjs/stx"]),SZ=S1(128),PZ=S1(64);function mK($){let Z=[],J=0,X=$.split(`
|
|
3729
|
+
`);for(let Y of X){let Q=J,G=null,z=!1;for(let K=0;K<Y.length;K++){let q=Y[K];if(z){z=!1;continue}if(q==="\\"){z=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&K+1<Y.length&&Y[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let K=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let q=Y.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let H=q[1].slice(1,-1).split(",").map((U)=>{let j=U.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((U)=>/^\w+$/.test(U));Z.push(...H)}}}}return[...new Set(Z)]}function dK($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,K=null;for(let q=0;q<X.length;q++){let W=X[q];if(K){if(Q+=W,W===K)K=null;continue}if(W==='"'||W==="'"||W==="`"){K=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=W}if(Q)Y.push(Q);return Y.map((q)=>{let W=q.trim(),H=W.startsWith("..."),U=H?W.slice(3):W,j=-1,B=0;for(let R=0;R<U.length;R++)if(U[R]==="<")B++;else if(U[R]===">")B--;else if(U[R]===":"&&B===0){j=R;break}if(j===-1)return q;let F=U.substring(0,j).trim().replace(/\?$/,""),O=U.substring(j+1),_=-1,L=0;for(let R=0;R<O.length;R++)if(O[R]==="<")L++;else if(O[R]===">")L--;else if(O[R]==="="&&L===0){_=R;break}let w=H?"...":"";if(_!==-1)return`${w}${F} = ${O.substring(_+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,K=G+1,q=0,W=null;while(K<Z.length&&z>0){let j=Z[K];if(W){if(j===W)W=null;K++;continue}if(j==='"'||j==="'"||j==="`"){W=j,K++;continue}if(j==="<")q++;else if(j===">"&&q>0)q--;else if(q===0){if(j==="(")z++;else if(j===")")z--}if(z>0)K++}if(z!==0)continue;let H=Z.substring(G+1,K);if(!H.includes(":"))continue;let U=J(H);Q.push({start:G+1,end:K,replacement:U})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:K,replacement:q}=Q[G];Z=Z.substring(0,z)+q+Z.substring(K)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...K]=G.split("="),q=z.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.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"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
3730
|
+
|
|
3731
|
+
`),Z}function lK($){return $.replace(/\s*imported from \S*(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])\S*/g,"")}function cK($){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test($)}function pK($){if($ instanceof SyntaxError)return!0;let Z=$ instanceof Error?$.message:String($);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(Z)}function iK($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}var vZ=new Set;async function nK($,Z,J,X={}){if(!$.trim())return;let Y=X2(),Q=U1($,JSON.stringify(Y)),G=SZ.get(Q);if(G===void 0){try{let C=H3({loader:"ts",target:"browser",define:Y}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=C.transformSync(v)}catch{G=dK($)}SZ.set(Q,G)}let z={exports:{}},K=z.exports,q=G2.cwd(),W={},H=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C)),U=new Map;for(let C of H)try{if(C.startsWith(".")){W[C]=await import(r0.resolve(r0.dirname(J),C));continue}let v=r0.resolve(q,"node_modules",C),m=r0.join(v,"package.json"),t=JSON.parse(x("fs").readFileSync(m,"utf8")),K0=t.main||"index.js";if(t.exports){let w0=typeof t.exports==="string"?t.exports:t.exports["."];if(typeof w0==="string")K0=w0;else if(w0?.bun)K0=w0.bun;else if(w0?.import)K0=w0.import;else if(w0?.default)K0=w0.default}W[C]=await import(r0.resolve(v,K0))}catch(v){if(C.startsWith("."))U.set(C,v instanceof Error?v.message:String(v))}let j=(C)=>{if(W[C])return W[C];let v=U.get(C);if(v!==void 0)throw Error(`Cannot require '${C}' from ${J}: ${v}`);return x(C)},B=Z.props||{},V=(C)=>{if(!C)return B;let v={};for(let[m,t]of Object.entries(C)){let K0=B[m];if(K0!==void 0)v[m]=K0;else if(typeof t==="function")v[m]=t();else v[m]=t}return v};for(let[C,v]of Object.entries(B))Object.defineProperty(V,C,{value:v,enumerable:!0,configurable:!0,writable:!0});let F=(C,v=!1)=>{if(C===void 0||C===null)return v;if(typeof C==="string"){let m=C.trim().toLowerCase();if(m===""||m==="true"||m==="1"||m==="on"||m==="yes")return!0;if(m==="false"||m==="0"||m==="off"||m==="no")return!1;return!0}return Boolean(C)},O=(C,v=0)=>{if(C===void 0||C===null)return v;if(typeof C==="string"){let t=C.trim();if(t==="")return v;let K0=Number(t);return Number.isFinite(K0)?K0:v}let m=Number(C);return Number.isFinite(m)?m:v};for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,C))continue;try{Object.defineProperty(V,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return B;let v={...B};for(let[m,t]of Object.entries(C)){let K0=t&&typeof t==="object"&&!Array.isArray(t)?t:{type:t};if(v[m]===void 0&&K0.default!==void 0)v[m]=typeof K0.default==="function"?K0.default():K0.default}return v},L=()=>Z.slots||{},w=(C,v)=>{let m={...C};for(let[t,K0]of Object.entries(v))if(m[t]===void 0)if(typeof K0==="function")m[t]=K0();else m[t]=K0;return m},R=(C)=>{let v=()=>C;return v.set=(m)=>{},v.update=(m)=>{},v},D=(C)=>{let v,m=!1;return()=>{if(!m)try{v=C(),m=!0}catch{v=void 0}return v}},N=(C)=>{},T=(C)=>C(),M=(C)=>{},I=(C)=>{},k=j4(Z);function A(C){let v=C||{};if(v.title!==void 0||v.description!==void 0)P({title:v.title,description:v.description})}function E(C){if(!C||typeof C!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,C),Z.__stxClientPayload=v}let S=()=>{let C=Z.__stxServeContext,v=Z.__stxServeSearch??C?.search??"",m=C?.path??"",t=Object.fromEntries(new URLSearchParams(v)),K0=Z.query,w0=Object.keys(t).length>0?t:K0??{},Z1=v||(Object.keys(w0).length>0?`?${new URLSearchParams(w0).toString()}`:"");return{params:Z.params??{},query:w0,path:m,name:"",fullPath:m+Z1,hash:"",matched:[]}},b=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),y=(C)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=iZ(v,C||{})},P=(C)=>{y(nZ(C||{}))},h=(C)=>({value:C}),p=(C)=>C,u=(C)=>({value:typeof C==="function"?C():C}),o=(C,v)=>{},$0=(C)=>{},Y0=(C)=>{},i=(C)=>C?C():Promise.resolve(),q0=(C)=>(v,...m)=>{},r=(C)=>{},L0=(C,v)=>{},c0=(C,v)=>v,p0=()=>({value:"light"}),B1=()=>R(!1),f=(C)=>R(!1),l=()=>R(!1),J0=()=>f("(prefers-color-scheme: dark)"),j0=()=>f("(prefers-color-scheme: light)"),_0=()=>f("(prefers-reduced-motion: reduce)"),W0=()=>f("(prefers-contrast: more)"),i0={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:{}},a9=new Proxy(i0,{get(C,v){if(v in C)return C[v];return},set(C,v,m){return C[v]=m,!0}}),t9={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},K2=console;try{let C=sZ(G,J),v=new Set(Object.keys(B)),m=Object.keys(Z).filter((a)=>!v.has(a)&&!hK.has(a)&&z2(a)),t=m.map((a)=>Z[a]);if(!m.includes("__stxServeContext"))m.push("__stxServeContext"),t.push(void 0);let K0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),w0=[],Z1=[];for(let[a,u0]of Object.entries(B)){if(!z2(a))continue;if(K0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;w0.push(a),Z1.push(u0)}let y0=mK(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
|
|
3585
3732
|
`),d=Z.params??{},c=[],G0=[];for(let a=0;a<m.length;a++){if(m[a]==="params")continue;c.push(m[a]),G0.push(t[a])}let s=[...q3,...w0,...c],R0=`return (async () => {
|
|
3586
3733
|
${C}
|
|
3587
3734
|
${y0}
|
|
3588
3735
|
return module.exports
|
|
3589
|
-
})()`,H0=U1(R0,s.join("\x00")),b0=
|
|
3736
|
+
})()`,H0=U1(R0,s.join("\x00")),b0=PZ.get(H0);if(!b0)b0=Function(...s,R0),PZ.set(H0,b0);let J1=Z.__stx_options?.runtimeConfig;if(J1||/\buse(?:Server)?RuntimeConfig\b/.test(G))await p9(Z,J,J1);let v0=await mZ(Z.__stx_runtime_config??dZ()??pZ(),()=>n6(Z,()=>b0(z,K,j,B,V,F,O,_,w,E,s6,cZ,lZ,R,D,N,T,M,I,A,S,b,y,P,k.setResponseStatus,k.setResponseHeader,k.notFound,h,p,u,o,$0,Y0,i,q0,r,L,L0,c0,p0,B1,f,l,J0,j0,_0,W0,a9,t9,K2,i0.confirm,i0.alert,i0.fetch,d,...Z1,...G0)));if(X.preserveExisting){for(let[a,u0]of Object.entries(v0))if(!(a in Z)||Z[a]===void 0)Z[a]=u0}else Object.assign(Z,v0);for(let[a,u0]of Object.entries(B))if(!(a in Z))Z[a]=u0}catch(C){if(Z.__stx_strict_hydration)throw C;let v=lK(C instanceof Error?C.message:String(C));if(cK(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`),X.onFailure?.({kind:"module-resolution",message:v,error:C});else if(pK(C))console.warn(`[stx] server <script> in ${J??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${v}`),X.onFailure?.({kind:"syntax",message:v,error:C});else if(iK(v))console.warn(`[stx] server <script> in ${J??"<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: ${v}`),X.onFailure?.({kind:"missing-binding",message:v,error:C});else{let m=`${J??"<unknown>"}\x00${v}`;if(G2.env.STX_DEBUG||!vZ.has(m))vZ.add(m),console.warn(`[stx] server <script> in ${J??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${v}`);X.onFailure?.({kind:"unknown",message:v,error:C})}try{await Zq(G,Z,J)}catch(m){if(G2.env.STX_DEBUG){let t=m instanceof Error?m.message:String(m);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${t}`)}}}}function sK($){let Z=0,J=null,X=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,X||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return J===null&&Z===0&&Y}var oK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function sZ($,Z){let J=Z?r0.dirname(Z):G2.cwd(),X=G2.cwd(),Y=$.split(`
|
|
3590
3737
|
`),Q=[],G=0;while(G<Y.length){let z=Y[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let K=0;for(;G<Y.length;G++){for(let q of Y[G])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let K=0,q=!1,W=G;for(let j=G;j<Y.length&&!q;j++){let B=null,V=!1,F=Y[j];for(let O=0;O<F.length;O++){let _=F[O];if(V){V=!1;continue}if(_==="\\"){V=!0;continue}if(B){if(_===B)B=null;continue}if(_==='"'||_==="'"||_==="`"){B=_;continue}if(_==="(")K++;else if(_===")"){if(K--,K===0){G=j+1,q=!0;break}}}}if(!q)G=Y.length;let H=Y.slice(W,G).join(`
|
|
3591
|
-
`),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(H);if(B)U.push(`${j}: ${JSON.stringify(B[2])}`)}if(U.length>0)Q.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let K=z,q=0;while(!
|
|
3592
|
-
`+j;if(H<=0&&U>=G)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),G=U+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return
|
|
3593
|
-
`),J,X)}function
|
|
3594
|
-
`)z=!1;Q++;continue}if(K){if(Y+=W,W==="*"&&H==="/"){Y+=H,Q+=2,K=!1;continue}Q++;continue}if(!G&&W==="/"&&H==="/"){z=!0,Y+=W,Q++;continue}if(!G&&W==="/"&&H==="*"){K=!0,Y+=W,Q++;continue}if(G){if(Y+=W,W==="\\"){Y+=H,Q+=2;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(W==="$"&&H==="{"){q++,Y+=H,Q+=2;continue}if(W==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){G=W,Y+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=
|
|
3738
|
+
`),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(H);if(B)U.push(`${j}: ${JSON.stringify(B[2])}`)}if(U.length>0)Q.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let K=z,q=0;while(!sK(K)&&G+q+1<Y.length)q++,K=`${K} ${Y[G+q].trim()}`;G+=q;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),H=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+['"](.+?)['"]/),j=K,B=(V)=>{if(V.startsWith("."))return r0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return r0.resolve(X,V.slice(2));return V};if(W){let[,V,F]=W,O=B(F);Q.push(`const ${V} = (await import('${O}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(H){let[,V,F]=H,O=B(F),_=[],L=[],w=uK.has(F);for(let R of V.split(",")){let D=R.trim();if(!D)continue;let N=D.split(/\s+as\s+/);if(N.length===2){let[T,M]=[N[0].trim(),N[1].trim()];if(w&&CZ.has(T)){Q.push(`const ${M} = ${T};`);continue}_.push(`${T}: ${M}`),L.push(M)}else{if(w&&CZ.has(D))continue;_.push(D),L.push(D)}}if(_.length>0)Q.push(`const { ${_.join(", ")} } = await import('${O}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(U){let V=B(U[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(oK.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let K=fZ(Y,G),{type:q,name:W,value:H}=K;Q.push(`${q} ${W} = ${H};`),Q.push(`module.exports.${W} = ${W};`),G=K.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let K=W3(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let K=fZ(Y,G),{type:q,name:W,value:H}=K;Q.push(`${q} ${W} = ${H};`),Q.push(`module.exports.${W} = ${W};`),G=K.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let K=W3(Y,G);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),G=K.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let K=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[G]=K;let W=W3(q,G);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);G=W.nextIndex}else if(z.startsWith("export default ")){let K=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let K=z.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=Y[G].replace(/^export\s+/,""),H=0,U=G;for(;U<Y.length;U++){let j=Y[U];for(let B of j)if(B==="{")H++;else if(B==="}")H--;if(U>G)W+=`
|
|
3739
|
+
`+j;if(H<=0&&U>=G)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),G=U+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return rK(Q.join(`
|
|
3740
|
+
`),J,X)}function rK($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,K=!1,q=0;while(Q<X){let W=$[Q],H=$[Q+1];if(z){if(Y+=W,W===`
|
|
3741
|
+
`)z=!1;Q++;continue}if(K){if(Y+=W,W==="*"&&H==="/"){Y+=H,Q+=2,K=!1;continue}Q++;continue}if(!G&&W==="/"&&H==="/"){z=!0,Y+=W,Q++;continue}if(!G&&W==="/"&&H==="*"){K=!0,Y+=W,Q++;continue}if(G){if(Y+=W,W==="\\"){Y+=H,Q+=2;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(W==="$"&&H==="{"){q++,Y+=H,Q+=2;continue}if(W==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){G=W,Y+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=aK($,Q);if(U){let{quote:j,path:B,end:V}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?r0.resolve(Z,B):r0.resolve(J,B.slice(2));Y+=`await import(${j}${F}${j})`,Q=V;continue}}}Y+=W,Q++}return Y}function aK($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let X=$[J];if(X!=="'"&&X!=='"')return null;J++;let Y=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(Y,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Q,end:J+1}}function oZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=M0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function rZ($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Y=0,Q="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Y===0?oZ(J,X):null;if(z){Z.push(...rZ(z.pattern)),X=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<J.length&&J[X]!==","&&Y===0){if(J[X]==="{"||J[X]==="[")Y++;else if(J[X]==="}"||J[X]==="]")Y--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function tK($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Y)=>Y===" "||Y==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Y=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[J+1],K=$[J-1];if(z!=="="&&z!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if($[J]!=="=")return null}while(J<$.length&&X($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function xZ($,Z,J,X){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function fZ($,Z){let J=$[Z].trim(),X=tK(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let W=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let H=J.slice(W[0].length),U=Z;if(H.startsWith("{")||H.startsWith("[")){let B=H[0],V=B==="{"?"}":"]",F=xZ(H,B,V,0),O=H;for(let _=Z+1;_<$.length&&F>0;_++)O+=` ${$[_].trim()}`,U=_,F=xZ($[_],B,V,F);if(F>0)O=H,U=Z;H=O}let j=oZ(H,0);if(j){let B=W[1],V=j.pattern,F=H.slice(j.endPos).trim();if(F.startsWith("=")){let O=F.slice(1).trim(),_=O,L=Math.max(U,Z);if(gZ(O)){let N=hZ($,L,O);_=N.value,L=N.nextIndex}else L=L+1;_=_.trim().replace(/;$/,"");let w=rZ(V),R=`__stx_src_${Z}`,D=w.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
3595
3742
|
`);return{type:B,name:R,value:`${_}; ${B} ${V} = ${R};
|
|
3596
|
-
${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,K=z,q=Z;if(
|
|
3597
|
-
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:K,nextIndex:q}}function W3($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(
|
|
3743
|
+
${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,K=z,q=Z;if(gZ(z)){let W=hZ($,Z,z);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
|
|
3744
|
+
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:G,value:K,nextIndex:q}}function W3($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(eK(J)){let z=$q($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function gZ($){let Z=$.trim();if(Z.startsWith("{"))return M0(Z,"{","}",0)===-1;if(Z.startsWith("["))return M0(Z,"[","]",0)===-1;return!aZ(Z)}function aZ($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Q==="$"&&$[Y+1]==="{"){X++,Y++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function tZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=M0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function eK($){let Z=tZ($);if(Z===-1)return!0;return M0($,"{","}",Z)===-1}function hZ($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!aZ(X)){let Q=$[Y];X+=`
|
|
3598
3745
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
|
|
3599
|
-
${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function
|
|
3600
|
-
${G}`,Y++}return{functionCode:X,nextIndex:Y}}function
|
|
3601
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function
|
|
3746
|
+
${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function $q($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=tZ(X);if(Q!==-1){if(M0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
|
|
3747
|
+
${G}`,Y++}return{functionCode:X,nextIndex:Y}}function uZ($,Z){let J=X0($,Z)??X0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...G2.env}})},Y=Object.keys(X).filter(z2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function Zq($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let K=z.trim().replace(/;$/,""),q=uZ(K,Z);if(q!==void 0)Z[G]=q}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),q=uZ(K,Z);if(q!==void 0)Z[G]=q}catch{}}}function Jq($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function Xq($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var c2=new r1(500),o9=new r1(1000),qJ=33554432,j3=qJ;function Yq($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===j3)return;j3=Z,r9.setMaxBytes(Z)}var r9=new r1(2000,{maxBytes:qJ,sizeOf:($)=>$.output.length});function Qq($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function eZ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Gq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function E1($){return!Gq($)}var s9=new Map;function H3($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=s9.get(Z);if(J)return J;if(s9.size>=16)s9.clear();let X=new Bun.Transpiler($);return s9.set(Z,X),X}var $J=new WeakMap,zq=256;function y1($){try{let Z=H3({loader:"ts",target:"browser",define:X2()}),J=$J.get(Z);if(!J)J=new Map,$J.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let K=Q.length;return Q.push(z),`"__STX_EXPR_${K}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=zq){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Kq($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},K=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3748
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let B=H[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(K())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return Z}function qq($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Wq($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Hq($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let K=$[X];if(K==="}")Q++;else if(K==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let K of qq(z)){let q=K.trim();if(!q||q.startsWith("..."))continue;let W=Wq(q);if(W===-1)continue;let H=q.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(H))continue;if(Z[H]!==void 0)continue;let U=q.slice(W+1).trim();if(!U)continue;try{let j=Object.keys(Z).filter(z2),B=Function(...j,`"use strict"; return (${U});`);Z[H]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}var Uq=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function jq($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!J)return null;let X=J[2].toLowerCase();if(!Uq.has(X))return null;if(($.match(new RegExp(`<${X}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${X}>\\s*$`,"i").test($))return null;let Q=J[0].length;return $.slice(0,Q)+Z+$.slice(Q)}async function k9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((_)=>_.charAt(0).toUpperCase()+_.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=J.__importedComponents;if(K){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(K.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?g.resolve(Y.root):void 0,H=W??g.dirname(X),U=[],j=(O)=>{if(O&&!U.includes(O))U.push(O)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),W)j(g.resolve(W,"resources/views/components")),j(g.resolve(W,"resources/components")),j(g.resolve(W,"src/components")),j(g.resolve(W,"components"));for(let O of Y._layerComponentDirs??[])j(O);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let O of V)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return e(g.resolve(g.dirname(X),`${Q}.stx`));let F=ZJ(g.resolve(import.meta.dir,"components"));for(let O of U){let _=g.isAbsolute(O)?O:g.resolve(H,O);if(ZJ(_)===F)continue;for(let L of q)if(await e(g.join(_,L)))return!0}return!1}function ZJ($){try{return KJ.realpathSync($)}catch{return $}}function Bq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Vq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Lq($,Z,J){if(!$.includes("{{")&&!$.includes("{!!"))return $;let X=(Y,Q)=>{let G;try{G=S0(Y,Z)}catch{return Q}if(G===void 0||G===null)return"";let z=String(G);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${J??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return $.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>X(Q,Y)).replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>X(Q,Y))}var JJ=new Set;function XJ($,Z,J,X){let Y=`${$}\x00${Z}\x00${X??""}`;if(!process.env.STX_DEBUG&&JJ.has(Y))return;JJ.add(Y);let Q=Z?` used in ${Z}`:"",G=X?` Cause: ${X}.`:"",z=J.length>0?`
|
|
3602
3749
|
searched:
|
|
3603
3750
|
${J.map((K)=>` - ${K}`).join(`
|
|
3604
|
-
`)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function
|
|
3605
|
-
`)}`}if(J&&W0.includes("{{ text || slot }}"))W0=W0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:i0}=await n("stx/slots",()=>import("./chunk-
|
|
3751
|
+
`)}`:"";console.error(`[stx] component <${$}> could not be resolved${Q}, so it rendered as nothing.${G}${z}`)}function YJ($){return`<!-- stx: component "${$.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Oq($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function k1($,Z,J,X,Y,Q,G,z=new Set,K){let{extractVariables:q}=await n("stx/variable-extractor",()=>import("./chunk-sm3d4kbn.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let H=new Set(W);H.add($);let U=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=U&&U!=="load"&&Bq(U)?U:"";try{let B=(d)=>d.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,O=null,_=Y.__importedComponents;if(_){let d=[F,F.toLowerCase(),B(F),V(F)];for(let c of d)if(_.has(c)){O=_.get(c);break}}let L=[];if(!O){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],c=[...new Set(d)],G0=Y.__originalFilePath,s=[];if(s.push(...G._layerComponentDirs??[]),G0){let I0=g.join(g.dirname(G0),"components");s.push(I0)}if(X)s.push(X);let R0=G._rootComponentsDir;if(typeof R0==="string"&&!s.includes(R0))s.push(R0);let H0=g.join(g.dirname(Q),"components");if(!s.includes(H0))s.push(H0);if(G.componentsDir&&G.componentsDir!==X&&!s.includes(G.componentsDir))s.push(G.componentsDir);let b0=typeof G.root==="string"?g.resolve(G.root):void 0,J1=b0??g.dirname(Q),v0=[];if(b0)v0.push(g.resolve(b0,"resources/views/components")),v0.push(g.resolve(b0,"resources/components")),v0.push(g.resolve(b0,"src/components")),v0.push(g.resolve(b0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let I0 of v0)if(!s.includes(I0))s.push(I0);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let I0 of a)if(typeof I0==="string"&&!s.includes(I0))s.push(I0)}if(G.fallbackComponentsDir&&!s.includes(G.fallbackComponentsDir))s.push(G.fallbackComponentsDir);let u0=[...new Set(s.map((I0)=>{if(!I0)return I0;return g.isAbsolute(I0)?I0:g.resolve(J1,I0)}))];s.length=0,s.push(...u0);let L1=`${F}\x00${Q}\x00${u0.join("\x00")}`,e9=o9.get(L1);if(e9)if(await e(e9))O=e9;else o9.delete(L1);if(!O&&(F.startsWith("./")||F.startsWith("../")))O=g.resolve(g.dirname(Q),`${F}.stx`),L.push(O);else if(!O)for(let I0 of s){if(!I0)continue;for(let i2 of c){let n2=g.join(I0,i2);if(L.push(n2),await e(n2)){O=n2;break}}if(O)break;if(!O)try{let i2=await import("fs");if(!i2.statSync(I0,{throwIfNoEntry:!1})?.isDirectory())continue;let FJ=8,$5=[{path:I0,depth:0}];while($5.length>0&&!O){let s2=$5.pop();if(s2.depth>=FJ)continue;let O3;try{O3=i2.readdirSync(s2.path,{withFileTypes:!0})}catch{continue}for(let o2 of O3){if(!o2.isDirectory())continue;if(o2.name==="node_modules"||o2.name.startsWith("."))continue;let F3=g.join(s2.path,o2.name);for(let _J of c){let Z5=g.join(F3,_J);if(L.push(Z5),await e(Z5)){O=Z5;break}}if(O)break;$5.push({path:F3,depth:s2.depth+1})}}}catch{}if(O)break}if(O)o9.set(L1,O)}if(!O||!await e(O))return XJ($,Q,L),YJ($);K.add(O);let w;if(c2.has(O))w=c2.get(O);else try{w=await Bun.file(O).text(),c2.set(O,w)}catch(d){let c=d instanceof Error?d.message:String(d);return XJ($,Q,[O],c),YJ($)}let R=new Set(["__originalFilePath","__importedComponents",a2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,c]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=c;let N=J;if(J.includes("@include")){let{processIncludes:d}=await n("stx/includes",()=>import("./chunk-059sx1ky.js"));N=await d(J,Y,Q,G,K)}let T=f0(N),M=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,c)=>{let G0=T.scripts[Number(c)]||"",s=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",R0=s.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),H0=!R0||["module","text/javascript","application/javascript"].includes(R0);if(!/\bserver\b/i.test(s)&&H0)return M.push(G0),"";return G0}),{extractSlotContent:k}=await n("stx/slots",()=>import("./chunk-hs73jbhj.js")),A=k(I),E={};if(A.defaultSlot?.trim())E.default=A.defaultSlot;for(let[d,c]of A.namedSlots)E[d]=c.content;let S=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++S.n}_${S.key}`,y={...D,$uid:b,...Z,props:Z,slot:I,$slots:E,__processedComponents:H,__sections:{},__stx_signals_gate:X1(w)||Vq(J)};Hq(w,y);let P=w,h=F9(P);if(h)P=h.content.trim();let p=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,u=[...w.matchAll(p)],o=[],$0=null,Y0=u.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),i=null,q0=null,r=null,L0=0,c0=null;if(Yq(G),Y0&&j3>0){let d=Qq({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((c)=>c.configFile),uid:b});if(d!==null){i=`${O}\x00${U1(w)}\x00${d}`;let c=r9.get(i);if(c){for(let G0 of c.dependencies)K.add(G0);if(S3(Y,c.clientFactories),S.n+=c.uidsConsumed,c.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let s of c.preservedClientExpressions)G0.add(s);Y.__stx_preserved_client_expressions=[...G0]}return c.output}q0=new Set(K),r=b3(Y),L0=S.n,c0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}let p0=new Set;for(let d of u){let c=d[1]||"",G0=d[2]||"",s=c.includes("server");if(E1(c)&&G0.trim())G0=y1(G0);if(s&&G0){for(let H0 of j1(G0))p0.add(H0);try{await q(G0,y,O,{onFailure:(H0)=>{if(H0.kind!=="unknown")$0=H0.kind}})}catch(H0){}}if(!s){let H0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b0=H0.includes("{{")&&H0.includes("}}"),J1=H0.includes("{!!")&&H0.includes("!!}");if(b0||J1)H0=U5(H0,y,O);let v0=c.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");o.push(`<script${v0}>${H0}</script>`)}}let f=f0(w).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),l=f?f[1]:"",J0=f?f[2]:"",j0="",_0=l&&/\bscoped\b/i.test(l);if(f)j0=`<style${l}>${Lq(J0,y,O)}</style>`;let W0=P;if(W0=W0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f)W0=W0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(W0=W0.replace(d,(G0,s)=>{let R0=s.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(R0)c.push(`<style${R0[1]}>${R0[2]}</style>`);return""}),W0=W0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)j0=`${j0}${c.join(`
|
|
3752
|
+
`)}`}if(J&&W0.includes("{{ text || slot }}"))W0=W0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:i0}=await n("stx/slots",()=>import("./chunk-hs73jbhj.js")),{defaultSlot:a9,namedSlots:t9}=A,K2=o.some((d)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),C=(d)=>K2?x8(d,b):d,v=new Map([...t9].map(([d,c])=>[d,{...c,content:C(c.content)}]));W0=await i0(W0,C(a9),v,y);let m=Oq(o),t=(Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[]).filter((d)=>!p0.has(d));if(m.length>0||t.length>0)y.__stx_client_signal_names=[...new Set([...t,...m])];else delete y.__stx_client_signal_names;let K0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:K2||o.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let w0=await Y3(W0,y,O,K0,K),Z1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of w0.matchAll(/\{\{([\s\S]*?)\}\}/g))Z1.add(d[1].trim());if(Z1.size>0)Y.__stx_preserved_client_expressions=[...Z1];let V1=b,y0=w0;if(K2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${eZ(JSON.stringify(Z))}"`}catch{}let c=j?` stx-hydrate="${eZ(j)}"`:"",G0=` data-stx-scope="${V1}"${d}${c}`;y0=jq(w0,G0)??`<div${G0}>${w0}</div>`;let s=await Promise.all(o.map(async(R0)=>{let H0=R0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!H0)return R0;let[,b0,J1]=H0,{vendorStyleTags:v0,factoryBody:a}=await wq(J1,O,G.buildMode==="compile"),u0=j?null:Q5(Y,a),L1=u0?`window.__stxComponentFactories[${JSON.stringify(u0)}](${JSON.stringify(V1)});`:`(${a})(${JSON.stringify(V1)});`;if(j)return`${v0}<script type="stx/island" data-stx-island="${V1}" data-stx-scoped data-stx-owner="${V1}"${b0}>${L1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${V1}"${b0}>${L1}</script>`}));if(y0=y0+`
|
|
3606
3753
|
`+s.join(`
|
|
3607
3754
|
`),j0)y0+=`
|
|
3608
3755
|
`+j0}else{if(j0)y0+=`
|
|
@@ -3610,9 +3757,9 @@ ${J.map((K)=>` - ${K}`).join(`
|
|
|
3610
3757
|
`+G0.join(`
|
|
3611
3758
|
`),y.__stx_event_bindings=[]}}if(_0){let d=c9(y0,O);if(d.hasScoped)y0=d.html}if(i&&q0){let d=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];r9.set(i,{output:y0,dependencies:[...K].filter((c)=>!q0.has(c)),clientFactories:r?C3(Y,r):[],uidsConsumed:S.n-L0,preservedClientExpressions:c0?d.filter((c)=>!c0.has(c)):[]})}if($0)y0=`<!--stx-render-failed:${$0}-->${y0}`;return M.length>0?`${y0}
|
|
3612
3759
|
${M.join(`
|
|
3613
|
-
`)}`:y0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function e($){return Bun.file($).exists()}function B3($,Z){let J=g.resolve(Z),X=g.resolve($),Y=J.endsWith(g.sep)?J:J+g.sep;if(X===J||X.startsWith(Y))return X;return null}async function
|
|
3760
|
+
`)}`:y0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function e($){return Bun.file($).exists()}function B3($,Z){let J=g.resolve(Z),X=g.resolve($),Y=J.endsWith(g.sep)?J:J+g.sep;if(X===J||X.startsWith(Y))return X;return null}async function Fq($,Z,J,X){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await e(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function q9($,Z,J,X){let Y=await _q($,Z,J,X);if(Y===null)return null;let Q=B3(Y,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir,...J._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let K=g.isAbsolute(z)?z:g.resolve(process.cwd(),z);if(B3(Y,K))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function _q($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let U=g.join(Q,$),j=B3(U,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await e(j)&&X)X.add(j);return j}let G=g.join(Y,$);if(await e(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let j=`${G}${U}`;if(await e(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(z.push(...J._layerLayoutDirs??[]),J.layoutsDir)z.push(g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir));let K=g.resolve(Y),q=process.cwd();for(let U=0;U<10;U++){let j=g.join(K,"layouts"),B=!1;try{B=KJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=g.dirname(K);if(V===K||V.length<q.length)break;K=V}for(let U of z){let j=await Fq(U,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let U=g.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:g.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[g.join(U,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let V of B)if(await e(V)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(X)X.add(V);return V}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=g.join(J.partialsDir||Y,"layouts",U[1]);if(await e(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await e(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(J.partialsDir){let U=g.join(J.partialsDir,"layouts");if(await e(U)){let j=g.join(U,$);if(await e(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await e(B)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let W=J.partialsDir||g.join(process.cwd(),"views"),H=g.join(W,$);if(await e(H)){if(J.debug)console.log(`Found in views path: ${H}`);if(X)X.add(H);return H}if(!$.endsWith(".stx")){let U=`${H}.stx`;if(await e(U)){if(J.debug)console.log(`Found in views path with extension: ${U}`);if(X)X.add(U);return U}}if(Y.includes("temp")){let U=g.join(g.dirname(Y),"layouts",$);if(await e(U)){if(J.debug)console.log(`Found in temp layouts dir: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await e(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function WJ($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
3614
3761
|
`),z=0;for(let K=0;K<G.length;K++)if(z+=G[K].length+1,z>=Z){X=K+1,Y=G[K].trim();let q=Math.max(0,K-2),W=Math.min(G.length,K+3);Q=G.slice(q,W).map((H,U)=>{let j=q+U+1;return`${j===X?"> ":" "}${j}: ${H}`}).join(`
|
|
3615
|
-
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return
|
|
3762
|
+
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return WJ($,G)}}catch{}return{lineNumber:X,lineContent:Y,context:Q}}var Z0={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 O0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=WJ(X,Y,Q),K=J.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&X){let H=X.lastIndexOf(`
|
|
3616
3763
|
`,Math.max(0,Y-1));q=Y-(H+1)+1}let W="";if(G>0)W+=`
|
|
3617
3764
|
${J}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
3618
3765
|
`;if(W+=`
|
|
@@ -3625,8 +3772,8 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
3625
3772
|
`,z)W+=`
|
|
3626
3773
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3627
3774
|
${Z0.dim}${z}${Z0.reset}
|
|
3628
|
-
`;return W}function
|
|
3629
|
-
${o1("const",[...
|
|
3775
|
+
`;return W}function F_(){c2.clear(),o9.clear(),r9.clear()}function __(){return{size:c2.size,maxSize:500}}var U3=S1(128);async function wq($,Z,J){let X=U1($,Z,J),Y=U3.get(X);if(Y){if(zJ(Y.deps))return Y;U3.delete(X)}let Q=V3($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=L3(Q.styles);G=J2(G).code;let{hasUserImports:K,bundleClientScript:q}=await n("stx/client-script-bundler",()=>import("./chunk-cfskf6ag.js")),W=[],H=!1;if(K(G)){let O=G;G=await q(O,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),H=G===O}let{stripStxRuntimeImports:U}=await n("stx/signal-processing",()=>import("./chunk-9dr0s6qa.js"));G=U(G);let j=e0(G),B=Kq(j),V=`function(__scopeId) {
|
|
3776
|
+
${o1("const",[...QJ,...B],j)}
|
|
3630
3777
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3631
3778
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
3632
3779
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -3654,18 +3801,18 @@ catch (e) {}
|
|
|
3654
3801
|
finally {
|
|
3655
3802
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
3656
3803
|
}
|
|
3657
|
-
}`,F={vendorStyleTags:z,factoryBody:V,deps:
|
|
3804
|
+
}`,F={vendorStyleTags:z,factoryBody:V,deps:GJ([...W,...Q.styles.map((O)=>O.resolvedPath)])};if(!H&&Q.unresolved.length===0)U3.set(X,F);return F}var Rq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Dq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Nq($,Z){let J=Z;while(!0){let X=v1.join(J,"node_modules",$,"package.json");if(p2.existsSync(X))return v1.dirname(X);let Y=v1.dirname(J);if(Y===J)return null;J=Y}}function Mq($,Z){if(!$||typeof $!=="object")return null;let J=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return J(Y.import);if(typeof Y.default==="object")return J(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Y,prefix:G,suffix:z}}if(X){let Y=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=J($[X.pattern]);if(Q)return Q.replace("*",Y)}return null}function Aq($,Z){let J=Dq($);if(!J||!J.subpath)return null;let X=Nq(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(p2.readFileSync(v1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=Mq(Y.exports,Q);if(!G)return null;let z=v1.resolve(X,G);return p2.existsSync(z)?z:null}function V3($,Z){let J=Z.filePath?v1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(Rq,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:v1.resolve(J,q),!p2.existsSync(W))throw Error(`file not found: ${W}`)}else{let H=null;try{H=Bun.resolveSync(q,X)}catch{H=Aq(q,X)}if(!H)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=H}}catch(H){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${H?.message||H}`),G.push(q),""}if(Y.has(W))return"";Y.add(W);try{let H=p2.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:H})}catch(H){console.warn(`[stx:vendor-css] could not read ${W}: ${H?.message||H}`),G.push(q)}return""}),styles:Q,unresolved:G}}function Iq($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function L3($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Iq(Z.source)}" data-stx-layer="vendor">
|
|
3658
3805
|
@layer vendor {
|
|
3659
3806
|
${Z.contents}
|
|
3660
3807
|
}
|
|
3661
3808
|
</style>`}).join(`
|
|
3662
3809
|
`)}
|
|
3663
|
-
`}var
|
|
3810
|
+
`}var Tq=Q2;function J2($){let Z=Q0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of z[1].split(",")){let q=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)J.add(q)}let X=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of z[1].split(",")){let q=K.trim().split(/[:=]/).pop()?.trim();if(q)X.add(q)}let Y=H1.filter((z)=>{if(J.has(z)||X.has(z))return!1;return LJ(Z,z,!0)}),Q=BJ(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
3664
3811
|
`)}
|
|
3665
|
-
${$}`,imports:Y,models:Q}}var
|
|
3812
|
+
${$}`,imports:Y,models:Q}}var kq=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 BJ($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=J.exec($))!==null)if(!kq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Eq($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of J[1].split(",")){let Y=X.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function VJ($){let Z=new Set,J=new Set,X=$;X=X.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let Y=new Set,Q=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Q.exec($))!==null){let H=G[1],U=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of H.split(",")){let F=V.trim();if(!F||F.startsWith("type "))continue;let O=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!O)continue;let _=O[1],L=O[2]||_;if(Y.add(_),Y.add(L),U==="stx"||U==="@stacksjs/stx")Z.add(_);else J.add(_);if(L!==_)j.push(`${L} = ${_}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=Eq(X);for(let H of Tq){if(Y.has(H)||z.has(H))continue;if(new RegExp(`\\b${H}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(H)}let K=Q0(X),q=new Set;for(let H of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of H[1].split(",")){let j=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let V=B.trim();if(V)q.add(V)}}for(let H of H1){if(Y.has(H)||z.has(H)||q.has(H))continue;if(LJ(K,H))J.add(H)}let W=BJ(X);for(let H of W)if(!Y.has(H)&&!z.has(H))J.add(H);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function LJ($,Z,J=!1){let X=new RegExp(`\\b${Z.replace(/[$]/g,"\\$")}\\b`,"g");for(let Y of $.matchAll(X)){let Q=Y.index??0,G=Q+Z.length,z=Q-1;while(z>=0&&/\s/.test($[z]))z--;if($[z]==="."&&$.slice(Math.max(0,z-2),z+1)!=="...")continue;let K=G;while(K<$.length&&/\s/.test($[K]))K++;if($[K]===":"&&$[K+1]!==":"&&($[z]==="{"||$[z]===","))continue;if(J&&!/^\s*(?:<[^>]*>)?\s*\(/.test($.slice(G)))continue;return!0}return!1}function OJ($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
3666
3813
|
${J.join(`
|
|
3667
3814
|
`)}
|
|
3668
|
-
${
|
|
3815
|
+
${yq($,Z)}`;return""}function x_($,Z=[]){let{browserImports:J}=VJ($),X=new Set(Z);return OJ([],J.filter((Y)=>!X.has(Y)))}function yq($,Z){let J=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
3669
3816
|
[${J.join(", ")}].forEach(function (e) {
|
|
3670
3817
|
if (e[1] !== 'undefined') return;
|
|
3671
3818
|
console.error(
|
|
@@ -3674,10 +3821,10 @@ ${Eq($,Z)}`;return""}function b_($,Z=[]){let{browserImports:J}=BJ($),X=new Set(Z
|
|
|
3674
3821
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
3675
3822
|
);
|
|
3676
3823
|
});
|
|
3677
|
-
`}function d9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function
|
|
3824
|
+
`}function d9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function bq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Cq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,HJ=new Set;function Sq($,Z){let J=Cq.test($),X=Z.length>32768;if(!J&&!X)return;if(HJ.has($))return;if(HJ.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" 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(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function s$($,Z){if(!Z)return"";let J=Q0($),X=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!bq(J,Q))continue;if(r2($,Q)){if(X)console.warn(`[stx] defineClientPayload declares "${Q}", but this client block also declares "${Q}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Q}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;Sq(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
3678
3825
|
${Y.join(`
|
|
3679
3826
|
`)}
|
|
3680
|
-
`}var
|
|
3827
|
+
`}var Pq={left:0,middle:1,right:2};function vq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=Pq[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function xq($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=X5($.handler),G=vq(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(J5(X,Y))z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),H=`var $emit = function(name, detail) {
|
|
3681
3828
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
3682
3829
|
};`;function U(j){if(/\$emit\s*\(/.test(j))return`${H}
|
|
3683
3830
|
${j}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -3720,23 +3867,23 @@ else {
|
|
|
3720
3867
|
else {
|
|
3721
3868
|
${Q}
|
|
3722
3869
|
}
|
|
3723
|
-
}${K})`}function
|
|
3870
|
+
}${K})`}function fq($){if($.length===0)return"";return`
|
|
3724
3871
|
// STX: auto-generated event bindings
|
|
3725
|
-
${$.map((J,X)=>
|
|
3726
|
-
`)}`}function
|
|
3727
|
-
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var
|
|
3872
|
+
${$.map((J,X)=>xq(J,X)).join(`
|
|
3873
|
+
`)}`}function UJ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let q=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&q===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(X[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===K){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
|
|
3874
|
+
`)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let K=X.slice(G),q=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=q[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let H=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let U=H[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=H[0].length;continue}}G++}return Z}var gq=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 hq($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!gq.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=H.exec($))!==null)X(Q[1]);return Z}async function l9($,Z={}){let J=$,X="",Y=!1,Q=[],G=V3(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=L3(G.styles),K=J2(J);J=K.code,Q=[...K.imports,...K.models];let{hasUserImports:q,bundleClientScript:W}=await n("stx/client-script-bundler",()=>import("./chunk-cfskf6ag.js"));if(q(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=VJ(J);J=L.code,X=OJ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${s$(J,Z.serverData)}${X}`,J=e0(J),!Y&&E1(Z.attrs||""))J=y1(J);let H=fq(Z.eventBindings||[]),U=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(U),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
|
|
3728
3875
|
${Z2(`${X}${J}
|
|
3729
3876
|
${H}`)}
|
|
3730
|
-
</script>`}let V=
|
|
3877
|
+
</script>`}let V=jJ($),F=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function _(L){let w=L.length>0?`
|
|
3731
3878
|
return { ${L.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${B}>
|
|
3732
3879
|
window.stx.mount(function() {
|
|
3733
3880
|
'use strict';
|
|
3734
3881
|
${Z2(`${X}${J}
|
|
3735
3882
|
${H}${w}`)}
|
|
3736
|
-
})</script>`}if(!O&&!F){if(V)return _(
|
|
3883
|
+
})</script>`}if(!O&&!F){if(V)return _(UJ($));if(Z.templateContent){let L=UJ($);if(L.length>0){let w=hq(Z.templateContent);if(L.some((D)=>w.has(D)))return _(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
|
|
3737
3884
|
;(function() {
|
|
3738
3885
|
'use strict';
|
|
3739
3886
|
${Z2(`${X}${J}
|
|
3740
3887
|
${H}`)}
|
|
3741
3888
|
})()</script>`}
|
|
3742
|
-
export{
|
|
3889
|
+
export{zX as vl,KX as wl,qX as xl,a0 as yl,V5 as zl,L5 as Al,O5 as Bl,F5 as Cl,W4 as Dl,q4 as El,OX as Fl,_X as Gl,RX as Hl,EW as Il,yW as Jl,bW as Kl,CW as Ll,SW as Ml,QX as Nl,Q4 as Ol,G4 as Pl,z4 as Ql,K4 as Rl,TW as Sl,w4 as Tl,F2 as Ul,wJ as Vl,J5 as Wl,X5 as Xl,Y5 as Yl,AJ as Zl,I3 as _l,mq as $l,H1 as am,X2 as bm,gL as cm,V3 as dm,L3 as em,Tq as fm,J2 as gm,VJ as hm,LJ as im,OJ as jm,x_ as km,d9 as lm,s$ as mm,l9 as nm,nq as om,$9 as pm,sq as qm,oq as rm,rq as sm,aq as tm,X9 as um,fJ as vm,HW as wm,gJ as xm,UW as ym,hJ as zm,Z9 as Am,W5 as Bm,H5 as Cm,X1 as Dm,uJ as Em,U5 as Fm,lJ as Gm,jW as Hm,F1 as Im,cJ as Jm,BW as Km,S0 as Lm,VW as Mm,_W as Nm,tJ as Om,eJ as Pm,J4 as Qm,X4 as Rm,Y4 as Sm,AW as Tm,H4 as Um,w5 as Vm,L2 as Wm,Y9 as Xm,fW as Ym,_5 as Zm,MX as _m,AX as $m,IX as an,gW as bn,j4 as cn,B4 as dn,z1 as en,K1 as fn,R1 as gn,X7 as hn,N2 as in,L9 as jn,u5 as kn,SY as ln,vY as mn,G7 as nn,fY as on,gY as pn,K7 as qn,D1 as rn,bU as sn,q7 as tn,s5 as un,lY as vn,n5 as wn,cY as xn,pY as yn,CU as zn,SU as An,W7 as Bn,H7 as Cn,U7 as Dn,iY as En,nY as Fn,PU as Gn,vU as Hn,sY as In,xU as Jn,fU as Kn,O7 as Ln,R7 as Mn,a5 as Nn,oU as On,I2 as Pn,t5 as Qn,e5 as Rn,rU as Sn,HQ as Tn,aU as Un,UQ as Vn,M7 as Wn,tU as Xn,jQ as Yn,eU as Zn,$j as _n,F9 as $n,G$ as ao,Rj as bo,Dj as co,Nj as do,Mj as eo,vQ as fo,Z6 as go,C2 as ho,pQ as io,N$ as jo,Q8 as ko,zL as lo,W8 as mo,zz as no,vL as oo,Uz as po,N8 as qo,o$ as ro,M8 as so,I8 as to,r$ as uo,kz as vo,Ez as wo,T8 as xo,F8 as yo,yz as zo,Cz as Ao,g$ as Bo,s6 as Co,o6 as Do,q3 as Eo,dK as Fo,lK as Go,cK as Ho,pK as Io,iK as Jo,nK as Ko,sK as Lo,sZ as Mo,tK as No,Jq as Oo,Xq as Po,a1 as Qo,y$ as Ro,N6 as So,VG as To,ZV as Uo,JV as Vo,j6 as Wo,XV as Xo,I$ as Yo,T$ as Zo,k$ as _o,T6 as $o,k6 as ap,E6 as bp,EV as cp,yV as dp,b6 as ep,bV as fp,NG as gp,S6 as hp,f6 as ip,v$ as jp,hG as kp,x$ as lp,d6 as mp,l6 as np,sG as op,mV as pp,dV as qp,c6 as rp,lV as sp,cV as tp,f$ as up,iV as vp,p6 as wp,nV as xp,t6 as yp,x9 as zp,f9 as Ap,$2 as Bp,aG as Cp,$8 as Dp,Z8 as Ep,tV as Fp,m$ as Gp,tG as Hp,eG as Ip,d$ as Jp,l$ as Kp,J8 as Lp,X8 as Mp,a$ as Np,t$ as Op,Z3 as Pp,Y3 as Qp,OZ as Rp,GK as Sp,qK as Tp,WK as Up,j1 as Vp,kF as Wp,EF as Xp,yF as Yp,bF as Zp,AZ as _p,AK as $p,CF as aq,SF as bq,PF as cq,yK as dq,vK as eq,xK as fq,fK as gq,gK as hq,Gq as iq,E1 as jq,H3 as kq,y1 as lq,jq as mq,k9 as nq,Bq as oq,Vq as pq,Oq as qq,k1 as rq,e as sq,q9 as tq,WJ as uq,O0 as vq,F_ as wq,__ as xq,R4 as yq,D4 as zq,_1 as Aq,N4 as Bq,f1 as Cq,M4 as Dq,_2 as Eq,aW as Fq,uX as Gq,D5 as Hq,tW as Iq,N5 as Jq,eW as Kq,$H as Lq,Q1 as Mq,ZH as Nq,JH as Oq,XH as Pq,YH as Qq,QH as Rq,GH as Sq,mX as Tq,A5 as Uq,A4 as Vq,KH as Wq,qH as Xq,WH as Yq,HH as Zq,UH as _q,T4 as $q,jH as ar,k4 as br,BH as cr,VH as dr,w2 as er,nX as fr,_H as gr,oX as hr,P4 as ir,K9 as jr,AH as kr,m4 as lr,C5 as mr,vH as nr,P5 as or,HY as pr,VY as qr,xH as rr,fH as sr,gH as tr,hH as ur,uH as vr,mH as wr,LY as xr,OY as yr,l4 as zr,v5 as Ar,RY as Br,f5 as Cr,Z7 as Dr,YU as Er,QU as Fr,h5 as Gr,TY as Hr,J7 as Ir};
|