@stacksjs/stx 0.2.415 → 0.2.416
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-02k2v1mb.js +2 -0
- package/dist/chunk-0dh1rgg8.js +2 -0
- package/dist/{chunk-eed4fwps.js → chunk-0es4h5v1.js} +2 -2
- package/dist/chunk-0hrqt5c2.js +2 -0
- package/dist/chunk-0vtk2rpr.js +2 -0
- package/dist/{chunk-mp6hy8g4.js → chunk-1ctvgd7v.js} +1 -1
- package/dist/chunk-1rd3jzrq.js +2 -0
- package/dist/{chunk-b98be3yp.js → chunk-26j2q9rq.js} +7 -7
- package/dist/chunk-2py27bzq.js +2 -0
- package/dist/{chunk-px7fvbj6.js → chunk-2qa7hjp2.js} +2 -2
- package/dist/chunk-35e6zj5x.js +2 -0
- package/dist/{chunk-qghxz7jm.js → chunk-388rx71h.js} +6 -6
- package/dist/chunk-3ch40ebr.js +2 -0
- package/dist/{chunk-bay9s6rs.js → chunk-3g8zzdgs.js} +5 -5
- package/dist/{chunk-md8rqn48.js → chunk-3t0yaexe.js} +5 -5
- package/dist/{chunk-b84h16er.js → chunk-3wrmz1j9.js} +6 -6
- package/dist/{chunk-ak1cgcah.js → chunk-41k0th97.js} +4 -4
- package/dist/chunk-49cpqjx2.js +2 -0
- package/dist/chunk-4k1nkp9r.js +2 -0
- package/dist/chunk-50vq8k55.js +2 -0
- package/dist/chunk-56pkjk55.js +2 -0
- package/dist/chunk-5hnh00ry.js +2 -0
- package/dist/chunk-5j52h3e3.js +2 -0
- package/dist/chunk-5y1mekxe.js +2 -0
- package/dist/chunk-5zryk911.js +2 -0
- package/dist/{chunk-h6zsqb9r.js → chunk-6agy2x1f.js} +2 -2
- package/dist/chunk-72w28vm8.js +2 -0
- package/dist/{chunk-3kthfs03.js → chunk-7mbpjv9e.js} +2 -2
- package/dist/chunk-7s7k94as.js +2 -0
- package/dist/{chunk-9g27ybyr.js → chunk-7tabykst.js} +2 -2
- package/dist/chunk-7wb6jf17.js +2 -0
- package/dist/{chunk-9p9qkbtg.js → chunk-7zjvsacw.js} +2 -2
- package/dist/{chunk-fh1qrp68.js → chunk-89xcpdsp.js} +5 -5
- package/dist/chunk-8cbkqckh.js +2 -0
- package/dist/chunk-8ycy1b0e.js +2 -0
- package/dist/chunk-8ygks6dx.js +3 -0
- package/dist/{chunk-xtvf6n6f.js → chunk-95165j9c.js} +2 -2
- package/dist/{chunk-re8b5r9x.js → chunk-9fyss0yk.js} +2 -2
- package/dist/{chunk-8eqrwj1k.js → chunk-9rnh52t2.js} +10 -10
- package/dist/{chunk-169n1vpx.js → chunk-9t2xx2y4.js} +3 -3
- package/dist/{chunk-0zaess6f.js → chunk-a47yp92z.js} +5 -5
- package/dist/{chunk-765e1s44.js → chunk-ae7j3n39.js} +6 -6
- package/dist/chunk-aqrnpgn7.js +2 -0
- package/dist/{chunk-amtr3rmf.js → chunk-at0ar6t3.js} +3 -3
- package/dist/chunk-b9rebdtq.js +2 -0
- package/dist/{chunk-7gkv67ky.js → chunk-bfjzfrw3.js} +2 -2
- package/dist/{chunk-z0g9jvv0.js → chunk-c4bkj1xw.js} +6 -6
- package/dist/chunk-c4thhfx9.js +2 -0
- package/dist/{chunk-6hc5vz20.js → chunk-cn9hgyh5.js} +2 -2
- package/dist/{chunk-pgzvyrv6.js → chunk-cq408jrm.js} +3 -3
- package/dist/chunk-cw6kqb63.js +2 -0
- package/dist/chunk-d3vtgnep.js +2 -0
- package/dist/chunk-d4ynv4z2.js +2 -0
- package/dist/chunk-d7xrewxq.js +2 -0
- package/dist/{chunk-q9bdh4s5.js → chunk-dd5fa7d6.js} +2 -2
- package/dist/{chunk-shr559s7.js → chunk-ddk6fx5b.js} +2 -2
- package/dist/{chunk-8nhshfz6.js → chunk-de2pv6ys.js} +2 -2
- package/dist/{chunk-3efw27as.js → chunk-dg1n3g1d.js} +146 -146
- package/dist/chunk-ecr598p7.js +2 -0
- package/dist/chunk-eev80mpy.js +2 -0
- package/dist/chunk-ef5vz9w5.js +2 -0
- package/dist/chunk-f5qd84w8.js +2 -0
- package/dist/{chunk-gawrg4gb.js → chunk-fctjn68q.js} +6 -6
- package/dist/{chunk-amd6ey3t.js → chunk-fkhxz1dx.js} +5 -5
- package/dist/chunk-g69tnqga.js +2 -0
- package/dist/chunk-gacycmb0.js +2 -0
- package/dist/chunk-ggywfyzm.js +2 -0
- package/dist/chunk-gp1bhn7t.js +2 -0
- package/dist/{chunk-vgvtnwxa.js → chunk-gq97zh73.js} +3 -3
- package/dist/chunk-gr3r9xdh.js +2 -0
- package/dist/{chunk-ngc2wke4.js → chunk-gxrewzhv.js} +2 -2
- package/dist/{chunk-wfy1zq53.js → chunk-gyv1t0f0.js} +5 -5
- package/dist/{chunk-340a824p.js → chunk-h8wegkb5.js} +1 -1
- package/dist/{chunk-e9hs7kk6.js → chunk-hec0bvvf.js} +1 -1
- package/dist/chunk-hg1eq72d.js +2 -0
- package/dist/chunk-hvyqs5tf.js +2 -0
- package/dist/{chunk-y5310237.js → chunk-j8rxdbe5.js} +2 -2
- package/dist/{chunk-5qns2sdz.js → chunk-jr4dwkvc.js} +2 -2
- package/dist/chunk-kbysqxmd.js +2 -0
- package/dist/chunk-kmnsrvrp.js +2 -0
- package/dist/chunk-m6fvj7g1.js +2 -0
- package/dist/{chunk-j03revz2.js → chunk-m9xdkzm6.js} +3 -3
- package/dist/chunk-mgw2cvb7.js +2 -0
- package/dist/chunk-mvwt1c8f.js +2 -0
- package/dist/{chunk-v91p6ekp.js → chunk-n5k88y07.js} +3 -3
- package/dist/{chunk-r3f9jcf7.js → chunk-nj8edn4m.js} +3 -3
- package/dist/chunk-nvh31cxn.js +2 -0
- package/dist/{chunk-fr2txj8q.js → chunk-p1tb8kxq.js} +4 -4
- package/dist/chunk-p34gbb4z.js +2 -0
- package/dist/chunk-peyt18ce.js +2 -0
- package/dist/{chunk-jnkrn913.js → chunk-ppse812s.js} +1 -1
- package/dist/{chunk-752hw7cd.js → chunk-qff4qkx5.js} +3 -3
- package/dist/chunk-qpx8kvd8.js +2 -0
- package/dist/{chunk-f46qsp4m.js → chunk-qzkebqm3.js} +2 -2
- package/dist/chunk-rb272g9d.js +3 -0
- package/dist/{chunk-m4sk62wb.js → chunk-rfdqrv5v.js} +4 -4
- package/dist/{chunk-9vrja6vp.js → chunk-rg6csnkw.js} +1 -1
- package/dist/chunk-rh1dyfsn.js +2 -0
- package/dist/{chunk-czxt605c.js → chunk-rhw7pqhy.js} +4 -4
- package/dist/{chunk-thyt8ed8.js → chunk-rp4khnan.js} +3 -3
- package/dist/{chunk-s5xezjps.js → chunk-rqc4jx2v.js} +1 -1
- package/dist/chunk-rspc8gn8.js +2 -0
- package/dist/{chunk-9amp82bx.js → chunk-rv5bk83t.js} +2 -2
- package/dist/chunk-rvs61c88.js +2 -0
- package/dist/chunk-sf1vhfrb.js +2 -0
- package/dist/{chunk-96k8s808.js → chunk-sh5c60a2.js} +2 -2
- package/dist/{chunk-ym95v4nc.js → chunk-std6xw3y.js} +2 -2
- package/dist/{chunk-pbh4smw3.js → chunk-t9axxwy9.js} +4 -4
- package/dist/{chunk-wzx0164n.js → chunk-tc274fcv.js} +4 -4
- package/dist/{chunk-9pt8fd2n.js → chunk-tfhjbjq5.js} +3 -3
- package/dist/chunk-ty7t3gp4.js +3 -0
- package/dist/{chunk-6h38kkjf.js → chunk-v096a6fw.js} +6 -6
- package/dist/chunk-vc9wa97m.js +2 -0
- package/dist/{chunk-y1cmjvk3.js → chunk-vvp4cmfq.js} +5 -5
- package/dist/{chunk-t4hzprsm.js → chunk-vvs75dse.js} +2 -2
- package/dist/{chunk-tafqyf2g.js → chunk-wjag92ch.js} +73 -73
- package/dist/chunk-wjzqz3yr.js +2 -0
- package/dist/{chunk-hepd9qgx.js → chunk-wpe72ann.js} +5 -5
- package/dist/{chunk-ej9j6k1q.js → chunk-x0mq57pe.js} +2 -2
- package/dist/chunk-x7j0krz8.js +2 -0
- package/dist/chunk-xkv0evbf.js +2 -0
- package/dist/{chunk-x0q32ees.js → chunk-y5cqkmkf.js} +2 -2
- package/dist/{chunk-42wbs8vq.js → chunk-y6rahx7t.js} +5 -5
- package/dist/{chunk-yazk54jr.js → chunk-yk63jd7v.js} +1 -1
- package/dist/chunk-yt452b4a.js +2 -0
- package/dist/{chunk-hkrmcbwy.js → chunk-yt6h8c6g.js} +11 -11
- package/dist/chunk-yxfx44fv.js +2 -0
- package/dist/{chunk-ce1sejr3.js → chunk-yzv8n6qw.js} +2 -2
- package/dist/{chunk-g186znp9.js → chunk-zcctf7tx.js} +3 -3
- package/dist/{chunk-ft4p6d28.js → chunk-znbay168.js} +2 -2
- package/dist/{chunk-xfp7k0v8.js → chunk-zyxp0nb3.js} +7 -7
- package/dist/cli.js +20 -20
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +3 -0
- package/dist/dev-server/serve-multi.js +1 -1
- package/dist/document-shell.js +15 -3
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/production-server.js +4 -4
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +15 -15
- package/package.json +5 -5
- package/dist/chunk-020xyn9q.js +0 -3
- package/dist/chunk-04jhmfbz.js +0 -2
- package/dist/chunk-0pnj3zt2.js +0 -2
- package/dist/chunk-1098mas0.js +0 -2
- package/dist/chunk-18vmfkcc.js +0 -2
- package/dist/chunk-1b6t12hd.js +0 -2
- package/dist/chunk-1zs30k3y.js +0 -2
- package/dist/chunk-2ce7f416.js +0 -2
- package/dist/chunk-393341w7.js +0 -2
- package/dist/chunk-39g1134q.js +0 -2
- package/dist/chunk-3qn1wcdg.js +0 -2
- package/dist/chunk-3s2vnqcf.js +0 -2
- package/dist/chunk-4bjravgk.js +0 -2
- package/dist/chunk-5gsxpaqk.js +0 -2
- package/dist/chunk-6cfa3g0r.js +0 -2
- package/dist/chunk-7z2ra0yf.js +0 -2
- package/dist/chunk-92ps1xpk.js +0 -2
- package/dist/chunk-9xrbve19.js +0 -2
- package/dist/chunk-atws6p5s.js +0 -2
- package/dist/chunk-dd8cja4h.js +0 -2
- package/dist/chunk-dgdm3hy3.js +0 -2
- package/dist/chunk-f1sxycmv.js +0 -2
- package/dist/chunk-fbcv4fes.js +0 -2
- package/dist/chunk-fjs0a8h7.js +0 -2
- package/dist/chunk-fpfzm238.js +0 -2
- package/dist/chunk-fyzajkrx.js +0 -2
- package/dist/chunk-fzapbw9p.js +0 -3
- package/dist/chunk-g03s93qr.js +0 -3
- package/dist/chunk-gc1drn2p.js +0 -2
- package/dist/chunk-gea5hf0v.js +0 -2
- package/dist/chunk-gqv3ta5d.js +0 -2
- package/dist/chunk-h6kp2m9r.js +0 -2
- package/dist/chunk-hbxz85wy.js +0 -2
- package/dist/chunk-hhnw2sn3.js +0 -2
- package/dist/chunk-hjg3ndgh.js +0 -2
- package/dist/chunk-hk1mj4tz.js +0 -2
- package/dist/chunk-hn9pkyv8.js +0 -2
- package/dist/chunk-hpgr4qgp.js +0 -2
- package/dist/chunk-hrbbbtbn.js +0 -2
- package/dist/chunk-j9qcrwbg.js +0 -2
- package/dist/chunk-jk4njz0w.js +0 -2
- package/dist/chunk-jmabeqfq.js +0 -2
- package/dist/chunk-jp10q90g.js +0 -2
- package/dist/chunk-jt0n43mk.js +0 -2
- package/dist/chunk-m1vdghnx.js +0 -2
- package/dist/chunk-nc8my58s.js +0 -2
- package/dist/chunk-nn2vstke.js +0 -2
- package/dist/chunk-nppdrf0x.js +0 -2
- package/dist/chunk-p2v2a68k.js +0 -2
- package/dist/chunk-pazfr1a1.js +0 -2
- package/dist/chunk-pdb5fw3r.js +0 -2
- package/dist/chunk-pdt69hpb.js +0 -2
- package/dist/chunk-q6vrb2pe.js +0 -2
- package/dist/chunk-q7qchkvk.js +0 -2
- package/dist/chunk-sd321bn3.js +0 -2
- package/dist/chunk-t5pvq5mx.js +0 -2
- package/dist/chunk-w72qx0eb.js +0 -2
- package/dist/chunk-xwzvfqcb.js +0 -2
- package/dist/chunk-ydjfar14.js +0 -2
- package/dist/chunk-z23kaxq6.js +0 -2
- package/dist/chunk-z8xn5ta3.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{yn,m,Co,Dt,Os,$o,Eo,To,_o}from"./chunk-yzv8n6qw.js";import{R}from"./chunk-de2pv6ys.js";import{t,J,or,a,re,As,_,Pt,mn,Ps,c,p,I,ke,Ze,l,ar}from"./chunk-c4bkj1xw.js";import{z,Xe,H,P,D,bo,Ct,G,$t,xe,Et,vo,Zn,ne,V,Tt,ln,Qn,f}from"./chunk-26j2q9rq.js";import{vn,wn,dr,$e}from"./chunk-rhw7pqhy.js";import{w,_s,Je,Rs,fe,ir}from"./chunk-rfdqrv5v.js";import{Cs,$s,Es,Ts,tr,nr}from"./chunk-zyxp0nb3.js";import{mo,xs,Jn,Yn}from"./chunk-41k0th97.js";import{de,At,er,ks,S,Ke}from"./chunk-gxrewzhv.js";import{cn}from"./chunk-rv5bk83t.js";import{Ds}from"./chunk-bfjzfrw3.js";import{ao,co,uo,po}from"./chunk-qff4qkx5.js";import{qe}from"./chunk-tfexmdkt.js";import{s,we}from"./chunk-9t2xx2y4.js";import{u}from"./chunk-cg8hg6cs.js";import{Rt,So,dn,pn}from"./chunk-ty7t3gp4.js";import{ge,O,hn}from"./chunk-2qa7hjp2.js";import{pr}from"./chunk-znbay168.js";import hr from"path";import Fs from"fs";var qf=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Po(e,o){if(o.passive)return!0;if(o.prevent||o.nonpassive)return!1;return qf.has(e.toLowerCase())}var Hc=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"]),qc={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"},Xf=new Set(["ctrl","alt","shift","meta"]),Zc={left:0,middle:1,right:2};function Xc(e){let o={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let x of e){let v=x.toLowerCase();if(v==="prevent")o.prevent=!0;else if(v==="stop")o.stop=!0;else if(v==="once")o.once=!0;else if(v==="capture")o.capture=!0;else if(v==="self")o.self=!0;else if(v==="passive")o.passive=!0;else if(v==="nonpassive")o.nonpassive=!0;else if(Xf.has(v))o.systemKeys.push(v);else if(v in Zc)o.mouse=v;else if(v in qc||/^[a-z]$/.test(v))o.keys.push(qc[v]||v.toUpperCase());else if(v.startsWith("debounce")){let k=v.match(/debounce(?:\.(\d+))?/);o.debounce=k?.[1]?Number.parseInt(k[1],10):300}else if(v.startsWith("throttle")){let k=v.match(/throttle(?:\.(\d+))?/);o.throttle=k?.[1]?Number.parseInt(k[1],10):300}}return o}function Jc(e,o=""){let x=[],v=0,k=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,E;while((E=k.exec(e))!==null){let[C,j,L]=E,B=E.index,F=B+C.length,U=`__stx_evt_${o}${v++}`,Z=[],Y=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Q;while((Q=Y.exec(L))!==null){let[,oe,ie]=Q,ce=oe.split("."),ae=ce[0];if(!Hc.has(ae))continue;Z.push({attribute:`@${oe}`,event:ae,handler:ie,modifiers:Xc(ce.slice(1)),elementId:U})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Q=se.exec(L))!==null){let[,oe,ie]=Q,ce=oe.split("."),ae=ce[0];if(!Hc.has(ae))continue;Z.push({attribute:`@${oe}`,event:ae,handler:ie,modifiers:Xc(ce.slice(1)),elementId:U})}if(Z.length>0)x.push({originalTag:C,elementId:U,events:Z,startIndex:B,endIndex:F})}return x}function Kf(e){let o=[],{modifiers:x}=e;if(x.self)o.push("if ($event.target !== $el) return");for(let v of x.systemKeys)o.push(`if (!$event.${v}Key) return`);if(x.keys.length>0){let v=x.keys.map((k)=>`$event.key === '${k}'`).join(" || ");o.push(`if (!(${v})) return`)}if(x.mouse!==null){let v=Zc[x.mouse];o.push(`if ($event.button !== ${v}) return`)}if(x.prevent)o.push("$event.preventDefault()");if(x.stop)o.push("$event.stopPropagation()");return o.join("; ")}function Zf(e,o){let x=e;if(o.debounce!==null)x=`__stx_debounce(() => { ${x} }, ${o.debounce})`;else if(o.throttle!==null)x=`__stx_throttle(() => { ${x} }, ${o.throttle})`;return x}function Mo(e){let o=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(o))return e;return`if (typeof ${o} === 'function' && !${o}._isSignal) ${o}($event);`}function Jf(e){let{modifiers:o}=e,x=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),v=Kf(e),k=Zf(Mo(e.handler),o),E=[];if(o.once)E.push("once: true");if(o.capture)E.push("capture: true");if(Po(e.event,o))E.push("passive: true");let C=E.length>0?`, { ${E.join(", ")} }`:"",j=k.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${x}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -111,7 +111,7 @@ else {
|
|
|
111
111
|
${e.map(Jf).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function Gf(e,o=""){let x=Jc(e,o);if(x.length===0)return{template:e,bindings:[]};let v=e,k=[];for(let E=x.length-1;E>=0;E--){let C=x[E],j=C.originalTag;if(!j.includes(" id="))j=j.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${C.elementId}"`);else{let L=j.match(/id=["']([^"']+)["']/);if(L)for(let B of C.events)B.elementId=L[1]}for(let L of C.events){let B=L.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");j=j.replace(F,""),j=j.replace(U,"")}v=v.slice(0,C.startIndex)+j+v.slice(C.endIndex),k.push(...C.events)}return{template:v,bindings:k}}function Kc(e){let o=e.$uid;return typeof o==="string"&&o?`${o}_`:""}function Gc(e,o,x){if(
|
|
114
|
+
</script>`}function Gf(e,o=""){let x=Jc(e,o);if(x.length===0)return{template:e,bindings:[]};let v=e,k=[];for(let E=x.length-1;E>=0;E--){let C=x[E],j=C.originalTag;if(!j.includes(" id="))j=j.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${C.elementId}"`);else{let L=j.match(/id=["']([^"']+)["']/);if(L)for(let B of C.events)B.elementId=L[1]}for(let L of C.events){let B=L.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");j=j.replace(F,""),j=j.replace(U,"")}v=v.slice(0,C.startIndex)+j+v.slice(C.endIndex),k.push(...C.events)}return{template:v,bindings:k}}function Kc(e){let o=e.$uid;return typeof o==="string"&&o?`${o}_`:""}function Gc(e,o,x){if($o(e))return e;if(o.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:j,bindings:L}=Gf(e,Kc(o)),B=o.__stx_event_bindings||[];return o.__stx_event_bindings=[...B,...L],j}let v=Jc(e,Kc(o));if(v.length===0)return e;let k=e;for(let j=v.length-1;j>=0;j--){let L=v[j],B=L.originalTag;if(!B.includes(" id="))B=B.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${L.elementId}"`);else{let F=B.match(/id=["']([^"']+)["']/);if(F)for(let U of L.events)U.elementId=F[1]}for(let F of L.events){let U=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Z=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),Y=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");B=B.replace(Z,""),B=B.replace(Y,"")}k=k.slice(0,L.startIndex)+B+k.slice(L.endIndex)}let E=Oo(v.flatMap((j)=>j.events)),C=k.lastIndexOf("</body>");if(C!==-1)k=k.slice(0,C)+E+`
|
|
115
115
|
`+k.slice(C);else k+=E;return k}function Yc(e,o){let x=new Set;for(let v of e.split(",")){let k=v.trim().replace(/^\.\.\./,"").trim();if(!k)continue;if(o){let E=k.lastIndexOf(":");if(E!==-1)k=k.slice(E+1).trim()}if(k=k.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(k))x.add(k)}return x}function Ks(e,o){let x=s(e),{depths:v,balanced:k}=we(x),E=(j)=>!k||v[j]===0,C=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${o}\\b)`,"g");for(let j of x.matchAll(C)){let L=(j.index??0)+j[0].length-j[1].length;if(E(L))return!0}for(let j of x.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(E(j.index??0)&&Yc(j[1],!0).has(o))return!0;for(let j of x.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(E(j.index??0)&&Yc(j[1],!1).has(o))return!0;return!1}import Bf from"fs";import Ye from"path";import{createHash as Yf}from"crypto";var Zs="__stx_component_client_factories";function Js(e){let o=e[Zs];return o instanceof Map?o:null}function el(e){e[Zs]=new Map}function No(e,o){let x=Js(e);if(!x)return null;let v=Yf("sha256").update(o).digest("hex").slice(0,16),k=x.get(v);if(k)k.instances++;else x.set(v,{body:o,instances:1});return v}function tl(e,o){let x=Js(o);if(!x?.size)return e;let v=new Map;for(let[F,U]of x)if(U.instances===1)v.set(F,U.body);let k=[];if(v.size>0){let F=[...v.keys()].map((Y)=>JSON.stringify(Y).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),U=new RegExp(`window\\.__stxComponentFactories\\[(${F})\\]\\(("[^"]+")\\);`,"g"),Z=U.exec(e);while(Z!==null){let Y=v.get(JSON.parse(Z[1]));if(Y!==void 0)k.push({start:Z.index,end:Z.index+Z[0].length,replacement:`(${Y})(${Z[2]});`});Z=U.exec(e)}}let E=[...x].filter(([,F])=>F.instances>1);if(E.length===0)return Qc(e,k);let j=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
116
116
|
(function() {
|
|
117
117
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
@@ -120,8 +120,8 @@ ${E.map(([F,U])=>` try { factories[${JSON.stringify(F)}] = factories[${JSON.str
|
|
|
120
120
|
`)}
|
|
121
121
|
})();
|
|
122
122
|
</script>`,L=e.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),B=L<0?0:L;return k.push({start:B,end:B,replacement:`${j}
|
|
123
|
-
`}),Qc(e,k)}function Qc(e,o){if(o.length===0)return e;o.sort((E,C)=>E.start-C.start||E.end-C.end);let x=Array(o.length*2+1),v=0,k=0;for(let E of o)x[k++]=e.slice(v,E.start),x[k++]=E.replacement,v=E.end;return x[k]=e.slice(v),x.join("")}function nl(e){let o=Js(e),x=new Map;if(o)for(let[v,k]of o)x.set(v,k.instances);return x}function rl(e,o){let x=Js(e);if(!x)return[];let v=[];for(let[k,E]of x){let C=E.instances-(o.get(k)??0);if(C>0)v.push({body:E.body,count:C})}return v}function sl(e,o){for(let{body:x,count:v}of o)for(let k=0;k<v;k++)No(e,x)}import cl from"fs";var il=0,jo=new Map;function ji(){il=0,jo.clear()}function Gs(e,o){let x=il++,v=`<!--__STX_${e.toUpperCase()}_${x}__-->`;return jo.set(v,{type:e,expression:o}),v}function Bi(){let e={};for(let[o,x]of jo)e[o]={type:x.type,expression:x.expression};return e}function Fi(e,o){let x=e;for(let[v,k]of o)x=x.split(v).join(k);return x}function Jr(e){return e.includes("<!--__STX_")}var Qf=/@(?=[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 eg(e){return Array.from({length:e},()=>"{").join("⁠")}function ol(e){return e.replace(/\{{2,}/g,(o)=>eg(o.length)).replace(/\{(?=!)/g,"{⁠").replace(Qf,"@")}var tg=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ng=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,rg=/^data:(?:text\/html|application\/xhtml\+xml)/,sg=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ig(e){return e.replace(sg,"").toLowerCase()}function og(e){let o=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(o))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(o))return"fetched";return null}function al(e,o="navigable"){let x=ig(e);if(tg.test(x))return!0;return o==="navigable"?ng.test(x):rg.test(x)}function Mr(e,o="navigable"){return al(e,o)?"unsafe:"+e:e}function ag(e){let o=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!o)return null;if(o[3].trim()!=="")return null;return og(o[1])}function Lo(e,o,x=256){if(o<=x)return e.slice(0,o);let v=e.slice(o-x,o),k=v.search(/[\s"'`/]/);return k===-1?"":v.slice(k)}function Bo(e,o,x=o){let v=ag(e);return v&&al(o,v)?"unsafe:"+x:x}var Nr={},ll=new Map;function cg(e){let o=ll.get(e);if(!o){let x=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`:${x}(?!\\w)`,"g"),ll.set(e,o)}return o.lastIndex=0,o}var Ln={uppercase:(e,o)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,o)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,o)=>{if(e===void 0||e===null)return"";let x=String(e);return x.charAt(0).toUpperCase()+x.slice(1)},number:(e,o,x=0)=>{if(e===void 0||e===null)return"";try{let v=Number(e);return Number.isNaN(v)?"":v.toFixed(Number.parseInt(String(x),10))}catch{return""}},fmt:(e,o,x="en-US")=>{if(e===void 0||e===null)return"";try{let v=Number(e);if(Number.isNaN(v))return String(e);return v.toLocaleString(x)}catch{return String(e)}},join:(e,o,x=",")=>{if(!Array.isArray(e))return"";return e.join(String(x))},escape:(e,o)=>{if(e===void 0||e===null)return"";return vt(String(e))},translate:(e,o,x={})=>{if(!o||!o.__translations)return e;let v=o.__translations,k=o.__i18nConfig?.fallbackToKey??!0,E=String(e).split("."),C=v;for(let L of E){if(C===void 0||C===null)break;C=C[L]}if(C===void 0||C===null)return k?e:"";let j=String(C);return Object.entries(x).forEach(([L,B])=>{j=j.replace(cg(L),String(B))}),j},t:(e,o,x={})=>Ln.translate(e,o,x),truncate:(e,o,x=50,v="...")=>{if(e===void 0||e===null)return"";let k=String(e);if(k.length<=x)return k;if(x<=v.length)return v.substring(0,x);return k.substring(0,x-v.length)+v},date:(e,o,x="short",v="en-US")=>{if(e===void 0||e===null)return"";try{let k=e instanceof Date?e:new Date(e);if(Number.isNaN(k.getTime()))return String(e);let E={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(x==="iso")return k.toISOString();return new Intl.DateTimeFormat(v,E[x]||E.short).format(k)}catch{return String(e)}},currency:(e,o,x="USD",v="en-US")=>{if(e===void 0||e===null)return"";try{let k=Number(e);if(Number.isNaN(k))return String(e);return new Intl.NumberFormat(v,{style:"currency",currency:x}).format(k)}catch{return String(e)}},pluralize:(e,o,x,v)=>{let k=Number(e);if(Number.isNaN(k))return x;let E=v||`${x}s`;return k===1?x:E},first:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let x=String(e);return x.charAt(x.length-1)},length:(e,o)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,o,x=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return x?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,o,x="")=>e===void 0||e===null||e===""?x:e,reverse:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,o,x=0,v)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(x,v);return e},replace:(e,o,x,v="")=>{if(e===void 0||e===null)return"";let k=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(k,"g"),()=>v)},stripTags:(e,o)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,o)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,o)=>{let x=Number(e);return Number.isNaN(x)?0:Math.abs(x)},round:(e,o,x=0)=>{let v=Number(e);if(Number.isNaN(v))return 0;let k=10**x;return Math.round(v*k)/k}};function Xa(e,o){if(e in Ln)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Nr[e]=o}function _u(e){for(let[o,x]of Object.entries(e))Xa(o,x)}function Ka(){return{...Ln,...Nr}}function Ru(){for(let e of Object.keys(Nr))delete Nr[e]}function Ga(e,o,x=2){let v=0,k=null;for(let E=o+x;E<e.length;E++){let C=e[E];if(k){if(C==="\\"){E++;continue}if(C===k)k=null;continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="{"){v++;continue}if(C==="}"){if(v>0){v--;continue}let j=0;while(e[E+j]==="}")j++;if(j>=x)return E}}return-1}function jn(e,o,x=2){let v="{".repeat(x);if(!e.includes(v))return e;let k="",E=0;for(;;){let C=e.indexOf(v,E);if(C===-1)break;let j=Ga(e,C,x);if(j===-1)break;k+=e.slice(E,C)+o(e.slice(C,j+x),e.slice(C+x,j),C),E=j+x}return E===0?e:k+e.slice(E)}function h(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function vt(e){return ol(h(e))}function be(e,o){let{scripts:x}=V(e);for(let v of x){let k=v.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!k||/\bserver\b|\bsrc\s*=/.test(k[1]))continue;let E=k[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(E))return!0;if(hn(E,o))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Ja(e){let o=[],x=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let v=x.exec(e);v;v=x.exec(e)){let k=v[1].toLowerCase(),E=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(v[3]);if(!E)continue;let C=new Set([E[1],...E[2]?[E[2]]:[]]),j=v.index+v[0].length;if(v[0].endsWith("/>")){o.push({start:v.index,end:j,names:C});continue}let L=new RegExp(`<(/?)${k}\\b[^>]*?(/?)>`,"gi");L.lastIndex=j;let B=1,F=e.length;for(let U=L.exec(e);U;U=L.exec(e)){if(U[2]==="/")continue;if(B+=U[1]==="/"?-1:1,B===0){F=U.index+U[0].length;break}}o.push({start:v.index,end:F,names:C})}return o}function lg(e,o,x){let v=s(x);for(let k of e){if(o<k.start||o>=k.end)continue;for(let E of k.names)if(new RegExp(`(?<![.#\\w$])${E.replace(/\$/g,"\\$")}(?![\\w$])`).test(v))return!0}return!1}function ul(e,o){let x=["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"],v=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),k="",E=!1,C=0;for(let B=0;B<v.length;B++){let F=v[B];if(!E&&F==="`"){E=!0,C=0;continue}if(E){if(F==="`"&&C===0){E=!1;continue}if(F==="$"&&v[B+1]==="{"){C++,B++,k+=" ";continue}if(F==="}"&&C>0){C--;continue}if(C>0){k+=F;continue}continue}k+=F}v=k;let j=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,L;while((L=j.exec(v))!==null){let B=L[1];if(!v.substring(0,L.index).trimEnd().endsWith(".")){if(!x.includes(B)&&!(B in o))return!1}}return!0}function ug(e,o){let x=o.__stx_serverDeclared;if(!x||x.size===0)return!1;let v=s(e);for(let k of x)if(new RegExp(`(?<![.#\\w$])${k}(?![\\w$])`).test(v))return!0;return!1}var dl=new Set;function pl(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function fl(e,o){let x=`${o??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!dl.has(x))dl.add(x),console.warn(`[stx] {{ ${e} }} in a <script> in ${o??"<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 Yr(e,o,x){let v=e;return v=v.replace(/\{!!([\s\S]*?)!!\}/g,(k,E)=>{try{let C=b(E,o);if(C===void 0)return pl(E)?fl(E.trim(),x):k;return C===null?"":String(C)}catch{return k}}),v=jn(v,(k,E,C)=>{let j=E.trim();if(/^__[A-Z_]+__$/.test(j))return k;try{let L=b(E,o);if(L===void 0)return pl(j)?fl(j,x):k;return JSON.stringify(L).replace(/</g,"\\u003c")}catch{return k}}),v}function Ya(e,o){if(!e.includes("{"))return e;let x=e;return x=x.replace(/\{!!([\s\S]*?)!!\}/g,(v,k)=>{try{let E=b(k,o);if(E===void 0)return v;return E===null?"":String(E)}catch{return v}}),x=jn(x,(v,k,E)=>{let C=k.trim();if(/^__[A-Z_]+__$/.test(C))return v;try{let j=b(k,o);if(j===void 0)return v;if(j===null)return"";let L=String(j);return Bo(Lo(x,E),L,vt(L))}catch{return v}}),x}function Au(e,o,x={}){let{output:v,scripts:k}=V(e),E=k.map((C)=>{let j=C.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),L=C.match(/^<script\b[^>]*>/i),B=C.search(/<\/script\s*>$/i);if(!j||!L||B===-1)return C;let F=j[1],U=j[2];if(/\bdata-raw\b/.test(F))return C;if(x.skipServer&&/\bserver\b/.test(F))return C;let Y=`<script${Ya(F,o)}>`;if(/\bsrc\s*=/.test(F)||/\btype\s*=\s*["']application\/json["']/.test(F))return Y+U+C.slice(B);return Y+Yr(U,o)+C.slice(B)});return Et(v,E)}function q(e,o,x){let v=e,k=(Z,Y)=>{let Q=Ct(Z,Y);if(Q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(Y,Q))?-1:Q},E=(Z,Y,Q,se)=>{let oe=Q.length,{output:ie,tokens:ce}=ne(Z,Y,(ae,pe)=>se(oe+pe));return Q.push(...ce),ie},C=[];v=E(v,k,C,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let j=[];v=E(v,G,j,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let L=o?.__stx_signals_gate===!0||be(e),B=new Set(Array.isArray(o?.__stx_client_signal_names)?o.__stx_client_signal_names:[]),F=new Set(Array.isArray(o?.__stx_preserved_client_expressions)?o.__stx_preserved_client_expressions:[]);v=jn(v,(Z,Y,Q)=>{try{let se=b(Y,o,!1,(oe)=>zo(oe,Z,x,e));return se!==void 0&&se!==null?String(se):""}catch(se){let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${Y.trim()}}}}: ${oe}`,x,e,Q,Z)}},3),v=v.replace(/\{!!([\s\S]*?)!!\}/g,(Z,Y,Q)=>{try{let se=b(Y,o,!1,(oe)=>zo(oe,Z,x,e));if(se===void 0&&o.__stx_buildMode==="compile")return Gs("raw",Y.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(o.__stx_buildMode==="compile")return Gs("raw",Y.trim());let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${Y.trim()} !!}: ${oe}`,x,e,Q,Z)}}),v=E(v,G,j,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),v=E(v,k,C,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let U=L?Ja(v):[];if(v=jn(v,(Z,Y,Q)=>{let se=Y.trim();if(U.length>0&&lg(U,Q,se))return Z;if(F.has(se))return Z;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ie=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=se.match(ie)?.[1],pe=ae&&((ae in o)||oe.includes(ae)),me=Boolean(ae&&B.has(ae)),he=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Se=se.match(he),Ee=Se&&!oe.includes(Se[1])&&!(Se[1]in o);if(/^__[A-Z_]+__$/.test(se))return"";let Ce;try{let Re=b(Y,o,!1,(_e)=>{Ce=_e});if(me)return Z;if(L&&!ul(se,o))return Z;if(Ce)zo(Ce,Z,x,e);if(o.__stx_buildMode==="compile"&&!L&&(Re===void 0||ug(se,o)))return Gs("expr",se);if(Re===void 0||Re===null)return"";let Ae=String(Re);return Bo(Lo(v,Q),Ae,vt(Ae))}catch(Re){if(me)return Z;if(L&&!ul(se,o))return Z;if(Ee)return Z;let Ae=Re instanceof Error?Re.message:String(Re);return g("Expression",`Error evaluating: {{ ${se} }}: ${Ae}`,x,e,Q,Z)}}),j.length>0)v=v.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,Y)=>j[Number(Y)]??Z);if(C.length>0)v=v.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,Y)=>C[Number(Y)]??Z);return v}function Za(e,o,x){if(!o.trim())return e;let v=e,k=o.trim();while(k.length>0){let E=k.match(/^(\w+)/);if(!E)break;let C=E[1];k=k.substring(C.length).trim();let j=Nr[C]||Ln[C];if(!j)throw Error(`Filter not found: ${C}. Available filters: ${Object.keys(Ka()).join(", ")}`);let L=[];if(k.startsWith(":")){let B=k.match(/^:([^|\s]+)/);if(B){let F=B[1].trim();try{let U=Number(F);L=[Number.isNaN(U)?F:U]}catch{L=[F]}k=k.substring(B[0].length).trim()}}else if(k.startsWith("(")){let B=1,F=1;while(B>0&&F<k.length){if(k[F]==="(")B++;if(k[F]===")")B--;F++}if(B===0){let U=k.substring(1,F-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))L=[b(`(${U})`,x,!0)];else{let Z=[],Y="",Q=null,se=0,oe=0,ie=0,ce=!1;for(let ae=0;ae<U.length;ae++){let pe=U[ae];if(ce){Y+=pe,ce=!1;continue}if(pe==="\\"){Y+=pe,ce=!0;continue}if(Q){if(Y+=pe,pe===Q)Q=null;continue}if(pe==='"'||pe==="'"||pe==="`"){Q=pe,Y+=pe;continue}if(pe==="(")se++;else if(pe===")")se--;else if(pe==="[")oe++;else if(pe==="]")oe--;else if(pe==="{")ie++;else if(pe==="}")ie--;if(pe===","&&se===0&&oe===0&&ie===0){Z.push(Y),Y="";continue}Y+=pe}if(Y)Z.push(Y);L=Z.map((ae)=>{let pe=ae.trim();return b(pe,x,!0)})}}catch{L=[U]}k=k.substring(F).trim()}}try{v=j(v,x,...L)}catch(B){let F=B instanceof Error?B.message:String(B);throw Error(`Error applying filter '${C}': ${F}`)}if(k.startsWith("|"))k=k.substring(1).trim();else break}return v}function dg(e){let o=!1,x="",v=0,k=0,E=0,C=!1;for(let j=0;j<e.length;j++){let L=e[j],B=e[j+1];if(o&&C){C=!1;continue}if(o&&L==="\\"){C=!0;continue}if(C=!1,(L==='"'||L==="'"||L==="`")&&!C){if(!o)o=!0,x=L;else if(L===x)o=!1,x="";continue}if(o&&x==="`"&&L==="$"&&B==="{"){let F=1;j+=2;while(j<e.length&&F>0){if(e[j]==="{")F++;else if(e[j]==="}")F--;if(F>0)j++}continue}if(o)continue;if(L==="(")v++;else if(L===")")v--;else if(L==="[")k++;else if(L==="]")k--;else if(L==="{")E++;else if(L==="}")E--;if(L==="|"&&v===0&&k===0&&E===0){if(B==="|"){j++;continue}if(B==="="){j++;continue}return j}}return-1}var Or=new Set,pg=1000;function Pu(){Or.clear()}function zo(e,o,x,v){if(!O())return;let k=`${x}\x00${e.expression}`;if(Or.has(k))return;if(Or.size>=pg)Or.clear();Or.add(k);let E=x,C=v;try{if(x&&cl.existsSync(x))C=cl.readFileSync(x,"utf8")}catch{}let j=C.indexOf(o);if(j>=0)E=`${x}:${C.slice(0,j).split(`
|
|
124
|
-
`).length}`;console.warn(`${E}: stx warning: ${o} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function b(e,o,x=!1,v){try{let k=e.trim(),E=dg(k);if(E>0){let j=k.substring(0,E).trim(),L=k.substring(E+1).trim(),B=b(j,o,!0,v);return
|
|
123
|
+
`}),Qc(e,k)}function Qc(e,o){if(o.length===0)return e;o.sort((E,C)=>E.start-C.start||E.end-C.end);let x=Array(o.length*2+1),v=0,k=0;for(let E of o)x[k++]=e.slice(v,E.start),x[k++]=E.replacement,v=E.end;return x[k]=e.slice(v),x.join("")}function nl(e){let o=Js(e),x=new Map;if(o)for(let[v,k]of o)x.set(v,k.instances);return x}function rl(e,o){let x=Js(e);if(!x)return[];let v=[];for(let[k,E]of x){let C=E.instances-(o.get(k)??0);if(C>0)v.push({body:E.body,count:C})}return v}function sl(e,o){for(let{body:x,count:v}of o)for(let k=0;k<v;k++)No(e,x)}import cl from"fs";var il=0,jo=new Map;function Bi(){il=0,jo.clear()}function Gs(e,o){let x=il++,v=`<!--__STX_${e.toUpperCase()}_${x}__-->`;return jo.set(v,{type:e,expression:o}),v}function Fi(){let e={};for(let[o,x]of jo)e[o]={type:x.type,expression:x.expression};return e}function zi(e,o){let x=e;for(let[v,k]of o)x=x.split(v).join(k);return x}function Yr(e){return e.includes("<!--__STX_")}var Qf=/@(?=[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 eg(e){return Array.from({length:e},()=>"{").join("⁠")}function ol(e){return e.replace(/\{{2,}/g,(o)=>eg(o.length)).replace(/\{(?=!)/g,"{⁠").replace(Qf,"@")}var tg=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ng=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,rg=/^data:(?:text\/html|application\/xhtml\+xml)/,sg=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ig(e){return e.replace(sg,"").toLowerCase()}function og(e){let o=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(o))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(o))return"fetched";return null}function al(e,o="navigable"){let x=ig(e);if(tg.test(x))return!0;return o==="navigable"?ng.test(x):rg.test(x)}function Mr(e,o="navigable"){return al(e,o)?"unsafe:"+e:e}function ag(e){let o=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!o)return null;if(o[3].trim()!=="")return null;return og(o[1])}function Lo(e,o,x=256){if(o<=x)return e.slice(0,o);let v=e.slice(o-x,o),k=v.search(/[\s"'`/]/);return k===-1?"":v.slice(k)}function Bo(e,o,x=o){let v=ag(e);return v&&al(o,v)?"unsafe:"+x:x}var Nr={},ll=new Map;function cg(e){let o=ll.get(e);if(!o){let x=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`:${x}(?!\\w)`,"g"),ll.set(e,o)}return o.lastIndex=0,o}var jn={uppercase:(e,o)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,o)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,o)=>{if(e===void 0||e===null)return"";let x=String(e);return x.charAt(0).toUpperCase()+x.slice(1)},number:(e,o,x=0)=>{if(e===void 0||e===null)return"";try{let v=Number(e);return Number.isNaN(v)?"":v.toFixed(Number.parseInt(String(x),10))}catch{return""}},fmt:(e,o,x="en-US")=>{if(e===void 0||e===null)return"";try{let v=Number(e);if(Number.isNaN(v))return String(e);return v.toLocaleString(x)}catch{return String(e)}},join:(e,o,x=",")=>{if(!Array.isArray(e))return"";return e.join(String(x))},escape:(e,o)=>{if(e===void 0||e===null)return"";return wt(String(e))},translate:(e,o,x={})=>{if(!o||!o.__translations)return e;let v=o.__translations,k=o.__i18nConfig?.fallbackToKey??!0,E=String(e).split("."),C=v;for(let L of E){if(C===void 0||C===null)break;C=C[L]}if(C===void 0||C===null)return k?e:"";let j=String(C);return Object.entries(x).forEach(([L,B])=>{j=j.replace(cg(L),String(B))}),j},t:(e,o,x={})=>jn.translate(e,o,x),truncate:(e,o,x=50,v="...")=>{if(e===void 0||e===null)return"";let k=String(e);if(k.length<=x)return k;if(x<=v.length)return v.substring(0,x);return k.substring(0,x-v.length)+v},date:(e,o,x="short",v="en-US")=>{if(e===void 0||e===null)return"";try{let k=e instanceof Date?e:new Date(e);if(Number.isNaN(k.getTime()))return String(e);let E={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(x==="iso")return k.toISOString();return new Intl.DateTimeFormat(v,E[x]||E.short).format(k)}catch{return String(e)}},currency:(e,o,x="USD",v="en-US")=>{if(e===void 0||e===null)return"";try{let k=Number(e);if(Number.isNaN(k))return String(e);return new Intl.NumberFormat(v,{style:"currency",currency:x}).format(k)}catch{return String(e)}},pluralize:(e,o,x,v)=>{let k=Number(e);if(Number.isNaN(k))return x;let E=v||`${x}s`;return k===1?x:E},first:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let x=String(e);return x.charAt(x.length-1)},length:(e,o)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,o,x=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return x?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,o,x="")=>e===void 0||e===null||e===""?x:e,reverse:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,o,x=0,v)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(x,v);return e},replace:(e,o,x,v="")=>{if(e===void 0||e===null)return"";let k=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(k,"g"),()=>v)},stripTags:(e,o)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,o)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,o)=>{let x=Number(e);return Number.isNaN(x)?0:Math.abs(x)},round:(e,o,x=0)=>{let v=Number(e);if(Number.isNaN(v))return 0;let k=10**x;return Math.round(v*k)/k}};function Ka(e,o){if(e in jn)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Nr[e]=o}function Ru(e){for(let[o,x]of Object.entries(e))Ka(o,x)}function Ga(){return{...jn,...Nr}}function Au(){for(let e of Object.keys(Nr))delete Nr[e]}function Ja(e,o,x=2){let v=0,k=null;for(let E=o+x;E<e.length;E++){let C=e[E];if(k){if(C==="\\"){E++;continue}if(C===k)k=null;continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="{"){v++;continue}if(C==="}"){if(v>0){v--;continue}let j=0;while(e[E+j]==="}")j++;if(j>=x)return E}}return-1}function Bn(e,o,x=2){let v="{".repeat(x);if(!e.includes(v))return e;let k="",E=0;for(;;){let C=e.indexOf(v,E);if(C===-1)break;let j=Ja(e,C,x);if(j===-1)break;k+=e.slice(E,C)+o(e.slice(C,j+x),e.slice(C+x,j),C),E=j+x}return E===0?e:k+e.slice(E)}function h(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function wt(e){return ol(h(e))}function be(e,o){let{scripts:x}=V(e);for(let v of x){let k=v.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!k||/\bserver\b|\bsrc\s*=/.test(k[1]))continue;let E=k[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(E))return!0;if(yn(E,o))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Ya(e){let o=[],x=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let v=x.exec(e);v;v=x.exec(e)){let k=v[1].toLowerCase(),E=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(v[3]);if(!E)continue;let C=new Set([E[1],...E[2]?[E[2]]:[]]),j=v.index+v[0].length;if(v[0].endsWith("/>")){o.push({start:v.index,end:j,names:C});continue}let L=new RegExp(`<(/?)${k}\\b[^>]*?(/?)>`,"gi");L.lastIndex=j;let B=1,F=e.length;for(let U=L.exec(e);U;U=L.exec(e)){if(U[2]==="/")continue;if(B+=U[1]==="/"?-1:1,B===0){F=U.index+U[0].length;break}}o.push({start:v.index,end:F,names:C})}return o}function lg(e,o,x){let v=s(x);for(let k of e){if(o<k.start||o>=k.end)continue;for(let E of k.names)if(new RegExp(`(?<![.#\\w$])${E.replace(/\$/g,"\\$")}(?![\\w$])`).test(v))return!0}return!1}function ul(e,o){let x=["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"],v=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),k="",E=!1,C=0;for(let B=0;B<v.length;B++){let F=v[B];if(!E&&F==="`"){E=!0,C=0;continue}if(E){if(F==="`"&&C===0){E=!1;continue}if(F==="$"&&v[B+1]==="{"){C++,B++,k+=" ";continue}if(F==="}"&&C>0){C--;continue}if(C>0){k+=F;continue}continue}k+=F}v=k;let j=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,L;while((L=j.exec(v))!==null){let B=L[1];if(!v.substring(0,L.index).trimEnd().endsWith(".")){if(!x.includes(B)&&!(B in o))return!1}}return!0}function ug(e,o){let x=o.__stx_serverDeclared;if(!x||x.size===0)return!1;let v=s(e);for(let k of x)if(new RegExp(`(?<![.#\\w$])${k}(?![\\w$])`).test(v))return!0;return!1}var dl=new Set;function pl(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function fl(e,o){let x=`${o??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!dl.has(x))dl.add(x),console.warn(`[stx] {{ ${e} }} in a <script> in ${o??"<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 Zr(e,o,x){let v=e;return v=v.replace(/\{!!([\s\S]*?)!!\}/g,(k,E)=>{try{let C=b(E,o);if(C===void 0)return pl(E)?fl(E.trim(),x):k;return C===null?"":String(C)}catch{return k}}),v=Bn(v,(k,E,C)=>{let j=E.trim();if(/^__[A-Z_]+__$/.test(j))return k;try{let L=b(E,o);if(L===void 0)return pl(j)?fl(j,x):k;return JSON.stringify(L).replace(/</g,"\\u003c")}catch{return k}}),v}function Za(e,o){if(!e.includes("{"))return e;let x=e;return x=x.replace(/\{!!([\s\S]*?)!!\}/g,(v,k)=>{try{let E=b(k,o);if(E===void 0)return v;return E===null?"":String(E)}catch{return v}}),x=Bn(x,(v,k,E)=>{let C=k.trim();if(/^__[A-Z_]+__$/.test(C))return v;try{let j=b(k,o);if(j===void 0)return v;if(j===null)return"";let L=String(j);return Bo(Lo(x,E),L,wt(L))}catch{return v}}),x}function Pu(e,o,x={}){let{output:v,scripts:k}=V(e),E=k.map((C)=>{let j=C.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),L=C.match(/^<script\b[^>]*>/i),B=C.search(/<\/script\s*>$/i);if(!j||!L||B===-1)return C;let F=j[1],U=j[2];if(/\bdata-raw\b/.test(F))return C;if(x.skipServer&&/\bserver\b/.test(F))return C;let Y=`<script${Za(F,o)}>`;if(/\bsrc\s*=/.test(F)||/\btype\s*=\s*["']application\/json["']/.test(F))return Y+U+C.slice(B);return Y+Zr(U,o)+C.slice(B)});return Tt(v,E)}function q(e,o,x){let v=e,k=(Z,Y)=>{let Q=$t(Z,Y);if(Q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(Y,Q))?-1:Q},E=(Z,Y,Q,se)=>{let oe=Q.length,{output:ie,tokens:ce}=ne(Z,Y,(ae,pe)=>se(oe+pe));return Q.push(...ce),ie},C=[];v=E(v,k,C,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let j=[];v=E(v,G,j,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let L=o?.__stx_signals_gate===!0||be(e),B=new Set(Array.isArray(o?.__stx_client_signal_names)?o.__stx_client_signal_names:[]),F=new Set(Array.isArray(o?.__stx_preserved_client_expressions)?o.__stx_preserved_client_expressions:[]);v=Bn(v,(Z,Y,Q)=>{try{let se=b(Y,o,!1,(oe)=>zo(oe,Z,x,e));return se!==void 0&&se!==null?String(se):""}catch(se){let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${Y.trim()}}}}: ${oe}`,x,e,Q,Z)}},3),v=v.replace(/\{!!([\s\S]*?)!!\}/g,(Z,Y,Q)=>{try{let se=b(Y,o,!1,(oe)=>zo(oe,Z,x,e));if(se===void 0&&o.__stx_buildMode==="compile")return Gs("raw",Y.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(o.__stx_buildMode==="compile")return Gs("raw",Y.trim());let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${Y.trim()} !!}: ${oe}`,x,e,Q,Z)}}),v=E(v,G,j,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),v=E(v,k,C,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let U=L?Ya(v):[];if(v=Bn(v,(Z,Y,Q)=>{let se=Y.trim();if(U.length>0&&lg(U,Q,se))return Z;if(F.has(se))return Z;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ie=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=se.match(ie)?.[1],pe=ae&&((ae in o)||oe.includes(ae)),me=Boolean(ae&&B.has(ae)),he=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Se=se.match(he),Ee=Se&&!oe.includes(Se[1])&&!(Se[1]in o);if(/^__[A-Z_]+__$/.test(se))return"";let Ce;try{let Ae=b(Y,o,!1,(_e)=>{Ce=_e});if(me)return Z;if(L&&!ul(se,o))return Z;if(Ce)zo(Ce,Z,x,e);if(o.__stx_buildMode==="compile"&&!L&&(Ae===void 0||ug(se,o)))return Gs("expr",se);if(Ae===void 0||Ae===null)return"";let Re=String(Ae);return Bo(Lo(v,Q),Re,wt(Re))}catch(Ae){if(me)return Z;if(L&&!ul(se,o))return Z;if(Ee)return Z;let Re=Ae instanceof Error?Ae.message:String(Ae);return g("Expression",`Error evaluating: {{ ${se} }}: ${Re}`,x,e,Q,Z)}}),j.length>0)v=v.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,Y)=>j[Number(Y)]??Z);if(C.length>0)v=v.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,Y)=>C[Number(Y)]??Z);return v}function Qa(e,o,x){if(!o.trim())return e;let v=e,k=o.trim();while(k.length>0){let E=k.match(/^(\w+)/);if(!E)break;let C=E[1];k=k.substring(C.length).trim();let j=Nr[C]||jn[C];if(!j)throw Error(`Filter not found: ${C}. Available filters: ${Object.keys(Ga()).join(", ")}`);let L=[];if(k.startsWith(":")){let B=k.match(/^:([^|\s]+)/);if(B){let F=B[1].trim();try{let U=Number(F);L=[Number.isNaN(U)?F:U]}catch{L=[F]}k=k.substring(B[0].length).trim()}}else if(k.startsWith("(")){let B=1,F=1;while(B>0&&F<k.length){if(k[F]==="(")B++;if(k[F]===")")B--;F++}if(B===0){let U=k.substring(1,F-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))L=[b(`(${U})`,x,!0)];else{let Z=[],Y="",Q=null,se=0,oe=0,ie=0,ce=!1;for(let ae=0;ae<U.length;ae++){let pe=U[ae];if(ce){Y+=pe,ce=!1;continue}if(pe==="\\"){Y+=pe,ce=!0;continue}if(Q){if(Y+=pe,pe===Q)Q=null;continue}if(pe==='"'||pe==="'"||pe==="`"){Q=pe,Y+=pe;continue}if(pe==="(")se++;else if(pe===")")se--;else if(pe==="[")oe++;else if(pe==="]")oe--;else if(pe==="{")ie++;else if(pe==="}")ie--;if(pe===","&&se===0&&oe===0&&ie===0){Z.push(Y),Y="";continue}Y+=pe}if(Y)Z.push(Y);L=Z.map((ae)=>{let pe=ae.trim();return b(pe,x,!0)})}}catch{L=[U]}k=k.substring(F).trim()}}try{v=j(v,x,...L)}catch(B){let F=B instanceof Error?B.message:String(B);throw Error(`Error applying filter '${C}': ${F}`)}if(k.startsWith("|"))k=k.substring(1).trim();else break}return v}function dg(e){let o=!1,x="",v=0,k=0,E=0,C=!1;for(let j=0;j<e.length;j++){let L=e[j],B=e[j+1];if(o&&C){C=!1;continue}if(o&&L==="\\"){C=!0;continue}if(C=!1,(L==='"'||L==="'"||L==="`")&&!C){if(!o)o=!0,x=L;else if(L===x)o=!1,x="";continue}if(o&&x==="`"&&L==="$"&&B==="{"){let F=1;j+=2;while(j<e.length&&F>0){if(e[j]==="{")F++;else if(e[j]==="}")F--;if(F>0)j++}continue}if(o)continue;if(L==="(")v++;else if(L===")")v--;else if(L==="[")k++;else if(L==="]")k--;else if(L==="{")E++;else if(L==="}")E--;if(L==="|"&&v===0&&k===0&&E===0){if(B==="|"){j++;continue}if(B==="="){j++;continue}return j}}return-1}var Or=new Set,pg=1000;function Iu(){Or.clear()}function zo(e,o,x,v){if(!O())return;let k=`${x}\x00${e.expression}`;if(Or.has(k))return;if(Or.size>=pg)Or.clear();Or.add(k);let E=x,C=v;try{if(x&&cl.existsSync(x))C=cl.readFileSync(x,"utf8")}catch{}let j=C.indexOf(o);if(j>=0)E=`${x}:${C.slice(0,j).split(`
|
|
124
|
+
`).length}`;console.warn(`${E}: stx warning: ${o} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function b(e,o,x=!1,v){try{let k=e.trim(),E=dg(k);if(E>0){let j=k.substring(0,E).trim(),L=k.substring(E+1).trim(),B=b(j,o,!0,v);return Qa(B,L,o)}let C=mn(k);if(C!==null){v?.({expression:k,rule:C});return}try{let j=Object.keys(o),L=Object.values(o);return l(k,j)(...L)}catch{return c(k,o)}}catch(k){if(k instanceof ReferenceError){let E=/(\b\w+)\s+is not defined/.exec(k.message);if(E){let C=E[1],j=fg(C,Object.keys(o));if(j&&j!==C)k.message=`${k.message} \u2014 did you mean '${j}'?`}}if(!x)console.error(`Error evaluating expression: ${e}`,k);throw k}}function fg(e,o){let x=null;for(let k of o){if(k===e)continue;let E=gg(e,k);if(x===null||E<x.dist)x={key:k,dist:E}}if(!x)return null;let v=Math.max(e.length,x.key.length);if(x.dist<=2||x.dist/v<=0.35)return x.key;return null}function gg(e,o){if(e===o)return 0;if(e.length===0)return o.length;if(o.length===0)return e.length;let[x,v]=e.length<o.length?[e,o]:[o,e],k=Array(x.length+1),E=Array(x.length+1);for(let C=0;C<=x.length;C++)k[C]=C;for(let C=1;C<=v.length;C++){E[0]=C;for(let j=1;j<=x.length;j++){let L=x[j-1]===v[C-1]?0:1;E[j]=Math.min(E[j-1]+1,k[j]+1,k[j-1]+L)}for(let j=0;j<=x.length;j++)k[j]=E[j]}return k[x.length]}function Du(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Qx from"fs";import Gt from"path";var Wo=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],gl=/<body\b([^>]*)>/gi;function bn(e){let o=0,x,v=Wo.map(()=>{return});while(o<e.length){if(x===void 0||x!==null&&x.index<o)gl.lastIndex=o,x=gl.exec(e);if(!x)return null;let k=x.index,E=-1,C=null;for(let L=0;L<Wo.length;L++){let B=Wo[L],F=v[L];if(F===void 0||F!==null&&F.index<o)B.open.lastIndex=o,F=B.open.exec(e),v[L]=F;if(!F)continue;if(F.index<k&&(E===-1||F.index<E))E=F.index,C=B.close}if(E===-1||!C)return{index:k,tag:x[0],attrs:x[1]??""};C.lastIndex=E;let j=C.exec(e);if(!j)return null;o=j.index+j[0].length}return null}function br(e,o){let x=bn(e);if(!x)return e;return e.slice(0,x.index)+o(x.tag,x.attrs)+e.slice(x.index+x.tag.length)}var ml=/<style\b[^>]*>/iy,hl=/<\/style>/gi,yl=/<script\b[^>]*>/iy,xl=/<template(?=[\s>/])[^>]*>/iy,bl=/<\/template\s*>/iy;function jr(e){let o=0,x=0,v=-1;while(o<e.length){let k=e.indexOf("<",o);if(k===-1)return-1;if(e.startsWith("<!--",k)){let L=e.indexOf("-->",k+4);o=L===-1?e.length:L+3;continue}ml.lastIndex=k;let E=ml.exec(e);if(E){hl.lastIndex=k+E[0].length;let L=hl.exec(e);o=L===null?e.length:L.index+8;continue}xl.lastIndex=k;let C=xl.exec(e);if(C){if(x===0)v=k;x++,o=k+C[0].length;continue}bl.lastIndex=k;let j=bl.exec(e);if(j){if(x>0)x--;o=k+j[0].length;continue}if(yl.lastIndex=k,yl.test(e))return x>0?v:k;o=k+1}return-1}function vl(){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 Fo(e){return Symbol(e)}var
|
|
472
|
+
`}function Fo(e){return Symbol(e)}var qv=Fo("theme"),Xv=Fo("router"),Kv=Fo("i18n");import*as $l from"crypto";function wl(e){let o=/\$(\w+)\./g,x=[],v;while((v=o.exec(e))!==null)if(!x.includes(v[1]))x.push(v[1]);return x}function mg(){return`stx-${$l.randomBytes(4).toString("hex")}`}function hg(e){return/\$\w+\./.test(e)}function yg(e){if(!e.includes("{{")||!/\$\w+\./.test(e))return{html:e,bindings:[],stores:new Set};let o=[],x=new Set,v=/<(\w+)([^>]*?)(\s*\/?>)/g,k=e;return k=k.replace(v,(E,C,j,L)=>{if(["script","style","template"].includes(C.toLowerCase()))return E;let B=[],F=!1,U=j,Z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,Y=[...j.matchAll(Z)];for(let oe of Y){let ie=oe[0],ce=oe[1],ae=oe[2];if(hg(ae)){F=!0;let pe=ae.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(pe){let me=pe[1];if(B.push({attr:ce,expr:me,fullMatch:ie,originalAttr:ce}),wl(me).forEach((Se)=>x.add(Se)),ce==="text")U=U.replace(ie,"");else if(ce==="class")U=U.replace(ie,'class=""');else if(ce==="disabled"||ce==="hidden")U=U.replace(ie,"");else U=U.replace(ie,`${ce}=""`)}}}if(!F)return E;let Q=U.match(/\bid\s*=\s*"([^"]+)"/),se;if(Q)se=Q[1];else se=mg(),U=` id="${se}"${U}`;for(let oe of B)o.push({elementId:se,attribute:oe.attr,expression:oe.expr,stores:wl(oe.expr)});return`<${C}${U}${L}`}),{html:k,bindings:o,stores:x}}function xg(e,o){if(e.length===0)return"";let x=Array.from(o),v=`
|
|
473
473
|
<script>
|
|
474
474
|
(function() {
|
|
475
475
|
'use strict';
|
|
@@ -1304,7 +1304,7 @@ else {
|
|
|
1304
1304
|
style="--stx-transition-duration: ${E}ms; --stx-transition-ease: ${C}; --stx-transition-delay: ${j}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Al={name:"scrollAnimate",handler:(e,o,x,v)=>{if(o.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let k=o[0],E=o.length>1?Number.parseInt(o[1],10)||300:300,C=o.length>2?o[2]||"ease":"ease",j=o.length>3?Number.parseFloat(o[3])||0.2:0.2,L=o.length>4?Number.parseInt(o[4],10)||0:0,B=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,F=`--stx-transition-duration: ${E}ms; --stx-transition-ease: ${C}; --stx-transition-delay: ${L}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(k==="fade")U+=" stx-fade";else if(k==="slide-up"||k==="slide")U+=" stx-from-bottom";else if(k==="slide-down")U+=" stx-from-top";else if(k==="slide-left")U+=" stx-from-right";else if(k==="slide-right")U+=" stx-from-left";else if(k==="scale")U+=" stx-scale";else if(k.includes("-"))U+=` stx-${k}`;else U+=` stx-${k}`;return`<div id="${B}" class="${U}" style="${F}" data-threshold="${j}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Tl={name:"animationGroup",handler:(e,o,x,v)=>{if(o.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let k=o[0],E=o.slice(1).map((B)=>B.startsWith("#")||B.startsWith(".")?B:`#${B}`),C=x.staggerDelay||50,j=x.sequence||!0,L=Dg(k,E,{staggerDelay:C,sequence:j});return`${e}
|
|
1305
1305
|
${L}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Il={name:"motion",handler:(e,o,x,v)=>{let k=o.length>0?o[0].toLowerCase()==="true":!0,E=Rg();return`<div data-animate="${k?"auto":"true"}">${e}</div>${E}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Dl(e,o,x,v){let k=e;if(v.animation?.enabled===!1)return k;let E=x.includes("test")&&x.includes("animation");if(!Ag(k)&&!E)return k;if(!k.includes('<style id="stx-animation-base">')){let j=Ig();k=k.replace("</head>",`${j}
|
|
1306
1306
|
</head>`)}if(k.includes("stx-observe")){if(!k.includes("Intersection Observer for scroll animations")){let L=Tg(),B=k.lastIndexOf("</body>");if(B!==-1)k=k.slice(0,B)+L+`
|
|
1307
|
-
`+k.slice(B)}}return k}function je(e){let o=e.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!o)return null;try{return Function(`return ${o[1]}`)()}catch{return null}}function Pl(e){let o=e?.layout;if(o===!1)return!1;return typeof o==="string"&&o.trim()?o.trim():void 0}var Pg=100,Mg=599,Uo="__stxResponseStatus",Lr="__stxResponseHeaders";function Ys(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Pg&&e<=Mg}function
|
|
1307
|
+
`+k.slice(B)}}return k}function je(e){let o=e.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!o)return null;try{return Function(`return ${o[1]}`)()}catch{return null}}function Pl(e){let o=e?.layout;if(o===!1)return!1;return typeof o==="string"&&o.trim()?o.trim():void 0}var Pg=100,Mg=599,Uo="__stxResponseStatus",Lr="__stxResponseHeaders";function Ys(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Pg&&e<=Mg}function xt(e){for(let o of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let x=o[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!x)continue;let v=Number(x[1]);if(Ys(v))return v}return}function Vo(e,o){if(!e||typeof e!=="object")return!1;let x=typeof o==="string"&&/^\d+$/.test(o.trim())?Number(o.trim()):o;if(!Ys(x))return!1;return e[Uo]=x,!0}function Og(e,o,x){if(!e||typeof e!=="object")return;let v=String(o??"").trim();if(!v)return;e[Lr]={...e[Lr],[v]:String(x)}}function Be(e){let o=e?.[Uo];return Ys(o)?o:void 0}function Fe(e){let o=e?.[Lr];if(!o||typeof o!=="object")return;let x=Object.entries(o).map(([v,k])=>[v,String(k)]);return x.length>0?Object.fromEntries(x):void 0}function Hi(e,o){if(!e||!o||e===o||typeof o!=="object")return;let x=Be(e);if(x!==void 0)o[Uo]=x;let v=Fe(e);if(v)o[Lr]={...o[Lr],...v}}function Fn(e){return{setResponseStatus:(o)=>{Vo(e,o)},notFound:(o=404)=>{let x=Ys(o)&&o>=400?o:404;Vo(e,x)},setResponseHeader:(o,x)=>{Og(e,o,x)}}}function Ml(e,o,x={}){if(!e.includes("@status"))return e;let{filePath:v,buildMode:k}=x,E=k==="compile",C="",j=0,L=/@status\s*\(/g,B;while((B=L.exec(e))!==null){let F=Ng(e,B.index+B[0].length-1);if(F<0)break;let U=e.slice(B.index+B[0].length,F).trim(),Z=/^\d+$/.test(U)?Number(U):c(U,o),Y=v?` in ${v}`:"";if(E)console.warn(`[stx] @status(${U})${Y} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${U}) from <script server> instead \u2014 that runs per request.`);else if(!Vo(o,Z))console.warn(`[stx] @status(${U})${Y} is not an HTTP status (100-599) \u2014 ignoring it.`);C+=e.slice(j,B.index),j=F+1+(e.slice(F+1).match(/^[^\S\n]*\n?/)?.[0].length??0),L.lastIndex=j}return j===0?e:C+e.slice(j)}function Ng(e,o){let x=1,v=null,k=!1;for(let E=o+1;E<e.length;E++){let C=e[E];if(k){k=!1;continue}if(v){if(C==="\\")k=!0;else if(C===v)v=null;continue}if(C==='"'||C==="'"||C==="`"){v=C;continue}if(C==="(")x++;else if(C===")"&&--x===0)return E}return-1}var jg=0,Lg=0;function Ol(e,o){let x=e.match(new RegExp(`${o}\\s*=\\s*"([^"]*)"`,"i"));if(x)return x[1];let v=e.match(new RegExp(`${o}\\s*=\\s*'([^']*)'`,"i"));if(v)return v[1];return null}function Bg(e){let o=[],x=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,v;while((v=x.exec(e))!==null){let[k,E,C]=v,j=v.index,L=Ol(C,"x-data");if(!L)continue;let B=`__stx_scope_${jg++}`,F=Ol(C,"x-init"),U=zg(e,E,j+k.length),Z=e.slice(j,U.endIndex),Y=Wg(Z);o.push({id:B,selector:`[data-stx-scope="${B}"]`,stateExpr:L,initExpr:F,bindings:[],refs:Y})}return o}function zg(e,o,x){let v=1,k=x,E=new RegExp(`<${o}(?:\\s|>)`,"gi"),C=new RegExp(`</${o}>`,"gi"),j=new RegExp(`<${o}[^>]*/\\s*>`,"gi");while(v>0&&k<e.length){E.lastIndex=k,C.lastIndex=k,j.lastIndex=k;let L=E.exec(e),B=C.exec(e),F=j.exec(e);if(F&&F.index<(L?.index??1/0)){k=F.index+F[0].length;continue}if(!B)return{endIndex:e.length};if(L&&L.index<B.index)v++,k=L.index+L[0].length;else{if(v--,v===0)return{endIndex:B.index+B[0].length};k=B.index+B[0].length}}return{endIndex:e.length}}function Wg(e){let o=new Map,x=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),v=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,k;while((k=v.exec(x))!==null){let[,E,C]=k,j=Fg(E);o.set(C,j)}return o}function Fg(e){let o=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(o)return o[1];return`__stx_el_${Lg++}`}function Vg(){return`
|
|
1308
1308
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1309
1309
|
(function() {
|
|
1310
1310
|
var style = document.createElement('style');
|
|
@@ -1569,7 +1569,7 @@ window.__stx_reactive = (function() {
|
|
|
1569
1569
|
${Vg()}
|
|
1570
1570
|
${x}
|
|
1571
1571
|
</script>`}function jl(e,o,x){if(!qg(e))return e;let v=Bg(e);if(v.length===0)return e;let k=Hg(e,v),E=Ug(v,o),C=k.lastIndexOf("</body>");if(C!==-1)k=k.slice(0,C)+E+`
|
|
1572
|
-
`+k.slice(C);else k+=E;return k}function Hg(e,o){let x=0,v=e.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(k,E,C)=>{let j=o[x++];if(!j)return k;let L=/data-stx-scope="([^"]*)"/.exec(C);if(L)return j.id=L[1],j.selector=`[data-stx-scope="${j.id}"]`,k;return`<${E} data-stx-scope="${j.id}"${C}>`});return v=v.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),v=v.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),v=v.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),v=v.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),v}function qg(e){return/x-data\s*=\s*["']/.test(e)}import Tm from"fs";import ra from"path";import{createHighlighter as Im}from"ts-syntax-highlighter";import si from"fs";import Yt from"path";import{loadConfigWithResult as _m}from"bunfig";async function Xg(e,o,x,v){let k=o[0]?.replace(/['"]/g,"")||"main",E=$e();if(k!=="main")E=E.replace("container:'main'",`container:'${k}'`);return`<script data-stx-router>${E}</script>`}var Ll={name:"stxRouter",handler:Xg,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function In(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Bl(e){let o=e.trim().toLowerCase();return!o.startsWith("javascript:")&&!o.startsWith("vbscript:")&&!o.startsWith("data:text/html")}function
|
|
1572
|
+
`+k.slice(C);else k+=E;return k}function Hg(e,o){let x=0,v=e.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(k,E,C)=>{let j=o[x++];if(!j)return k;let L=/data-stx-scope="([^"]*)"/.exec(C);if(L)return j.id=L[1],j.selector=`[data-stx-scope="${j.id}"]`,k;return`<${E} data-stx-scope="${j.id}"${C}>`});return v=v.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),v=v.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),v=v.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),v=v.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),v}function qg(e){return/x-data\s*=\s*["']/.test(e)}import Tm from"fs";import ra from"path";import{createHighlighter as Im}from"ts-syntax-highlighter";import si from"fs";import Yt from"path";import{loadConfigWithResult as _m}from"bunfig";async function Xg(e,o,x,v){let k=o[0]?.replace(/['"]/g,"")||"main",E=$e();if(k!=="main")E=E.replace("container:'main'",`container:'${k}'`);return`<script data-stx-router>${E}</script>`}var Ll={name:"stxRouter",handler:Xg,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function In(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Bl(e){let o=e.trim().toLowerCase();return!o.startsWith("javascript:")&&!o.startsWith("vbscript:")&&!o.startsWith("data:text/html")}function Ln(e){let o=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,x=e.match(o);if(!x)return{data:{},content:e.trim()};let v=x[1],k=e.slice(x[0].length),E={};for(let C of v.split(`
|
|
1573
1573
|
`)){let j=C.trim();if(!j||j.startsWith("#"))continue;let L=j.indexOf(":");if(L===-1)continue;let B=j.slice(0,L).trim(),F=j.slice(L+1).trim();if(typeof F==="string"){if(F.startsWith('"')&&F.endsWith('"')||F.startsWith("'")&&F.endsWith("'"))F=F.slice(1,-1);else if(F.startsWith("[")&&F.endsWith("]"))try{F=JSON.parse(F)}catch{}else if(F==="true")F=!0;else if(F==="false")F=!1;else if(/^-?\d+(?:\.\d+)?$/.test(F))F=Number(F)}E[B]=F}return{data:E,content:k.trim()}}function Ne(e,o={}){let{gfm:x=!0,breaks:v=!1}=o,k=e,E=[];if(k=k.replace(/```(\w*)\n([\s\S]*?)```/g,(F,U,Z)=>{let Y=E.length,Q=U?` class="language-${In(U)}"`:"";return E.push(`<pre><code${Q}>${In(Z.trim())}</code></pre>`),`\x00CODEBLOCK${Y}\x00`}),k=k.replace(/`([^`]*)`/g,(F,U)=>`<code>${In(U)}</code>`),k=k.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),k=k.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),k=k.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),k=k.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),k=k.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),k=k.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),k=k.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),k=k.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),k=k.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),k=k.replace(/__(.+?)__/g,"<strong>$1</strong>"),k=k.replace(/\*(.+?)\*/g,"<em>$1</em>"),k=k.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),x)k=k.replace(/~~(.+?)~~/g,"<del>$1</del>");if(k=k.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(F,U,Z)=>`<img src="${Bl(Z)?In(Z):""}" alt="${In(U)}" />`),k=k.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(F,U,Z)=>`<a href="${Bl(Z)?In(Z):""}">${U}</a>`),k=k.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),k=k.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),k=k.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1574
1574
|
`),k=k.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),k=k.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),k=k.replace(/<\/ul>\n<ul>/g,""),k=k.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),k=k.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),k=k.replace(/<\/ol>\n<ol>/g,""),k=k.replace(/<li data-ul>/g,"<li>"),k=k.replace(/<li data-ol>/g,"<li>"),x)k=k.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(F,U,Z)=>{let Q=`<tr>${U.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${In(oe)}</th>`).join("")}</tr>`,se=Z.trim().split(`
|
|
1575
1575
|
`).map((oe)=>`<tr>${oe.split("|").map((ce)=>ce.trim()).filter(Boolean).map((ce)=>`<td>${In(ce)}</td>`).join("")}</tr>`).join(`
|
|
@@ -1588,7 +1588,7 @@ ${se}
|
|
|
1588
1588
|
`)}</p>`);if(k=j.join(`
|
|
1589
1589
|
`),v)k=k.replace(/\n/g,`<br />
|
|
1590
1590
|
`);for(let F=0;F<E.length;F++)k=k.replace(`\x00CODEBLOCK${F}\x00`,E[F]);return k=k.replace(/<p>\s*<\/p>/g,""),k.trim()}async function zl(e,o,x=""){let v=e,k=[],E=/@markdown(?:\([^)]*\))?/g,C;while((C=E.exec(e))!==null){let j=C.index,L=C[0].match(/@markdown\(([^)]*)\)/),B=L?L[1]:"",F=j+C[0].length,U=1,Z=F,Y=-1;while(U>0&&Z<e.length){let oe=e.indexOf("@markdown",Z),ie=e.indexOf("@endmarkdown",Z);if(ie===-1)break;if(oe!==-1&&oe<ie&&oe!==j){let ce=e[oe+9];if(ce==="("||ce===`
|
|
1591
|
-
`||ce==="\r"||ce===" "||ce===void 0)U++;Z=oe+9}else{if(U--,U===0){Y=ie;break}Z=ie+12}}if(Y===-1)continue;let Q=e.slice(F,Y),se=e.slice(j,Y+12);k.push({fullMatch:se,options:B,content:Q,index:j}),E.lastIndex=Y+12}for(let{fullMatch:j,options:L,content:B,index:F}of k)try{let U={};if(L)L.split(",").forEach((Q)=>{let se=Q.trim();if(se)U[se]=!0});let Z={gfm:U.gfm??!0,breaks:U.breaks??!1},Y=Ne(B.trim(),Z);v=v.split(j).join(Y)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=g("Markdown Directive",`Error processing markdown: ${Z}`,x,e,F,j);v=v.split(j).join(Y)}return v}async function Wl(e,o,x,v){let k={gfm:!0,breaks:!1};return o.forEach((E)=>{let C=E.trim().replace(/['"]/g,"");if(C==="breaks")k.breaks=!0;if(C==="no-gfm")k.gfm=!1}),Ne(e.trim(),k)}var
|
|
1591
|
+
`||ce==="\r"||ce===" "||ce===void 0)U++;Z=oe+9}else{if(U--,U===0){Y=ie;break}Z=ie+12}}if(Y===-1)continue;let Q=e.slice(F,Y),se=e.slice(j,Y+12);k.push({fullMatch:se,options:B,content:Q,index:j}),E.lastIndex=Y+12}for(let{fullMatch:j,options:L,content:B,index:F}of k)try{let U={};if(L)L.split(",").forEach((Q)=>{let se=Q.trim();if(se)U[se]=!0});let Z={gfm:U.gfm??!0,breaks:U.breaks??!1},Y=Ne(B.trim(),Z);v=v.split(j).join(Y)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=g("Markdown Directive",`Error processing markdown: ${Z}`,x,e,F,j);v=v.split(j).join(Y)}return v}async function Wl(e,o,x,v){let k={gfm:!0,breaks:!1};return o.forEach((E)=>{let C=E.trim().replace(/['"]/g,"");if(C==="breaks")k.breaks=!0;if(C==="no-gfm")k.gfm=!1}),Ne(e.trim(),k)}var vr=[320,480,640,768,1024,1280,1536,1920,2560],Kg=[1,1.5,2,3],Br=["avif","webp","jpeg"],Zg={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function Ho(e,o=vr,x={},v){return o.sort((k,E)=>k-E).map((k)=>`${zr(e,{...x,w:k,fm:v})} ${k}w`).join(", ")}function Fl(e,o,x=Kg,v={},k){return x.sort((E,C)=>E-C).map((E)=>{let C=Math.round(o*E);return`${zr(e,{...v,w:C,dpr:E,fm:k})} ${E}x`}).join(", ")}function qo(e,o="100vw"){if(!e||Object.keys(e).length===0)return o;let v=Object.entries(e).map(([k,E])=>{let C=/^\d+$/.test(k)?`${k}px`:k;return{bp:C,size:E,numericBp:Number.parseInt(C)||0}}).sort((k,E)=>k.numericBp-E.numericBp).map(({bp:k,size:E})=>`(max-width: ${k}) ${E}`);return v.push(o),v.join(", ")}function zr(e,o={}){let x=Object.entries(o).filter(([,E])=>E!==void 0&&E!==null).map(([E,C])=>{if(Array.isArray(C))return[E,C.join(",")];return[E,String(C)]});if(x.length===0)return e;let v=x.map(([E,C])=>`${E}=${encodeURIComponent(C)}`).join("&"),k=e.includes("?")?"&":"?";return`${e}${k}${v}`}function Xo(e){return Zg[e]||"application/octet-stream"}var Jg={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Zo=`
|
|
1592
1592
|
.stx-img-placeholder {
|
|
1593
1593
|
position: relative;
|
|
1594
1594
|
overflow: hidden;
|
|
@@ -1634,20 +1634,20 @@ ${se}
|
|
|
1634
1634
|
#${e}.stx-img-loaded img {
|
|
1635
1635
|
opacity: 1;
|
|
1636
1636
|
}
|
|
1637
|
-
`.trim()}var Ko=new Map;async function Ul(e,o={}){let x=`${e}:${JSON.stringify(o)}`;if(Ko.has(x))return Ko.get(x);let v=await Yg(e,o);return Ko.set(x,v),v}async function tm(){try{return await import("./chunk-
|
|
1638
|
-
`):void 0,script:dt}}async function nm(e,o,x,v){let{src:k,alt:E,width:C,height:j,sizes:L,widths:B=
|
|
1637
|
+
`.trim()}var Ko=new Map;async function Ul(e,o={}){let x=`${e}:${JSON.stringify(o)}`;if(Ko.has(x))return Ko.get(x);let v=await Yg(e,o);return Ko.set(x,v),v}async function tm(){try{return await import("./chunk-35e6zj5x.js")}catch(e){if(!Hl)console.warn("[stx-media] Image processor not available, some features disabled:",e),Hl=!0;return null}}var Hl=!1,Jo=80,ei="async",ti="lazy",ql=!1;async function Qs(e,o={}){let x=o,v=e;if(v.process&&!v.skipOptimization){if(x.tsImagesConfig?.enabled&&!x.isDev)return im(v,x)}if(x.processedResult?.processed)return Qo(e,x.processedResult,o);if(x.responsiveVariants)return Zl(e,x.responsiveVariants,o);let{src:k,alt:E,width:C,height:j,sizes:L,widths:B=vr,dpr:F,formats:U=Br,quality:Z=Jo,params:Y={},placeholder:Q="none",placeholderOptions:se={},lazy:oe=!0,priority:ie=!1,loading:ce=ie?"eager":ti,decoding:ae=ei,fetchpriority:pe,objectFit:me,objectPosition:he,crossorigin:Se,referrerpolicy:Ee}=e,{class:Ce,style:Ae,id:Re}=e,_e=e.data||{},{isDev:Te=!1,baseUrl:Me=""}=o;if(Te&&!o.optimize)return sm(e);let De,Ie,Oe=Re||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(Q!=="none"&&!ie)try{De=await Ul(k,{strategy:Q,...se}),Ie=Vl(Oe,De,se)}catch{}let tt=F!==void 0&&C!==void 0,ot;if(tt)ot=rm(e,Oe,De,o);else ot=await nm(e,Oe,De,o);let nt;if(ie){let ht=U.includes("webp")?"webp":U[0],at=Ho(k,B,{...Y,q:Z},ht),It=typeof L==="object"?qo(L):L||"100vw";nt=`<link rel="preload" as="image" imagesrcset="${at}" imagesizes="${It}" />`}let yt=[];if(!ql&&Q!=="none")yt.push(Zo),ql=!0;if(Ie)yt.push(Ie);let dt=oe?Kl(Oe):void 0;return{html:ot,preloadLink:nt,css:yt.length>0?yt.join(`
|
|
1638
|
+
`):void 0,script:dt}}async function nm(e,o,x,v){let{src:k,alt:E,width:C,height:j,sizes:L,widths:B=vr,formats:F=Br,quality:U=Jo,params:Z={},lazy:Y=!0,priority:Q=!1,loading:se=Q?"eager":ti,decoding:oe=ei,fetchpriority:ie,objectFit:ce,objectPosition:ae,crossorigin:pe,referrerpolicy:me}=e,{class:he,style:Se}=e,Ee=e.data||{},Ce=typeof L==="object"?qo(L):L||"100vw",Ae=[];for(let Te of F){let Me=Ho(k,B,{...Z,q:U},Te),De=Xo(Te);if(Y&&!Q)Ae.push(` <source type="${De}" data-srcset="${Me}" data-sizes="${Ce}" />`);else Ae.push(` <source type="${De}" srcset="${Me}" sizes="${Ce}" />`)}let Re=Go({src:zr(k,{...Z,q:U}),alt:E,width:C,height:j,loading:Q?void 0:se,decoding:oe,fetchpriority:Q?"high":ie,objectFit:ce,objectPosition:ae,crossorigin:pe,referrerpolicy:me,className:Xl(he,x),style:Yo(Se,ce,ae,x),lazy:Y&&!Q,data:Ee}),_e;if(x){let Te=`background-image: url('${x.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${o}" class="stx-img-placeholder" style="${Te}">
|
|
1639
1639
|
<picture>
|
|
1640
|
-
${
|
|
1640
|
+
${Ae.join(`
|
|
1641
1641
|
`)}
|
|
1642
|
-
<img ${
|
|
1642
|
+
<img ${Re} />
|
|
1643
1643
|
</picture>
|
|
1644
1644
|
</div>`}else _e=`<picture${o?` id="${o}"`:""}>
|
|
1645
|
-
${
|
|
1645
|
+
${Ae.join(`
|
|
1646
1646
|
`)}
|
|
1647
|
-
<img ${
|
|
1648
|
-
</picture>`;return _e}function rm(e,o,x,v){let{src:k,alt:E,width:C,height:j,dpr:L=[1,2,3],quality:B=Jo,params:F={},lazy:U=!0,priority:Z=!1,loading:Y=Z?"eager":ti,decoding:Q=ei,fetchpriority:se,objectFit:oe,objectPosition:ie,crossorigin:ce,referrerpolicy:ae}=e,{class:pe,style:me}=e,he=e.data||{},Se=typeof C==="number"?C:Number.parseInt(String(C),10),Ee=Fl(k,Se,L,{...F,q:B}),Ce=Go({src:zr(k,{...F,w:Se,q:B}),alt:E,width:C,height:j,loading:Z?void 0:Y,decoding:Q,fetchpriority:Z?"high":se,objectFit:oe,objectPosition:ie,crossorigin:ce,referrerpolicy:ae,className:Xl(pe,x),style:Yo(me,oe,ie,x),lazy:U&&!Z,data:he}),
|
|
1649
|
-
<img ${Ce} ${
|
|
1650
|
-
</div>`}return`<img ${o?`id="${o}" `:""}${Ce} ${
|
|
1647
|
+
<img ${Re} />
|
|
1648
|
+
</picture>`;return _e}function rm(e,o,x,v){let{src:k,alt:E,width:C,height:j,dpr:L=[1,2,3],quality:B=Jo,params:F={},lazy:U=!0,priority:Z=!1,loading:Y=Z?"eager":ti,decoding:Q=ei,fetchpriority:se,objectFit:oe,objectPosition:ie,crossorigin:ce,referrerpolicy:ae}=e,{class:pe,style:me}=e,he=e.data||{},Se=typeof C==="number"?C:Number.parseInt(String(C),10),Ee=Fl(k,Se,L,{...F,q:B}),Ce=Go({src:zr(k,{...F,w:Se,q:B}),alt:E,width:C,height:j,loading:Z?void 0:Y,decoding:Q,fetchpriority:Z?"high":se,objectFit:oe,objectPosition:ie,crossorigin:ce,referrerpolicy:ae,className:Xl(pe,x),style:Yo(me,oe,ie,x),lazy:U&&!Z,data:he}),Ae=U&&!Z?`data-srcset="${Ee}"`:`srcset="${Ee}"`;if(x){let Re=`background-image: url('${x.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${o}" class="stx-img-placeholder" style="${Re}">
|
|
1649
|
+
<img ${Ce} ${Ae} />
|
|
1650
|
+
</div>`}return`<img ${o?`id="${o}" `:""}${Ce} ${Ae} />`}function sm(e){let{src:o,alt:x,width:v,height:k,loading:E=ti,decoding:C=ei,fetchpriority:j,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U,priority:Z=!1}=e,{class:Y,style:Q,id:se}=e,oe=e.data||{};return{html:`<img ${Go({src:o,alt:x,width:v,height:k,loading:Z?"eager":E,decoding:C,fetchpriority:Z?"high":j,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U,className:Y,style:Yo(Q,L,B),id:se,data:oe})} />`}}function Go(e){let o=[];if(e.lazy)o.push(`data-src="${xn(e.src)}"`),o.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else o.push(`src="${xn(e.src)}"`);if(o.push(`alt="${xn(e.alt)}"`),e.width)o.push(`width="${e.width}"`);if(e.height)o.push(`height="${e.height}"`);if(e.loading)o.push(`loading="${e.loading}"`);if(e.decoding)o.push(`decoding="${e.decoding}"`);if(e.fetchpriority)o.push(`fetchpriority="${e.fetchpriority}"`);if(e.crossorigin)o.push(`crossorigin="${e.crossorigin}"`);if(e.referrerpolicy)o.push(`referrerpolicy="${e.referrerpolicy}"`);if(e.className)o.push(`class="${xn(e.className)}"`);if(e.style)o.push(`style="${xn(e.style)}"`);if(e.id)o.push(`id="${xn(e.id)}"`);if(e.data)for(let[x,v]of Object.entries(e.data))o.push(`data-${x}="${xn(v)}"`);if(e.lazy)o.push("data-stx-lazy");return o.join(" ")}function Xl(e,o){let x=[];if(e)x.push(e);if(o)x.push("stx-img-blur");return x.join(" ")||""}function Yo(e,o,x,v){let k=[];if(o)k.push(`object-fit: ${o}`);if(x)k.push(`object-position: ${x}`);if(v)k.push("opacity: 0; transition: opacity 300ms ease-out");if(e)k.push(e);return k.join("; ")}function xn(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Kl(e){return`
|
|
1651
1651
|
(function() {
|
|
1652
1652
|
const container = document.getElementById('${e}');
|
|
1653
1653
|
if (!container) return;
|
|
@@ -1684,7 +1684,7 @@ ${Re.join(`
|
|
|
1684
1684
|
|
|
1685
1685
|
observer.observe(container);
|
|
1686
1686
|
})();
|
|
1687
|
-
`.trim()}async function im(e,o){let x=await tm();if(!x)return Qs({...e,process:!1},o);let v=o.tsImagesConfig;if(e.responsiveWidths&&e.responsiveWidths.length>0||e.widths&&e.widths.length>0||!e.width&&!e.dpr){let E=await x.generateResponsiveVariants(e.src,e,v);if(E)return Zl(e,E,o)}else{let E=await x.processImage(e.src,e,v);if(E.processed)return Qo(e,E,o)}return Qs({...e,process:!1},o)}async function Qo(e,o,x){let{alt:v,width:k,height:E,lazy:C=!0,priority:j=!1,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U}=e,{class:Z,style:Y}=e,Q=e.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=e.data||{},oe=o.variants||[],ie=oe.find((Ie)=>Ie.format==="jpeg")||oe.find((Ie)=>Ie.format==="webp")||oe[0],ce=ie?.url||e.src,ae=oe.filter((Ie)=>Ie.format===(ie?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),pe=new Map;for(let Ie of oe){if(!pe.has(Ie.format))pe.set(Ie.format,[]);pe.get(Ie.format).push(Ie)}let me=[],he=["avif","webp","jpeg","png"];for(let Ie of he){let Oe=pe.get(Ie);if(Oe&&Oe.length>0){let tt=Oe.map((nt)=>`${nt.url} ${nt.width}w`).join(", "),ot=Xo(Ie);if(C&&!j)me.push(` <source type="${ot}" data-srcset="${tt}" />`);else me.push(` <source type="${ot}" srcset="${tt}" />`)}}let Se=[];if(C&&!j){if(Se.push(`data-src="${xn(ce)}"`),Se.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ae)Se.push(`data-srcset="${ae}"`)}else if(Se.push(`src="${xn(ce)}"`),ae)Se.push(`srcset="${ae}"`);Se.push(`alt="${xn(v)}"`);let Ee=k||o.originalWidth,Ce=E||o.originalHeight;if(Ee)Se.push(`width="${Ee}"`);if(Ce)Se.push(`height="${Ce}"`);if(!j)Se.push(`loading="${C?"lazy":"eager"}"`);if(Se.push('decoding="async"'),j)Se.push('fetchpriority="high"');if(F)Se.push(`crossorigin="${F}"`);if(U)Se.push(`referrerpolicy="${U}"`);let
|
|
1687
|
+
`.trim()}async function im(e,o){let x=await tm();if(!x)return Qs({...e,process:!1},o);let v=o.tsImagesConfig;if(e.responsiveWidths&&e.responsiveWidths.length>0||e.widths&&e.widths.length>0||!e.width&&!e.dpr){let E=await x.generateResponsiveVariants(e.src,e,v);if(E)return Zl(e,E,o)}else{let E=await x.processImage(e.src,e,v);if(E.processed)return Qo(e,E,o)}return Qs({...e,process:!1},o)}async function Qo(e,o,x){let{alt:v,width:k,height:E,lazy:C=!0,priority:j=!1,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U}=e,{class:Z,style:Y}=e,Q=e.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=e.data||{},oe=o.variants||[],ie=oe.find((Ie)=>Ie.format==="jpeg")||oe.find((Ie)=>Ie.format==="webp")||oe[0],ce=ie?.url||e.src,ae=oe.filter((Ie)=>Ie.format===(ie?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),pe=new Map;for(let Ie of oe){if(!pe.has(Ie.format))pe.set(Ie.format,[]);pe.get(Ie.format).push(Ie)}let me=[],he=["avif","webp","jpeg","png"];for(let Ie of he){let Oe=pe.get(Ie);if(Oe&&Oe.length>0){let tt=Oe.map((nt)=>`${nt.url} ${nt.width}w`).join(", "),ot=Xo(Ie);if(C&&!j)me.push(` <source type="${ot}" data-srcset="${tt}" />`);else me.push(` <source type="${ot}" srcset="${tt}" />`)}}let Se=[];if(C&&!j){if(Se.push(`data-src="${xn(ce)}"`),Se.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ae)Se.push(`data-srcset="${ae}"`)}else if(Se.push(`src="${xn(ce)}"`),ae)Se.push(`srcset="${ae}"`);Se.push(`alt="${xn(v)}"`);let Ee=k||o.originalWidth,Ce=E||o.originalHeight;if(Ee)Se.push(`width="${Ee}"`);if(Ce)Se.push(`height="${Ce}"`);if(!j)Se.push(`loading="${C?"lazy":"eager"}"`);if(Se.push('decoding="async"'),j)Se.push('fetchpriority="high"');if(F)Se.push(`crossorigin="${F}"`);if(U)Se.push(`referrerpolicy="${U}"`);let Ae=[];if(L)Ae.push(`object-fit: ${L}`);if(B)Ae.push(`object-position: ${B}`);if(o.placeholder&&C)Ae.push("opacity: 0; transition: opacity 300ms ease-out");if(Y)Ae.push(Y);if(Ae.length>0)Se.push(`style="${Ae.join("; ")}"`);let Re=[];if(Z)Re.push(Z);if(o.placeholder)Re.push("stx-img-blur");if(Re.length>0)Se.push(`class="${Re.join(" ")}"`);if(C&&!j)Se.push("data-stx-lazy");for(let[Ie,Oe]of Object.entries(se))Se.push(`data-${Ie}="${xn(Oe)}"`);let _e;if(o.placeholder||o.dominantColor&&e.useDominantColor){let Ie=o.placeholder?`background-image: url('${o.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${o.dominantColor};`;_e=`<div id="${Q}" class="stx-img-placeholder" style="${Ie}">
|
|
1688
1688
|
<picture>
|
|
1689
1689
|
${me.join(`
|
|
1690
1690
|
`)}
|
|
@@ -1695,16 +1695,16 @@ ${me.join(`
|
|
|
1695
1695
|
`)}
|
|
1696
1696
|
<img ${Se.join(" ")} />
|
|
1697
1697
|
</picture>`;let Te=[];if(o.placeholder)Te.push(Zo);let Me=C?Kl(Q):void 0,De;if(j&&ae)De=`<link rel="preload" as="image" imagesrcset="${ae}" />`;return{html:_e,preloadLink:De,css:Te.length>0?Te.join(`
|
|
1698
|
-
`):void 0,script:Me}}async function Zl(e,o,x){let v={src:o.src,processed:!0,variants:[],placeholder:o.placeholder?.dataURL,originalWidth:o.placeholder?.width,originalHeight:o.placeholder?.height};for(let[k,E]of Object.entries(o.byFormat))if(E)v.variants.push(...E);return Qo(e,v,x)}function om(){return qe({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,o,x,v)=>{let{src:k,alt:E,options:C}=am(e,o,x);if(!k)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let j={src:k,alt:E||"",widths:C.widths||
|
|
1698
|
+
`):void 0,script:Me}}async function Zl(e,o,x){let v={src:o.src,processed:!0,variants:[],placeholder:o.placeholder?.dataURL,originalWidth:o.placeholder?.width,originalHeight:o.placeholder?.height};for(let[k,E]of Object.entries(o.byFormat))if(E)v.variants.push(...E);return Qo(e,v,x)}function om(){return qe({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,o,x,v)=>{let{src:k,alt:E,options:C}=am(e,o,x);if(!k)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let j={src:k,alt:E||"",widths:C.widths||vr,formats:C.formats||Br,quality:C.quality,sizes:C.sizes,dpr:C.dpr,params:C.params,placeholder:C.placeholder,placeholderOptions:C.placeholderOptions,lazy:C.lazy!==!1,priority:C.priority||!1,loading:C.loading,decoding:C.decoding,fetchpriority:C.fetchpriority,objectFit:C.objectFit,objectPosition:C.objectPosition,class:C.class,style:C.style,id:C.id,width:C.width,height:C.height},L=x.__isDev||!1,B=await Qs(j,{isDev:L}),F=B.html;if(B.preloadLink)F=B.preloadLink+`
|
|
1699
1699
|
`+F;if(B.css)F+=`
|
|
1700
1700
|
<style>${B.css}</style>`;if(B.script)F+=`
|
|
1701
|
-
<script>${B.script}</script>`;return F},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function am(e,o,x){if(o.src)return{src:String(o.src),alt:String(o.alt||""),options:o.options||{}};let v=e.trim();if(v.startsWith("@img(")||v.startsWith("("))v=v.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let k=cm(v),E=ea(k[0],x)||"",C=ea(k[1],x)||"",j={};if(k[2]){let L=ea(k[2],x);if(typeof L==="object"&&L!==null)j=L;else if(typeof k[2]==="string")try{j=JSON.parse(k[2])}catch{}}return{src:E,alt:C,options:j}}function cm(e){let o=[],x="",v=!1,k="",E=0,C=0;for(let j=0;j<e.length;j++){let L=e[j],B=j>0?e[j-1]:"";if((L==='"'||L==="'"||L==="`")&&B!=="\\"){if(!v)v=!0,k=L;else if(L===k)v=!1,k="";else x+=L;continue}if(!v){if(L==="{")E++;if(L==="}")E--;if(L==="[")C++;if(L==="]")C--;if(L===","&&E===0&&C===0){o.push(x.trim()),x="";continue}}x+=L}if(x.trim())o.push(x.trim());return o}function ea(e,o){if(typeof e!=="string")return e;let x=e.trim();if(x.startsWith('"')&&x.endsWith('"')||x.startsWith("'")&&x.endsWith("'"))return x.slice(1,-1);if(!x.startsWith("/")&&!x.startsWith(".")&&!x.startsWith("http")&&!x.startsWith("{")){let v=o[x];if(v!==void 0)return v}if(x.startsWith("{")||x.startsWith("["))try{return JSON.parse(x)}catch{}return x}var Jl=om();async function Yl(){try{return await import("./chunk-
|
|
1701
|
+
<script>${B.script}</script>`;return F},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function am(e,o,x){if(o.src)return{src:String(o.src),alt:String(o.alt||""),options:o.options||{}};let v=e.trim();if(v.startsWith("@img(")||v.startsWith("("))v=v.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let k=cm(v),E=ea(k[0],x)||"",C=ea(k[1],x)||"",j={};if(k[2]){let L=ea(k[2],x);if(typeof L==="object"&&L!==null)j=L;else if(typeof k[2]==="string")try{j=JSON.parse(k[2])}catch{}}return{src:E,alt:C,options:j}}function cm(e){let o=[],x="",v=!1,k="",E=0,C=0;for(let j=0;j<e.length;j++){let L=e[j],B=j>0?e[j-1]:"";if((L==='"'||L==="'"||L==="`")&&B!=="\\"){if(!v)v=!0,k=L;else if(L===k)v=!1,k="";else x+=L;continue}if(!v){if(L==="{")E++;if(L==="}")E--;if(L==="[")C++;if(L==="]")C--;if(L===","&&E===0&&C===0){o.push(x.trim()),x="";continue}}x+=L}if(x.trim())o.push(x.trim());return o}function ea(e,o){if(typeof e!=="string")return e;let x=e.trim();if(x.startsWith('"')&&x.endsWith('"')||x.startsWith("'")&&x.endsWith("'"))return x.slice(1,-1);if(!x.startsWith("/")&&!x.startsWith(".")&&!x.startsWith("http")&&!x.startsWith("{")){let v=o[x];if(v!==void 0)return v}if(x.startsWith("{")||x.startsWith("["))try{return JSON.parse(x)}catch{}return x}var Jl=om();async function Yl(){try{return await import("./chunk-3ch40ebr.js")}catch(e){if(!Gl)console.warn("[stx-media] Video processor not available, some features disabled:",e),Gl=!0;return null}}var Gl=!1,Ql=!0,eu="metadata",lm="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ni(e,o={}){let x=o,v=e;if(v.process&&!v.skipProcessing){if(x.tsVideosConfig?.enabled&&!x.isDev)return gm(v,x)}if(x.processedResult?.processed)return nu(e,x.processedResult,o);let k;if(v.generatePoster&&v.src&&!e.poster)k=await mm(v,x);let{src:E,sources:C=[],poster:j,posterPlaceholder:L,controls:B=Ql,autoplay:F=!1,muted:U=!1,loop:Z=!1,preload:Y=eu,playsinline:Q=!0,lazy:se=!0,player:oe="native",type:ie,width:ce,height:ae,crossorigin:pe,disablePictureInPicture:me=!1,disableRemotePlayback:he=!1}=e,Se=k||j,{class:Ee,style:Ce}=e,Ae=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return dm(e,o);if(ie&&ie!=="video")return um(E||"",ie,e);let Re=C.length>0?C:E?[{src:E,type:tu(E)}]:[],_e=[`id="${Ae}"`];if(B)_e.push("controls");if(F)_e.push("autoplay");if(U)_e.push("muted");if(Z)_e.push("loop");if(Q)_e.push("playsinline");if(me)_e.push("disablepictureinpicture");if(he)_e.push("disableremoteplayback");if(pe)_e.push(`crossorigin="${pe}"`);if(se){if(_e.push(`data-preload="${Y}"`),_e.push('preload="none"'),Se)_e.push(`data-poster="${Ht(Se)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${Y}"`),Se)_e.push(`poster="${Ht(Se)}"`);if(ce)_e.push(`width="${ce}"`);if(ae)_e.push(`height="${ae}"`);if(Ee)_e.push(`class="${Ht(Ee)}"`);if(Ce)_e.push(`style="${Ht(Ce)}"`);let Te=Re.map((Ie)=>` <source ${se?`data-src="${Ht(Ie.src)}"`:`src="${Ht(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
|
|
1702
1702
|
`),Me=`<video ${_e.join(" ")}>
|
|
1703
1703
|
${Te}
|
|
1704
1704
|
Your browser does not support the video tag.
|
|
1705
1705
|
</video>`,De;if(se)De=`
|
|
1706
1706
|
(function() {
|
|
1707
|
-
var video = document.getElementById('${
|
|
1707
|
+
var video = document.getElementById('${Ae}');
|
|
1708
1708
|
if (!video) return;
|
|
1709
1709
|
|
|
1710
1710
|
var observer = new IntersectionObserver(function(entries) {
|
|
@@ -1906,11 +1906,11 @@ else {
|
|
|
1906
1906
|
.ts-video-player__play-button svg {
|
|
1907
1907
|
margin-left: 4px;
|
|
1908
1908
|
}
|
|
1909
|
-
`.trim();return{html:ae,script:pe,css:me}}function tu(e){switch(e.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 pm(e){let o=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let x of o){let v=e.match(x);if(v)return v[1]}return null}function fm(e){let o=e.match(/vimeo\.com\/(\d+)/);return o?o[1]:null}function Ht(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function gm(e,o){let x=await Yl();if(!x)return ni({...e,process:!1},o);let v=o.tsVideosConfig,k=await x.processVideo(e.src,e,v,e.onProcessProgress);if(k.processed)return nu(e,k,o);return ni({...e,process:!1},o)}async function mm(e,o){let x=await Yl();if(!x||!e.src)return;let v=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},k=o.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await x.generatePoster(e.src,v,k.outputDir,k.baseUrl||"/videos"))?.url}function nu(e,o,x){let{controls:v=Ql,autoplay:k=!1,muted:E=!1,loop:C=!1,preload:j=eu,playsinline:L=!0,lazy:B=!0,width:F,height:U,crossorigin:Z,disablePictureInPicture:Y=!1,disableRemotePlayback:Q=!1}=e,{class:se,style:oe}=e,ie=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ce=e.src,ae=tu(ce);if(o.transcoded)ce=o.transcoded.url,ae="video/mp4";let pe=o.streaming?.hls||o.streaming?.dash;if(pe){if(o.streaming?.hls)ce=o.streaming.hls.manifestUrl,ae="application/x-mpegURL";else if(o.streaming?.dash)ce=o.streaming.dash.manifestUrl,ae="application/dash+xml"}let me=o.poster?.url||e.poster,he=[`id="${ie}"`];if(v)he.push("controls");if(k)he.push("autoplay");if(E)he.push("muted");if(C)he.push("loop");if(L)he.push("playsinline");if(Y)he.push("disablepictureinpicture");if(Q)he.push("disableremoteplayback");if(Z)he.push(`crossorigin="${Z}"`);if(B){if(he.push(`data-preload="${j}"`),he.push('preload="none"'),me)he.push(`data-poster="${Ht(me)}"`);he.push("data-stx-lazy")}else if(he.push(`preload="${j}"`),me)he.push(`poster="${Ht(me)}"`);let Se=F||o.metadata?.width,Ee=U||o.metadata?.height;if(Se)he.push(`width="${Se}"`);if(Ee)he.push(`height="${Ee}"`);if(se)he.push(`class="${Ht(se)}"`);if(oe)he.push(`style="${Ht(oe)}"`);let
|
|
1910
|
-
${Re}
|
|
1911
|
-
Your browser does not support the video tag.
|
|
1912
|
-
</video>`;if(o.spriteSheet)Ae=`<div class="stx-video-wrapper" data-sprite-sheet="${Ht(o.spriteSheet.url)}" data-sprite-cols="${o.spriteSheet.columns}" data-sprite-interval="${o.spriteSheet.interval}">
|
|
1909
|
+
`.trim();return{html:ae,script:pe,css:me}}function tu(e){switch(e.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 pm(e){let o=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let x of o){let v=e.match(x);if(v)return v[1]}return null}function fm(e){let o=e.match(/vimeo\.com\/(\d+)/);return o?o[1]:null}function Ht(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function gm(e,o){let x=await Yl();if(!x)return ni({...e,process:!1},o);let v=o.tsVideosConfig,k=await x.processVideo(e.src,e,v,e.onProcessProgress);if(k.processed)return nu(e,k,o);return ni({...e,process:!1},o)}async function mm(e,o){let x=await Yl();if(!x||!e.src)return;let v=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},k=o.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await x.generatePoster(e.src,v,k.outputDir,k.baseUrl||"/videos"))?.url}function nu(e,o,x){let{controls:v=Ql,autoplay:k=!1,muted:E=!1,loop:C=!1,preload:j=eu,playsinline:L=!0,lazy:B=!0,width:F,height:U,crossorigin:Z,disablePictureInPicture:Y=!1,disableRemotePlayback:Q=!1}=e,{class:se,style:oe}=e,ie=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ce=e.src,ae=tu(ce);if(o.transcoded)ce=o.transcoded.url,ae="video/mp4";let pe=o.streaming?.hls||o.streaming?.dash;if(pe){if(o.streaming?.hls)ce=o.streaming.hls.manifestUrl,ae="application/x-mpegURL";else if(o.streaming?.dash)ce=o.streaming.dash.manifestUrl,ae="application/dash+xml"}let me=o.poster?.url||e.poster,he=[`id="${ie}"`];if(v)he.push("controls");if(k)he.push("autoplay");if(E)he.push("muted");if(C)he.push("loop");if(L)he.push("playsinline");if(Y)he.push("disablepictureinpicture");if(Q)he.push("disableremoteplayback");if(Z)he.push(`crossorigin="${Z}"`);if(B){if(he.push(`data-preload="${j}"`),he.push('preload="none"'),me)he.push(`data-poster="${Ht(me)}"`);he.push("data-stx-lazy")}else if(he.push(`preload="${j}"`),me)he.push(`poster="${Ht(me)}"`);let Se=F||o.metadata?.width,Ee=U||o.metadata?.height;if(Se)he.push(`width="${Se}"`);if(Ee)he.push(`height="${Ee}"`);if(se)he.push(`class="${Ht(se)}"`);if(oe)he.push(`style="${Ht(oe)}"`);let Ae=` <source ${B?`data-src="${Ht(ce)}"`:`src="${Ht(ce)}"`} type="${ae}" />`,Re=`<video ${he.join(" ")}>
|
|
1913
1910
|
${Ae}
|
|
1911
|
+
Your browser does not support the video tag.
|
|
1912
|
+
</video>`;if(o.spriteSheet)Re=`<div class="stx-video-wrapper" data-sprite-sheet="${Ht(o.spriteSheet.url)}" data-sprite-cols="${o.spriteSheet.columns}" data-sprite-interval="${o.spriteSheet.interval}">
|
|
1913
|
+
${Re}
|
|
1914
1914
|
</div>`;let _e;if(B)_e=`
|
|
1915
1915
|
(function() {
|
|
1916
1916
|
var video = document.getElementById('${ie}');
|
|
@@ -1955,9 +1955,9 @@ ${Ae}
|
|
|
1955
1955
|
width: 100%;
|
|
1956
1956
|
height: auto;
|
|
1957
1957
|
}
|
|
1958
|
-
`.trim();return{html:
|
|
1958
|
+
`.trim();return{html:Re,script:_e,css:Te}}function ru(){return qe({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,o,x,v)=>{let{src:k,options:E}=hm(e,o,x);if(!k)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let C={src:k,poster:E.poster,controls:E.controls!==!1,autoplay:E.autoplay||!1,muted:E.muted||!1,loop:E.loop||!1,preload:E.preload||"metadata",playsinline:E.playsinline!==!1,lazy:E.lazy!==!1,player:E.player||"native",type:E.type,width:E.width,height:E.height,class:E.class,style:E.style,id:E.id,crossorigin:E.crossorigin,disablePictureInPicture:E.disablePictureInPicture,disableRemotePlayback:E.disableRemotePlayback,title:E.title,quality:E.quality,platform:E.platform,process:E.process,generatePoster:E.generatePoster,streaming:E.streaming,transcode:E.transcode,spriteSheet:E.spriteSheet,waveform:E.waveform},L={isDev:x.__isDev||!1,tsVideosConfig:x.__tsVideosConfig},B=await ni(C,L),F=B.html;if(B.css)F+=`
|
|
1959
1959
|
<style>${B.css}</style>`;if(B.script)F+=`
|
|
1960
|
-
<script>${B.script}</script>`;return F},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function hm(e,o,x){if(o.src)return{src:String(o.src),options:o.options||{}};let v=e.trim();if(v.startsWith("@video(")||v.startsWith("("))v=v.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let k=ym(v),E=su(k[0],x)||"",C={};if(k[1]){let j=su(k[1],x);if(typeof j==="object"&&j!==null)C=j;else if(typeof k[1]==="string")try{C=JSON.parse(k[1])}catch{}}return{src:E,options:C}}function ym(e){let o=[],x="",v=!1,k="",E=0,C=0;for(let j=0;j<e.length;j++){let L=e[j],B=j>0?e[j-1]:"";if((L==='"'||L==="'"||L==="`")&&B!=="\\"){if(!v)v=!0,k=L;else if(L===k)v=!1,k="";else x+=L;continue}if(!v){if(L==="{")E++;if(L==="}")E--;if(L==="[")C++;if(L==="]")C--;if(L===","&&E===0&&C===0){o.push(x.trim()),x="";continue}}x+=L}if(x.trim())o.push(x.trim());return o}function su(e,o){if(typeof e!=="string")return e;let x=e.trim();if(x.startsWith('"')&&x.endsWith('"')||x.startsWith("'")&&x.endsWith("'"))return x.slice(1,-1);if(!x.startsWith("/")&&!x.startsWith(".")&&!x.startsWith("http")&&!x.startsWith("{")){let v=o[x];if(v!==void 0)return v}if(x.startsWith("{")||x.startsWith("["))try{return JSON.parse(x)}catch{}return x}var ta=ru();import xm from"fs";import
|
|
1960
|
+
<script>${B.script}</script>`;return F},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function hm(e,o,x){if(o.src)return{src:String(o.src),options:o.options||{}};let v=e.trim();if(v.startsWith("@video(")||v.startsWith("("))v=v.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let k=ym(v),E=su(k[0],x)||"",C={};if(k[1]){let j=su(k[1],x);if(typeof j==="object"&&j!==null)C=j;else if(typeof k[1]==="string")try{C=JSON.parse(k[1])}catch{}}return{src:E,options:C}}function ym(e){let o=[],x="",v=!1,k="",E=0,C=0;for(let j=0;j<e.length;j++){let L=e[j],B=j>0?e[j-1]:"";if((L==='"'||L==="'"||L==="`")&&B!=="\\"){if(!v)v=!0,k=L;else if(L===k)v=!1,k="";else x+=L;continue}if(!v){if(L==="{")E++;if(L==="}")E--;if(L==="[")C++;if(L==="]")C--;if(L===","&&E===0&&C===0){o.push(x.trim()),x="";continue}}x+=L}if(x.trim())o.push(x.trim());return o}function su(e,o){if(typeof e!=="string")return e;let x=e.trim();if(x.startsWith('"')&&x.endsWith('"')||x.startsWith("'")&&x.endsWith("'"))return x.slice(1,-1);if(!x.startsWith("/")&&!x.startsWith(".")&&!x.startsWith("http")&&!x.startsWith("{")){let v=o[x];if(v!==void 0)return v}if(x.startsWith("{")||x.startsWith("["))try{return JSON.parse(x)}catch{}return x}var ta=ru();import xm from"fs";import rn from"path";async function Gn(e,o){if(!e.webComponents?.enabled)return[];let x=e.webComponents.components||[],v=[];if(x.length>0){if(e.debug)console.log(`Building ${x.length} web components...`);for(let k of x)try{let E=await bm(k,e,o);if(E)v.push(E)}catch(E){if(console.error(`Error building web component ${k.name}:`,E),e.debug)throw E}}return v}async function bm(e,o,x){let{name:v,file:k,tag:E,extends:C}=e;if(!v||!k||!E)return console.error("Invalid web component configuration, missing required fields:",e),null;let j=null;if(rn.isAbsolute(k)&&await n(k))j=k;else if(o.componentsDir){let se=rn.join(o.componentsDir,k);if(await n(se))j=se}if(!j)j=await Kn(k,process.cwd(),o,x);if(!j)return console.error(`Web component source file not found: ${k}`),null;let L=await Bun.file(j).text();x.add(j);let F=(e.outputFormat||"js")==="ts",U=F?wm({name:v,tag:E,baseElement:C,source:L,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):vm({name:v,tag:E,baseElement:C,source:L,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),Z=o.webComponents?.outputDir||"dist/web-components";await xm.promises.mkdir(Z,{recursive:!0});let Y=F?"ts":"js",Q=rn.join(Z,`${E}.${Y}`);if(await Bun.write(Q,U),o.debug)console.log(`Built web component ${v} -> ${Q}`);return Q}function vm(e){let{name:o,tag:x,baseElement:v="HTMLElement",source:k,shadowDOM:E,template:C,styleSource:j,attributes:L=[]}=e,B=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!E)B=B.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),B=B.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),B=B.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),B=B.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let F="";if(j)F=`<link rel="stylesheet" href="${j}">`;return`/**
|
|
1961
1961
|
* ${o} Web Component
|
|
1962
1962
|
* Auto-generated from stx component
|
|
1963
1963
|
*/
|
|
@@ -2255,17 +2255,17 @@ ${F}
|
|
|
2255
2255
|
}
|
|
2256
2256
|
|
|
2257
2257
|
customElements.define('${o}', ${C});
|
|
2258
|
-
`}async function iu(e,o,x,v){if(o.length<1)return a("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let k=o[0].replace(/['"]/g,""),C=(x.__stx_options||{}).componentsDir||"components",j=
|
|
2258
|
+
`}async function iu(e,o,x,v){if(o.length<1)return a("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let k=o[0].replace(/['"]/g,""),C=(x.__stx_options||{}).componentsDir||"components",j=rn.isAbsolute(C)?[rn.join(C,`${k}.stx`),rn.join(rn.dirname(v),`${k}.stx`)]:[rn.join(rn.dirname(v),C,`${k}.stx`),rn.join(process.cwd(),C,`${k}.stx`),rn.join(rn.dirname(v),`${k}.stx`)],L=null;for(let U of j)if(await n(U)){L=await Bun.file(U).text();break}if(!L)return a("WebComponent",`Component file not found: ${k}.stx`,t.FILE_NOT_FOUND);let B=$m(L,k);return`<script type="module">
|
|
2259
2259
|
${Sm(B)}
|
|
2260
|
-
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_t,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:Wl,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:iu,hasEndTag:!1,description:"Include a web component in the template"},lo,uo,er,tr,Rl,Tl,Il,Al,Ll,Cl,Jl,ta,...dr],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 Em(e,o,x){let v=o||"pages";if(e)return{root:e,pagesDir:v};let k=x||process.cwd(),E=Yt.join(k,"resources","views"),C=Yt.join(k,"resources","layouts");if(si.existsSync(E)&&si.existsSync(C))return{root:"resources",pagesDir:"views"};let j=Yt.join(k,"resources","views","pages");if(si.existsSync(j))return{root:"resources/views",pagesDir:v};return{root:".",pagesDir:v}}var ou=new Set,ii=["partialsDir","componentsDir","layoutsDir"],na=new WeakMap;function km(e,o){let x=o.replace(/[\\/]+$/,"");if(!x||x===".")return!0;let v=e.replace(/\\/g,"/"),k=x.replace(/\\/g,"/");return v===k||v.startsWith(`${k}/`)}function Sc(e,o){let x=!e.root,v=Em(e.root,e.pagesDir,o);if(e.root=v.root,e.pagesDir=v.pagesDir,x&&v.root!=="."){let k=`${o}::${v.root}`;if(!ou.has(k))ou.add(k),console.warn(`[stx] No "root" in config \u2014 inferred "${v.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!na.has(e)){let k={};for(let E of ii){let C=e[E];if(typeof C==="string"&&C)k[E]=C}na.set(e,k)}if(e.root&&e.root!=="."){let k=e.root;for(let E of ii){let C=e[E];if(typeof C!=="string"||!C)continue;if(Yt.isAbsolute(C)||km(C,k))continue;e[E]=Yt.join(k,C)}}for(let k of ii){let E=e[k];if(typeof E!=="string"||!E||Yt.isAbsolute(E))continue;e[k]=Yt.resolve(o,E)}return e}function Cm(e,o){let x=na.get(e);for(let v of ii){let k=e[v];if(typeof k!=="string"||!k)continue;let E=Yt.isAbsolute(k)?k:Yt.join(o,k);if(si.existsSync(E))continue;let C=x?.[v]??k,j=e.root,L=!!j&&j!==".";console.warn(`[stx] ${String(v)} resolves to "${E}", which does not exist. Configured as "${C}"`+(L?`, resolved under root "${j}".`:"."))}}function Rm(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Am(e){if(xo(e.stateDir),e.stateDir=un(),e.cachePath=dn(e.cachePath),e.build)e.build.cacheDir=dn(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=dn(e.media.cache.directory);if(e.story)e.story.outDir=dn(e.story.outDir)}var Dn=null,rr=new Map,ri=new Map,Wr=null;async function i(e){let o=e?Yt.resolve(e):process.cwd(),x=ri.get(o);if(x&&x.signature!==Gn(x.graph)){let E=rr.get(o);if(rr.delete(o),ri.delete(o),!e)Dn=null,Wr=null;let{clearComponentCache:C}=await import("./chunk-hhnw2sn3.js"),{partialsCache:j}=await import("./chunk-0pnj3zt2.js");if(C(),j.clear(),E&&x.configSignature===Jn(x.graph)){let L=E.then(async(B)=>{let F={...x.graph};await ws(F,o),ri.set(o,{graph:F,signature:Gn(F),configSignature:Jn(F)});let U={...B,_layerGraph:F};if(!e)Dn=U;return U});return rr.set(o,L),L}}if(!e){if(Dn)return Dn;if(Wr)return Wr}let v=rr.get(o);if(v)return v;let k=(async()=>{let C=(await _m({name:"stx",alias:"ui",cwd:o,defaultConfig:A,verbose:!1})).config;if(C.extends!==void 0||x){let F=await go(o,A);C=F.config,ri.set(o,{graph:F.graph,signature:Gn(F.graph),configSignature:Jn(F.graph)})}if(C.runtimeConfig){let{resolveRuntimeConfig:F}=await import("./chunk-hjg3ndgh.js");F(C.runtimeConfig,{});let{generateRuntimeConfigTypes:U}=await import("./chunk-jp10q90g.js");await U(o,C.runtimeConfig)}Rm(C),Am(C),Sc(C,o),Cm(C,o);let j=[],L=new Set((C.plugins??[]).map((F)=>typeof F==="string"?F:F[0]));for(let F of C.componentPackages??["@stacksjs/components"]){let U=`${F}/stx-plugin`;if(L.has(U)||L.has(F))continue;try{u.resolve(U,{paths:[o]}),j.push(U)}catch{}}let B=[...C.plugins??[],...j];if(B.length>0){let{pluginManager:F}=await import("./chunk-1098mas0.js"),U=[],Z=[];for(let Y of B){let Q=typeof Y==="string"?Y:Y[0],se=typeof Y==="string"?{}:Y[1]||{};try{let oe,ie;try{let ae=u.resolve(Q,{paths:[o]});oe=await import(ae),ie=Yt.dirname(ae)}catch{let ae=Yt.resolve(o,Q);oe=await import(ae),ie=Yt.dirname(ae)}let ce=oe.default||oe;if(!F.has(ce.name))await F.register(ce,C);if(ce.components){let ae=Array.isArray(ce.components)?ce.components:[ce.components];for(let pe of ae)U.push(Yt.resolve(ie,pe))}if(ce.pages){let ae=Yt.resolve(ie,ce.pages),pe=se.path||"/";Z.push({dir:ae,prefix:pe})}if(ce.setup){let ae={addDirective:(pe)=>{C.customDirectives=C.customDirectives||[],C.customDirectives.push(pe)},addRoute:(pe,me)=>{C.apiRoutes=C.apiRoutes||{},C.apiRoutes[pe]=me},addMiddleware:(pe)=>{C.middleware=C.middleware||[],C.middleware.push(pe)},pluginDir:ie,config:C};await ce.setup(se,ae)}console.log(`[stx] Plugin loaded: ${ce.name||Q}`)}catch(oe){console.warn(`[stx] Failed to load plugin ${Q}:`,oe.message)}}C._pluginComponentDirs=U,C._pluginPageDirs=Z}return C})();if(rr.set(o,k),k.catch(()=>{if(rr.get(o)===k)rr.delete(o)}),!e)Wr=k,k.then((E)=>{Dn=E}).catch(()=>{});return k}var T=new Proxy(A,{get(e,o){if(Dn&&o in Dn)return Dn[o];if(!Wr)i().catch((x)=>{console.warn("[stx] Failed to load config file:",x?.message||x)});return e[o]}});function Bu(e){return e}function Fu(e){let o=[],x=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")o.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")o.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")o.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")o.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)o.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)o.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let v=["auto","manual","sections"];if(!v.includes(e.streaming.strategy))o.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let v=["json","yaml","yml","js"];if(!v.includes(e.i18n.format))o.push({path:"i18n.format",message:`i18n.format must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)o.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)o.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let v=["AA","AAA"];if(!v.includes(e.a11y.level))o.push({path:"a11y.level",message:`a11y.level must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let v=["progressive","islands"];if(!v.includes(e.hydration.mode))o.push({path:"hydration.mode",message:`hydration.mode must be one of: ${v.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let v=["none","eager","lazy"];if(!v.includes(e.hydration.preload))o.push({path:"hydration.preload",message:`hydration.preload must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))o.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((v,k)=>{if(!v.name||typeof v.name!=="string")o.push({path:`customDirectives[${k}].name`,message:"Custom directive must have a name string",severity:"error"});if(!v.handler||typeof v.handler!=="function")o.push({path:`customDirectives[${k}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))o.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((v,k)=>{if(!v.name||typeof v.name!=="string")o.push({path:`middleware[${k}].name`,message:"Middleware must have a name string",severity:"error"});if(!v.handler||typeof v.handler!=="function")o.push({path:`middleware[${k}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!v.timing||!["before","after"].includes(v.timing))o.push({path:`middleware[${k}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)x.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)x.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)o.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let v=["fullscreen","standalone","minimal-ui","browser"];if(!v.includes(e.pwa.manifest.display))o.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let v=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!v.includes(e.pwa.manifest.orientation))o.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.routes){let v=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((k,E)=>{if(!k.pattern||typeof k.pattern!=="string")o.push({path:`pwa.routes[${E}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!v.includes(k.strategy))o.push({path:`pwa.routes[${E}].strategy`,message:`PWA route strategy must be one of: ${v.join(", ")}`,severity:"error"});if(k.maxAgeSeconds!==void 0&&(typeof k.maxAgeSeconds!=="number"||k.maxAgeSeconds<0))o.push({path:`pwa.routes[${E}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(k.maxEntries!==void 0&&(typeof k.maxEntries!=="number"||k.maxEntries<1))o.push({path:`pwa.routes[${E}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))o.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((k)=>typeof k!=="number"||k<16||k>1024).length>0)o.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let v=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((E)=>!v.includes(E)).length>0)o.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)x.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)x.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:o.length===0,errors:o,warnings:x}}var sa=new Map;async function ue(e,o={}){try{if(!await n(e))throw Error(`Markdown file not found: ${e}`);let v=(await Tm.promises.stat(e)).mtime.getTime();if(o.cache&&sa.has(e)){let U=sa.get(e);if(U.updatedAt>=v)return{content:U.content,data:U.data}}let k=await Bun.file(e).text(),{data:E,content:C}=Nn(k),j=o.markdown||T.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},B=Ne(C,{gfm:!0});if(j.syntaxHighlighting?.enabled&&j.syntaxHighlighting?.serverSide)B=await Dm(B,j.syntaxHighlighting?.defaultTheme||"github-dark",j.syntaxHighlighting?.highlightUnknownLanguages||!1);let F={content:B,data:E||{}};if(o.cache)sa.set(e,{...F,updatedAt:v});return F}catch(x){if(o.debug)console.error(`Error reading/parsing markdown file ${e}:`,x);let v=x instanceof Error?x.message:String(x);return{content:g("Markdown File",`Error reading/parsing markdown file: ${v}`,e,"",0,""),data:{}}}}var oi=null;async function Dm(e,o,x){let v=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oi)try{oi=await Im({theme:o||"github-dark",cache:!0})}catch(j){return console.error("Failed to initialize ts-syntax-highlighter:",j),e}let k=async(j,L,B,F)=>{let U=F.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),Z=B||(x?"text":"");if(!Z)return j;try{if(!oi.getSupportedLanguages().includes(Z))return j;return(await oi.highlight(U,Z,{theme:o})).html}catch(Y){console.error(`Error highlighting code block with language ${B}:`,Y)}return j},E=e,C=e.matchAll(v);for(let j of C){let[L,B,F,U]=j,Z=await k(L,B,F,U);E=E.replace(L,Z)}return E}async function au(e,o,x="",v={}){return await Pm(e,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(C,j,L,B)=>{try{let F=j;if(!ra.isAbsolute(j))F=ra.resolve(ra.dirname(x),j);let U={};if(L)try{try{U=JSON.parse(L)}catch{if(v.debug)console.warn("Using safer alternative for parsing JS object literal");let ce=L.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ae of ce){let pe=ae.indexOf(":");if(pe>0){let me=ae.substring(0,pe).trim(),he=ae.substring(pe+1).trim(),Se=he.startsWith('"')&&he.endsWith('"'),Ee=he.startsWith("'")&&he.endsWith("'");if(Se||Ee)he=he.substring(1,he.length-1);U[me]=he}}}}catch(ie){if(v.debug)console.error("Error parsing context in @markdown-file directive:",ie)}let{content:Z,data:Y}=await ue(F,v),Q={...o,...Y,...U},se=Z,oe=/\{\{([^}]+)\}\}/g;return se=se.replace(oe,(ie,ce)=>{let ae=ce.trim();return Q[ae]!==void 0?String(Q[ae]):ie}),se}catch(F){let U=F instanceof Error?F.message:String(F);return g("Markdown File",`Error including markdown file: ${U}`,x,e,B,C)}})}async function Pm(e,o,x){let v=[],k;while((k=o.exec(e))!==null){let j=k[0],L=k.index,B=k;v.push(x(...B).then((F)=>({match:j,replacement:F,index:L})))}let E=await Promise.all(v);E.sort((j,L)=>L.index-j.index);let C=e;for(let{match:j,replacement:L}of E)C=C.replace(j,()=>L);return C}function Pn(e,o){try{let x=e.trim();if(p(x))return l(x,Object.keys(o))(...Object.values(o));else return c(x,o)}catch{return!1}}function Mn(e,o){let x=Mm(e,o);return x.ok?{expression:x.expression,endPos:x.endPos}:null}function Mm(e,o){let x=o;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!=="(")return{ok:!1,reason:"missing-open-paren",pos:x};let v=w(e,"(",")",x);if(v===-1)return{ok:!1,reason:"unclosed-paren",pos:x};return{ok:!0,expression:e.slice(x+1,v),endPos:v+1}}function Om(e,o){let x=e.lastIndexOf("<",o);if(x===-1)return!1;return x>e.lastIndexOf(">",o)}function ar(e,o,x,v){let k=1,E=v,C=new RegExp(`@${o}\\s*\\(`,"g"),j=new RegExp(`@${x}(?![a-z])`,"g");while(E<e.length&&k>0){C.lastIndex=E,j.lastIndex=E;let L=C.exec(e),B=j.exec(e),F=L?L.index:1/0,U=B?B.index:1/0;if(F<U)k++,E=F+L[0].length;else if(U<1/0){if(k--,k===0)return U;E=U+B[0].length}else break}return-1}function cu(e,o){let x=e.slice(o).match(/^@if\s*/);if(!x)return null;let v=o+x[0].length,k=Mn(e,v);if(!k)return null;let E=k.endPos,C=ar(e,"if","endif",E);if(C===-1)return null;let j=e.slice(E,C),L=[],B=0,F="if",U=k.expression,Z=0,Y=0;while(B<j.length){let Q=j.indexOf("@",B);if(Q===-1)break;B=Q;let se=j.substring(Q);if(Om(j,Q)){B++;continue}if(/^@if\s*\(/.test(se)){Y++,B++;continue}if(/^@endif(?![a-z])/.test(se)){Y--,B+=6;continue}if(Y===0){let oe=se.match(/^@elseif\s*/);if(oe){L.push({type:F,condition:U,content:j.substring(Z,B),start:E+Z,end:E+B});let ie=B+oe[0].length,ce=Mn(j,ie);if(!ce){B++;continue}F="elseif",U=ce.expression,B=ce.endPos,Z=B;continue}else if(/^@else(?![a-z])/.test(se)){L.push({type:F,condition:U,content:j.substring(Z,B),start:E+Z,end:E+B}),F="else",U=void 0,B+=5,Z=B;continue}}B++}return L.push({type:F,condition:U,content:j.slice(Z),start:E+Z,end:E+j.length}),{fullMatch:e.slice(o,C+6),branches:L,start:o,end:C+6}}function Fr(e){let o=[],x=/@if\s*\(/g,v=x.exec(e);while(v!==null){if(o.some((C)=>v.index>C.start&&v.index<C.end)){v=x.exec(e);continue}let E=cu(e,v.index);if(E)o.push(E),x.lastIndex=E.end;v=x.exec(e)}return o}function ai(e,o,x){let v=[],k=new RegExp(`@${o}\\s*\\(`,"g"),E=k.exec(e);while(E!==null){if(v.some((se)=>E.index>se.start&&E.index<se.end)){E=k.exec(e);continue}let j=E.index,L=j+E[0].length-1,B=w(e,"(",")",L);if(B===-1){E=k.exec(e);continue}let F=e.slice(L+1,B),U=B+1,Z=ar(e,o,x,U);if(Z===-1){E=k.exec(e);continue}let Y=e.slice(U,Z),Q=Z+`@${x}`.length;v.push({fullMatch:e.slice(j,Q),name:o,params:F,content:Y,start:j,end:Q}),k.lastIndex=Q,E=k.exec(e)}return v}function ia(e,o){let x=e.slice(o).match(/^@switch\s*/);if(!x)return null;let v=o+x[0].length,k=Mn(e,v);if(!k)return null;let E=k.endPos,C=ar(e,"switch","endswitch",E);if(C===-1)return null;let j=e.slice(E,C),L=[],B=0,F=null,U=0;while(B<j.length){let Z=j.slice(B),Y=Z.match(/^@switch\s*\(/),Q=Z.match(/^@endswitch(?![a-z])/);if(Y){if(U++,F)F.content+=Y[0];B+=Y[0].length;continue}if(Q){if(U--,F)F.content+=Q[0];B+=Q[0].length;continue}if(U>0){if(F)F.content+=j[B];B++;continue}let se=Z.match(/^@case\s*/),oe=Z.match(/^@default(?![a-z])/),ie=Z.match(/^@break(?![a-z])/);if(se&&Z.startsWith("@case")){if(F)L.push(F);let ce=B+se[0].length,ae=Mn(j,ce);if(!ae){B++;continue}F={type:"case",value:ae.expression,content:""},B=ae.endPos}else if(oe&&Z.startsWith("@default")){if(F)L.push(F);F={type:"default",content:""},B+=oe[0].length}else if(ie&&Z.startsWith("@break"))B+=ie[0].length;else{if(F)F.content+=j[B];B++}}if(F)L.push(F);return{fullMatch:e.slice(o,C+10),expression:k.expression,cases:L,start:o,end:C+10}}function Bm(e,o,x){let v=e,k=!0;while(k){k=!1;let E=v.match(/@switch\s*\(/);if(!E||E.index===void 0)break;let C=E.index,j=ia(v,C);if(!j)break;try{let L;if(p(j.expression))L=l(j.expression,Object.keys(o))(...Object.values(o));else L=c(j.expression,o);let B="",F=!1;for(let U of j.cases)if(U.type==="default"){if(!F)B=U.content.trim()}else try{let Z;if(U.value&&p(U.value))Z=l(U.value,Object.keys(o))(...Object.values(o));else if(U.value)Z=c(U.value,o);if(L===Z){B=U.content.trim(),F=!0;break}}catch{continue}v=v.substring(0,C)+B+v.substring(j.end),k=!0}catch(L){let B=L instanceof Error?L.message:String(L),F=a("Switch",`Error evaluating @switch expression: ${B}`,t.EVALUATION_ERROR);v=v.substring(0,C)+F+v.substring(j.end);break}}return v}function zm(e){let o=[];return{masked:e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(v)=>(o.push(v),`\x00stx-script-${o.length-1}\x00`)),scripts:o}}function Wm(e,o){if(o.length===0)return e;return e.replace(/\u0000stx-script-(\d+)\u0000/g,(x,v)=>o[Number(v)]??x)}function Cn(e,o,x){let{masked:v,scripts:k}=zm(e);return Wm(Fm(v,o,x),k)}function Fm(e,o,x){let v=e;v=Bm(v,o,x);{let E=!0;while(E){E=!1;let C=v.match(/@unless\s*\(/);if(!C||C.index===void 0)break;let j=C.index,L=Mn(v,j+7);if(!L)break;let B=L.endPos,F=ar(v,"unless","endunless",B);if(F===-1){console.warn(`[stx] @unless directive at position ${j} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=v.slice(B,F),Z=L.expression,Y=-1;{let se=0,oe=/@(?:if|unless)\s*\(/g,ie=/@(?:endif|endunless)(?![a-z])/g,ce=/@else(?![a-z])/g,ae=[],pe;while((pe=oe.exec(U))!==null)ae.push({pos:pe.index,type:"open"});while((pe=ie.exec(U))!==null)ae.push({pos:pe.index,type:"close"});while((pe=ce.exec(U))!==null)ae.push({pos:pe.index,type:"else"});ae.sort((me,he)=>me.pos-he.pos);for(let me of ae)if(me.type==="open")se++;else if(me.type==="close")se--;else if(me.type==="else"&&se===0){Y=me.pos;break}}let Q;if(Y!==-1){let se=U.slice(0,Y),oe=U.slice(Y+5);Q=`@if (${Z})${oe}@else ${se}@endif`}else Q=`@if (!(${Z}))${U}@endif`;v=v.substring(0,j)+Q+v.substring(F+10),E=!0}}v=aa(v,o,x),v=ca(v,o,x),v=oa(v,o);let k=()=>{let E=Fr(v);if(E.length===0)return!1;let C=Array(E.length);for(let B=E.length-1;B>=0;B--){let F=E[B];try{let U="",Z=!1;for(let Y of F.branches){if(Z)break;if(Y.type==="else")U=Y.content,Z=!0;else try{let Q;if(Y.condition&&p(Y.condition))Q=l(Y.condition,Object.keys(o))(...Object.values(o));else if(Y.condition)Q=c(Y.condition,o);if(Q)U=Y.content,Z=!0}catch(Q){U=a(Y.type==="if"?"If":"Elseif",`Error in @${Y.type}(${Y.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),Z=!0}}C[B]=U}catch(U){let Z=U instanceof Error?U.message:String(U);C[B]=a("If",`Error processing @if block: ${Z}`,t.EVALUATION_ERROR)}}let j=Array(E.length*2+1),L=0;for(let B=0;B<E.length;B++){let F=E[B];j[B*2]=v.slice(L,F.start),j[B*2+1]=C[B],L=F.end}return j[E.length*2]=v.slice(L),v=j.join(""),!0};while(!0){let E=v;if(!k())break;if(v===E)break}return v}function lu(e){let o=0;while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!=="(")return null;o++;while(o<e.length&&/\s/.test(e[o]))o++;let x=e[o];if(x!=="'"&&x!=='"')return null;o++;let v=[];while(o<e.length){let k=e[o];if(k==="\\"&&o+1<e.length){v.push(e[o+1]),o+=2;continue}if(k===x){o++;break}v.push(k),o++}while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!==")")return null;return o++,{value:v.join(""),consumed:o}}function oa(e,o){let x=e;function v(j,L,B,F){let U=1,Z=F,Y=new RegExp(`@${L}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${B}(?![a-z])`,"g");while(Z<j.length&&U>0){Y.lastIndex=Z,Q.lastIndex=Z;let se=Y.exec(j),oe=Q.exec(j),ie=se?se.index:1/0,ce=oe?oe.index:1/0;if(ie<ce)U++,Z=ie+se[0].length;else if(ce<1/0){if(U--,U===0)return ce;Z=ce+oe[0].length}else break}return-1}function k(j,L,B){let F=0,U=new RegExp(`@${L}(?:\\s*\\(|\\s|$)`,"g"),Z=new RegExp(`@${B}(?![a-z])`,"g"),Y=/@else(?![a-z])/g,Q=[],se;while((se=U.exec(j))!==null)Q.push({pos:se.index,type:"open"});while((se=Z.exec(j))!==null)Q.push({pos:se.index,type:"close"});while((se=Y.exec(j))!==null)Q.push({pos:se.index,type:"else"});Q.sort((oe,ie)=>oe.pos-ie.pos);for(let oe of Q)if(oe.type==="open")F++;else if(oe.type==="close")F--;else if(oe.type==="else"&&F===0)return oe.pos;return-1}{let j=!0;while(j){j=!1;let L=x.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!L||L.index===void 0)break;let B=L.index,F,U,Z=x.slice(B+5),Y=lu(Z);if(Y)F=Y.value,U=B+5+Y.consumed;else U=B+5;let Q=v(x,"auth","endauth",U);if(Q===-1){console.warn(`[stx] @auth directive at position ${B} has no matching @endauth \u2014 the block was skipped.`);break}let se=x.slice(U,Q),oe=k(se,"auth","endauth"),ie;if(!o.auth)ie=!1;else ie=F?Pn(`auth?.check && auth?.user?.[${F}]`,o):Pn("auth?.check",o);let ce;if(oe!==-1){let ae=se.slice(0,oe),pe=se.slice(oe+5);ce=ie?ae:pe}else ce=ie?se:"";x=x.substring(0,B)+ce+x.substring(Q+8),j=!0}}{let j=!0;while(j){j=!1;let L=x.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!L||L.index===void 0)break;let B=L.index,F,U,Z=x.slice(B+6),Y=lu(Z);if(Y)F=Y.value,U=B+6+Y.consumed;else U=B+6;let Q=v(x,"guest","endguest",U);if(Q===-1){console.warn(`[stx] @guest directive at position ${B} has no matching @endguest \u2014 the block was skipped.`);break}let se=x.slice(U,Q),oe=k(se,"guest","endguest"),ie;if(!o.auth)ie=!0;else ie=F?Pn(`!auth?.check || !auth?.user?.[${F}]`,o):Pn("!auth?.check",o);let ce;if(oe!==-1){let ae=se.slice(0,oe),pe=se.slice(oe+5);ce=ie?ae:pe}else ce=ie?se:"";x=x.substring(0,B)+ce+x.substring(Q+9),j=!0}}function E(j,L,B){if(o.userCan&&typeof o.userCan[j]==="boolean")return o.userCan[j];if(o.permissions?.check&&typeof o.permissions.check==="function")try{let F=[j];if(L)F.push(L);if(B){let U=Pn(B,o);F.push(U)}return o.permissions.check(...F)}catch{return!1}return!1}function C(j){let L=j.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!L)return null;return{ability:L[1],type:L[2],id:L[3]?.trim(),paramsEnd:L[0].length}}for(let j of["can","cannot"]){let L=`end${j}`,B=j==="can"?"elsecan":"elsecannot",F=!0;while(F){F=!1;let U=x.match(new RegExp(`@${j}\\s*\\(`));if(!U||U.index===void 0)break;let Z=U.index,Y=x.slice(Z+`@${j}`.length),Q=C(Y);if(!Q)break;let se=Z+`@${j}`.length+Q.paramsEnd,oe=v(x,j,L,se);if(oe===-1){console.warn(`[stx] @${j} directive at position ${Z} has no matching @${L} \u2014 the block was skipped.`);break}let ie=x.slice(se,oe),ce=[],ae=0,pe=new RegExp(`@${j}\\s*\\(`,"g"),me=new RegExp(`@${L}(?![a-z])`,"g"),he=new RegExp(`@${B}\\s*\\(`,"g"),Se=/@else(?![a-z])/g,Ee=[],Ce;while((Ce=pe.exec(ie))!==null)Ee.push({pos:Ce.index,type:"open"});while((Ce=me.exec(ie))!==null)Ee.push({pos:Ce.index,type:"close"});while((Ce=he.exec(ie))!==null)Ee.push({pos:Ce.index,type:"elseDirective"});while((Ce=Se.exec(ie))!==null)Ee.push({pos:Ce.index,type:"else"});Ee.sort((De,Ie)=>De.pos-Ie.pos);for(let De of Ee){if(De.type==="open"){ae++;continue}if(De.type==="close"){ae--;continue}if(ae===0)ce.push(De)}let Re=[],Ae=0;for(let De=0;De<ce.length;De++){let Ie=ce[De];if(Re.push({content:ie.slice(Ae,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Oe=ie.slice(Ie.pos+`@${B}`.length),tt=C(Oe);if(tt){Re[Re.length-1]={content:ie.slice(Ae,Ie.pos)},Ae=Ie.pos+`@${B}`.length+tt.paramsEnd,Re.push({content:"",ability:tt.ability,type:tt.type,id:tt.id}),Re.pop();let ot=ce[De+1],nt=ot?ot.pos:ie.length;Re.push({content:ie.slice(Ae,nt),ability:tt.ability,type:tt.type,id:tt.id}),Ae=nt}}else Ae=Ie.pos+5}if(Ae<ie.length){let De=Re[Re.length-1];if(ce.length>0&&ce[ce.length-1].type==="else")Re.push({content:ie.slice(Ae),isFinalElse:!0});else if(Re.length===0)Re.push({content:ie.slice(Ae)})}let _e=E(Q.ability,Q.type,Q.id),Te=j==="can"?_e:!_e,Me="";if(Te)Me=Re[0]?.content||"";else{let De=!1;for(let Ie=1;Ie<Re.length;Ie++){let Oe=Re[Ie];if(Oe.isFinalElse){Me=Oe.content,De=!0;break}if(Oe.ability){let tt=E(Oe.ability,Oe.type,Oe.id);if(j==="can"?tt:!tt){Me=Oe.content,De=!0;break}}}if(!De&&Re.length>0){let Ie=Re[Re.length-1];if(Ie.isFinalElse)Me=Ie.content}}x=x.substring(0,Z)+Me+x.substring(oe+`@${L}`.length),F=!0}}return x}function aa(e,o,x){let v=e;function k(E,C,j,L,B){let F=!0;while(F){F=!1;let U=new RegExp(`@${C}\\s*\\(`),Z=E.match(U);if(!Z||Z.index===void 0)break;let Y=Z.index,Q=Mn(E,Y+`@${C}`.length);if(!Q)break;let se=Q.endPos,oe=ar(E,C,j,se);if(oe===-1){console.warn(`[stx] @${C} directive at position ${Y} has no matching @${j} \u2014 the block was skipped.`);break}let ie=E.slice(se,oe),ce=Q.expression,ae=-1,pe=0,me=0;while(me<ie.length){let he=ie.indexOf("@",me);if(he===-1)break;let Se=ie.substring(he);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Se)){pe++,me=he+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Se)){pe--,me=he+1;continue}if(pe===0&&/^@else(?![a-z])/.test(Se)){ae=he;break}me=he+1}try{let he=L(ce.trim()),Se;if(ae!==-1){let Ee=ie.slice(0,ae),Ce=ie.slice(ae+5);Se=he?Ee:Ce}else Se=he?ie:"";E=E.substring(0,Y)+Se+E.substring(oe+`@${j}`.length),F=!0}catch(he){let Se=he instanceof Error?he.message:String(he),Ee=a(B,`Error processing @${C} directive: ${Se}`,t.EVALUATION_ERROR);E=E.substring(0,Y)+Ee+E.substring(oe+`@${j}`.length);break}}return E}return v=k(v,"isset","endisset",(E)=>{let C=Pn(E,o);return C!==void 0&&C!==null},"Isset"),v=k(v,"empty","endempty",(E)=>{let C=Pn(E,o);return C===void 0||C===null||C===""||C===0||C===!1||Array.isArray(C)&&C.length===0||typeof C==="object"&&C!==null&&Object.keys(C).length===0},"Empty"),v}function ca(e,o,x){let v=e,k="development";function E(C,j,L,B){let F=new RegExp(`@${j}(?![a-z])`,"g"),U=new RegExp(`@${L}(?![a-z])`,"g"),Z=new RegExp(`^@${j}(?![a-z])`),Y=new RegExp(`^@${L}(?![a-z])`),Q=C,se=!0;while(se){se=!1,F.lastIndex=0;let oe=F.exec(Q);if(!oe)break;let ie=oe.index,ce=ie+oe[0].length;if(j==="env"){let _e=Q.substring(ce).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;ce+=_e[0].length,B=k===_e[2]}let ae=1,pe=ce,me=-1;while(ae>0&&pe<Q.length){F.lastIndex=pe,U.lastIndex=pe;let _e=F.exec(Q),Te=U.exec(Q),Me=_e?_e.index:1/0,De=Te?Te.index:1/0;if(Me<De)ae++,pe=Me+_e[0].length;else if(De<1/0){if(ae--,ae===0){me=De;break}pe=De+Te[0].length}else break}if(me===-1){console.warn(`[stx] @${j} directive at position ${ie} has no matching @${L} \u2014 the block was skipped.`);break}let he=Q.substring(ce,me),Se=-1,Ee=0,Ce=0;while(Ce<he.length){let _e=he.indexOf("@",Ce);if(_e===-1)break;let Te=he.substring(_e);if(Z.test(Te)){Ee++,Ce=_e+1;continue}if(Y.test(Te)){Ee--,Ce=_e+1;continue}if(Ee===0&&/^@else(?![a-z])/.test(Te)){Se=_e;break}Ce=_e+1}let Re;if(Se!==-1){let _e=he.slice(0,Se),Te=he.slice(Se+5);Re=B?_e:Te}else Re=B?he:"";let Ae=`@${L}`.length;Q=Q.substring(0,ie)+Re+Q.substring(me+Ae),se=!0}return Q}return v=E(v,"env","endenv",!1),v=E(v,"production","endproduction",k==="production"),v=E(v,"development","enddevelopment",k==="development"),v=E(v,"staging","endstaging",k==="staging"),v=E(v,"testing","endtesting",k==="testing"),v}var uu=new WeakMap;function du(e=16){let o=new Uint8Array(e);return crypto.getRandomValues(o),btoa(String.fromCharCode(...o))}function ci(e,o){if(!e)return o?.nonceGenerator?.()??du();let x=uu.get(e);if(!x)x=o?.nonceGenerator?.()??du(),uu.set(e,x);return x}function Vm(e,o){let x=[];for(let[v,k]of Object.entries(e)){if(k===void 0||k===null)continue;if(typeof k==="boolean"){if(k)x.push(v);continue}if(Array.isArray(k)){let E=[...k];if(o&&(v==="script-src"||v==="style-src"))E=E.filter((C)=>!C.startsWith("'nonce-")),E.push(`'nonce-${o}'`);if(E.length>0)x.push(`${v} ${E.join(" ")}`)}}return x.join("; ")}function pu(e,o){return`<meta http-equiv="Content-Security-Policy" content="${Vm(e,o).replace(/&/g,"&").replace(/"/g,""")}">`}function fu(e,o,x){if(!o.enabled||!o.addMetaTag)return e;if(e.includes('http-equiv="Content-Security-Policy"'))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let v=o.useNonce?ci(x,o):void 0,k=pu(o.directives,v);return e.replace(/<head([^>]*)>/,`<head$1>
|
|
2261
|
-
${k}`)}function gu(e,o){let x=e;return x=x.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(v,k)=>{if(k.includes("nonce="))return v;return`<script nonce="${o}"${k}>`}),x=x.replace(/<style([^>]*)>/gi,(v,k)=>{if(k.includes("nonce="))return v;return`<style nonce="${o}"${k}>`}),x}function mu(e,o,x,v){let k=e,E=v.csp;if(k=k.replace(/@csp\b/g,()=>{if(!E?.enabled||!E.directives)return"<!-- CSP not configured -->";let C=E.useNonce?ci(o,E):void 0;return pu(E.directives,C)}),k=k.replace(/@cspNonce\b/g,()=>{if(!E?.enabled||!E.useNonce)return"";return ci(o,E)}),E?.enabled&&E.useNonce)o.cspNonce=ci(o,E);return k}import Um from"crypto";var Hm=40,hu="_token",la=null;function qm(e=Hm){let o=Um.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e);return la=o,o}function Xm(){if(!la)qm();return la}function Km(e=hu){let o=Xm();return`<input type="hidden" name="${e}" value="${o}">`}function yu(e){return e.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(o,x,v)=>Km(v||hu))}async function xu(e,o,x,v){if(!v.customDirectives||v.customDirectives.length===0)return e;let k=e;for(let E of v.customDirectives){if(!E.name||typeof E.handler!=="function"){if(v.debug)console.warn("Invalid custom directive:",E);continue}if(E.hasEndTag)k=await Zm(k,E,o,x,v);else k=await Jm(k,E,o,x,v)}return k}async function Zm(e,o,x,v,k){let{name:E,handler:C}=o,j=`@${E}`,L=`@end${E}`,B=e,F=Xe(`${j}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${L}`,"g"),U=[],Z=F.exec(B);while(Z!==null){let[Y,Q="",se=""]=Z,oe=Z.index||0;try{let ie=Q?bu(o,Q):[],ce=se.trim(),ae=await C(ce,ie,x,v);U.push({original:Y,processed:ae,startIndex:oe})}catch(ie){let ce=ie instanceof Error?ie.message:String(ie);if(k.debug)console.error(`Error processing custom directive @${E}:`,ie);U.push({original:Y,processed:a("CustomDirective",`Error in @${E}${Q?`(${Q})`:""}: ${ce}`,t.EVALUATION_ERROR),startIndex:oe})}Z=F.exec(B)}for(let Y=U.length-1;Y>=0;Y--){let{original:Q,processed:se}=U[Y];B=B.replace(Q,se)}return B}async function Jm(e,o,x,v,k){let{name:E,handler:C}=o,j=e,L=[],B=[];if(o.rawParams){for(let Z of Ts(j,Xe(`(?<![\\w$@])@${E}\\s*\\(`,"g")))if(Z.end!==-1)B.push({fullMatch:Z.call,paramString:Z.args,startIndex:Z.start})}else{let Z=Xe(`@${E}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Z.lastIndex=0;let Y=Z.exec(j);while(Y!==null)B.push({fullMatch:Y[0],paramString:Y[1]??"",startIndex:Y.index||0}),Y=Z.exec(j)}for(let{fullMatch:Z,paramString:Y,startIndex:Q}of B)try{let se=bu(o,Y),oe=await C("",se,x,v);L.push({original:Z,processed:oe,startIndex:Q})}catch(se){let oe=se instanceof Error?se.message:String(se);if(k.debug)console.error(`Error processing custom directive @${E}:`,se);L.push({original:Z,processed:a("CustomDirective",`Error in @${E}(${Y}): ${oe}`,t.EVALUATION_ERROR),startIndex:Q})}let F=Xe(`@${E}(?!\\w)(?!\\s*\\()`,"g"),U=F.exec(j);while(U!==null){let[Z]=U,Y=U.index||0;try{let Q=await C("",[],x,v);L.push({original:Z,processed:Q,startIndex:Y})}catch(Q){let se=Q instanceof Error?Q.message:String(Q);if(k.debug)console.error(`Error processing custom directive @${E}:`,Q);L.push({original:Z,processed:a("CustomDirective",`Error in @${E}: ${se}`,t.EVALUATION_ERROR),startIndex:Y})}U=F.exec(j)}for(let Z=L.length-1;Z>=0;Z--){let{original:Y,processed:Q}=L[Z];j=j.replace(Y,Q)}return j}function bu(e,o){return e.rawParams?Je(o):Gm(o)}function Gm(e){if(!e.trim())return[];let o=[],x="",v=!1,k="";for(let E=0;E<e.length;E++){let C=e[E];if((C==='"'||C==="'")&&(E===0||e[E-1]!=="\\"))if(!v)v=!0,k=C;else if(C===k)v=!1;else x+=C;else if(C===","&&!v)o.push(x.trim()),x="";else x+=C}if(x.trim())o.push(x.trim());return o.map((E)=>{let C=E.trim();if(C.startsWith('"')&&C.endsWith('"')||C.startsWith("'")&&C.endsWith("'"))return C.substring(1,C.length-1);return C})}var vu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,wu=/^[A-Za-z_$][\w$]*$/,Ym=new Set(["light","dark","system"]);function cr(e,o){if(typeof e!=="string"||e.length===0)throw Error(`@appearanceBootstrap ${o} must be a non-empty string`)}function Qm(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("@appearanceBootstrap expects an options object");let o=e,{appearance:x,colorMode:v}=o;if(cr(o.storageKey,"storageKey"),x!==void 0&&(!x||typeof x!=="object"||Array.isArray(x)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap colorMode must be an object");if(cr(v.key,"colorMode.key"),cr(v.attribute,"colorMode.attribute"),cr(v.default,"colorMode.default"),!wu.test(v.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vu.test(v.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Ym.has(v.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let k=null;if(x){if(cr(x.key,"appearance.key"),cr(x.attribute,"appearance.attribute"),cr(x.default,"appearance.default"),!wu.test(x.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vu.test(x.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(x.allowed)||x.allowed.length===0||x.allowed.some((E)=>typeof E!=="string"||E.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!x.allowed.includes(x.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");k={key:x.key,attribute:x.attribute,allowed:[...new Set(x.allowed)],default:x.default}}return{storageKey:o.storageKey,appearance:k,colorMode:{key:v.key,attribute:v.attribute,default:v.default},respectExisting:o.respectExisting===!0}}function eh(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function th(e){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${eh(e)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function nh(e,o){let x=1,v=null,k=!1;for(let E=o+1;E<e.length;E++){let C=e[E];if(k){k=!1;continue}if(v){if(C==="\\")k=!0;else if(C===v)v=null;continue}if(C==='"'||C==="'"||C==="`"){v=C;continue}if(C==="(")x++;else if(C===")"&&--x===0)return E}return-1}function $u(e,o){let x=e,v=/@appearanceBootstrap\s*\(/g,k;while((k=v.exec(x))!==null){let E=k.index+k[0].length-1,C=nh(x,E);if(C===-1)throw Error("@appearanceBootstrap has an unclosed options object");let j=x.slice(E+1,C).trim(),L=c(`(${j})`,o),B=th(Qm(L));x=x.slice(0,k.index)+B+x.slice(C+1),v.lastIndex=k.index+B.length}return x}import rh from"crypto";function Ft(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Eu={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function li(e,o,x,v){let k=e||o;return x?`${k} ${v}`:k}function pn(e){return String(e).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function vr(e,o){if(/\bid\s*=/i.test(e))return"";return` id="${Ft(o)}"`}function ua(e,o,x){if(!o)return"";let v="";if(!/\baria-invalid\s*=/i.test(x))v+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(x))v+=` aria-describedby="${Ft(`${pn(e)}-error`)}"`;return v}function sh(){return rh.randomUUID()}function ui(e,o){let x=e;return x=x.replace(/@csrf/g,()=>{if(!o.csrf||typeof o.csrf!=="object"){let v=sh();o.csrf={token:v}}if(o.csrf.field)return o.csrf.field;if(o.csrf.token)return`<input type="hidden" name="_token" value="${Ft(o.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),x=x.replace(/@method\(['"]([^'"]+)['"]\)/g,(v,k)=>{let E=k.toUpperCase();if(k&&!["GET","POST"].includes(E))return`<input type="hidden" name="_method" value="${Ft(E)}">`;return v}),x}function ku(e,o,x=Eu){let v=e;return v=v.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(k,E,C,j,L,B="")=>{let F=E||C||"POST",U=j||L||"",Z=On(B),Y=F.toUpperCase(),Q=["GET","POST"].includes(Y)?Y:"POST",se=`<form method="${Ft(Q)}" action="${Ft(U)}"${Z?` ${Z}`:""}>`;if(se+=`
|
|
2260
|
+
</script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Rt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Wl,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:iu,hasEndTag:!1,description:"Include a web component in the template"},uo,po,tr,nr,Rl,Tl,Il,Al,Ll,Cl,Jl,ta,...pr],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 Em(e,o,x){let v=o||"pages";if(e)return{root:e,pagesDir:v};let k=x||process.cwd(),E=Yt.join(k,"resources","views"),C=Yt.join(k,"resources","layouts");if(si.existsSync(E)&&si.existsSync(C))return{root:"resources",pagesDir:"views"};let j=Yt.join(k,"resources","views","pages");if(si.existsSync(j))return{root:"resources/views",pagesDir:v};return{root:".",pagesDir:v}}var ou=new Set,ii=["partialsDir","componentsDir","layoutsDir"],na=new WeakMap;function km(e,o){let x=o.replace(/[\\/]+$/,"");if(!x||x===".")return!0;let v=e.replace(/\\/g,"/"),k=x.replace(/\\/g,"/");return v===k||v.startsWith(`${k}/`)}function kc(e,o){let x=!e.root,v=Em(e.root,e.pagesDir,o);if(e.root=v.root,e.pagesDir=v.pagesDir,x&&v.root!=="."){let k=`${o}::${v.root}`;if(!ou.has(k))ou.add(k),console.warn(`[stx] No "root" in config \u2014 inferred "${v.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!na.has(e)){let k={};for(let E of ii){let C=e[E];if(typeof C==="string"&&C)k[E]=C}na.set(e,k)}if(e.root&&e.root!=="."){let k=e.root;for(let E of ii){let C=e[E];if(typeof C!=="string"||!C)continue;if(Yt.isAbsolute(C)||km(C,k))continue;e[E]=Yt.join(k,C)}}for(let k of ii){let E=e[k];if(typeof E!=="string"||!E||Yt.isAbsolute(E))continue;e[k]=Yt.resolve(o,E)}return e}function Cm(e,o){let x=na.get(e);for(let v of ii){let k=e[v];if(typeof k!=="string"||!k)continue;let E=Yt.isAbsolute(k)?k:Yt.join(o,k);if(si.existsSync(E))continue;let C=x?.[v]??k,j=e.root,L=!!j&&j!==".";console.warn(`[stx] ${String(v)} resolves to "${E}", which does not exist. Configured as "${C}"`+(L?`, resolved under root "${j}".`:"."))}}function Rm(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Am(e){if(So(e.stateDir),e.stateDir=dn(),e.cachePath=pn(e.cachePath),e.build)e.build.cacheDir=pn(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=pn(e.media.cache.directory);if(e.story)e.story.outDir=pn(e.story.outDir)}var Dn=null,sr=new Map,ri=new Map,Wr=null;async function i(e){let o=e?Yt.resolve(e):process.cwd(),x=ri.get(o);if(x&&x.signature!==Jn(x.graph)){let E=sr.get(o);if(sr.delete(o),ri.delete(o),!e)Dn=null,Wr=null;let{clearComponentCache:C}=await import("./chunk-nvh31cxn.js"),{partialsCache:j}=await import("./chunk-peyt18ce.js");if(C(),j.clear(),E&&x.configSignature===Yn(x.graph)){let L=E.then(async(B)=>{let F={...x.graph};await xs(F,o),ri.set(o,{graph:F,signature:Jn(F),configSignature:Yn(F)});let U={...B,_layerGraph:F};if(!e)Dn=U;return U});return sr.set(o,L),L}}if(!e){if(Dn)return Dn;if(Wr)return Wr}let v=sr.get(o);if(v)return v;let k=(async()=>{let C=(await _m({name:"stx",alias:"ui",cwd:o,defaultConfig:A,verbose:!1})).config;if(C.extends!==void 0||x){let F=await mo(o,A);C=F.config,ri.set(o,{graph:F.graph,signature:Jn(F.graph),configSignature:Yn(F.graph)})}if(C.runtimeConfig){let{resolveRuntimeConfig:F}=await import("./chunk-02k2v1mb.js");F(C.runtimeConfig,{});let{generateRuntimeConfigTypes:U}=await import("./chunk-mvwt1c8f.js");await U(o,C.runtimeConfig)}Rm(C),Am(C),kc(C,o),Cm(C,o);let j=[],L=new Set((C.plugins??[]).map((F)=>typeof F==="string"?F:F[0]));for(let F of C.componentPackages??["@stacksjs/components"]){let U=`${F}/stx-plugin`;if(L.has(U)||L.has(F))continue;try{u.resolve(U,{paths:[o]}),j.push(U)}catch{}}let B=[...C.plugins??[],...j];if(B.length>0){let{pluginManager:F}=await import("./chunk-rh1dyfsn.js"),U=[],Z=[];for(let Y of B){let Q=typeof Y==="string"?Y:Y[0],se=typeof Y==="string"?{}:Y[1]||{};try{let oe,ie;try{let ae=u.resolve(Q,{paths:[o]});oe=await import(ae),ie=Yt.dirname(ae)}catch{let ae=Yt.resolve(o,Q);oe=await import(ae),ie=Yt.dirname(ae)}let ce=oe.default||oe;if(!F.has(ce.name))await F.register(ce,C);if(ce.components){let ae=Array.isArray(ce.components)?ce.components:[ce.components];for(let pe of ae)U.push(Yt.resolve(ie,pe))}if(ce.pages){let ae=Yt.resolve(ie,ce.pages),pe=se.path||"/";Z.push({dir:ae,prefix:pe})}if(ce.setup){let ae={addDirective:(pe)=>{C.customDirectives=C.customDirectives||[],C.customDirectives.push(pe)},addRoute:(pe,me)=>{C.apiRoutes=C.apiRoutes||{},C.apiRoutes[pe]=me},addMiddleware:(pe)=>{C.middleware=C.middleware||[],C.middleware.push(pe)},pluginDir:ie,config:C};await ce.setup(se,ae)}console.log(`[stx] Plugin loaded: ${ce.name||Q}`)}catch(oe){console.warn(`[stx] Failed to load plugin ${Q}:`,oe.message)}}C._pluginComponentDirs=U,C._pluginPageDirs=Z}return C})();if(sr.set(o,k),k.catch(()=>{if(sr.get(o)===k)sr.delete(o)}),!e)Wr=k,k.then((E)=>{Dn=E}).catch(()=>{});return k}var T=new Proxy(A,{get(e,o){if(Dn&&o in Dn)return Dn[o];if(!Wr)i().catch((x)=>{console.warn("[stx] Failed to load config file:",x?.message||x)});return e[o]}});function Fu(e){return e}function zu(e){let o=[],x=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")o.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")o.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")o.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")o.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)o.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)o.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let v=["auto","manual","sections"];if(!v.includes(e.streaming.strategy))o.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let v=["json","yaml","yml","js"];if(!v.includes(e.i18n.format))o.push({path:"i18n.format",message:`i18n.format must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)o.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)o.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let v=["AA","AAA"];if(!v.includes(e.a11y.level))o.push({path:"a11y.level",message:`a11y.level must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let v=["progressive","islands"];if(!v.includes(e.hydration.mode))o.push({path:"hydration.mode",message:`hydration.mode must be one of: ${v.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let v=["none","eager","lazy"];if(!v.includes(e.hydration.preload))o.push({path:"hydration.preload",message:`hydration.preload must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))o.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((v,k)=>{if(!v.name||typeof v.name!=="string")o.push({path:`customDirectives[${k}].name`,message:"Custom directive must have a name string",severity:"error"});if(!v.handler||typeof v.handler!=="function")o.push({path:`customDirectives[${k}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))o.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((v,k)=>{if(!v.name||typeof v.name!=="string")o.push({path:`middleware[${k}].name`,message:"Middleware must have a name string",severity:"error"});if(!v.handler||typeof v.handler!=="function")o.push({path:`middleware[${k}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!v.timing||!["before","after"].includes(v.timing))o.push({path:`middleware[${k}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)x.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)x.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)o.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let v=["fullscreen","standalone","minimal-ui","browser"];if(!v.includes(e.pwa.manifest.display))o.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let v=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!v.includes(e.pwa.manifest.orientation))o.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.routes){let v=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((k,E)=>{if(!k.pattern||typeof k.pattern!=="string")o.push({path:`pwa.routes[${E}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!v.includes(k.strategy))o.push({path:`pwa.routes[${E}].strategy`,message:`PWA route strategy must be one of: ${v.join(", ")}`,severity:"error"});if(k.maxAgeSeconds!==void 0&&(typeof k.maxAgeSeconds!=="number"||k.maxAgeSeconds<0))o.push({path:`pwa.routes[${E}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(k.maxEntries!==void 0&&(typeof k.maxEntries!=="number"||k.maxEntries<1))o.push({path:`pwa.routes[${E}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))o.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((k)=>typeof k!=="number"||k<16||k>1024).length>0)o.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let v=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((E)=>!v.includes(E)).length>0)o.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)x.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)x.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:o.length===0,errors:o,warnings:x}}var sa=new Map;async function ue(e,o={}){try{if(!await n(e))throw Error(`Markdown file not found: ${e}`);let v=(await Tm.promises.stat(e)).mtime.getTime();if(o.cache&&sa.has(e)){let U=sa.get(e);if(U.updatedAt>=v)return{content:U.content,data:U.data}}let k=await Bun.file(e).text(),{data:E,content:C}=Ln(k),j=o.markdown||T.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},B=Ne(C,{gfm:!0});if(j.syntaxHighlighting?.enabled&&j.syntaxHighlighting?.serverSide)B=await Dm(B,j.syntaxHighlighting?.defaultTheme||"github-dark",j.syntaxHighlighting?.highlightUnknownLanguages||!1);let F={content:B,data:E||{}};if(o.cache)sa.set(e,{...F,updatedAt:v});return F}catch(x){if(o.debug)console.error(`Error reading/parsing markdown file ${e}:`,x);let v=x instanceof Error?x.message:String(x);return{content:g("Markdown File",`Error reading/parsing markdown file: ${v}`,e,"",0,""),data:{}}}}var oi=null;async function Dm(e,o,x){let v=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oi)try{oi=await Im({theme:o||"github-dark",cache:!0})}catch(j){return console.error("Failed to initialize ts-syntax-highlighter:",j),e}let k=async(j,L,B,F)=>{let U=F.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),Z=B||(x?"text":"");if(!Z)return j;try{if(!oi.getSupportedLanguages().includes(Z))return j;return(await oi.highlight(U,Z,{theme:o})).html}catch(Y){console.error(`Error highlighting code block with language ${B}:`,Y)}return j},E=e,C=e.matchAll(v);for(let j of C){let[L,B,F,U]=j,Z=await k(L,B,F,U);E=E.replace(L,Z)}return E}async function au(e,o,x="",v={}){return await Pm(e,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(C,j,L,B)=>{try{let F=j;if(!ra.isAbsolute(j))F=ra.resolve(ra.dirname(x),j);let U={};if(L)try{try{U=JSON.parse(L)}catch{if(v.debug)console.warn("Using safer alternative for parsing JS object literal");let ce=L.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ae of ce){let pe=ae.indexOf(":");if(pe>0){let me=ae.substring(0,pe).trim(),he=ae.substring(pe+1).trim(),Se=he.startsWith('"')&&he.endsWith('"'),Ee=he.startsWith("'")&&he.endsWith("'");if(Se||Ee)he=he.substring(1,he.length-1);U[me]=he}}}}catch(ie){if(v.debug)console.error("Error parsing context in @markdown-file directive:",ie)}let{content:Z,data:Y}=await ue(F,v),Q={...o,...Y,...U},se=Z,oe=/\{\{([^}]+)\}\}/g;return se=se.replace(oe,(ie,ce)=>{let ae=ce.trim();return Q[ae]!==void 0?String(Q[ae]):ie}),se}catch(F){let U=F instanceof Error?F.message:String(F);return g("Markdown File",`Error including markdown file: ${U}`,x,e,B,C)}})}async function Pm(e,o,x){let v=[],k;while((k=o.exec(e))!==null){let j=k[0],L=k.index,B=k;v.push(x(...B).then((F)=>({match:j,replacement:F,index:L})))}let E=await Promise.all(v);E.sort((j,L)=>L.index-j.index);let C=e;for(let{match:j,replacement:L}of E)C=C.replace(j,()=>L);return C}function Pn(e,o){try{let x=e.trim();if(p(x))return l(x,Object.keys(o))(...Object.values(o));else return c(x,o)}catch{return!1}}function Mn(e,o){let x=Mm(e,o);return x.ok?{expression:x.expression,endPos:x.endPos}:null}function Mm(e,o){let x=o;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!=="(")return{ok:!1,reason:"missing-open-paren",pos:x};let v=w(e,"(",")",x);if(v===-1)return{ok:!1,reason:"unclosed-paren",pos:x};return{ok:!0,expression:e.slice(x+1,v),endPos:v+1}}function Om(e,o){let x=e.lastIndexOf("<",o);if(x===-1)return!1;return x>e.lastIndexOf(">",o)}function cr(e,o,x,v){let k=1,E=v,C=new RegExp(`@${o}\\s*\\(`,"g"),j=new RegExp(`@${x}(?![a-z])`,"g");while(E<e.length&&k>0){C.lastIndex=E,j.lastIndex=E;let L=C.exec(e),B=j.exec(e),F=L?L.index:1/0,U=B?B.index:1/0;if(F<U)k++,E=F+L[0].length;else if(U<1/0){if(k--,k===0)return U;E=U+B[0].length}else break}return-1}function cu(e,o){let x=e.slice(o).match(/^@if\s*/);if(!x)return null;let v=o+x[0].length,k=Mn(e,v);if(!k)return null;let E=k.endPos,C=cr(e,"if","endif",E);if(C===-1)return null;let j=e.slice(E,C),L=[],B=0,F="if",U=k.expression,Z=0,Y=0;while(B<j.length){let Q=j.indexOf("@",B);if(Q===-1)break;B=Q;let se=j.substring(Q);if(Om(j,Q)){B++;continue}if(/^@if\s*\(/.test(se)){Y++,B++;continue}if(/^@endif(?![a-z])/.test(se)){Y--,B+=6;continue}if(Y===0){let oe=se.match(/^@elseif\s*/);if(oe){L.push({type:F,condition:U,content:j.substring(Z,B),start:E+Z,end:E+B});let ie=B+oe[0].length,ce=Mn(j,ie);if(!ce){B++;continue}F="elseif",U=ce.expression,B=ce.endPos,Z=B;continue}else if(/^@else(?![a-z])/.test(se)){L.push({type:F,condition:U,content:j.substring(Z,B),start:E+Z,end:E+B}),F="else",U=void 0,B+=5,Z=B;continue}}B++}return L.push({type:F,condition:U,content:j.slice(Z),start:E+Z,end:E+j.length}),{fullMatch:e.slice(o,C+6),branches:L,start:o,end:C+6}}function Fr(e){let o=[],x=/@if\s*\(/g,v=x.exec(e);while(v!==null){if(o.some((C)=>v.index>C.start&&v.index<C.end)){v=x.exec(e);continue}let E=cu(e,v.index);if(E)o.push(E),x.lastIndex=E.end;v=x.exec(e)}return o}function ai(e,o,x){let v=[],k=new RegExp(`@${o}\\s*\\(`,"g"),E=k.exec(e);while(E!==null){if(v.some((se)=>E.index>se.start&&E.index<se.end)){E=k.exec(e);continue}let j=E.index,L=j+E[0].length-1,B=w(e,"(",")",L);if(B===-1){E=k.exec(e);continue}let F=e.slice(L+1,B),U=B+1,Z=cr(e,o,x,U);if(Z===-1){E=k.exec(e);continue}let Y=e.slice(U,Z),Q=Z+`@${x}`.length;v.push({fullMatch:e.slice(j,Q),name:o,params:F,content:Y,start:j,end:Q}),k.lastIndex=Q,E=k.exec(e)}return v}function ia(e,o){let x=e.slice(o).match(/^@switch\s*/);if(!x)return null;let v=o+x[0].length,k=Mn(e,v);if(!k)return null;let E=k.endPos,C=cr(e,"switch","endswitch",E);if(C===-1)return null;let j=e.slice(E,C),L=[],B=0,F=null,U=0;while(B<j.length){let Z=j.slice(B),Y=Z.match(/^@switch\s*\(/),Q=Z.match(/^@endswitch(?![a-z])/);if(Y){if(U++,F)F.content+=Y[0];B+=Y[0].length;continue}if(Q){if(U--,F)F.content+=Q[0];B+=Q[0].length;continue}if(U>0){if(F)F.content+=j[B];B++;continue}let se=Z.match(/^@case\s*/),oe=Z.match(/^@default(?![a-z])/),ie=Z.match(/^@break(?![a-z])/);if(se&&Z.startsWith("@case")){if(F)L.push(F);let ce=B+se[0].length,ae=Mn(j,ce);if(!ae){B++;continue}F={type:"case",value:ae.expression,content:""},B=ae.endPos}else if(oe&&Z.startsWith("@default")){if(F)L.push(F);F={type:"default",content:""},B+=oe[0].length}else if(ie&&Z.startsWith("@break"))B+=ie[0].length;else{if(F)F.content+=j[B];B++}}if(F)L.push(F);return{fullMatch:e.slice(o,C+10),expression:k.expression,cases:L,start:o,end:C+10}}function Bm(e,o,x){let v=e,k=!0;while(k){k=!1;let E=v.match(/@switch\s*\(/);if(!E||E.index===void 0)break;let C=E.index,j=ia(v,C);if(!j)break;try{let L;if(p(j.expression))L=l(j.expression,Object.keys(o))(...Object.values(o));else L=c(j.expression,o);let B="",F=!1;for(let U of j.cases)if(U.type==="default"){if(!F)B=U.content.trim()}else try{let Z;if(U.value&&p(U.value))Z=l(U.value,Object.keys(o))(...Object.values(o));else if(U.value)Z=c(U.value,o);if(L===Z){B=U.content.trim(),F=!0;break}}catch{continue}v=v.substring(0,C)+B+v.substring(j.end),k=!0}catch(L){let B=L instanceof Error?L.message:String(L),F=a("Switch",`Error evaluating @switch expression: ${B}`,t.EVALUATION_ERROR);v=v.substring(0,C)+F+v.substring(j.end);break}}return v}function zm(e){let o=[];return{masked:e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(v)=>(o.push(v),`\x00stx-script-${o.length-1}\x00`)),scripts:o}}function Wm(e,o){if(o.length===0)return e;return e.replace(/\u0000stx-script-(\d+)\u0000/g,(x,v)=>o[Number(v)]??x)}function Cn(e,o,x){let{masked:v,scripts:k}=zm(e);return Wm(Fm(v,o,x),k)}function Fm(e,o,x){let v=e;v=Bm(v,o,x);{let E=!0;while(E){E=!1;let C=v.match(/@unless\s*\(/);if(!C||C.index===void 0)break;let j=C.index,L=Mn(v,j+7);if(!L)break;let B=L.endPos,F=cr(v,"unless","endunless",B);if(F===-1){console.warn(`[stx] @unless directive at position ${j} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=v.slice(B,F),Z=L.expression,Y=-1;{let se=0,oe=/@(?:if|unless)\s*\(/g,ie=/@(?:endif|endunless)(?![a-z])/g,ce=/@else(?![a-z])/g,ae=[],pe;while((pe=oe.exec(U))!==null)ae.push({pos:pe.index,type:"open"});while((pe=ie.exec(U))!==null)ae.push({pos:pe.index,type:"close"});while((pe=ce.exec(U))!==null)ae.push({pos:pe.index,type:"else"});ae.sort((me,he)=>me.pos-he.pos);for(let me of ae)if(me.type==="open")se++;else if(me.type==="close")se--;else if(me.type==="else"&&se===0){Y=me.pos;break}}let Q;if(Y!==-1){let se=U.slice(0,Y),oe=U.slice(Y+5);Q=`@if (${Z})${oe}@else ${se}@endif`}else Q=`@if (!(${Z}))${U}@endif`;v=v.substring(0,j)+Q+v.substring(F+10),E=!0}}v=aa(v,o,x),v=ca(v,o,x),v=oa(v,o);let k=()=>{let E=Fr(v);if(E.length===0)return!1;let C=Array(E.length);for(let B=E.length-1;B>=0;B--){let F=E[B];try{let U="",Z=!1;for(let Y of F.branches){if(Z)break;if(Y.type==="else")U=Y.content,Z=!0;else try{let Q;if(Y.condition&&p(Y.condition))Q=l(Y.condition,Object.keys(o))(...Object.values(o));else if(Y.condition)Q=c(Y.condition,o);if(Q)U=Y.content,Z=!0}catch(Q){U=a(Y.type==="if"?"If":"Elseif",`Error in @${Y.type}(${Y.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),Z=!0}}C[B]=U}catch(U){let Z=U instanceof Error?U.message:String(U);C[B]=a("If",`Error processing @if block: ${Z}`,t.EVALUATION_ERROR)}}let j=Array(E.length*2+1),L=0;for(let B=0;B<E.length;B++){let F=E[B];j[B*2]=v.slice(L,F.start),j[B*2+1]=C[B],L=F.end}return j[E.length*2]=v.slice(L),v=j.join(""),!0};while(!0){let E=v;if(!k())break;if(v===E)break}return v}function lu(e){let o=0;while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!=="(")return null;o++;while(o<e.length&&/\s/.test(e[o]))o++;let x=e[o];if(x!=="'"&&x!=='"')return null;o++;let v=[];while(o<e.length){let k=e[o];if(k==="\\"&&o+1<e.length){v.push(e[o+1]),o+=2;continue}if(k===x){o++;break}v.push(k),o++}while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!==")")return null;return o++,{value:v.join(""),consumed:o}}function oa(e,o){let x=e;function v(j,L,B,F){let U=1,Z=F,Y=new RegExp(`@${L}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${B}(?![a-z])`,"g");while(Z<j.length&&U>0){Y.lastIndex=Z,Q.lastIndex=Z;let se=Y.exec(j),oe=Q.exec(j),ie=se?se.index:1/0,ce=oe?oe.index:1/0;if(ie<ce)U++,Z=ie+se[0].length;else if(ce<1/0){if(U--,U===0)return ce;Z=ce+oe[0].length}else break}return-1}function k(j,L,B){let F=0,U=new RegExp(`@${L}(?:\\s*\\(|\\s|$)`,"g"),Z=new RegExp(`@${B}(?![a-z])`,"g"),Y=/@else(?![a-z])/g,Q=[],se;while((se=U.exec(j))!==null)Q.push({pos:se.index,type:"open"});while((se=Z.exec(j))!==null)Q.push({pos:se.index,type:"close"});while((se=Y.exec(j))!==null)Q.push({pos:se.index,type:"else"});Q.sort((oe,ie)=>oe.pos-ie.pos);for(let oe of Q)if(oe.type==="open")F++;else if(oe.type==="close")F--;else if(oe.type==="else"&&F===0)return oe.pos;return-1}{let j=!0;while(j){j=!1;let L=x.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!L||L.index===void 0)break;let B=L.index,F,U,Z=x.slice(B+5),Y=lu(Z);if(Y)F=Y.value,U=B+5+Y.consumed;else U=B+5;let Q=v(x,"auth","endauth",U);if(Q===-1){console.warn(`[stx] @auth directive at position ${B} has no matching @endauth \u2014 the block was skipped.`);break}let se=x.slice(U,Q),oe=k(se,"auth","endauth"),ie;if(!o.auth)ie=!1;else ie=F?Pn(`auth?.check && auth?.user?.[${F}]`,o):Pn("auth?.check",o);let ce;if(oe!==-1){let ae=se.slice(0,oe),pe=se.slice(oe+5);ce=ie?ae:pe}else ce=ie?se:"";x=x.substring(0,B)+ce+x.substring(Q+8),j=!0}}{let j=!0;while(j){j=!1;let L=x.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!L||L.index===void 0)break;let B=L.index,F,U,Z=x.slice(B+6),Y=lu(Z);if(Y)F=Y.value,U=B+6+Y.consumed;else U=B+6;let Q=v(x,"guest","endguest",U);if(Q===-1){console.warn(`[stx] @guest directive at position ${B} has no matching @endguest \u2014 the block was skipped.`);break}let se=x.slice(U,Q),oe=k(se,"guest","endguest"),ie;if(!o.auth)ie=!0;else ie=F?Pn(`!auth?.check || !auth?.user?.[${F}]`,o):Pn("!auth?.check",o);let ce;if(oe!==-1){let ae=se.slice(0,oe),pe=se.slice(oe+5);ce=ie?ae:pe}else ce=ie?se:"";x=x.substring(0,B)+ce+x.substring(Q+9),j=!0}}function E(j,L,B){if(o.userCan&&typeof o.userCan[j]==="boolean")return o.userCan[j];if(o.permissions?.check&&typeof o.permissions.check==="function")try{let F=[j];if(L)F.push(L);if(B){let U=Pn(B,o);F.push(U)}return o.permissions.check(...F)}catch{return!1}return!1}function C(j){let L=j.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!L)return null;return{ability:L[1],type:L[2],id:L[3]?.trim(),paramsEnd:L[0].length}}for(let j of["can","cannot"]){let L=`end${j}`,B=j==="can"?"elsecan":"elsecannot",F=!0;while(F){F=!1;let U=x.match(new RegExp(`@${j}\\s*\\(`));if(!U||U.index===void 0)break;let Z=U.index,Y=x.slice(Z+`@${j}`.length),Q=C(Y);if(!Q)break;let se=Z+`@${j}`.length+Q.paramsEnd,oe=v(x,j,L,se);if(oe===-1){console.warn(`[stx] @${j} directive at position ${Z} has no matching @${L} \u2014 the block was skipped.`);break}let ie=x.slice(se,oe),ce=[],ae=0,pe=new RegExp(`@${j}\\s*\\(`,"g"),me=new RegExp(`@${L}(?![a-z])`,"g"),he=new RegExp(`@${B}\\s*\\(`,"g"),Se=/@else(?![a-z])/g,Ee=[],Ce;while((Ce=pe.exec(ie))!==null)Ee.push({pos:Ce.index,type:"open"});while((Ce=me.exec(ie))!==null)Ee.push({pos:Ce.index,type:"close"});while((Ce=he.exec(ie))!==null)Ee.push({pos:Ce.index,type:"elseDirective"});while((Ce=Se.exec(ie))!==null)Ee.push({pos:Ce.index,type:"else"});Ee.sort((De,Ie)=>De.pos-Ie.pos);for(let De of Ee){if(De.type==="open"){ae++;continue}if(De.type==="close"){ae--;continue}if(ae===0)ce.push(De)}let Ae=[],Re=0;for(let De=0;De<ce.length;De++){let Ie=ce[De];if(Ae.push({content:ie.slice(Re,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Oe=ie.slice(Ie.pos+`@${B}`.length),tt=C(Oe);if(tt){Ae[Ae.length-1]={content:ie.slice(Re,Ie.pos)},Re=Ie.pos+`@${B}`.length+tt.paramsEnd,Ae.push({content:"",ability:tt.ability,type:tt.type,id:tt.id}),Ae.pop();let ot=ce[De+1],nt=ot?ot.pos:ie.length;Ae.push({content:ie.slice(Re,nt),ability:tt.ability,type:tt.type,id:tt.id}),Re=nt}}else Re=Ie.pos+5}if(Re<ie.length){let De=Ae[Ae.length-1];if(ce.length>0&&ce[ce.length-1].type==="else")Ae.push({content:ie.slice(Re),isFinalElse:!0});else if(Ae.length===0)Ae.push({content:ie.slice(Re)})}let _e=E(Q.ability,Q.type,Q.id),Te=j==="can"?_e:!_e,Me="";if(Te)Me=Ae[0]?.content||"";else{let De=!1;for(let Ie=1;Ie<Ae.length;Ie++){let Oe=Ae[Ie];if(Oe.isFinalElse){Me=Oe.content,De=!0;break}if(Oe.ability){let tt=E(Oe.ability,Oe.type,Oe.id);if(j==="can"?tt:!tt){Me=Oe.content,De=!0;break}}}if(!De&&Ae.length>0){let Ie=Ae[Ae.length-1];if(Ie.isFinalElse)Me=Ie.content}}x=x.substring(0,Z)+Me+x.substring(oe+`@${L}`.length),F=!0}}return x}function aa(e,o,x){let v=e;function k(E,C,j,L,B){let F=!0;while(F){F=!1;let U=new RegExp(`@${C}\\s*\\(`),Z=E.match(U);if(!Z||Z.index===void 0)break;let Y=Z.index,Q=Mn(E,Y+`@${C}`.length);if(!Q)break;let se=Q.endPos,oe=cr(E,C,j,se);if(oe===-1){console.warn(`[stx] @${C} directive at position ${Y} has no matching @${j} \u2014 the block was skipped.`);break}let ie=E.slice(se,oe),ce=Q.expression,ae=-1,pe=0,me=0;while(me<ie.length){let he=ie.indexOf("@",me);if(he===-1)break;let Se=ie.substring(he);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Se)){pe++,me=he+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Se)){pe--,me=he+1;continue}if(pe===0&&/^@else(?![a-z])/.test(Se)){ae=he;break}me=he+1}try{let he=L(ce.trim()),Se;if(ae!==-1){let Ee=ie.slice(0,ae),Ce=ie.slice(ae+5);Se=he?Ee:Ce}else Se=he?ie:"";E=E.substring(0,Y)+Se+E.substring(oe+`@${j}`.length),F=!0}catch(he){let Se=he instanceof Error?he.message:String(he),Ee=a(B,`Error processing @${C} directive: ${Se}`,t.EVALUATION_ERROR);E=E.substring(0,Y)+Ee+E.substring(oe+`@${j}`.length);break}}return E}return v=k(v,"isset","endisset",(E)=>{let C=Pn(E,o);return C!==void 0&&C!==null},"Isset"),v=k(v,"empty","endempty",(E)=>{let C=Pn(E,o);return C===void 0||C===null||C===""||C===0||C===!1||Array.isArray(C)&&C.length===0||typeof C==="object"&&C!==null&&Object.keys(C).length===0},"Empty"),v}function ca(e,o,x){let v=e,k="development";function E(C,j,L,B){let F=new RegExp(`@${j}(?![a-z])`,"g"),U=new RegExp(`@${L}(?![a-z])`,"g"),Z=new RegExp(`^@${j}(?![a-z])`),Y=new RegExp(`^@${L}(?![a-z])`),Q=C,se=!0;while(se){se=!1,F.lastIndex=0;let oe=F.exec(Q);if(!oe)break;let ie=oe.index,ce=ie+oe[0].length;if(j==="env"){let _e=Q.substring(ce).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;ce+=_e[0].length,B=k===_e[2]}let ae=1,pe=ce,me=-1;while(ae>0&&pe<Q.length){F.lastIndex=pe,U.lastIndex=pe;let _e=F.exec(Q),Te=U.exec(Q),Me=_e?_e.index:1/0,De=Te?Te.index:1/0;if(Me<De)ae++,pe=Me+_e[0].length;else if(De<1/0){if(ae--,ae===0){me=De;break}pe=De+Te[0].length}else break}if(me===-1){console.warn(`[stx] @${j} directive at position ${ie} has no matching @${L} \u2014 the block was skipped.`);break}let he=Q.substring(ce,me),Se=-1,Ee=0,Ce=0;while(Ce<he.length){let _e=he.indexOf("@",Ce);if(_e===-1)break;let Te=he.substring(_e);if(Z.test(Te)){Ee++,Ce=_e+1;continue}if(Y.test(Te)){Ee--,Ce=_e+1;continue}if(Ee===0&&/^@else(?![a-z])/.test(Te)){Se=_e;break}Ce=_e+1}let Ae;if(Se!==-1){let _e=he.slice(0,Se),Te=he.slice(Se+5);Ae=B?_e:Te}else Ae=B?he:"";let Re=`@${L}`.length;Q=Q.substring(0,ie)+Ae+Q.substring(me+Re),se=!0}return Q}return v=E(v,"env","endenv",!1),v=E(v,"production","endproduction",k==="production"),v=E(v,"development","enddevelopment",k==="development"),v=E(v,"staging","endstaging",k==="staging"),v=E(v,"testing","endtesting",k==="testing"),v}var uu=new WeakMap;function du(e=16){let o=new Uint8Array(e);return crypto.getRandomValues(o),btoa(String.fromCharCode(...o))}function ci(e,o){if(!e)return o?.nonceGenerator?.()??du();let x=uu.get(e);if(!x)x=o?.nonceGenerator?.()??du(),uu.set(e,x);return x}function Vm(e,o){let x=[];for(let[v,k]of Object.entries(e)){if(k===void 0||k===null)continue;if(typeof k==="boolean"){if(k)x.push(v);continue}if(Array.isArray(k)){let E=[...k];if(o&&(v==="script-src"||v==="style-src"))E=E.filter((C)=>!C.startsWith("'nonce-")),E.push(`'nonce-${o}'`);if(E.length>0)x.push(`${v} ${E.join(" ")}`)}}return x.join("; ")}function pu(e,o){return`<meta http-equiv="Content-Security-Policy" content="${Vm(e,o).replace(/&/g,"&").replace(/"/g,""")}">`}function fu(e,o,x){if(!o.enabled||!o.addMetaTag)return e;if(e.includes('http-equiv="Content-Security-Policy"'))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let v=o.useNonce?ci(x,o):void 0,k=pu(o.directives,v);return e.replace(/<head([^>]*)>/,`<head$1>
|
|
2261
|
+
${k}`)}function gu(e,o){let x=e;return x=x.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(v,k)=>{if(k.includes("nonce="))return v;return`<script nonce="${o}"${k}>`}),x=x.replace(/<style([^>]*)>/gi,(v,k)=>{if(k.includes("nonce="))return v;return`<style nonce="${o}"${k}>`}),x}function mu(e,o,x,v){let k=e,E=v.csp;if(k=k.replace(/@csp\b/g,()=>{if(!E?.enabled||!E.directives)return"<!-- CSP not configured -->";let C=E.useNonce?ci(o,E):void 0;return pu(E.directives,C)}),k=k.replace(/@cspNonce\b/g,()=>{if(!E?.enabled||!E.useNonce)return"";return ci(o,E)}),E?.enabled&&E.useNonce)o.cspNonce=ci(o,E);return k}import Um from"crypto";var Hm=40,hu="_token",la=null;function qm(e=Hm){let o=Um.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e);return la=o,o}function Xm(){if(!la)qm();return la}function Km(e=hu){let o=Xm();return`<input type="hidden" name="${e}" value="${o}">`}function yu(e){return e.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(o,x,v)=>Km(v||hu))}async function xu(e,o,x,v){if(!v.customDirectives||v.customDirectives.length===0)return e;let k=e;for(let E of v.customDirectives){if(!E.name||typeof E.handler!=="function"){if(v.debug)console.warn("Invalid custom directive:",E);continue}if(E.hasEndTag)k=await Zm(k,E,o,x,v);else k=await Jm(k,E,o,x,v)}return k}async function Zm(e,o,x,v,k){let{name:E,handler:C}=o,j=`@${E}`,L=`@end${E}`,B=e,F=Xe(`${j}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${L}`,"g"),U=[],Z=F.exec(B);while(Z!==null){let[Y,Q="",se=""]=Z,oe=Z.index||0;try{let ie=Q?bu(o,Q):[],ce=se.trim(),ae=await C(ce,ie,x,v);U.push({original:Y,processed:ae,startIndex:oe})}catch(ie){let ce=ie instanceof Error?ie.message:String(ie);if(k.debug)console.error(`Error processing custom directive @${E}:`,ie);U.push({original:Y,processed:a("CustomDirective",`Error in @${E}${Q?`(${Q})`:""}: ${ce}`,t.EVALUATION_ERROR),startIndex:oe})}Z=F.exec(B)}for(let Y=U.length-1;Y>=0;Y--){let{original:Q,processed:se}=U[Y];B=B.replace(Q,se)}return B}async function Jm(e,o,x,v,k){let{name:E,handler:C}=o,j=e,L=[],B=[];if(o.rawParams){for(let Z of _s(j,Xe(`(?<![\\w$@])@${E}\\s*\\(`,"g")))if(Z.end!==-1)B.push({fullMatch:Z.call,paramString:Z.args,startIndex:Z.start})}else{let Z=Xe(`@${E}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Z.lastIndex=0;let Y=Z.exec(j);while(Y!==null)B.push({fullMatch:Y[0],paramString:Y[1]??"",startIndex:Y.index||0}),Y=Z.exec(j)}for(let{fullMatch:Z,paramString:Y,startIndex:Q}of B)try{let se=bu(o,Y),oe=await C("",se,x,v);L.push({original:Z,processed:oe,startIndex:Q})}catch(se){let oe=se instanceof Error?se.message:String(se);if(k.debug)console.error(`Error processing custom directive @${E}:`,se);L.push({original:Z,processed:a("CustomDirective",`Error in @${E}(${Y}): ${oe}`,t.EVALUATION_ERROR),startIndex:Q})}let F=Xe(`@${E}(?!\\w)(?!\\s*\\()`,"g"),U=F.exec(j);while(U!==null){let[Z]=U,Y=U.index||0;try{let Q=await C("",[],x,v);L.push({original:Z,processed:Q,startIndex:Y})}catch(Q){let se=Q instanceof Error?Q.message:String(Q);if(k.debug)console.error(`Error processing custom directive @${E}:`,Q);L.push({original:Z,processed:a("CustomDirective",`Error in @${E}: ${se}`,t.EVALUATION_ERROR),startIndex:Y})}U=F.exec(j)}for(let Z=L.length-1;Z>=0;Z--){let{original:Y,processed:Q}=L[Z];j=j.replace(Y,Q)}return j}function bu(e,o){return e.rawParams?Je(o):Gm(o)}function Gm(e){if(!e.trim())return[];let o=[],x="",v=!1,k="";for(let E=0;E<e.length;E++){let C=e[E];if((C==='"'||C==="'")&&(E===0||e[E-1]!=="\\"))if(!v)v=!0,k=C;else if(C===k)v=!1;else x+=C;else if(C===","&&!v)o.push(x.trim()),x="";else x+=C}if(x.trim())o.push(x.trim());return o.map((E)=>{let C=E.trim();if(C.startsWith('"')&&C.endsWith('"')||C.startsWith("'")&&C.endsWith("'"))return C.substring(1,C.length-1);return C})}var vu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,wu=/^[A-Za-z_$][\w$]*$/,Ym=new Set(["light","dark","system"]);function lr(e,o){if(typeof e!=="string"||e.length===0)throw Error(`@appearanceBootstrap ${o} must be a non-empty string`)}function Qm(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("@appearanceBootstrap expects an options object");let o=e,{appearance:x,colorMode:v}=o;if(lr(o.storageKey,"storageKey"),x!==void 0&&(!x||typeof x!=="object"||Array.isArray(x)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap colorMode must be an object");if(lr(v.key,"colorMode.key"),lr(v.attribute,"colorMode.attribute"),lr(v.default,"colorMode.default"),!wu.test(v.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vu.test(v.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Ym.has(v.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let k=null;if(x){if(lr(x.key,"appearance.key"),lr(x.attribute,"appearance.attribute"),lr(x.default,"appearance.default"),!wu.test(x.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vu.test(x.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(x.allowed)||x.allowed.length===0||x.allowed.some((E)=>typeof E!=="string"||E.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!x.allowed.includes(x.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");k={key:x.key,attribute:x.attribute,allowed:[...new Set(x.allowed)],default:x.default}}return{storageKey:o.storageKey,appearance:k,colorMode:{key:v.key,attribute:v.attribute,default:v.default},respectExisting:o.respectExisting===!0}}function eh(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function th(e){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${eh(e)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function nh(e,o){let x=1,v=null,k=!1;for(let E=o+1;E<e.length;E++){let C=e[E];if(k){k=!1;continue}if(v){if(C==="\\")k=!0;else if(C===v)v=null;continue}if(C==='"'||C==="'"||C==="`"){v=C;continue}if(C==="(")x++;else if(C===")"&&--x===0)return E}return-1}function $u(e,o){let x=e,v=/@appearanceBootstrap\s*\(/g,k;while((k=v.exec(x))!==null){let E=k.index+k[0].length-1,C=nh(x,E);if(C===-1)throw Error("@appearanceBootstrap has an unclosed options object");let j=x.slice(E+1,C).trim(),L=c(`(${j})`,o),B=th(Qm(L));x=x.slice(0,k.index)+B+x.slice(C+1),v.lastIndex=k.index+B.length}return x}import rh from"crypto";function Ft(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Eu={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function li(e,o,x,v){let k=e||o;return x?`${k} ${v}`:k}function un(e){return String(e).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function wr(e,o){if(/\bid\s*=/i.test(e))return"";return` id="${Ft(o)}"`}function ua(e,o,x){if(!o)return"";let v="";if(!/\baria-invalid\s*=/i.test(x))v+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(x))v+=` aria-describedby="${Ft(`${un(e)}-error`)}"`;return v}function sh(){return rh.randomUUID()}function ui(e,o){let x=e;return x=x.replace(/@csrf/g,()=>{if(!o.csrf||typeof o.csrf!=="object"){let v=sh();o.csrf={token:v}}if(o.csrf.field)return o.csrf.field;if(o.csrf.token)return`<input type="hidden" name="_token" value="${Ft(o.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),x=x.replace(/@method\(['"]([^'"]+)['"]\)/g,(v,k)=>{let E=k.toUpperCase();if(k&&!["GET","POST"].includes(E))return`<input type="hidden" name="_method" value="${Ft(E)}">`;return v}),x}function ku(e,o,x=Eu){let v=e;return v=v.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(k,E,C,j,L,B="")=>{let F=E||C||"POST",U=j||L||"",Z=On(B),Y=F.toUpperCase(),Q=["GET","POST"].includes(Y)?Y:"POST",se=`<form method="${Ft(Q)}" action="${Ft(U)}"${Z?` ${Z}`:""}>`;if(se+=`
|
|
2262
2262
|
${ui("@csrf",o)}`,!["GET","POST"].includes(Y))se+=`
|
|
2263
|
-
${ui(`@method('${Y}')`,o)}`;return se}),v=v.replace(/@endform/g,"</form>"),v=v.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(k,E,C,j,L,B="")=>{let F=E||C||"",U=j||L||"",Z=On(B),Y=Vr(F,o),Q=Y!==void 0&&Y!==null?Y:U||"",se=Z.match(/type=['"]([^'"]+)['"]/i),oe=se?se[1]:"text",ie=Ur(F,o),ce=Z.match(/class=['"]([^'"]+)['"]/i),ae=li(ce?ce[1]:"",x.input,ie,x.inputError),pe=Z.replace(/class=['"][^'"]+['"]/i,"");return pe=pe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Ft(oe)}" name="${Ft(F)}"${vr(Z,pn(F))} value="${Ft(Q)}" class="${ae}"${ua(F,ie,Z)}${pe?` ${pe}`:""}>`}),v=v.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(k,E,C="",j="")=>{let L=On(C),B=Vr(E,o)||j.trim(),F=Ur(E,o),U=L.match(/class=['"]([^'"]+)['"]/i),Z=li(U?U[1]:"",x.input,F,x.inputError),Y=L.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Ft(E)}"${vr(L,pn(E))} class="${Z}"${ua(E,F,L)}${Y?` ${Y}`:""}>${Ft(B)}</textarea>`}),v=v.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(k,E,C="",j)=>{let L=On(C),B=Vr(E,o),F=Ur(E,o),U=L.match(/class=['"]([^'"]+)['"]/i),Z=li(U?U[1]:"",x.input,F,x.inputError),Y=L.replace(/class=['"][^'"]+['"]/i,""),Q=j;if(B!==void 0)Q=j.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,oe,ie)=>{if((Array.isArray(B)?B.some((ae)=>String(ae)===ie):String(B)===ie)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return se});return`<select name="${Ft(E)}"${vr(L,pn(E))} class="${Z}"${ua(E,F,L)}${Y?` ${Y}`:""}>${Q}</select>`}),v=v.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(k,E,C,j="")=>{let L=C===void 0?"1":C,B=C===void 0?pn(E):`${pn(E)}-${pn(L)}`,F=On(j),U=Vr(E,o),Z=U!==void 0&&(Array.isArray(U)?U.some((oe)=>String(oe)===L):U===!0||String(U)===L),Y=F.match(/class=['"]([^'"]+)['"]/i),Q=Y?Y[1]:x.checkInput,se=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Ft(E)}"${vr(F,B)} value="${Ft(L)}" class="${Q}"${Z?" checked":""}${se?` ${se}`:""}>`}),v=v.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(k,E,C,j="")=>{let L=On(j),B=Vr(E,o),F=B!==void 0&&B===C,U=L.match(/class=['"]([^'"]+)['"]/i),Z=U?U[1]:x.checkInput,Y=L.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Ft(E)}"${vr(L,`${pn(E)}-${pn(C)}`)} value="${Ft(C)}" class="${Z}"${F?" checked":""}${Y?` ${Y}`:""}>`}),v=v.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(k,E,C="")=>{let j=On(C),L=j.match(/accept=['"]([^'"]+)['"]/i),B=L?L[1]:"",F=j.includes("multiple"),U=Ur(E,o),Z=j.match(/class=['"]([^'"]+)['"]/i),Y=li(Z?Z[1]:"",x.input,U,x.inputError),Q=j.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Ft(E)}"${vr(j,pn(E))}`,`class="${Y}"`];if(B)se.push(`accept="${Ft(B)}"`);if(F)se.push("multiple");if(Q)se.push(Q);return`${se.join(" ")}>`}),v=v.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(k,E,C="",j)=>{let L=On(C),B=L.match(/class=['"]([^'"]+)['"]/i),F=B?B[1]:x.label,U=L.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Ft(pn(E))}" class="${F}"${U?` ${U}`:""}>${j}</label>`}),v}function Cu(e,o,x=Eu){return e.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(v,k,E)=>{try{if(Ur(k,o)){let C=E.replace(/\{\{([^}]+)\}\}/g,(j,L)=>{try{if(L.trim()==="$message"||L.trim()==="message")return Su(k,o);if(L.trim().includes("errors.first")||L.trim().includes("$errors.first")){if(typeof o.errors?.first==="function")return o.errors.first(k);return Su(k,o)}let B=L.trim();if(p(B)){let F=c(B,o);return F!==void 0?String(F):B}return B}catch{return L}});return`<div id="${Ft(`${pn(k)}-error`)}" role="alert">${C}</div>`}return""}catch(C){return console.error("Error processing @error directive:",C),v}})}function Ur(e,o){if(!o.errors)return!1;if(typeof o.errors.has==="function")return o.errors.has(e);if(typeof o.errors==="object")return Object.prototype.hasOwnProperty.call(o.errors,e);return!1}function Su(e,o){if(!o.errors)return"";if(typeof o.errors.get==="function")return o.errors.get(e);if(typeof o.errors==="object"&&Object.prototype.hasOwnProperty.call(o.errors,e)){let x=o.errors[e];return Array.isArray(x)?x[0]:String(x)}return""}function Vr(e,o){let x;if(o.old&&typeof o.old==="function")return o.old(e);if(o.old&&typeof o.old==="object")return o.old[e];if(e.endsWith("[]")){let v=e.slice(0,-2);if(x=o[v],x!==void 0)return x}return o[e]}function On(e){if(!e.trim())return"";let o=[],x=e.trim(),v=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,k;while((k=v.exec(x))!==null){let[,E,,C]=k;o.push(`${E}="${C.trim()}"`)}return o.join(" ")}var Hr=/<\/?template\b[^>]*>/gi,ih=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function oh(e){let o=e.replace(/^<template\b/i,"").replace(/>$/,"");return ih.test(o)}function ee(e){Hr.lastIndex=0;let o;while((o=Hr.exec(e))!==null){if(o[0].startsWith("</")||oh(o[0]))continue;let x=o.index,v=Hr.lastIndex,k=1,E;while((E=Hr.exec(e))!==null)if(E[0].startsWith("</")){if(k--,k===0){let C=E.index;return{start:x,openEnd:v,closeStart:C,end:Hr.lastIndex,content:e.slice(v,C)}}}else k++;return null}return null}import Nt from"path";import{existsSync as ry}from"fs";import di from"fs";import Bt from"path";var zu=new Map;function pi(e,o=!0){let x=zu.get(e);if(o&&x)return x;let v=new Map,k=[Bt.join(e,"src"),Bt.join(e,"dist"),e];function E(C,j){if(j>6)return;let L;try{L=di.readdirSync(C,{withFileTypes:!0})}catch{return}for(let B of L){let F=Bt.join(C,B.name);if(B.isDirectory()){if(B.name==="node_modules"||B.name.startsWith("."))continue;E(F,j+1)}else if(B.isFile()&&B.name.endsWith(".stx")){let U=B.name.slice(0,-4);if(!v.has(U))v.set(U,F);let Z=U.toLowerCase();if(!v.has(Z))v.set(Z,F);let Y=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!v.has(Y))v.set(Y,F)}}}for(let C of k)if(E(C,0),v.size>0)break;if(o)zu.set(e,v);return v}function fi(e,o){if(e.startsWith(".")||e.startsWith("/"))return null;let x=o;while(!0){let v=Bt.join(x,"node_modules",e);try{if(di.statSync(v).isDirectory())return v}catch{}let k=Bt.dirname(x);if(k===x)return null;x=k}}function gi(e,o,x={}){return[Bt.resolve(Bt.dirname(o),`${e}.stx`),Bt.resolve(Bt.dirname(o),e),Bt.resolve(x.componentsDir||"components",`${e}.stx`),Bt.resolve(x.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Wu(e){let o=e.endsWith(".stx")?e.slice(0,-4):e,x=o.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""),v=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[o,x,v]}function da(e,o){let[x,v,k]=Wu(e);for(let E of[x,x.toLowerCase(),v,k]){let C=o?.__importedComponents?.get(E);if(C!==void 0)return C}}function*pa(e,o,x={},v){let k=Wu(e);if(k[0].startsWith("./")||k[0].startsWith("../")){yield Bt.resolve(Bt.dirname(o),`${k[0]}.stx`);return}let E=[...new Set(k.map((L)=>`${L}.stx`))],C=x.projectRoot||process.cwd(),j=[...v?.__originalFilePath?[Bt.join(Bt.dirname(v.__originalFilePath),"components")]:[],...x.componentsDir?[x.componentsDir]:[],Bt.join(Bt.dirname(o),"components"),Bt.resolve(C,"src/components"),Bt.resolve(C,"components"),...import.meta.dir?[Bt.resolve(import.meta.dir,"components")]:[]];for(let L of new Set(j)){for(let B of E)yield Bt.join(L,B);try{for(let B of di.readdirSync(L,{withFileTypes:!0}))if(B.isDirectory())for(let F of E)yield Bt.join(L,B.name,F)}catch{}}}function Vu(e,o,x={},v){let k=da(e,v);if(k!==void 0)return k;for(let E of pa(e,o,x,v))try{if(di.statSync(E,{throwIfNoEntry:!1})?.isFile())return E}catch{}return null}class Uu{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let o of e.aliases)this.builtins.set(o.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,o,x,v){let k=da(e,v);if(k!==void 0)return k;for(let E of pa(e,o,x,v))if(await n(E))return E;return null}}var wr=new Uu;function Ut(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var lr="\x00stx-boolean-attribute";function fa(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}function $r(e,o){let x=[];for(let[v,k]of Object.entries(e.static)){if(o.has(v))continue;let E=e.staticNames?.[v]??v;if(typeof k==="boolean"){if(k)x.push(Ut(E));continue}if(k===lr){x.push(Ut(E));continue}x.push(`${Ut(E)}="${Ut(fa(String(k)))}"`)}return x}function Sr(e,o){let x=[];for(let[v,k]of Object.entries(e.serverDynamic??{})){if(o.has(v))continue;if(k===null||k===void 0||k===!1)continue;let E=e.serverDynamicNames?.[v]??v;if(k===!0){x.push(Ut(E));continue}if(typeof k==="object")continue;x.push(`${Ut(E)}="${Ut(fa(String(k)))}"`)}return x}function _r(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ah(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var ga={name:"StxLink",aliases:["stx-link"],render(e,o,x){let v=ah(e),k=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),E=typeof e.static.activeClass==="string"?e.static.activeClass:"active",C=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",j=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,L=[];if(v.reactive)L.push(`:href="${_r(v.value)}"`);else L.push(`href="${_r(Mr(v.value,"navigable"))}"`);if(k)L.push(`class="${_r(k)}"`);if(L.push("data-stx-link"),L.push(`data-stx-active-class="${_r(E)}"`),L.push(`data-stx-exact-active-class="${_r(C)}"`),j)L.push("data-stx-prefetch");let B=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(B)L.push(`data-stx-active-match="${_r(B)}"`);let F=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return L.push(...$r(e,F)),L.push(...Sr(e,F)),`<a ${L.join(" ")}>${o}</a>`}};import{createHash as nd}from"crypto";import Qt from"fs";import qt from"path";import{decode as mh,generateThumbHash as hh}from"ts-images";import{createImageDeliveryCatalog as Ju}from"ts-images/delivery";import ma from"fs";function mi(e,o,x){let v=Buffer.alloc(x),k=ma.readSync(e,v,0,x,o);return v.subarray(0,k)}function ha(e){if(e.length<25)return!1;let o=(v,k)=>String.fromCharCode(...e.subarray(v,k));if(o(0,4)!=="RIFF"||o(8,12)!=="WEBP")return!1;let x=o(12,16);if(x==="VP8X")return(e[20]&16)!==0;if(x==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function ya(e){let o;try{o=ma.openSync(e,"r");let x=mi(o,0,33);if(x.length>=3&&x[0]===255&&x[1]===216&&x[2]===255)return"none";if(x.length>=26&&x[0]===137&&x.toString("latin1",1,4)==="PNG"){let v=x[25];if(v===4||v===6)return"possible";let k=8;for(let E=0;E<64;E++){let C=mi(o,k,8);if(C.length<8)return"unknown";let j=C.toString("latin1",4,8);if(j==="tRNS")return"possible";if(j==="IDAT"||j==="IEND")return"none";k+=12+C.readUInt32BE(0)}return"unknown"}if(x.length>=25&&x.toString("latin1",0,4)==="RIFF"&&x.toString("latin1",8,12)==="WEBP"){if(ha(x))return"possible";let v=x.toString("latin1",12,16);return v==="VP8 "||v==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(o!==void 0)ma.closeSync(o)}}import ch from"fs";import hi from"os";import{join as Hu}from"path";import{fileURLToPath as qu}from"url";import{Worker as Xu}from"worker_threads";var xi=Symbol("stx.image-worker.unavailable");function lh(e=typeof hi.availableParallelism==="function"?hi.availableParallelism():hi.cpus().length){return Math.max(1,Math.min(2,e-1))}var yi=0,Zu=[];async function uh(){if(yi<lh()){yi++;return}await new Promise((e)=>Zu.push(e)),yi++}function dh(){yi--,Zu.shift()?.()}var ph="@stacksjs/stx/builtins/image-warmup-worker";function fh(e=process.cwd()){let o=import.meta.url.endsWith(".ts")?"ts":"js";try{let x=new URL(`./image-warmup-worker.${o}`,import.meta.url);if(x.protocol==="file:"&&ch.existsSync(qu(x)))return qu(x)}catch{}try{let x=typeof Bun<"u"?Bun.resolveSync(ph,e):void 0;return x&&gh(x)?x:void 0}catch{return}}function gh(e,o=process.env){let x=e.replace(/\\/g,"/");if(x.split("/").some((k)=>/@\d[^/]*@@@\d+$/.test(k)))return!1;return![o.BUN_INSTALL_CACHE_DIR,Hu(o.BUN_INSTALL||Hu(hi.homedir(),".bun"),"install","cache")].filter((k)=>!!k).map((k)=>`${k.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((k)=>x.startsWith(k))}var Ku=!1;function qr(e){if(!Ku)Ku=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return xi}function xa(e){return e instanceof Error?e.message:String(e)}async function ba(e,o){if(typeof Xu!=="function")return qr("node:worker_threads has no Worker in this runtime");let x=fh();if(!x)return qr("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await uh();try{return await new Promise((v,k)=>{let E;try{E=new Xu(x)}catch(B){v(qr(`could not start ${x}: ${xa(B)}`));return}let C=!1,j=!1,L=(B)=>{if(j)return;j=!0,B(),E.terminate()};E.on("message",(B)=>{if(B.type==="ready"){C=!0,E.postMessage({task:e,args:o});return}if(B.type==="result"){L(()=>v(B.value));return}let F=Error(B.error?.message??"image worker failed");if(B.error?.name)F.name=B.error.name;if(B.error?.stack)F.stack=B.error.stack;L(()=>k(F))}),E.on("error",(B)=>{L(()=>C?k(B instanceof Error?B:Error(xa(B)||"image worker crashed")):v(qr(`the worker failed before it was ready: ${xa(B)}`)))}),E.on("exit",(B)=>{L(()=>C?k(Error("image worker exited before it finished")):v(qr(`the worker exited with code ${B} before it was ready`)))})})}finally{dh()}}var yh=new Set([".avif",".jpeg",".jpg",".png",".webp"]),xh=[320,640,960,1280,1920],vi="/_stx/images",bh=`stx:${vi}:alpha-1`,vh=["@stacksjs/ts-webp","@stacksjs/ts-avif"],bi;function wh(e,o){let x=qt.dirname(Bun.resolveSync(e,o));while(x!==qt.dirname(x)){let v=qt.join(x,"package.json");if(Qt.existsSync(v)){let k=JSON.parse(Qt.readFileSync(v,"utf8"));if(k.name===e)return k.version}x=qt.dirname(x)}return}function $h(){if(bi!==void 0)return bi;let e;try{e=qt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return bi=vh.map((o)=>{let x;try{x=e?wh(o,e):void 0}catch{}return`${o.replace("@stacksjs/","")}@${x??"unknown"}`}).join("+"),bi}var Gu=Symbol.for("stx.image-delivery");function fs(){let e=globalThis;return e[Gu]??={catalog:new Map,transparent:new Set},e[Gu]}var Yu=new Set;function Sh(e){return`/${e.split(qt.sep).map(encodeURIComponent).join("/")}`}function _h(e){let o=qt.extname(e),x=e.slice(0,-o.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),v=nd("sha256").update(e).digest("hex").slice(0,8);return`${x||"image"}-${v}`}function Qu(e,o=`stx:${vi}`){let x=(v)=>`${vi}/${v.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:o,async stat(v){let k=qt.join(e,v);try{let E=await Qt.promises.stat(k);return E.size>0?{bytes:E.size,path:k,url:x(v)}:null}catch{return null}},async write(v,k){let E=qt.join(e,v);await Qt.promises.mkdir(qt.dirname(E),{recursive:!0});let C=`${E}.${process.pid}.tmp`;return await Qt.promises.writeFile(C,k),await Qt.promises.rename(C,E),{bytes:k.byteLength,path:E,url:x(v)}},url:x}}async function rd(e,o=e){let x=await Qt.promises.readdir(o,{withFileTypes:!0});x.sort((k,E)=>k.name.localeCompare(E.name));let v=[];for(let k of x){let E=qt.join(o,k.name);if(k.isDirectory()){v.push(...await rd(e,E));continue}if(!k.isFile()||!yh.has(qt.extname(k.name).toLowerCase()))continue;v.push({absolutePath:E,relativePath:qt.relative(e,E)})}return v}function ed(e,o){return e.map((x)=>({key:Sh(x.relativePath),input:x.absolutePath,name:_h(x.relativePath),...Eh(x.absolutePath)?{options:{storage:o}}:{}}))}function Eh(e){return ya(e)==="possible"}function kh(e){for(let o=3;o<e.length;o+=4)if(e[o]!==255)return!0;return!1}async function Ch(e){let o=Object.entries(e).filter(([,k])=>k.fallback.format==="png"),x=new Set,v=8;for(let k=0;k<o.length;k+=8)await Promise.all(o.slice(k,k+8).map(async([E,C])=>{let j=C.variants.filter((L)=>L.format==="png").sort((L,B)=>L.width-B.width)[0];try{let L=await mh(new Uint8Array(await Qt.promises.readFile(j?.path??C.fallback.path)));if(kh(L.data))x.add(E)}catch{x.add(E)}}));return x}function Rh(e,o){let x=[];for(let v of o){let k=e[v],E=k?.variants.filter((j)=>j.format==="webp")??[];if(!k||E.length===0)continue;if(!E.some((j)=>{let L;try{return L=Qt.openSync(j.path,"r"),!ha(mi(L,0,32))}catch{return!0}finally{if(L!==void 0)Qt.closeSync(L)}}))continue;if(k.variants=k.variants.filter((j)=>j.format!=="webp"),delete k.sources.webp,x.push(v),!Yu.has(v))Yu.add(v),console.warn(`[stx-images] ${v} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return x}async function Ah(e){let o=[],x=8;for(let v=0;v<e.length;v+=8){let k=e.slice(v,v+8),E=await Promise.all(k.map(async(C)=>{try{return await hh(C.absolutePath),C}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${C.relativePath}`),null}}));o.push(...E.filter((C)=>C!==null))}return o}function va(e){return qt.join(e,"undecodable.json")}function Th(e){try{let o=Qt.readFileSync(va(e),"utf-8"),x=JSON.parse(o);return x&&typeof x==="object"?x:{}}catch{return{}}}function Ih(e,o){try{Qt.mkdirSync(qt.dirname(va(e)),{recursive:!0}),Qt.writeFileSync(va(e),JSON.stringify(o))}catch{}}function td(e){try{let o=Qt.statSync(e);return{mtimeMs:o.mtimeMs,size:o.size}}catch{return}}function sd(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let o=e.split(/[?#]/,1)[0];if(!o)return;try{return`/${o.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Zr(e){let o=sd(e);return o?fs().catalog.get(o):void 0}function Qr(e){let o=sd(e);return o?fs().transparent.has(o):!1}function es(e){let o=(v)=>e.variants.filter((k)=>k.format===v).reduce((k,E)=>k+E.bytes,0),x=o(e.fallback.format);return["avif","webp"].map((v)=>({format:v,srcset:e.sources[v]||"",bytes:o(v)})).filter((v)=>v.srcset&&v.bytes>0&&v.bytes<x).sort((v,k)=>v.bytes-k.bytes).map(({format:v,srcset:k})=>({format:v,srcset:k}))}function Du(e){let o=Zr(e);if(!o)return;return{src:o.fallback.url,srcset:o.sources[o.fallback.format]||"",sources:es(o).map(({format:x,srcset:v})=>({type:`image/${x}`,srcset:v})),width:o.source.width,height:o.source.height,placeholder:Qr(e)?void 0:o.placeholder?.dataUrl}}function Fn(){let e=fs();e.catalog=new Map,e.transparent=new Set}function Dh(e){let o=fs();o.catalog=new Map(e.entries),o.transparent=new Set(e.transparent)}async function Ou(e,o,x={}){if(!e||!Qt.existsSync(e))return Fn(),{count:0,fingerprint:""};if(x.offThread){let Q=await ba("delivery",{publicDir:e,outputDir:o});if(Q!==xi)return Dh(Q.state),Q.result}let v=await rd(e);if(v.length===0)return Fn(),{count:0,fingerprint:""};let k=Th(o),E=v.filter((Q)=>{let se=k[Q.relativePath];if(!se)return!0;let oe=td(Q.absolutePath);return!oe||oe.mtimeMs!==se.mtimeMs||oe.size!==se.size});if(E.length===0)return Fn(),{count:0,fingerprint:""};let C=Qu(qt.join(o,"_stx","images"),`${bh}:${$h()}`),j={outDir:qt.join(o,"_stx","images"),storage:Qu(qt.join(o,"_stx","images")),baseUrl:vi,widths:xh,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},L=E,B;try{B=await Ju({...j,entries:ed(E,C)})}catch(Q){if(L=await Ah(E),L.length===E.length)throw Q;let se=new Set(L.map((ie)=>ie.relativePath)),oe=!1;for(let ie of E){if(se.has(ie.relativePath))continue;let ce=td(ie.absolutePath);if(!ce)continue;k[ie.relativePath]=ce,oe=!0}if(oe)Ih(o,k);if(L.length===0)return Fn(),{count:0,fingerprint:""};B=await Ju({...j,entries:ed(L,C)})}let F=await Ch(B.entries),U=Rh(B.entries,F),Z=fs();Z.catalog=new Map(Object.entries(B.entries)),Z.transparent=F;let Y=F.size===0&&U.length===0?B.fingerprint:nd("sha256").update(B.fingerprint).update(JSON.stringify({transparent:[...F].sort(),droppedWebp:U.sort()})).digest("hex");return{count:L.length,fingerprint:Y}}var Ph=new Map;function wa(e){if(!e)return;let o=e.split("?")[0].split("#")[0];return Ph.get(o)}var Mh={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$a=[320,640,768,1024,1280,1536,1920];function zt(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Zt(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}function wi(e,o,x=!1){let v=e.serverDynamic[o];if(v!==void 0)return v!==!1&&v!=="false";let k=e.static[o];if(k!==void 0)return k!=="false"&&k!==!1;return x}function Sa(e){if(e.includes("(")||e.includes(","))return e;let o=e.trim().split(/\s+/),x=[];for(let v of o)if(v.includes(":")){let[k,E]=v.split(":"),C=Mh[k];if(C)x.push(`(max-width: ${C}px) ${E}`);else{let j=Number.parseInt(k);if(!Number.isNaN(j))x.push(`(max-width: ${j}px) ${E}`)}}else x.push(v);return x.join(", ")}function _a(e,o,x,v){return o.map((k)=>`${xs(e,k,void 0,x,v)} ${k}w`).join(", ")}function Oh(e,o,x,v,k){return o.map((E)=>{let C=x?x*E:void 0;return`${xs(e,C,void 0,v,k)} ${E}x`}).join(", ")}function xs(e,o,x,v,k){if(!v||v==="local"||v==="static")return e;if(v==="cloudinary"){let E=[];if(o)E.push(`w_${o}`);if(x)E.push(`h_${x}`);if(k)E.push(`f_${k}`);E.push("q_auto");let C=E.join(",");return e.replace("/upload/",`/upload/${C}/`)}if(v==="imgix"){let E=new URLSearchParams;if(o)E.set("w",String(o));if(x)E.set("h",String(x));if(k)E.set("fm",k);E.set("auto","format");let C=e.includes("?")?"&":"?";return`${e}${C}${E.toString()}`}if(v==="bunny"){let E=new URLSearchParams;if(o)E.set("width",String(o));if(x)E.set("height",String(x));if(k)E.set("format",k);let C=e.includes("?")?"&":"?";return`${e}${C}${E.toString()}`}return e}function Nh(e){return`var s=this.style;${e.map((o)=>`s.${o}=''`).join(";")}`}function jh(e,o,x="#e5e7eb"){let v=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${o}"><rect width="100%" height="100%" fill="${x}"/></svg>`;return`data:image/svg+xml;base64,${btoa(v)}`}var Ea={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,o,x){let v=Zt(e,"src")||"",k=Zr(v),E=Zt(e,"alt")||"",C=Zt(e,"width")||(k?String(k.source.width):void 0),j=Zt(e,"height")||(k?String(k.source.height):void 0),L=Zt(e,"sizes"),B=Zt(e,"srcset"),F=Zt(e,"densities"),U=Zt(e,"format"),Z=Qr(v)||wa(v)?.transparent===!0,Y=Zt(e,"placeholder")||(k&&!Z?"thumbhash":void 0),Q=Zt(e,"placeholderColor")||"#e5e7eb",se=Zt(e,"provider"),oe=Zt(e,"class")||Zt(e,"className")||"",ie=Zt(e,"style")||"",ce=Zt(e,"quality"),ae=wi(e,"lazy",!0),pe=wi(e,"preload",!1),me=wi(e,"priority",!1),he=Zt(e,"loading"),Se=Zt(e,"decoding")||"async",Ee=!!k||wi(e,"picture",!1)||!!U,Ce=C?Number.parseInt(C):void 0,Re=j?Number.parseInt(j):void 0,Ae=B||"",_e="";if(k)Ae=k.sources[k.fallback.format]||"",_e=L?Sa(L):"100vw";else if(!Ae&&L&&se&&se!=="local"&&se!=="static")Ae=_a(v,$a,se,U),_e=Sa(L);else if(!Ae&&F){let dt=F.split(/\s+/).map((ht)=>Number.parseFloat(ht.replace("x","")));Ae=Oh(v,dt,Ce,se,U)}else if(L)_e=Sa(L);let Te=[];if(ie)Te.push(ie);if(Ce&&Re)Te.push(`aspect-ratio:${Ce}/${Re}`);let Me=[],De=Y==="blur"||Y==="color"||Y==="thumbhash";if(De&&!Z){let dt=k?.placeholder?{dataUrl:k.placeholder.dataUrl,color:Q}:wa(v);if(dt&&Y==="color")Te.push(`background-color:${dt.color}`),Me.push("backgroundColor");else if(dt)Te.push(`background-color:${dt.color}`),Te.push(`background-image:url(${dt.dataUrl})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundColor","backgroundImage");else{let ht=jh(Ce||16,Re||9,Q);Te.push(`background-image:url(${ht})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundImage")}}else if(!De&&Y&&Y!=="empty"&&Y!=="none")Te.push(`background-image:url(${zt(Y)})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundImage");let Ie=k?.fallback.url||xs(v,Ce,Re,se,U),Oe=[];if(Oe.push(`src="${zt(Mr(Ie,"fetched"))}"`),Oe.push(`alt="${zt(E)}"`),C)Oe.push(`width="${zt(C)}"`);if(j)Oe.push(`height="${zt(j)}"`);let tt=he||(me||pe?"eager":ae?"lazy":"");if(tt)Oe.push(`loading="${zt(tt)}"`);if(me)Oe.push('fetchpriority="high"');if(Oe.push(`decoding="${zt(Se)}"`),oe)Oe.push(`class="${zt(oe)}"`);if(Te.length>0)Oe.push(`style="${zt(Te.join(";"))}"`);if(Ae)Oe.push(`srcset="${zt(Mr(Ae,"fetched"))}"`);if(_e)Oe.push(`sizes="${zt(_e)}"`);let ot=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Me.length>0){let dt=typeof e.static.onload==="string"?e.static.onload:"",ht=Nh(Me)+(dt?`;${dt}`:"");Oe.push(`onload="${zt(ht)}"`),ot.add("onload")}Oe.push(...$r(e,ot)),Oe.push(...Sr(e,ot));let nt=`<img ${Oe.join(" ")} />`,yt="";if(pe){let ht=U==="webp"?"image/webp":U==="avif"?"image/avif":"";yt=`<link rel="preload" as="image" href="${zt(Ie)}"${ht?` type="${ht}"`:""}${Ae?` imagesrcset="${zt(Ae)}"`:""}${_e?` imagesizes="${zt(_e)}"`:""} />
|
|
2264
|
-
`}if(Ee){let dt=[];if(k)for(let ht of
|
|
2263
|
+
${ui(`@method('${Y}')`,o)}`;return se}),v=v.replace(/@endform/g,"</form>"),v=v.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(k,E,C,j,L,B="")=>{let F=E||C||"",U=j||L||"",Z=On(B),Y=Vr(F,o),Q=Y!==void 0&&Y!==null?Y:U||"",se=Z.match(/type=['"]([^'"]+)['"]/i),oe=se?se[1]:"text",ie=Ur(F,o),ce=Z.match(/class=['"]([^'"]+)['"]/i),ae=li(ce?ce[1]:"",x.input,ie,x.inputError),pe=Z.replace(/class=['"][^'"]+['"]/i,"");return pe=pe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Ft(oe)}" name="${Ft(F)}"${wr(Z,un(F))} value="${Ft(Q)}" class="${ae}"${ua(F,ie,Z)}${pe?` ${pe}`:""}>`}),v=v.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(k,E,C="",j="")=>{let L=On(C),B=Vr(E,o)||j.trim(),F=Ur(E,o),U=L.match(/class=['"]([^'"]+)['"]/i),Z=li(U?U[1]:"",x.input,F,x.inputError),Y=L.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Ft(E)}"${wr(L,un(E))} class="${Z}"${ua(E,F,L)}${Y?` ${Y}`:""}>${Ft(B)}</textarea>`}),v=v.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(k,E,C="",j)=>{let L=On(C),B=Vr(E,o),F=Ur(E,o),U=L.match(/class=['"]([^'"]+)['"]/i),Z=li(U?U[1]:"",x.input,F,x.inputError),Y=L.replace(/class=['"][^'"]+['"]/i,""),Q=j;if(B!==void 0)Q=j.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,oe,ie)=>{if((Array.isArray(B)?B.some((ae)=>String(ae)===ie):String(B)===ie)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return se});return`<select name="${Ft(E)}"${wr(L,un(E))} class="${Z}"${ua(E,F,L)}${Y?` ${Y}`:""}>${Q}</select>`}),v=v.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(k,E,C,j="")=>{let L=C===void 0?"1":C,B=C===void 0?un(E):`${un(E)}-${un(L)}`,F=On(j),U=Vr(E,o),Z=U!==void 0&&(Array.isArray(U)?U.some((oe)=>String(oe)===L):U===!0||String(U)===L),Y=F.match(/class=['"]([^'"]+)['"]/i),Q=Y?Y[1]:x.checkInput,se=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Ft(E)}"${wr(F,B)} value="${Ft(L)}" class="${Q}"${Z?" checked":""}${se?` ${se}`:""}>`}),v=v.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(k,E,C,j="")=>{let L=On(j),B=Vr(E,o),F=B!==void 0&&B===C,U=L.match(/class=['"]([^'"]+)['"]/i),Z=U?U[1]:x.checkInput,Y=L.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Ft(E)}"${wr(L,`${un(E)}-${un(C)}`)} value="${Ft(C)}" class="${Z}"${F?" checked":""}${Y?` ${Y}`:""}>`}),v=v.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(k,E,C="")=>{let j=On(C),L=j.match(/accept=['"]([^'"]+)['"]/i),B=L?L[1]:"",F=j.includes("multiple"),U=Ur(E,o),Z=j.match(/class=['"]([^'"]+)['"]/i),Y=li(Z?Z[1]:"",x.input,U,x.inputError),Q=j.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Ft(E)}"${wr(j,un(E))}`,`class="${Y}"`];if(B)se.push(`accept="${Ft(B)}"`);if(F)se.push("multiple");if(Q)se.push(Q);return`${se.join(" ")}>`}),v=v.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(k,E,C="",j)=>{let L=On(C),B=L.match(/class=['"]([^'"]+)['"]/i),F=B?B[1]:x.label,U=L.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Ft(un(E))}" class="${F}"${U?` ${U}`:""}>${j}</label>`}),v}function Cu(e,o,x=Eu){return e.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(v,k,E)=>{try{if(Ur(k,o)){let C=E.replace(/\{\{([^}]+)\}\}/g,(j,L)=>{try{if(L.trim()==="$message"||L.trim()==="message")return Su(k,o);if(L.trim().includes("errors.first")||L.trim().includes("$errors.first")){if(typeof o.errors?.first==="function")return o.errors.first(k);return Su(k,o)}let B=L.trim();if(p(B)){let F=c(B,o);return F!==void 0?String(F):B}return B}catch{return L}});return`<div id="${Ft(`${un(k)}-error`)}" role="alert">${C}</div>`}return""}catch(C){return console.error("Error processing @error directive:",C),v}})}function Ur(e,o){if(!o.errors)return!1;if(typeof o.errors.has==="function")return o.errors.has(e);if(typeof o.errors==="object")return Object.prototype.hasOwnProperty.call(o.errors,e);return!1}function Su(e,o){if(!o.errors)return"";if(typeof o.errors.get==="function")return o.errors.get(e);if(typeof o.errors==="object"&&Object.prototype.hasOwnProperty.call(o.errors,e)){let x=o.errors[e];return Array.isArray(x)?x[0]:String(x)}return""}function Vr(e,o){let x;if(o.old&&typeof o.old==="function")return o.old(e);if(o.old&&typeof o.old==="object")return o.old[e];if(e.endsWith("[]")){let v=e.slice(0,-2);if(x=o[v],x!==void 0)return x}return o[e]}function On(e){if(!e.trim())return"";let o=[],x=e.trim(),v=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,k;while((k=v.exec(x))!==null){let[,E,,C]=k;o.push(`${E}="${C.trim()}"`)}return o.join(" ")}var Hr=/<\/?template\b[^>]*>/gi,ih=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function oh(e){let o=e.replace(/^<template\b/i,"").replace(/>$/,"");return ih.test(o)}function ee(e){Hr.lastIndex=0;let o;while((o=Hr.exec(e))!==null){if(o[0].startsWith("</")||oh(o[0]))continue;let x=o.index,v=Hr.lastIndex,k=1,E;while((E=Hr.exec(e))!==null)if(E[0].startsWith("</")){if(k--,k===0){let C=E.index;return{start:x,openEnd:v,closeStart:C,end:Hr.lastIndex,content:e.slice(v,C)}}}else k++;return null}return null}import Nt from"path";import{existsSync as ry}from"fs";import di from"fs";import Bt from"path";var Tu=new Map;function pi(e,o=!0){let x=Tu.get(e);if(o&&x)return x;let v=new Map,k=[Bt.join(e,"src"),Bt.join(e,"dist"),e];function E(C,j){if(j>6)return;let L;try{L=di.readdirSync(C,{withFileTypes:!0})}catch{return}for(let B of L){let F=Bt.join(C,B.name);if(B.isDirectory()){if(B.name==="node_modules"||B.name.startsWith("."))continue;E(F,j+1)}else if(B.isFile()&&B.name.endsWith(".stx")){let U=B.name.slice(0,-4);if(!v.has(U))v.set(U,F);let Z=U.toLowerCase();if(!v.has(Z))v.set(Z,F);let Y=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!v.has(Y))v.set(Y,F)}}}for(let C of k)if(E(C,0),v.size>0)break;if(o)Tu.set(e,v);return v}function fi(e,o){if(e.startsWith(".")||e.startsWith("/"))return null;let x=o;while(!0){let v=Bt.join(x,"node_modules",e);try{if(di.statSync(v).isDirectory())return v}catch{}let k=Bt.dirname(x);if(k===x)return null;x=k}}function gi(e,o,x={}){return[Bt.resolve(Bt.dirname(o),`${e}.stx`),Bt.resolve(Bt.dirname(o),e),Bt.resolve(x.componentsDir||"components",`${e}.stx`),Bt.resolve(x.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Wu(e){let o=e.endsWith(".stx")?e.slice(0,-4):e,x=o.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""),v=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[o,x,v]}function da(e,o){let[x,v,k]=Wu(e);for(let E of[x,x.toLowerCase(),v,k]){let C=o?.__importedComponents?.get(E);if(C!==void 0)return C}}function*pa(e,o,x={},v){let k=Wu(e);if(k[0].startsWith("./")||k[0].startsWith("../")){yield Bt.resolve(Bt.dirname(o),`${k[0]}.stx`);return}let E=[...new Set(k.map((L)=>`${L}.stx`))],C=x.projectRoot||process.cwd(),j=[...v?.__originalFilePath?[Bt.join(Bt.dirname(v.__originalFilePath),"components")]:[],...x.componentsDir?[x.componentsDir]:[],Bt.join(Bt.dirname(o),"components"),Bt.resolve(C,"src/components"),Bt.resolve(C,"components"),...import.meta.dir?[Bt.resolve(import.meta.dir,"components")]:[]];for(let L of new Set(j)){for(let B of E)yield Bt.join(L,B);try{for(let B of di.readdirSync(L,{withFileTypes:!0}))if(B.isDirectory())for(let F of E)yield Bt.join(L,B.name,F)}catch{}}}function Vu(e,o,x={},v){let k=da(e,v);if(k!==void 0)return k;for(let E of pa(e,o,x,v))try{if(di.statSync(E,{throwIfNoEntry:!1})?.isFile())return E}catch{}return null}class Uu{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let o of e.aliases)this.builtins.set(o.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,o,x,v){let k=da(e,v);if(k!==void 0)return k;for(let E of pa(e,o,x,v))if(await n(E))return E;return null}}var $r=new Uu;function Ut(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var ur="\x00stx-boolean-attribute";function fa(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}function Sr(e,o){let x=[];for(let[v,k]of Object.entries(e.static)){if(o.has(v))continue;let E=e.staticNames?.[v]??v;if(typeof k==="boolean"){if(k)x.push(Ut(E));continue}if(k===ur){x.push(Ut(E));continue}x.push(`${Ut(E)}="${Ut(fa(String(k)))}"`)}return x}function _r(e,o){let x=[];for(let[v,k]of Object.entries(e.serverDynamic??{})){if(o.has(v))continue;if(k===null||k===void 0||k===!1)continue;let E=e.serverDynamicNames?.[v]??v;if(k===!0){x.push(Ut(E));continue}if(typeof k==="object")continue;x.push(`${Ut(E)}="${Ut(fa(String(k)))}"`)}return x}function Er(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ah(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var ga={name:"StxLink",aliases:["stx-link"],render(e,o,x){let v=ah(e),k=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),E=typeof e.static.activeClass==="string"?e.static.activeClass:"active",C=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",j=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,L=[];if(v.reactive)L.push(`:href="${Er(v.value)}"`);else L.push(`href="${Er(Mr(v.value,"navigable"))}"`);if(k)L.push(`class="${Er(k)}"`);if(L.push("data-stx-link"),L.push(`data-stx-active-class="${Er(E)}"`),L.push(`data-stx-exact-active-class="${Er(C)}"`),j)L.push("data-stx-prefetch");let B=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(B)L.push(`data-stx-active-match="${Er(B)}"`);let F=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return L.push(...Sr(e,F)),L.push(..._r(e,F)),`<a ${L.join(" ")}>${o}</a>`}};import{createHash as nd}from"crypto";import Qt from"fs";import qt from"path";import{decode as mh,generateThumbHash as hh}from"ts-images";import{createImageDeliveryCatalog as Ju}from"ts-images/delivery";import ma from"fs";function mi(e,o,x){let v=Buffer.alloc(x),k=ma.readSync(e,v,0,x,o);return v.subarray(0,k)}function ha(e){if(e.length<25)return!1;let o=(v,k)=>String.fromCharCode(...e.subarray(v,k));if(o(0,4)!=="RIFF"||o(8,12)!=="WEBP")return!1;let x=o(12,16);if(x==="VP8X")return(e[20]&16)!==0;if(x==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function ya(e){let o;try{o=ma.openSync(e,"r");let x=mi(o,0,33);if(x.length>=3&&x[0]===255&&x[1]===216&&x[2]===255)return"none";if(x.length>=26&&x[0]===137&&x.toString("latin1",1,4)==="PNG"){let v=x[25];if(v===4||v===6)return"possible";let k=8;for(let E=0;E<64;E++){let C=mi(o,k,8);if(C.length<8)return"unknown";let j=C.toString("latin1",4,8);if(j==="tRNS")return"possible";if(j==="IDAT"||j==="IEND")return"none";k+=12+C.readUInt32BE(0)}return"unknown"}if(x.length>=25&&x.toString("latin1",0,4)==="RIFF"&&x.toString("latin1",8,12)==="WEBP"){if(ha(x))return"possible";let v=x.toString("latin1",12,16);return v==="VP8 "||v==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(o!==void 0)ma.closeSync(o)}}import ch from"fs";import hi from"os";import{join as Hu}from"path";import{fileURLToPath as qu}from"url";import{Worker as Xu}from"worker_threads";var xi=Symbol("stx.image-worker.unavailable");function lh(e=typeof hi.availableParallelism==="function"?hi.availableParallelism():hi.cpus().length){return Math.max(1,Math.min(2,e-1))}var yi=0,Zu=[];async function uh(){if(yi<lh()){yi++;return}await new Promise((e)=>Zu.push(e)),yi++}function dh(){yi--,Zu.shift()?.()}var ph="@stacksjs/stx/builtins/image-warmup-worker";function fh(e=process.cwd()){let o=import.meta.url.endsWith(".ts")?"ts":"js";try{let x=new URL(`./image-warmup-worker.${o}`,import.meta.url);if(x.protocol==="file:"&&ch.existsSync(qu(x)))return qu(x)}catch{}try{let x=typeof Bun<"u"?Bun.resolveSync(ph,e):void 0;return x&&gh(x)?x:void 0}catch{return}}function gh(e,o=process.env){let x=e.replace(/\\/g,"/");if(x.split("/").some((k)=>/@\d[^/]*@@@\d+$/.test(k)))return!1;return![o.BUN_INSTALL_CACHE_DIR,Hu(o.BUN_INSTALL||Hu(hi.homedir(),".bun"),"install","cache")].filter((k)=>!!k).map((k)=>`${k.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((k)=>x.startsWith(k))}var Ku=!1;function qr(e){if(!Ku)Ku=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return xi}function xa(e){return e instanceof Error?e.message:String(e)}async function ba(e,o){if(typeof Xu!=="function")return qr("node:worker_threads has no Worker in this runtime");let x=fh();if(!x)return qr("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await uh();try{return await new Promise((v,k)=>{let E;try{E=new Xu(x)}catch(B){v(qr(`could not start ${x}: ${xa(B)}`));return}let C=!1,j=!1,L=(B)=>{if(j)return;j=!0,B(),E.terminate()};E.on("message",(B)=>{if(B.type==="ready"){C=!0,E.postMessage({task:e,args:o});return}if(B.type==="result"){L(()=>v(B.value));return}let F=Error(B.error?.message??"image worker failed");if(B.error?.name)F.name=B.error.name;if(B.error?.stack)F.stack=B.error.stack;L(()=>k(F))}),E.on("error",(B)=>{L(()=>C?k(B instanceof Error?B:Error(xa(B)||"image worker crashed")):v(qr(`the worker failed before it was ready: ${xa(B)}`)))}),E.on("exit",(B)=>{L(()=>C?k(Error("image worker exited before it finished")):v(qr(`the worker exited with code ${B} before it was ready`)))})})}finally{dh()}}var yh=new Set([".avif",".jpeg",".jpg",".png",".webp"]),xh=[320,640,960,1280,1920],vi="/_stx/images",bh=`stx:${vi}:alpha-1`,vh=["@stacksjs/ts-webp","@stacksjs/ts-avif"],bi;function wh(e,o){let x=qt.dirname(Bun.resolveSync(e,o));while(x!==qt.dirname(x)){let v=qt.join(x,"package.json");if(Qt.existsSync(v)){let k=JSON.parse(Qt.readFileSync(v,"utf8"));if(k.name===e)return k.version}x=qt.dirname(x)}return}function $h(){if(bi!==void 0)return bi;let e;try{e=qt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return bi=vh.map((o)=>{let x;try{x=e?wh(o,e):void 0}catch{}return`${o.replace("@stacksjs/","")}@${x??"unknown"}`}).join("+"),bi}var Gu=Symbol.for("stx.image-delivery");function Xr(){let e=globalThis;return e[Gu]??={catalog:new Map,transparent:new Set},e[Gu]}var Yu=new Set;function Sh(e){return`/${e.split(qt.sep).map(encodeURIComponent).join("/")}`}function _h(e){let o=qt.extname(e),x=e.slice(0,-o.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),v=nd("sha256").update(e).digest("hex").slice(0,8);return`${x||"image"}-${v}`}function Qu(e,o=`stx:${vi}`){let x=(v)=>`${vi}/${v.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:o,async stat(v){let k=qt.join(e,v);try{let E=await Qt.promises.stat(k);return E.size>0?{bytes:E.size,path:k,url:x(v)}:null}catch{return null}},async write(v,k){let E=qt.join(e,v);await Qt.promises.mkdir(qt.dirname(E),{recursive:!0});let C=`${E}.${process.pid}.tmp`;return await Qt.promises.writeFile(C,k),await Qt.promises.rename(C,E),{bytes:k.byteLength,path:E,url:x(v)}},url:x}}async function rd(e,o=e){let x=await Qt.promises.readdir(o,{withFileTypes:!0});x.sort((k,E)=>k.name.localeCompare(E.name));let v=[];for(let k of x){let E=qt.join(o,k.name);if(k.isDirectory()){v.push(...await rd(e,E));continue}if(!k.isFile()||!yh.has(qt.extname(k.name).toLowerCase()))continue;v.push({absolutePath:E,relativePath:qt.relative(e,E)})}return v}function ed(e,o){return e.map((x)=>({key:Sh(x.relativePath),input:x.absolutePath,name:_h(x.relativePath),...Eh(x.absolutePath)?{options:{storage:o}}:{}}))}function Eh(e){return ya(e)==="possible"}function kh(e){for(let o=3;o<e.length;o+=4)if(e[o]!==255)return!0;return!1}async function Ch(e){let o=Object.entries(e).filter(([,k])=>k.fallback.format==="png"),x=new Set,v=8;for(let k=0;k<o.length;k+=8)await Promise.all(o.slice(k,k+8).map(async([E,C])=>{let j=C.variants.filter((L)=>L.format==="png").sort((L,B)=>L.width-B.width)[0];try{let L=await mh(new Uint8Array(await Qt.promises.readFile(j?.path??C.fallback.path)));if(kh(L.data))x.add(E)}catch{x.add(E)}}));return x}function Rh(e,o){let x=[];for(let v of o){let k=e[v],E=k?.variants.filter((j)=>j.format==="webp")??[];if(!k||E.length===0)continue;if(!E.some((j)=>{let L;try{return L=Qt.openSync(j.path,"r"),!ha(mi(L,0,32))}catch{return!0}finally{if(L!==void 0)Qt.closeSync(L)}}))continue;if(k.variants=k.variants.filter((j)=>j.format!=="webp"),delete k.sources.webp,x.push(v),!Yu.has(v))Yu.add(v),console.warn(`[stx-images] ${v} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return x}async function Ah(e){let o=[],x=8;for(let v=0;v<e.length;v+=8){let k=e.slice(v,v+8),E=await Promise.all(k.map(async(C)=>{try{return await hh(C.absolutePath),C}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${C.relativePath}`),null}}));o.push(...E.filter((C)=>C!==null))}return o}function va(e){return qt.join(e,"undecodable.json")}function Th(e){try{let o=Qt.readFileSync(va(e),"utf-8"),x=JSON.parse(o);return x&&typeof x==="object"?x:{}}catch{return{}}}function Ih(e,o){try{Qt.mkdirSync(qt.dirname(va(e)),{recursive:!0}),Qt.writeFileSync(va(e),JSON.stringify(o))}catch{}}function td(e){try{let o=Qt.statSync(e);return{mtimeMs:o.mtimeMs,size:o.size}}catch{return}}function sd(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let o=e.split(/[?#]/,1)[0];if(!o)return;try{return`/${o.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Qr(e){let o=sd(e);return o?Xr().catalog.get(o):void 0}function es(e){let o=sd(e);return o?Xr().transparent.has(o):!1}function ts(e){let o=(v)=>e.variants.filter((k)=>k.format===v).reduce((k,E)=>k+E.bytes,0),x=o(e.fallback.format);return["avif","webp"].map((v)=>({format:v,srcset:e.sources[v]||"",bytes:o(v)})).filter((v)=>v.srcset&&v.bytes>0&&v.bytes<x).sort((v,k)=>v.bytes-k.bytes).map(({format:v,srcset:k})=>({format:v,srcset:k}))}function Ou(e){let o=Qr(e);if(!o)return;return{src:o.fallback.url,srcset:o.sources[o.fallback.format]||"",sources:ts(o).map(({format:x,srcset:v})=>({type:`image/${x}`,srcset:v})),width:o.source.width,height:o.source.height,placeholder:es(e)?void 0:o.placeholder?.dataUrl}}function zn(){let e=Xr();e.catalog=new Map,e.transparent=new Set}function Dh(e){let o=Xr();o.catalog=new Map(e.entries),o.transparent=new Set(e.transparent)}async function Mu(e,o,x={}){if(!e||!Qt.existsSync(e))return zn(),{count:0,fingerprint:""};if(x.offThread){let Q=await ba("delivery",{publicDir:e,outputDir:o});if(Q!==xi)return Dh(Q.state),Q.result}let v=await rd(e);if(v.length===0)return zn(),{count:0,fingerprint:""};let k=Th(o),E=v.filter((Q)=>{let se=k[Q.relativePath];if(!se)return!0;let oe=td(Q.absolutePath);return!oe||oe.mtimeMs!==se.mtimeMs||oe.size!==se.size});if(E.length===0)return zn(),{count:0,fingerprint:""};let C=Qu(qt.join(o,"_stx","images"),`${bh}:${$h()}`),j={outDir:qt.join(o,"_stx","images"),storage:Qu(qt.join(o,"_stx","images")),baseUrl:vi,widths:xh,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},L=E,B;try{B=await Ju({...j,entries:ed(E,C)})}catch(Q){if(L=await Ah(E),L.length===E.length)throw Q;let se=new Set(L.map((ie)=>ie.relativePath)),oe=!1;for(let ie of E){if(se.has(ie.relativePath))continue;let ce=td(ie.absolutePath);if(!ce)continue;k[ie.relativePath]=ce,oe=!0}if(oe)Ih(o,k);if(L.length===0)return zn(),{count:0,fingerprint:""};B=await Ju({...j,entries:ed(L,C)})}let F=await Ch(B.entries),U=Rh(B.entries,F),Z=Xr();Z.catalog=new Map(Object.entries(B.entries)),Z.transparent=F;let Y=F.size===0&&U.length===0?B.fingerprint:nd("sha256").update(B.fingerprint).update(JSON.stringify({transparent:[...F].sort(),droppedWebp:U.sort()})).digest("hex");return{count:L.length,fingerprint:Y}}var Ph=new Map;function wa(e){if(!e)return;let o=e.split("?")[0].split("#")[0];return Ph.get(o)}var Mh={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$a=[320,640,768,1024,1280,1536,1920];function zt(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Zt(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}function wi(e,o,x=!1){let v=e.serverDynamic[o];if(v!==void 0)return v!==!1&&v!=="false";let k=e.static[o];if(k!==void 0)return k!=="false"&&k!==!1;return x}function Sa(e){if(e.includes("(")||e.includes(","))return e;let o=e.trim().split(/\s+/),x=[];for(let v of o)if(v.includes(":")){let[k,E]=v.split(":"),C=Mh[k];if(C)x.push(`(max-width: ${C}px) ${E}`);else{let j=Number.parseInt(k);if(!Number.isNaN(j))x.push(`(max-width: ${j}px) ${E}`)}}else x.push(v);return x.join(", ")}function _a(e,o,x,v){return o.map((k)=>`${fs(e,k,void 0,x,v)} ${k}w`).join(", ")}function Oh(e,o,x,v,k){return o.map((E)=>{let C=x?x*E:void 0;return`${fs(e,C,void 0,v,k)} ${E}x`}).join(", ")}function fs(e,o,x,v,k){if(!v||v==="local"||v==="static")return e;if(v==="cloudinary"){let E=[];if(o)E.push(`w_${o}`);if(x)E.push(`h_${x}`);if(k)E.push(`f_${k}`);E.push("q_auto");let C=E.join(",");return e.replace("/upload/",`/upload/${C}/`)}if(v==="imgix"){let E=new URLSearchParams;if(o)E.set("w",String(o));if(x)E.set("h",String(x));if(k)E.set("fm",k);E.set("auto","format");let C=e.includes("?")?"&":"?";return`${e}${C}${E.toString()}`}if(v==="bunny"){let E=new URLSearchParams;if(o)E.set("width",String(o));if(x)E.set("height",String(x));if(k)E.set("format",k);let C=e.includes("?")?"&":"?";return`${e}${C}${E.toString()}`}return e}function Nh(e){return`var s=this.style;${e.map((o)=>`s.${o}=''`).join(";")}`}function jh(e,o,x="#e5e7eb"){let v=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${o}"><rect width="100%" height="100%" fill="${x}"/></svg>`;return`data:image/svg+xml;base64,${btoa(v)}`}var Ea={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,o,x){let v=Zt(e,"src")||"",k=Qr(v),E=Zt(e,"alt")||"",C=Zt(e,"width")||(k?String(k.source.width):void 0),j=Zt(e,"height")||(k?String(k.source.height):void 0),L=Zt(e,"sizes"),B=Zt(e,"srcset"),F=Zt(e,"densities"),U=Zt(e,"format"),Z=es(v)||wa(v)?.transparent===!0,Y=Zt(e,"placeholder")||(k&&!Z?"thumbhash":void 0),Q=Zt(e,"placeholderColor")||"#e5e7eb",se=Zt(e,"provider"),oe=Zt(e,"class")||Zt(e,"className")||"",ie=Zt(e,"style")||"",ce=Zt(e,"quality"),ae=wi(e,"lazy",!0),pe=wi(e,"preload",!1),me=wi(e,"priority",!1),he=Zt(e,"loading"),Se=Zt(e,"decoding")||"async",Ee=!!k||wi(e,"picture",!1)||!!U,Ce=C?Number.parseInt(C):void 0,Ae=j?Number.parseInt(j):void 0,Re=B||"",_e="";if(k)Re=k.sources[k.fallback.format]||"",_e=L?Sa(L):"100vw";else if(!Re&&L&&se&&se!=="local"&&se!=="static")Re=_a(v,$a,se,U),_e=Sa(L);else if(!Re&&F){let dt=F.split(/\s+/).map((ht)=>Number.parseFloat(ht.replace("x","")));Re=Oh(v,dt,Ce,se,U)}else if(L)_e=Sa(L);let Te=[];if(ie)Te.push(ie);if(Ce&&Ae)Te.push(`aspect-ratio:${Ce}/${Ae}`);let Me=[],De=Y==="blur"||Y==="color"||Y==="thumbhash";if(De&&!Z){let dt=k?.placeholder?{dataUrl:k.placeholder.dataUrl,color:Q}:wa(v);if(dt&&Y==="color")Te.push(`background-color:${dt.color}`),Me.push("backgroundColor");else if(dt)Te.push(`background-color:${dt.color}`),Te.push(`background-image:url(${dt.dataUrl})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundColor","backgroundImage");else{let ht=jh(Ce||16,Ae||9,Q);Te.push(`background-image:url(${ht})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundImage")}}else if(!De&&Y&&Y!=="empty"&&Y!=="none")Te.push(`background-image:url(${zt(Y)})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundImage");let Ie=k?.fallback.url||fs(v,Ce,Ae,se,U),Oe=[];if(Oe.push(`src="${zt(Mr(Ie,"fetched"))}"`),Oe.push(`alt="${zt(E)}"`),C)Oe.push(`width="${zt(C)}"`);if(j)Oe.push(`height="${zt(j)}"`);let tt=he||(me||pe?"eager":ae?"lazy":"");if(tt)Oe.push(`loading="${zt(tt)}"`);if(me)Oe.push('fetchpriority="high"');if(Oe.push(`decoding="${zt(Se)}"`),oe)Oe.push(`class="${zt(oe)}"`);if(Te.length>0)Oe.push(`style="${zt(Te.join(";"))}"`);if(Re)Oe.push(`srcset="${zt(Mr(Re,"fetched"))}"`);if(_e)Oe.push(`sizes="${zt(_e)}"`);let ot=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Me.length>0){let dt=typeof e.static.onload==="string"?e.static.onload:"",ht=Nh(Me)+(dt?`;${dt}`:"");Oe.push(`onload="${zt(ht)}"`),ot.add("onload")}Oe.push(...Sr(e,ot)),Oe.push(..._r(e,ot));let nt=`<img ${Oe.join(" ")} />`,yt="";if(pe){let ht=U==="webp"?"image/webp":U==="avif"?"image/avif":"";yt=`<link rel="preload" as="image" href="${zt(Ie)}"${ht?` type="${ht}"`:""}${Re?` imagesrcset="${zt(Re)}"`:""}${_e?` imagesizes="${zt(_e)}"`:""} />
|
|
2264
|
+
`}if(Ee){let dt=[];if(k)for(let ht of ts(k))dt.push(`<source type="image/${ht.format}" srcset="${zt(ht.srcset)}"${_e?` sizes="${zt(_e)}"`:""} />`);if(!k&&(U==="avif"||U==="auto")){let ht=fs(v,Ce,Ae,se,"avif"),at=Re?_a(v,$a,se,"avif"):`${ht}`;dt.push(`<source type="image/avif" srcset="${zt(at)}"${_e?` sizes="${zt(_e)}"`:""} />`)}if(!k&&(U==="webp"||U==="auto")){let ht=fs(v,Ce,Ae,se,"webp"),at=Re?_a(v,$a,se,"webp"):`${ht}`;dt.push(`<source type="image/webp" srcset="${zt(at)}"${_e?` sizes="${zt(_e)}"`:""} />`)}return`${yt}<picture>
|
|
2265
2265
|
${dt.join(`
|
|
2266
2266
|
`)}
|
|
2267
2267
|
${nt}
|
|
2268
|
-
</picture>`}return`${yt}${nt}`}};var id="/images/safe-image-default.svg";function
|
|
2268
|
+
</picture>`}return`${yt}${nt}`}};var id="/images/safe-image-default.svg";function ws(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kr(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}var Lh=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${id}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,ka={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,o,x){let v=kr(e,"src")||"",k=kr(e,"alt")||"",E=kr(e,"fallback")||id,C=kr(e,"class")||kr(e,"className")||"",j=kr(e,"fallbackClassName")||"",L=[];if(L.push(`src="${ws(v)}"`),L.push(`alt="${ws(k)}"`),C)L.push(`class="${ws(C)}"`);if(L.push(`data-fallback="${ws(E)}"`),j)L.push(`data-fallback-class="${ws(j)}"`);L.push('onerror="window.__stxSafeImageHandler(this)"');let B=new Set(["src","alt","fallback","class","className","fallbackClassName"]);L.push(...Sr(e,B)),L.push(..._r(e,B));let F=`<img ${L.join(" ")} />`,U=x.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${Lh}${F}`;return F}};function Ca(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Ss(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}function $i(e,o,x){let v=Ss(e,o);if(v!==void 0){let k=Number.parseInt(v,10);if(!Number.isNaN(k))return k}return x}var Ra={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,o,x){let v=Ca(Ss(e,"color")||"#6366f1"),k=Ca(Ss(e,"initialColor")||Ss(e,"initial-color")||""),E=Ca(Ss(e,"height")||"3px"),C=$i(e,"duration",2000),j=$i(e,"throttle",200),L=$i(e,"zIndex",999999)||$i(e,"z-index",999999),B=k?`linear-gradient(to right, ${k}, ${v})`:v;return`
|
|
2269
2269
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${E};background:${B};z-index:${L};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
2270
2270
|
<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>
|
|
2271
2271
|
</div>
|
|
@@ -2289,7 +2289,7 @@ ${nt}
|
|
|
2289
2289
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2290
2290
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2291
2291
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2292
|
-
</style>`}};function
|
|
2292
|
+
</style>`}};function Cr(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}var ld={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Ia={name:"StxDrawer",aliases:["stx-drawer"],render(e,o,x){let v=Cr(e,"id");if(!v)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let k=Ut(v),E=Cr(e,"side")||"right",C=Cr(e,"size")||"md",j=Cr(e,"closeOnBackdrop")!=="false",L=Cr(e,"closeOnEscape")!=="false",B=Cr(e,"overlay")!=="false",F=ld[C]||ld.md,U=E==="left",Z=U?"left:0":"right:0",Y=U?"translateX(-100%)":"translateX(100%)",Q=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${k}" class="stx-drawer-backdrop" data-stx-drawer="${k}" data-close-backdrop="${j}" data-close-escape="${L}" style="display:none;position:fixed;inset:0;z-index:99999;${B?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
2293
2293
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${Z};width:${F};max-width:100vw;transform:${Y};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
2294
2294
|
<div style="padding:1.5rem">${o}</div>
|
|
2295
2295
|
</div>
|
|
@@ -2298,7 +2298,7 @@ ${nt}
|
|
|
2298
2298
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2299
2299
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2300
2300
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2301
|
-
</style>`}};import{existsSync as zh,readFileSync as Wh}from"fs";var _i=new Map,ud=new Set;function Fh(e){if(ud.has(e))return;ud.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Vh(e){let o=process.cwd();for(let x of[`${o}/node_modules/@iconify-json/${e}/icons.json`,`${o}/pantry/@iconify-json/${e}/icons.json`,`${o}/node_modules/@iconify/json/json/${e}.json`,`${o}/pantry/@iconify/json/json/${e}.json`])if(zh(x))return x;for(let x of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return u.resolve(x)}catch{}return null}function Uh(e){if(_i.has(e))return _i.get(e);let o=Vh(e);if(!o)return Fh(e),null;try{let x=JSON.parse(Wh(o,"utf8"));return _i.set(e,x.icons),x.icons}catch{return null}}function
|
|
2301
|
+
</style>`}};import{existsSync as zh,readFileSync as Wh}from"fs";var _i=new Map,ud=new Set;function Fh(e){if(ud.has(e))return;ud.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Vh(e){let o=process.cwd();for(let x of[`${o}/node_modules/@iconify-json/${e}/icons.json`,`${o}/pantry/@iconify-json/${e}/icons.json`,`${o}/node_modules/@iconify/json/json/${e}.json`,`${o}/pantry/@iconify/json/json/${e}.json`])if(zh(x))return x;for(let x of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return u.resolve(x)}catch{}return null}function Uh(e){if(_i.has(e))return _i.get(e);let o=Vh(e);if(!o)return Fh(e),null;try{let x=JSON.parse(Wh(o,"utf8"));return _i.set(e,x.icons),x.icons}catch{return null}}function Rr(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);if(e.static[o]!==void 0)return String(e.static[o]);if(e.clientReactive[o]!==void 0)return e.clientReactive[o];return}var Da={name:"Icon",aliases:["icon","stx-icon"],render(e,o,x){let v=Rr(e,"name")??Rr(e,"icon");if(!v)return"<!-- Icon: missing name/icon prop -->";let k="lucide",E=v;if(v.includes(":")){let ce=v.split(":");k=ce[0],E=ce[1]}let C=Ut(Rr(e,"size")||"24"),j=Ut(Rr(e,"color")||"currentColor"),L=Ut(Rr(e,"class")||""),B=Ut(Rr(e,"style")||""),F=_i.get(k)??Uh(k);if(!F)return`<!-- Icon: collection "${k}" not loaded -->`;let U=F[E];if(!U)return`<!-- Icon: "${E}" not found in ${k} -->`;let Z=U.width||24,Y=U.height||24,Q=`0 0 ${Z} ${Y}`,se=U.body;if(j!=="currentColor")se=se.replace(/currentColor/g,j);let oe=L?` class="${L}"`:"",ie=B?` style="${B}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${C}" height="${C}" viewBox="${Q}" fill="none"${oe}${ie}>${se}</svg>`}};function Pa(){return`
|
|
2302
2302
|
(function(){
|
|
2303
2303
|
var tip=null,hideTimer=null,currentEl=null;
|
|
2304
2304
|
|
|
@@ -2401,11 +2401,11 @@ document.addEventListener("focusout",function(e){
|
|
|
2401
2401
|
if(el) hideTip();
|
|
2402
2402
|
});
|
|
2403
2403
|
})();
|
|
2404
|
-
`}function dd(e,...o){for(let x of o){if(e.serverDynamic[x]!==void 0)return String(e.serverDynamic[x]);let v=e.static[x];if(typeof v==="string")return v}return}function pd(e,o){let x=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${o}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),v=e.match(x);if(!v)return{region:null,rest:e};return{region:v[2],rest:e.replace(v[0],"")}}var Ma={name:"Suspense",aliases:["suspense"],render(e,o,x){let v=pd(o,"fallback"),k=v.rest,E=pd(k,"error"),C=E.rest,j=v.region??dd(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',L=E.region??dd(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${j}</div><div data-stx-suspense-error hidden>${L}</div><div data-stx-suspense-content hidden>${C}</div></div>`}};function Ei(e,...o){for(let x of o){if(e.serverDynamic[x]!==void 0)return String(e.serverDynamic[x]);let v=e.static[x];if(typeof v==="string")return v}return}var Oa={name:"TransitionGroup",aliases:["transition-group"],render(e,o,x){let v=(Ei(e,"name")||"v").replace(/["'<>]/g,""),k=(Ei(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",E=Ei(e,"class"),C=Ei(e,"id"),j=[`data-stx-transition-group="${v}"`,E?`class="${E}"`:"",C?`id="${C}"`:""].filter(Boolean).join(" ");return`<${k} ${j}>${o}</${k}>`}};function fd(e
|
|
2405
|
-
`||Ce==="\t")ce++;ae=Se+oe.length}else{if(ce--,ce===0){pe=Ee;break}ae=Ee+ie.length}}if(pe===-1){k=Y;continue}let me=e.slice(Y,pe),he=pe+ie.length;v.push({fullMatch:e.slice(C,he),tagName:B,attributes:se,content:me,startIndex:C,endIndex:he,isSelfClosing:!1}),k=he}}return v}function xd(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function bd(e,o){try{let x=Buffer.from(e,"base64").toString("utf8");return JSON.parse(x)}catch{}try{let x=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(x)}catch(x){if(o?.debug)console.error("Error decoding __stx_ prop:",x);return e}}function Na(e,o){let x=0,v="",k=o;while(k<e.length){let E=e[k];if(v){if(E==="\\")k++;else if(E===v)v=""}else if(E==='"'||E==="'"||E==="`")v=E;else if(E==="{")x++;else if(E==="}"){if(x--,x===0)return e.slice(o,k+1)}k++}return e.slice(o)}function vd(e){let o=e.trim();if(!o.startsWith("{")||!o.endsWith("}"))return null;if(Na(o,0).length!==o.length)return null;return o.slice(1,-1).trim()}var qh=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ja(e){let o=[],x=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,v;while((v=x.exec(e))!==null){let k=v[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(k))continue;let E=v.index,C=E+v[0].length,j=v[1].toLowerCase();if(v[0].endsWith("/>")||Xh.has(j)){o.push([E,C]);continue}let L=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`<\\/?${L}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");B.lastIndex=C;let F=1,U=C,Z;while((Z=B.exec(e))!==null)if(Z[0].startsWith("</")){if(F--,F===0){U=Z.index+Z[0].length;break}}else if(!Z[0].endsWith("/>"))F++;o.push([E,U])}return o}function wd(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((o)=>wd(o)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return e?String(e):""}function $d(e,o){if(!/:[\w-]+=/.test(e))return e;let x=e,v=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,k=[],E;while((E=v.exec(e))!==null)k.push([E.index,E.index+E[0].length]);k.push(...ja(e));function C(U){return k.some(([Z,Y])=>U>=Z&&U<Y)}let j=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,L=[],B=new Map,F=256;while((E=j.exec(x))!==null){if(C(E.index))continue;let U=E[0],Z=E[2];if(!Z||!Z.includes(":"))continue;let Y=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,Q,se=Z,oe=!1;while((Q=Y.exec(Z))!==null){let ie=Q[1],ce=Q[2];if(Eo(ie))continue;if(ce.includes("()")&&!ce.includes(".get(")||ce.includes("$store")||ce.includes("$ref"))continue;try{let ae=Object.keys(o),pe=Object.values(o),me=ce.match(/^([a-zA-Z_$][\w$]*)/);if(me&&!ae.includes(me[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(me[1]))continue;let he=JSON.stringify([ae,ce]),Se=B.get(he);if(!Se){if(Se=Function(...ae,`return (${ce})`),B.size>=F)B.clear();B.set(he,Se)}let Ee=Se(...pe);if(ie==="class"){let Ce=wd(Ee);if(Ce){let Re=se.match(/\sclass="([^"]*)"/);if(Re)se=se.replace(Re[0],` class="${Re[1]} ${Ce}"`);else se=se.replace(Q[0],` class="${Ce}"`)}else se=se.replace(Q[0],"");oe=!0;continue}if(qh.has(ie)){if(Ee)se=se.replace(Q[0],` ${ie}`);else se=se.replace(Q[0],"");oe=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)se=se.replace(Q[0],"");else{let Ce=String(Ee).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");se=se.replace(Q[0],` ${ie}="${Ce}"`)}oe=!0}catch{continue}}if(oe){let ie=E[3]?" /":"",ae=`<${E[1]}${se}${ie}>`;L.push({start:E.index,end:E.index+U.length,replacement:ae})}}if(L.length>0){let U=Array(L.length*2+1),Z=0;for(let Y=0;Y<L.length;Y++){let{start:Q,end:se,replacement:oe}=L[Y];U[Y*2]=x.slice(Z,Q),U[Y*2+1]=oe,Z=se}U[L.length*2]=x.slice(Z),x=U.join("")}return x}import Sd from"fs";import _d from"path";var Ms=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 rn(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Ms].some((o)=>o.toLowerCase()===e.toLowerCase());return Ms.has(e)||/[A-Z]/.test(e)}var Ed=!1;function Kh(e,o,x,v=!1){let k={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},E=new Set(Array.isArray(o.__stx_client_signal_names)?o.__stx_client_signal_names:[]),C=(F)=>{if(E.size===0)return!1;let U=s(F),Z=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&E.has(Z))return!0;for(let Y of E){let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${Q}\\s*\\(`).test(U))return!0}return!1},j=new Set(To),L=(F)=>{if(!F.includes("-")||F.startsWith("@")||F.startsWith(":")||F.startsWith("x-")||F.startsWith("__"))return F;if(F.startsWith("aria-")||F.startsWith("data-"))return F;return F.replace(/-([a-z0-9])/g,(U,Z)=>Z.toUpperCase())},B=(F,U)=>{let Z=L(F);if(k.static[Z]=U,Z!==F)k.staticNames[Z]=F};for(let[F,U]of Object.entries(e)){let Z=F.startsWith("x-")&&!j.has(F)&&!F.startsWith("x-bind:")&&!F.startsWith("x-on:")?`:${F.slice(2)}`:F;if(Z.startsWith("@")){k.events[Z]=U;continue}if(Z.startsWith("__stx_")){let Y=L(Z.slice(6));k.serverDynamic[Y]=bd(U,x);continue}if(Z.startsWith(":")){let Y=L(Z.slice(1)),Q=U===lr?Y:U;if(Y==="if"||Y==="for"||Y==="show"){k.clientReactive[Y]=Q;continue}if(v){k.clientReactive[Y]=Q;continue}if(C(Q)){k.clientReactive[Y]=Q;continue}try{if(!p(Q)){if(x.debug)console.error(`Unsafe expression in :${Y} binding: ${Q}`);k.clientReactive[Y]=Q;continue}let se=Object.keys(o),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(ke(Q).some((pe)=>!oe.has(pe)&&!se.includes(pe)&&!(pe in globalThis))){k.clientReactive[Y]=Q;continue}let ae=l(Q,se)(...Object.values(o));if(k.serverDynamic[Y]=ae,Y!==Z.slice(1)&&k.serverDynamicNames)k.serverDynamicNames[Y]=Z.slice(1)}catch{k.clientReactive[Y]=Q}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let Y=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(Y)try{let Q=Y[1];if(p(Q)){let oe=l(Q,Object.keys(o))(...Object.values(o));B(Z,oe!=null?String(oe):"")}else{if(x.debug)console.error(`Unsafe expression in ${Z}: ${Q}`);B(Z,U)}}catch(Q){if(x.debug)console.error(`Error evaluating expression for ${Z}:`,Q);B(Z,U)}else{let Q=U,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,oe;while((oe=se.exec(U))!==null)try{let ie=oe[1];if(!p(ie)){if(x.debug)console.error(`Unsafe expression in ${Z}: ${ie}`);continue}let ae=l(ie,Object.keys(o))(...Object.values(o));Q=Q.replace(oe[0],String(ae??""))}catch(ie){if(x.debug)console.error(`Error evaluating expression in ${Z}:`,ie)}B(Z,Q)}continue}B(Z,U===lr?"true":xd(U))}return k}var Zh=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Jh(e,o,x){if(!e.includes("@"))return e;if(!Zh.some(([k,E])=>k.test(e)&&e.includes(E)))return e;try{return Cn(e,o,x)}catch{return e}}function Gh(e){let o={},x=0,v=e.length;while(x<v){while(x<v&&/\s/.test(e[x]))x++;if(x>=v)break;let k="";while(x<v&&!/[\s=]/.test(e[x]))k+=e[x],x++;if(!k)break;while(x<v&&/\s/.test(e[x]))x++;if(x<v&&e[x]==="="){x++;while(x<v&&/\s/.test(e[x]))x++;let E="";if(x<v&&(e[x]==='"'||e[x]==="'")){let C=e[x];x++;while(x<v){let j=e[x];if(j==="\\"&&x+1<v){x++,E+=e[x],x++;continue}if(j===C){x++;break}E+=j,x++}}else if(e[x]==="{"){E=Na(e,x),x+=E.length;let C=vd(E);if(C!==null){o[`:${k}`]=C;continue}}else while(x<v&&!/\s/.test(e[x]))E+=e[x],x++;o[k]=E}else o[k]=lr}return o}function kd(e){return Object.entries(e).map(([o,x])=>x===lr?o:`${o}="${Yh(x)}"`).join(" ")}function Yh(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qh(e){let o=new Set,x=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,v;while((v=x.exec(e))!==null){let k=v[1];if(wr.isBuiltin(k))o.add(k)}return[...o].sort()}async function Qa(e,o,x,v,k){if(!/import\s/.test(e))return e;if(!o.__importedComponents)o.__importedComponents=new Map;let E=o.__importedComponents,C=_d.dirname(x),j=[],L=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of e.matchAll(L)){let[Z,Y,Q]=U,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=Q,ie,ce=[];while((ie=se.exec(Q))!==null){let[ae,pe,me,he]=ie,Se=null,Ee=null;if(he.startsWith(".")||he.startsWith("/")){let Ae=_d.resolve(C,he);if(Ae.endsWith(".stx"))Ee=Ae;else{let _e=`${Ae}.stx`;try{if(Sd.statSync(_e).isFile())Ee=_e}catch{try{if(Sd.statSync(Ae).isDirectory())Se=Ae}catch{}}}}else Se=fi(he,C);if(!Se&&!Ee)continue;let Ce=!1,Re=(Ae,_e)=>{E.set(Ae,_e),E.set(Ae.toLowerCase(),_e);let Te=Ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();E.set(Te,_e),k.add(_e)};if(me&&Ee)Re(me,Ee),Ce=!0;else if(pe){let Ae=pe.slice(1,-1).split(",").map((Te)=>Te.trim()).filter(Boolean).map((Te)=>{let Me=Te.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Me)return{source:Me[1],local:Me[2]};return{source:Te,local:Te}}),_e=Se?pi(Se):null;for(let{source:Te,local:Me}of Ae){let De=null;if(Ee)De=Ee;else if(_e)De=_e.get(Te)??_e.get(Te.toLowerCase())??_e.get(Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(De)Re(Me,De),Ce=!0}}if(Ce)ce.push({start:ie.index,end:ie.index+ae.length})}if(ce.length===0)continue;for(let ae=ce.length-1;ae>=0;ae--)oe=oe.slice(0,ce[ae].start)+oe.slice(ce[ae].end);j.push({start:U.index,end:U.index+Z.length,value:`<script${Y}>${oe}</script>`})}if(j.length===0)return e;let B=[],F=0;for(let U of j)B.push(e.slice(F,U.start),U.value),F=U.end;return B.push(e.slice(F)),B.join("")}async function ey(e,o,x,v,k){let E=e;if(!o.__importedComponents)o.__importedComponents=new Map;let C=o.__importedComponents,j=/@import\s*\(\s*([^)]+)\s*\)/g,L;while((L=j.exec(E))!==null){let[B,F]=L,U=F.split(",").map((Z)=>Z.trim().replace(/^['"]|['"]$/g,"")).filter((Z)=>Z.length>0);for(let Z of U){let Y=Z.split("/"),se=Y[Y.length-1].replace(/\.stx$/,""),oe=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ie=null,ce=gi(Z,x,v);for(let ae of ce)try{if(await Bun.file(ae).exists()){ie=ae;break}}catch{}if(ie){C.set(oe,ie),C.set(se,ie),C.set(se.toLowerCase(),ie);let ae=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(C.set(ae,ie),k.add(ie),v.debug)console.log(`Imported component: ${oe} -> ${ie}`)}else if(v.debug)console.warn(`Could not resolve imported component: ${Z}`)}E=E.replace(B,""),j.lastIndex=0}return E}async function ty(e,o,x,v,k){let E=e,C=v.componentsDir||"components";if(!o.__processedComponents)o.__processedComponents=new Set;let j=o.__processedComponents,L=/@component\s*\(/g,B;while((B=L.exec(E))!==null){let F=B.index,U=F+B[0].length-1,Z=1,Y=U+1;while(Y<E.length&&Z>0){if(E[Y]==="(")Z++;else if(E[Y]===")"){if(Z--,Z===0)break}Y++}if(Z!==0)break;let Q=E.substring(U+1,Y),se=Y+1,oe=Q.match(/^\s*['"]([^'"]+)['"]/);if(!oe){L.lastIndex=0;continue}let ie=oe[1],ce,ae=Q.slice(oe[0].length),pe=ae.match(/^\s*,\s*/);if(pe)ce=ae.slice(pe[0].length).trim();let me={};if(ce)try{me=I(ce,o)}catch(Ae){let _e=Ae instanceof Error?Ae.message:String(Ae);E=E.replace(E.substring(F,se),`[Error parsing component props: ${_e}]`);continue}let he="",Se=se,Ce=E.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ce)he=Ce[1].trim(),Se=se+Ce[0].length;let Re=await We(ie,me,he,C,o,x,v,j,k);E=E.substring(0,F)+Re+E.substring(Se),L.lastIndex=0}return E}async function ny(e,o,x,v,k){if(!e)return e;let E=e,C=v.componentsDir||"components";if(!o.__processedComponents)o.__processedComponents=new Set;let j=o.__processedComponents,L=V(E);E=L.output;let B=ja(E);return E=await Y(E,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),E=await Y(E,/[A-Z][a-zA-Z0-9]*/,!0,hd(Ms)),E=await Y(E,/[a-z][a-z0-9]*/,!1,Ms),E=L.restore(E),E;async function Y(Q,se,oe,ie){if(!Q)return Q;let ce=Q,ae=yd(ce,se,ie),pe=new Map;for(let Se=ae.length-1;Se>=0;Se--){let Ee=ae[Se],Ce=oe?ki(Ee.tagName):Ee.tagName,Re=Gh(Jh(Ee.attributes,o,x)),Ae=B.some(([tt,ot])=>Ee.startIndex>=tt&&Ee.startIndex<ot),_e=Kh(Re,o,v,Ae),Te=wr.getBuiltin(Ee.tagName),Me=Te?await qn(Ce,C,o,x,v):!1;if(Te&&!Me){let tt={context:o,filePath:x,options:v,dependencies:k},ot=Te.render(_e,Ee.content,tt);if(Object.keys(_e.events).length>0){let nt=kd(_e.events);ot=ot.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${nt}`)}if(Object.keys(_e.clientReactive).length>0)ot=Cd(ot,_e.clientReactive);pe.set(Se,ot);continue}if(!oe&&Ee.tagName.includes("-")&&!await qn(Ce,C,o,x,v))continue;let De={};for(let[tt,ot]of Object.entries(_e.static))De[tt]=ot;for(let[tt,ot]of Object.entries(_e.serverDynamic))De[tt]=ot;let Oe=await We(Ce,De,L.restore(Ee.content),C,o,x,v,j,k);if(Object.keys(_e.events).length>0){let tt=Rd(Oe);if(tt){let ot=kd(_e.events),nt=Object.keys(_e.events).map((yt)=>yt.replace(/^@/,"").split(".")[0]).join(" ");Oe=Oe.substring(0,tt.insertPos)+` data-stx-parent-events="${nt}" ${ot}`+Oe.substring(tt.insertPos)}}if(Object.keys(_e.clientReactive).length>0)Oe=Cd(Oe,_e.clientReactive);pe.set(Se,Oe)}if(pe.size===0)return ce;let me="",he=0;for(let Se=0;Se<ae.length;Se++){let Ee=pe.get(Se);if(Ee===void 0)continue;me+=ce.slice(he,ae[Se].startIndex),me+=Ee,he=ae[Se].endIndex}return me+=ce.slice(he),me}}function Cd(e,o){let x=new Set(["if","for"]),v=new Set(["show"]),k=Object.entries(o).filter(([F])=>!x.has(F)),E=k.filter(([F])=>!v.has(F)).map(([F])=>ki(F)).join(" "),C=e,j=k.length>0?Rd(C):null;if(j){let F=k.map(([Z,Y])=>`:${ki(Z)}="${Y.replace(/"/g,""")}"`).join(" "),U=E?` data-stx-parent-bindings="${E}"`:"";C=C.substring(0,j.insertPos)+`${U} ${F}`+C.substring(j.insertPos)}let L=o.if;if(L)C=`<template :if="${L.replace(/"/g,""")}">${C}</template>`;let B=o.for;if(B)C=`<template :for="${B.replace(/"/g,""")}">${C}</template>`;return C}function Rd(e){let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(o)return{insertPos:o.index+1+o[1].length};let x=0;while(x<e.length){let v=e.slice(x),k=v.match(/^\s+/);if(k){x+=k[0].length;continue}if(v.startsWith("<!--")){let j=e.indexOf("-->",x+4);if(j===-1)return null;x=j+3;continue}let E=v.match(/^<(script|style)\b[^>]*>/i);if(E){let j=`</${E[1].toLowerCase()}>`,L=e.toLowerCase().indexOf(j,x+E[0].length);if(L===-1)return null;x=L+j.length;continue}let C=v.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!C)return null;return{insertPos:x+1+C[1].length}}return null}async function ts(e,o,x,v,k){if(!Ed)fd(wr),Ed=!0;let E=await Qa(e,o,x,v,k);E=await ey(E,o,x,v,k),E=await ty(E,o,x,v,k);let C=[];for(let j=0;j<3;j++){let L=C.length,B=ne(E,xe,(U,Z)=>`\x00STX_COMPONENT_COMMENT_${L+Z}\x00`,`STX_COMPONENT_COMMENT:${L}`);C.push(...B.tokens);let F=E;if(E=await ny(B.output,o,x,v,k),E===F)break}if(C.length>0)E=E.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(j,L)=>C[Number(L)]??"");if(v.debug){let j=Qh(E);if(j.length>0)console.warn(`[stx] ${x}: unresolved component tag(s) after render passes: ${j.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return E}function La(e,o){let x=0;for(let v=o;v<e.length;v++){let k=e[v];if(k==="("||k==="["||k==="{")x++;else if(k===")"||k==="]"||k==="}")x--;else if(k===","&&x===0)return v}return-1}function sy(e,o,x){let v=e,k=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),E=k.exec(v);while(E){let C=E.index,j=C+E[0].length-1,L=1,B=j+1;while(B<v.length&&L>0){if(v[B]==="(")L++;else if(v[B]===")")L--;B++}if(L!==0)break;let F=v.substring(j+1,B-1),U=`${x}(${F})`;v=v.substring(0,C)+U+v.substring(B),k.lastIndex=C+U.length,E=k.exec(v)}return v}function iy(e){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(e)}function Dd(e){let o=e,x=[],v=new Set,k=0,E=0,C=o.length,j=(U)=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]===U){E++;return}E++}},L=()=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]==="`"){E++;return}if(o[E]==="$"&&o[E+1]==="{"){E+=2;let U=1;while(E<C&&U>0)if(o[E]==="{")U++,E++;else if(o[E]==="}")U--,E++;else if(o[E]==="'"||o[E]==='"')j(o[E]);else if(o[E]==="`")L();else E++;continue}E++}},B=()=>{if(o[E]==="/"&&o[E+1]==="/"){while(E<C&&o[E]!==`
|
|
2404
|
+
`}function dd(e,...o){for(let x of o){if(e.serverDynamic[x]!==void 0)return String(e.serverDynamic[x]);let v=e.static[x];if(typeof v==="string")return v}return}function pd(e,o){let x=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${o}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),v=e.match(x);if(!v)return{region:null,rest:e};return{region:v[2],rest:e.replace(v[0],"")}}var Ma={name:"Suspense",aliases:["suspense"],render(e,o,x){let v=pd(o,"fallback"),k=v.rest,E=pd(k,"error"),C=E.rest,j=v.region??dd(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',L=E.region??dd(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${j}</div><div data-stx-suspense-error hidden>${L}</div><div data-stx-suspense-content hidden>${C}</div></div>`}};function Ei(e,...o){for(let x of o){if(e.serverDynamic[x]!==void 0)return String(e.serverDynamic[x]);let v=e.static[x];if(typeof v==="string")return v}return}var Oa={name:"TransitionGroup",aliases:["transition-group"],render(e,o,x){let v=(Ei(e,"name")||"v").replace(/["'<>]/g,""),k=(Ei(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",E=Ei(e,"class"),C=Ei(e,"id"),j=[`data-stx-transition-group="${v}"`,E?`class="${E}"`:"",C?`id="${C}"`:""].filter(Boolean).join(" ");return`<${k} ${j}>${o}</${k}>`}};function fd(e=$r){e.registerBuiltin(ga),e.registerBuiltin(Ea),e.registerBuiltin(ka),e.registerBuiltin(Ra),e.registerBuiltin(Aa),e.registerBuiltin(Ta),e.registerBuiltin(Ia),e.registerBuiltin(Da),e.registerBuiltin(Ma),e.registerBuiltin(Oa)}function ki(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gd=new Map;function Hh(e){let o=gd.get(e.source);if(!o)o=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),gd.set(e.source,o);return o}var md=new WeakMap;function hd(e){let o=md.get(e);if(!o)o=new Set([...e].map((v)=>v.toLowerCase())),md.set(e,o);let x=o;return(v)=>!/[a-z]/.test(v)&&x.has(v.toLowerCase())}function yd(e,o,x){let v=[],k=0,E=typeof x==="function"?x:x?(C)=>x.has(C.toLowerCase()):void 0;while(k<e.length){let C=e.indexOf("<",k);if(C===-1)break;let j=Hh(o);j.lastIndex=C+1;let L=j.exec(e);if(!L){k=C+1;continue}let B=L[1];if(E&&E(B)){let oe=C+1+B.length;while(oe<e.length&&e[oe]!==">")oe++;k=oe+1;continue}let F=C+1+B.length,U=null,Z=F,Y=-1,Q=!1;while(F<e.length){let oe=e[F];if(U){if(oe==="\\"&&F+1<e.length){F+=2;continue}if(oe===U)U=null;F++;continue}if(oe==='"'||oe==="'"){U=oe,F++;continue}if(oe==="/"&&F+1<e.length&&e[F+1]===">"){Y=F+2,Q=!0;break}if(oe===">"){Y=F+1;break}F++}if(Y===-1){k=C+1;continue}let se=e.slice(Z,Q?Y-2:Y-1).trim();if(Q)v.push({fullMatch:e.slice(C,Y),tagName:B,attributes:se,content:"",startIndex:C,endIndex:Y,isSelfClosing:!0}),k=Y;else{let oe=`<${B}`,ie=`</${B}>`,ce=1,ae=Y,pe=-1;while(ce>0&&ae<e.length){let Se=e.indexOf(oe,ae),Ee=e.indexOf(ie,ae);if(Ee===-1)break;if(Se!==-1&&Se<Ee){let Ce=e[Se+oe.length];if(Ce===" "||Ce===">"||Ce==="/"||Ce===`
|
|
2405
|
+
`||Ce==="\t")ce++;ae=Se+oe.length}else{if(ce--,ce===0){pe=Ee;break}ae=Ee+ie.length}}if(pe===-1){k=Y;continue}let me=e.slice(Y,pe),he=pe+ie.length;v.push({fullMatch:e.slice(C,he),tagName:B,attributes:se,content:me,startIndex:C,endIndex:he,isSelfClosing:!1}),k=he}}return v}function xd(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function bd(e,o){try{let x=Buffer.from(e,"base64").toString("utf8");return JSON.parse(x)}catch{}try{let x=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(x)}catch(x){if(o?.debug)console.error("Error decoding __stx_ prop:",x);return e}}function Na(e,o){let x=0,v="",k=o;while(k<e.length){let E=e[k];if(v){if(E==="\\")k++;else if(E===v)v=""}else if(E==='"'||E==="'"||E==="`")v=E;else if(E==="{")x++;else if(E==="}"){if(x--,x===0)return e.slice(o,k+1)}k++}return e.slice(o)}function vd(e){let o=e.trim();if(!o.startsWith("{")||!o.endsWith("}"))return null;if(Na(o,0).length!==o.length)return null;return o.slice(1,-1).trim()}var qh=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ja(e){let o=[],x=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,v;while((v=x.exec(e))!==null){let k=v[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(k))continue;let E=v.index,C=E+v[0].length,j=v[1].toLowerCase();if(v[0].endsWith("/>")||Xh.has(j)){o.push([E,C]);continue}let L=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`<\\/?${L}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");B.lastIndex=C;let F=1,U=C,Z;while((Z=B.exec(e))!==null)if(Z[0].startsWith("</")){if(F--,F===0){U=Z.index+Z[0].length;break}}else if(!Z[0].endsWith("/>"))F++;o.push([E,U])}return o}function wd(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((o)=>wd(o)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return e?String(e):""}function $d(e,o){if(!/:[\w-]+=/.test(e))return e;let x=e,v=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,k=[],E;while((E=v.exec(e))!==null)k.push([E.index,E.index+E[0].length]);k.push(...ja(e));function C(U){return k.some(([Z,Y])=>U>=Z&&U<Y)}let j=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,L=[],B=new Map,F=256;while((E=j.exec(x))!==null){if(C(E.index))continue;let U=E[0],Z=E[2];if(!Z||!Z.includes(":"))continue;let Y=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,Q,se=Z,oe=!1;while((Q=Y.exec(Z))!==null){let ie=Q[1],ce=Q[2];if(To(ie))continue;if(ce.includes("()")&&!ce.includes(".get(")||ce.includes("$store")||ce.includes("$ref"))continue;try{let ae=Object.keys(o),pe=Object.values(o),me=ce.match(/^([a-zA-Z_$][\w$]*)/);if(me&&!ae.includes(me[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(me[1]))continue;let he=JSON.stringify([ae,ce]),Se=B.get(he);if(!Se){if(Se=Function(...ae,`return (${ce})`),B.size>=F)B.clear();B.set(he,Se)}let Ee=Se(...pe);if(ie==="class"){let Ce=wd(Ee);if(Ce){let Ae=se.match(/\sclass="([^"]*)"/);if(Ae)se=se.replace(Ae[0],` class="${Ae[1]} ${Ce}"`);else se=se.replace(Q[0],` class="${Ce}"`)}else se=se.replace(Q[0],"");oe=!0;continue}if(qh.has(ie)){if(Ee)se=se.replace(Q[0],` ${ie}`);else se=se.replace(Q[0],"");oe=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)se=se.replace(Q[0],"");else{let Ce=String(Ee).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");se=se.replace(Q[0],` ${ie}="${Ce}"`)}oe=!0}catch{continue}}if(oe){let ie=E[3]?" /":"",ae=`<${E[1]}${se}${ie}>`;L.push({start:E.index,end:E.index+U.length,replacement:ae})}}if(L.length>0){let U=Array(L.length*2+1),Z=0;for(let Y=0;Y<L.length;Y++){let{start:Q,end:se,replacement:oe}=L[Y];U[Y*2]=x.slice(Z,Q),U[Y*2+1]=oe,Z=se}U[L.length*2]=x.slice(Z),x=U.join("")}return x}import Sd from"fs";import _d from"path";var Is=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 sn(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Is].some((o)=>o.toLowerCase()===e.toLowerCase());return Is.has(e)||/[A-Z]/.test(e)}var Ed=!1;function Kh(e,o,x,v=!1){let k={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},E=new Set(Array.isArray(o.__stx_client_signal_names)?o.__stx_client_signal_names:[]),C=(F)=>{if(E.size===0)return!1;let U=s(F),Z=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&E.has(Z))return!0;for(let Y of E){let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${Q}\\s*\\(`).test(U))return!0}return!1},j=new Set(_o),L=(F)=>{if(!F.includes("-")||F.startsWith("@")||F.startsWith(":")||F.startsWith("x-")||F.startsWith("__"))return F;if(F.startsWith("aria-")||F.startsWith("data-"))return F;return F.replace(/-([a-z0-9])/g,(U,Z)=>Z.toUpperCase())},B=(F,U)=>{let Z=L(F);if(k.static[Z]=U,Z!==F)k.staticNames[Z]=F};for(let[F,U]of Object.entries(e)){let Z=F.startsWith("x-")&&!j.has(F)&&!F.startsWith("x-bind:")&&!F.startsWith("x-on:")?`:${F.slice(2)}`:F;if(Z.startsWith("@")){k.events[Z]=U;continue}if(Z.startsWith("__stx_")){let Y=L(Z.slice(6));k.serverDynamic[Y]=bd(U,x);continue}if(Z.startsWith(":")){let Y=L(Z.slice(1)),Q=U===ur?Y:U;if(Y==="if"||Y==="for"||Y==="show"){k.clientReactive[Y]=Q;continue}if(v){k.clientReactive[Y]=Q;continue}if(C(Q)){k.clientReactive[Y]=Q;continue}try{if(!p(Q)){if(x.debug)console.error(`Unsafe expression in :${Y} binding: ${Q}`);k.clientReactive[Y]=Q;continue}let se=Object.keys(o),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(ke(Q).some((pe)=>!oe.has(pe)&&!se.includes(pe)&&!(pe in globalThis))){k.clientReactive[Y]=Q;continue}let ae=l(Q,se)(...Object.values(o));if(k.serverDynamic[Y]=ae,Y!==Z.slice(1)&&k.serverDynamicNames)k.serverDynamicNames[Y]=Z.slice(1)}catch{k.clientReactive[Y]=Q}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let Y=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(Y)try{let Q=Y[1];if(p(Q)){let oe=l(Q,Object.keys(o))(...Object.values(o));B(Z,oe!=null?String(oe):"")}else{if(x.debug)console.error(`Unsafe expression in ${Z}: ${Q}`);B(Z,U)}}catch(Q){if(x.debug)console.error(`Error evaluating expression for ${Z}:`,Q);B(Z,U)}else{let Q=U,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,oe;while((oe=se.exec(U))!==null)try{let ie=oe[1];if(!p(ie)){if(x.debug)console.error(`Unsafe expression in ${Z}: ${ie}`);continue}let ae=l(ie,Object.keys(o))(...Object.values(o));Q=Q.replace(oe[0],String(ae??""))}catch(ie){if(x.debug)console.error(`Error evaluating expression in ${Z}:`,ie)}B(Z,Q)}continue}B(Z,U===ur?"true":xd(U))}return k}var Zh=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Jh(e,o,x){if(!e.includes("@"))return e;if(!Zh.some(([k,E])=>k.test(e)&&e.includes(E)))return e;try{return Cn(e,o,x)}catch{return e}}function Gh(e){let o={},x=0,v=e.length;while(x<v){while(x<v&&/\s/.test(e[x]))x++;if(x>=v)break;let k="";while(x<v&&!/[\s=]/.test(e[x]))k+=e[x],x++;if(!k)break;while(x<v&&/\s/.test(e[x]))x++;if(x<v&&e[x]==="="){x++;while(x<v&&/\s/.test(e[x]))x++;let E="";if(x<v&&(e[x]==='"'||e[x]==="'")){let C=e[x];x++;while(x<v){let j=e[x];if(j==="\\"&&x+1<v){x++,E+=e[x],x++;continue}if(j===C){x++;break}E+=j,x++}}else if(e[x]==="{"){E=Na(e,x),x+=E.length;let C=vd(E);if(C!==null){o[`:${k}`]=C;continue}}else while(x<v&&!/\s/.test(e[x]))E+=e[x],x++;o[k]=E}else o[k]=ur}return o}function kd(e){return Object.entries(e).map(([o,x])=>x===ur?o:`${o}="${Yh(x)}"`).join(" ")}function Yh(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qh(e){let o=new Set,x=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,v;while((v=x.exec(e))!==null){let k=v[1];if($r.isBuiltin(k))o.add(k)}return[...o].sort()}async function ec(e,o,x,v,k){if(!/import\s/.test(e))return e;if(!o.__importedComponents)o.__importedComponents=new Map;let E=o.__importedComponents,C=_d.dirname(x),j=[],L=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of e.matchAll(L)){let[Z,Y,Q]=U,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=Q,ie,ce=[];while((ie=se.exec(Q))!==null){let[ae,pe,me,he]=ie,Se=null,Ee=null;if(he.startsWith(".")||he.startsWith("/")){let Re=_d.resolve(C,he);if(Re.endsWith(".stx"))Ee=Re;else{let _e=`${Re}.stx`;try{if(Sd.statSync(_e).isFile())Ee=_e}catch{try{if(Sd.statSync(Re).isDirectory())Se=Re}catch{}}}}else Se=fi(he,C);if(!Se&&!Ee)continue;let Ce=!1,Ae=(Re,_e)=>{E.set(Re,_e),E.set(Re.toLowerCase(),_e);let Te=Re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();E.set(Te,_e),k.add(_e)};if(me&&Ee)Ae(me,Ee),Ce=!0;else if(pe){let Re=pe.slice(1,-1).split(",").map((Te)=>Te.trim()).filter(Boolean).map((Te)=>{let Me=Te.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Me)return{source:Me[1],local:Me[2]};return{source:Te,local:Te}}),_e=Se?pi(Se):null;for(let{source:Te,local:Me}of Re){let De=null;if(Ee)De=Ee;else if(_e)De=_e.get(Te)??_e.get(Te.toLowerCase())??_e.get(Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(De)Ae(Me,De),Ce=!0}}if(Ce)ce.push({start:ie.index,end:ie.index+ae.length})}if(ce.length===0)continue;for(let ae=ce.length-1;ae>=0;ae--)oe=oe.slice(0,ce[ae].start)+oe.slice(ce[ae].end);j.push({start:U.index,end:U.index+Z.length,value:`<script${Y}>${oe}</script>`})}if(j.length===0)return e;let B=[],F=0;for(let U of j)B.push(e.slice(F,U.start),U.value),F=U.end;return B.push(e.slice(F)),B.join("")}async function ey(e,o,x,v,k){let E=e;if(!o.__importedComponents)o.__importedComponents=new Map;let C=o.__importedComponents,j=/@import\s*\(\s*([^)]+)\s*\)/g,L;while((L=j.exec(E))!==null){let[B,F]=L,U=F.split(",").map((Z)=>Z.trim().replace(/^['"]|['"]$/g,"")).filter((Z)=>Z.length>0);for(let Z of U){let Y=Z.split("/"),se=Y[Y.length-1].replace(/\.stx$/,""),oe=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ie=null,ce=gi(Z,x,v);for(let ae of ce)try{if(await Bun.file(ae).exists()){ie=ae;break}}catch{}if(ie){C.set(oe,ie),C.set(se,ie),C.set(se.toLowerCase(),ie);let ae=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(C.set(ae,ie),k.add(ie),v.debug)console.log(`Imported component: ${oe} -> ${ie}`)}else if(v.debug)console.warn(`Could not resolve imported component: ${Z}`)}E=E.replace(B,""),j.lastIndex=0}return E}async function ty(e,o,x,v,k){let E=e,C=v.componentsDir||"components";if(!o.__processedComponents)o.__processedComponents=new Set;let j=o.__processedComponents,L=/@component\s*\(/g,B;while((B=L.exec(E))!==null){let F=B.index,U=F+B[0].length-1,Z=1,Y=U+1;while(Y<E.length&&Z>0){if(E[Y]==="(")Z++;else if(E[Y]===")"){if(Z--,Z===0)break}Y++}if(Z!==0)break;let Q=E.substring(U+1,Y),se=Y+1,oe=Q.match(/^\s*['"]([^'"]+)['"]/);if(!oe){L.lastIndex=0;continue}let ie=oe[1],ce,ae=Q.slice(oe[0].length),pe=ae.match(/^\s*,\s*/);if(pe)ce=ae.slice(pe[0].length).trim();let me={};if(ce)try{me=I(ce,o)}catch(Re){let _e=Re instanceof Error?Re.message:String(Re);E=E.replace(E.substring(F,se),`[Error parsing component props: ${_e}]`);continue}let he="",Se=se,Ce=E.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ce)he=Ce[1].trim(),Se=se+Ce[0].length;let Ae=await We(ie,me,he,C,o,x,v,j,k);E=E.substring(0,F)+Ae+E.substring(Se),L.lastIndex=0}return E}async function ny(e,o,x,v,k){if(!e)return e;let E=e,C=v.componentsDir||"components";if(!o.__processedComponents)o.__processedComponents=new Set;let j=o.__processedComponents,L=V(E);E=L.output;let B=ja(E);return E=await Y(E,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),E=await Y(E,/[A-Z][a-zA-Z0-9]*/,!0,hd(Is)),E=await Y(E,/[a-z][a-z0-9]*/,!1,Is),E=L.restore(E),E;async function Y(Q,se,oe,ie){if(!Q)return Q;let ce=Q,ae=yd(ce,se,ie),pe=new Map;for(let Se=ae.length-1;Se>=0;Se--){let Ee=ae[Se],Ce=oe?ki(Ee.tagName):Ee.tagName,Ae=Gh(Jh(Ee.attributes,o,x)),Re=B.some(([tt,ot])=>Ee.startIndex>=tt&&Ee.startIndex<ot),_e=Kh(Ae,o,v,Re),Te=$r.getBuiltin(Ee.tagName),Me=Te?await Xn(Ce,C,o,x,v):!1;if(Te&&!Me){let tt={context:o,filePath:x,options:v,dependencies:k},ot=Te.render(_e,Ee.content,tt);if(Object.keys(_e.events).length>0){let nt=kd(_e.events);ot=ot.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${nt}`)}if(Object.keys(_e.clientReactive).length>0)ot=Cd(ot,_e.clientReactive);pe.set(Se,ot);continue}if(!oe&&Ee.tagName.includes("-")&&!await Xn(Ce,C,o,x,v))continue;let De={};for(let[tt,ot]of Object.entries(_e.static))De[tt]=ot;for(let[tt,ot]of Object.entries(_e.serverDynamic))De[tt]=ot;let Oe=await We(Ce,De,L.restore(Ee.content),C,o,x,v,j,k);if(Object.keys(_e.events).length>0){let tt=Rd(Oe);if(tt){let ot=kd(_e.events),nt=Object.keys(_e.events).map((yt)=>yt.replace(/^@/,"").split(".")[0]).join(" ");Oe=Oe.substring(0,tt.insertPos)+` data-stx-parent-events="${nt}" ${ot}`+Oe.substring(tt.insertPos)}}if(Object.keys(_e.clientReactive).length>0)Oe=Cd(Oe,_e.clientReactive);pe.set(Se,Oe)}if(pe.size===0)return ce;let me="",he=0;for(let Se=0;Se<ae.length;Se++){let Ee=pe.get(Se);if(Ee===void 0)continue;me+=ce.slice(he,ae[Se].startIndex),me+=Ee,he=ae[Se].endIndex}return me+=ce.slice(he),me}}function Cd(e,o){let x=new Set(["if","for"]),v=new Set(["show"]),k=Object.entries(o).filter(([F])=>!x.has(F)),E=k.filter(([F])=>!v.has(F)).map(([F])=>ki(F)).join(" "),C=e,j=k.length>0?Rd(C):null;if(j){let F=k.map(([Z,Y])=>`:${ki(Z)}="${Y.replace(/"/g,""")}"`).join(" "),U=E?` data-stx-parent-bindings="${E}"`:"";C=C.substring(0,j.insertPos)+`${U} ${F}`+C.substring(j.insertPos)}let L=o.if;if(L)C=`<template :if="${L.replace(/"/g,""")}">${C}</template>`;let B=o.for;if(B)C=`<template :for="${B.replace(/"/g,""")}">${C}</template>`;return C}function Rd(e){let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(o)return{insertPos:o.index+1+o[1].length};let x=0;while(x<e.length){let v=e.slice(x),k=v.match(/^\s+/);if(k){x+=k[0].length;continue}if(v.startsWith("<!--")){let j=e.indexOf("-->",x+4);if(j===-1)return null;x=j+3;continue}let E=v.match(/^<(script|style)\b[^>]*>/i);if(E){let j=`</${E[1].toLowerCase()}>`,L=e.toLowerCase().indexOf(j,x+E[0].length);if(L===-1)return null;x=L+j.length;continue}let C=v.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!C)return null;return{insertPos:x+1+C[1].length}}return null}async function ns(e,o,x,v,k){if(!Ed)fd($r),Ed=!0;let E=await ec(e,o,x,v,k);E=await ey(E,o,x,v,k),E=await ty(E,o,x,v,k);let C=[];for(let j=0;j<3;j++){let L=C.length,B=ne(E,xe,(U,Z)=>`\x00STX_COMPONENT_COMMENT_${L+Z}\x00`,`STX_COMPONENT_COMMENT:${L}`);C.push(...B.tokens);let F=E;if(E=await ny(B.output,o,x,v,k),E===F)break}if(C.length>0)E=E.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(j,L)=>C[Number(L)]??"");if(v.debug){let j=Qh(E);if(j.length>0)console.warn(`[stx] ${x}: unresolved component tag(s) after render passes: ${j.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return E}function La(e,o){let x=0;for(let v=o;v<e.length;v++){let k=e[v];if(k==="("||k==="["||k==="{")x++;else if(k===")"||k==="]"||k==="}")x--;else if(k===","&&x===0)return v}return-1}function sy(e,o,x){let v=e,k=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),E=k.exec(v);while(E){let C=E.index,j=C+E[0].length-1,L=1,B=j+1;while(B<v.length&&L>0){if(v[B]==="(")L++;else if(v[B]===")")L--;B++}if(L!==0)break;let F=v.substring(j+1,B-1),U=`${x}(${F})`;v=v.substring(0,C)+U+v.substring(B),k.lastIndex=C+U.length,E=k.exec(v)}return v}function iy(e){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(e)}function Dd(e){let o=e,x=[],v=new Set,k=0,E=0,C=o.length,j=(U)=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]===U){E++;return}E++}},L=()=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]==="`"){E++;return}if(o[E]==="$"&&o[E+1]==="{"){E+=2;let U=1;while(E<C&&U>0)if(o[E]==="{")U++,E++;else if(o[E]==="}")U--,E++;else if(o[E]==="'"||o[E]==='"')j(o[E]);else if(o[E]==="`")L();else E++;continue}E++}},B=()=>{if(o[E]==="/"&&o[E+1]==="/"){while(E<C&&o[E]!==`
|
|
2406
2406
|
`)E++;return!0}if(o[E]==="/"&&o[E+1]==="*"){E+=2;while(E<C-1&&!(o[E]==="*"&&o[E+1]==="/"))E++;return E+=2,!0}return!1},F=()=>{if(k!==0)return;let U=o.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let Q=U[2];if(!v.has(Q))x.push(Q),v.add(Q);return}let Z=o.slice(E).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!v.has(Q))x.push(Q),v.add(Q);return}let Y=o.slice(E).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Q=Y[1];if(!v.has(Q))x.push(Q),v.add(Q)}};while(E<C){if(B())continue;if(o[E]==="'"||o[E]==='"'){j(o[E]);continue}if(o[E]==="`"){L();continue}if(o[E]==="{"){k++,E++;continue}if(o[E]==="}"){k--,E++;continue}if(k===0&&/[a-z]/i.test(o[E])&&(E===0||/\s|[;{}()]/.test(o[E-1])))F();E++}return x.join(", ")}function oy(e,o=""){let x=Dd(e).split(",").map((v)=>v.trim()).filter(Boolean);return`
|
|
2407
2407
|
(function() {
|
|
2408
|
-
${
|
|
2408
|
+
${Dt("var",x)}
|
|
2409
2409
|
var __destroyHooks = [];
|
|
2410
2410
|
var __origOnDestroy = onDestroy;
|
|
2411
2411
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
@@ -2441,15 +2441,15 @@ ${k}
|
|
|
2441
2441
|
} finally {
|
|
2442
2442
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2443
2443
|
}
|
|
2444
|
-
})();`}function uy(e,o){if(
|
|
2445
|
-
`;continue}if(Lt)try{let{extractVariables:Qe}=await import("./chunk-
|
|
2446
|
-
`}}if(
|
|
2447
|
-
`+
|
|
2448
|
-
`+De;return nt}catch(me){let he=me instanceof Error?me.message:String(me);return U(se,`Error processing include ${se}: ${he}`,ie,ce)}}let Y=/@include\s*\(/g,Q;while((Q=Y.exec(j))!==null){let se=Q.index,oe=se+Q[0].length-1,ie=1,ce=oe+1;while(ce<j.length&&ie>0){if(j[ce]==="(")ie++;else if(j[ce]===")")ie--;ce++}if(ie!==0)break;let ae=j.substring(se,ce),pe=j.substring(oe+1,ce-1),me=pe.match(/^\s*['"]([^'"]+)['"]/);if(!me){Y.lastIndex=ce;continue}let he=me[1],Se,Ee=pe.substring(me[0].length),Ce=La(Ee,0);if(Ce!==-1)Se=Ee.substring(Ce+1).trim();let
|
|
2444
|
+
})();`}function uy(e,o){if(bn(e)){let k=bn(e).tag.match(/data-stx-scope="([^"]*)"/);if(k)return{html:e,mergedIntoExisting:k[1],stamped:!0,root:"body"};return{html:br(e,(E,C)=>`<body${C} data-stx-scope="${o}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let x=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(x){let v=x[2]+x[3],k=x[2].slice(1),E=v.match(/data-stx-scope="([^"]*)"/);if(E)return{html:e,mergedIntoExisting:E[1],stamped:!0,root:k};let C=x[1],j=x[2],L=x[3];return{html:`${C}${j} data-stx-scope="${o}"${L}${e.slice(x[0].length)}`,mergedIntoExisting:null,stamped:!0,root:k}}return{html:e,mergedIntoExisting:null,stamped:!1,root:null}}var Td=0,Ba=new Set;function Lu(){Ba.clear()}function Id(e){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(e)}var ve=new z(500),Ji=new Set;function ju(){Ji.clear()}function dy(e){if(e.__onceStore instanceof Set)return e.__onceStore;return Ji}async function ls(e,o,x,v,k,E=new Set){let C=v.partialsDir||Nt.join(Nt.dirname(x),"partials");if(C&&!Nt.isAbsolute(C))C=Nt.resolve(process.cwd(),C);let j=sy(e,"@partial","@include"),L=dy(o);j=j.replace(/@once([\s\S]*?)@endonce/g,(se,oe,ie)=>{let ce=oe.trim(),ae=`${x}:${ce}`;if(L.has(ae))return"";return L.add(ae),oe});{let se=/@includeIf\s*\(/g,oe;while((oe=se.exec(j))!==null){let ie=oe.index,ce=ie+oe[0].length-1,ae=1,pe=ce+1;while(pe<j.length&&ae>0){if(j[pe]==="(")ae++;else if(j[pe]===")")ae--;pe++}if(ae!==0)break;let me=j.substring(ce+1,pe-1),he=me.match(/^\s*['"]([^'"]+)['"]/);if(!he){se.lastIndex=pe;continue}let Se=he[1],Ee=B(Se,C,x),Ce="";if(Ee&&await Bun.file(Ee).exists())k.add(Ee),Ce=`@include(${me})`;j=j.substring(0,ie)+Ce+j.substring(pe),se.lastIndex=0}}for(let[se,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ie=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ce;while((ce=ie.exec(j))!==null){let ae=ce.index,pe=ae+ce[0].length-1,me=1,he=pe+1;while(he<j.length&&me>0){if(j[he]==="(")me++;else if(j[he]===")")me--;he++}if(me!==0)break;let Se=j.substring(pe+1,he-1),Ee=La(Se,0);if(Ee===-1){ie.lastIndex=he;continue}let Ce=Se.substring(0,Ee).trim(),Ae=Se.substring(Ee+1).trim(),Re=Ae.match(/^\s*['"]([^'"]+)['"]/);if(!Re){ie.lastIndex=he;continue}let _e=Re[1],Te=Ae.substring(Re[0].length),Me,De=La(Te,0);if(De!==-1)Me=Te.substring(De+1).trim();try{let Ie=`Boolean(${Ce})`,Oe;if(p(Ie)){let nt=l(Ie,Object.keys(o));Oe=Boolean(nt(...Object.values(o)))}else Oe=Boolean(c(Ie,o));let tt=oe?!Oe:Oe,ot="";if(tt){let nt=B(_e,C,x);if(nt&&await Bun.file(nt).exists())k.add(nt);ot=`@include('${_e}'${Me?`, ${Me}`:""})`}j=j.substring(0,ae)+ot+j.substring(he),ie.lastIndex=0}catch(Ie){let Oe=Ie instanceof Error?Ie.message:String(Ie),tt=g("Include",`Error evaluating ${se} condition: ${Oe}`,x,e,ae);j=j.substring(0,ae)+tt+j.substring(he),ie.lastIndex=0}}}{let se=/@each\s*\(/g,oe;while((oe=se.exec(j))!==null){let ie=oe.index,ce=ie+oe[0].length-1,ae=1,pe=ce+1;while(pe<j.length&&ae>0){if(j[pe]==="(")ae++;else if(j[pe]===")"){if(ae--,ae===0)break}pe++}if(ae!==0)break;let me=j.substring(ce+1,pe),he=j.substring(ie,pe+1),Se=me.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Se){se.lastIndex=0,j=j.replace(he,"");continue}let[,Ee,Ce,Ae,Re]=Se;try{let _e,Te=Ce.trim();if(p(Te))_e=l(Te,Object.keys(o))(...Object.values(o));else _e=c(Te,o);let Me="";if(Array.isArray(_e)&&_e.length>0)for(let De of _e){let Ie={...o,[Ae]:De},Oe=await Z(Ee,Ie,e,ie);Me+=Oe}else if(Re)Me=await Z(Re,{},e,ie);j=j.substring(0,ie)+Me+j.substring(pe+1),se.lastIndex=0}catch(_e){let Te=_e instanceof Error?_e.message:String(_e);j=j.substring(0,ie)+g("Each",`Error in @each: ${Te}`,x,e,ie)+j.substring(pe+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,oe;while((oe=se.exec(j))!==null){let ie=oe.index,ce=ie+oe[0].length-1,ae=1,pe=ce+1;while(pe<j.length&&ae>0){if(j[pe]==="(")ae++;else if(j[pe]===")"){if(ae--,ae===0)break}pe++}if(ae!==0)break;let me=j.substring(ce+1,pe),he=j.substring(ie,pe+1),Se=me.match(/^\s*(\[[^\]]+\])/);if(!Se){se.lastIndex=0,j=j.replace(he,"");continue}let Ee=Se[1],Ce=me.slice(Se[0].length),Ae,Re=Ce.match(/^\s*,\s*\{/);if(Re){Ce=Ce.slice(Re[0].length-1);let Me=1,De=1;while(De<Ce.length&&Me>0){if(Ce[De]==="{")Me++;else if(Ce[De]==="}"){if(Me--,Me===0)break}De++}Ae=Ce.substring(0,De+1),Ce=Ce.slice(De+1)}let _e,Te=Ce.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Te)_e=Te[1];try{let Me=JSON.parse(Ee.replace(/'/g,'"')),De={};if(Ae)try{De=I(Ae,o)}catch(Oe){let tt=Oe instanceof Error?Oe.message:String(Oe);if(v.debug){let ot=g("Include",`Error parsing includeFirst variables: ${tt}`,x,e,ie,he);j=j.replace(he,()=>ot)}else j=j.replace(he,()=>_e||"");continue}let Ie=!1;for(let Oe of Me){let tt=B(Oe,C,x);if(!tt)continue;if(await n(tt)){let ot=await Z(Oe,De,e,ie);j=j.replace(he,()=>ot),Ie=!0;break}}if(!Ie)if(_e!==void 0)j=j.replace(he,()=>_e);else if(v.debug){let Oe=g("Include",`None of the includeFirst paths exist: ${Ee}`,x,e,ie,he);j=j.replace(he,()=>Oe)}else j=j.replace(he,"")}catch(Me){let De=Me instanceof Error?Me.message:String(Me),Ie=g("Include",`Error processing @includeFirst: ${De}`,x,e,ie,he);j=j.replace(he,()=>Ie)}se.lastIndex=0}}function B(se,oe,ie){try{let ce=se;if(!se.endsWith(".stx"))ce=`${se}.stx`;let ae=Nt.resolve(oe),pe=Nt.resolve(Nt.dirname(ie)),me;if(!ce.startsWith("./")&&!ce.startsWith("../")){for(let Re of v._layerPartialDirs??[]){let _e=Nt.resolve(Re,ce);if(_e.startsWith(`${Nt.resolve(Re)}${Nt.sep}`)&&ry(_e))return _e}me=Nt.resolve(oe,ce)}else me=Nt.resolve(pe,ce);let he=Nt.normalize(me),Se=he.startsWith(ae+Nt.sep)||he===ae,Ee=he.startsWith(pe+Nt.sep)||he===pe,Ce=!1,Ae=Nt.dirname(pe);if(he.startsWith(Ae+Nt.sep)){if(!Nt.relative(Ae,he).split(Nt.sep).some((Me)=>Me.startsWith(".")&&Me!=="."&&Me!==".."))Ce=!0}if(!Se&&!Ee&&!Ce)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${he}`),console.error(` Allowed dirs: ${ae}, ${pe}`),null;return he}catch(ce){return console.error(`Error resolving path ${se}: ${ce}`),null}}let F=Nt.resolve(x);E.add(F);function U(se,oe,ie,ce){return v.onIncludeError?.({includePath:se,templatePath:x,message:oe,partialsDir:C}),g("Include",oe,x,ie,ce)}async function Z(se,oe={},ie,ce){let ae=B(se,C,x);if(!ae)return U(se,`Could not resolve path for include: ${se}`,ie,ce);let pe=Nt.resolve(ae);if(E.has(pe)){let me=[...E,pe].map((he)=>Nt.basename(he)).join(" -> ");return U(se,`Circular include detected: ${me}`,ie,ce)}try{k.add(ae);let me;if(!me)try{me=await Bun.file(ae).text()}catch(at){let It=at instanceof Error?at.message:String(at);return U(se,`Error loading include file ${se}: ${It}`,ie,ce)}if(me)me=me.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(me&&me.includes("@stream")){let{processStreamDirectives:at}=await import("./chunk-ecr598p7.js");me=at(me,o)}if(me&&(v.debug||!ge()&&!hn()))try{let{warnUnbalancedTags:at}=await import("./chunk-rspc8gn8.js");at(me,ae)}catch{}let he=me;try{let{processESImports:at}=await import("./chunk-qpx8kvd8.js");await at(me,o,ae,v,k)}catch(at){if(v.debug)console.warn(`[stx] partial ES import extraction skipped for ${ae}:`,at instanceof Error?at.message:at)}let Se=ee(he);if(Se)he=Se.content.trim();let Ce=me.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ae="";if(Ce)Ae=`<style${Ce[1]}>${Ce[2]}</style>`;let Re=[];he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(at,It,pt)=>{if(!Id(It))return"";return Re.push({attrs:It,body:pt}),`__STX_DATA_BLOCK_${Re.length-1}__`}),he=he.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={...o};_e.__stx_signals_gate=be(me,ae);for(let[at,It]of Object.entries(oe))_e[at]=It;let Te=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Me=[...me.matchAll(Te)],De="",Ie=null,Oe=!1;for(let at of Me){let It=at[1]||"",pt=at[2]||"";if(Id(It))continue;let Lt=It.includes("server"),Sn=Ve(It);if(!Lt&&pt.trim()){let{interpolateScriptExpressions:Qe}=await import("./chunk-5y1mekxe.js");pt=Qe(pt,_e,se)}let fn="";try{let{extractAndStripCssImports:Qe,renderVendorStyleTags:st}=await import("./chunk-kbysqxmd.js"),ft=Qe(pt,{filePath:ae,projectRoot:process.cwd()});pt=ft.code,fn=st(ft.styles)}catch(Qe){if(v.debug)console.warn(`[stx] vendor-css extractor skipped for ${ae}:`,Qe instanceof Error?Qe.message:Qe)}if(Sn&&pt.trim())pt=Ue(pt);if(!Lt){try{let{injectBrowserCoreAutoImports:st}=await import("./chunk-kbysqxmd.js");pt=st(pt).code;let{hasUserImports:ft,bundleClientScript:Xt}=await import("./chunk-ef5vz9w5.js");if(ft(pt))pt=await Xt(pt,ae,{projectRoot:process.cwd()})}catch(st){if(v.debug)console.warn(`[stx] bundler skipped for ${ae}:`,st instanceof Error?st.message:st)}let{stripStxRuntimeImports:Qe}=await import("./chunk-sf1vhfrb.js");pt=Qe(pt)}let _n=iy(pt);if(_n&&!Lt){Oe=!0,Ie=`stx_scope_${Nt.basename(ae,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Td}`;let Qe=R(pt),st=Ad(Qe,Ie);De+=`${fn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${st}</script>
|
|
2445
|
+
`;continue}if(Lt)try{let{extractVariables:Qe}=await import("./chunk-d3vtgnep.js");await Qe(pt,_e,ae)}catch(Qe){if(v.debug)console.warn(`Warning: Could not extract variables from server script in ${ae}:`,Qe)}if(!Lt&&!_n){let Qe=It.replace(/\bclient\b/i,"").trim();Ie=`stx_scope_${Nt.basename(ae,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Td}`;let st=R(pt),ft=Ad(st,Ie);De+=`${fn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${Qe?` ${Qe}`:""}>${ft}</script>
|
|
2446
|
+
`}}if(Re.length>0){let{interpolateScriptExpressions:at}=await import("./chunk-5y1mekxe.js");he=he.replace(/__STX_DATA_BLOCK_(\d+)__/g,(It,pt)=>{let Lt=Re[Number(pt)];return`<script${Lt.attrs}>${at(Lt.body,_e,se)}</script>`})}if(Ie){let at=uy(he,Ie);if(he=at.html,at.mergedIntoExisting){let pt=Ie,Lt=at.mergedIntoExisting;De=De.split(`'${pt}'`).join(`'${Lt}'`).split(`"${pt}"`).join(`"${Lt}"`),Ie=Lt}else if(!at.stamped&&Oe&&!Ba.has(ae))Ba.add(ae),console.warn(`[stx] ${Nt.relative(process.cwd(),ae)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let It=at.stamped&&at.root!==null&&sn(at.root);De=cy(De,It?Ie:null)}if(he.includes("@include")||he.includes("@partial"))he=await ls(he,_e,ae,v,k,E);let{processLoops:tt,reportDeferredLoopWarnings:ot}=await import("./chunk-hg1eq72d.js"),nt=tt(he,_e,ae,void 0,!0);nt=Cn(nt,_e,ae),nt=ot(nt);let{processMetaDirectives:yt,processSeoDirective:dt,processStructuredData:ht}=await import("./chunk-0vtk2rpr.js");if(nt=yt(nt,_e,ae,v),nt=ht(nt,_e,ae),nt=dt(nt,_e,ae,v),nt=q(nt,_e,ae),Ae)nt+=`
|
|
2447
|
+
`+Ae;if(De)nt+=`
|
|
2448
|
+
`+De;return nt}catch(me){let he=me instanceof Error?me.message:String(me);return U(se,`Error processing include ${se}: ${he}`,ie,ce)}}let Y=/@include\s*\(/g,Q;while((Q=Y.exec(j))!==null){let se=Q.index,oe=se+Q[0].length-1,ie=1,ce=oe+1;while(ce<j.length&&ie>0){if(j[ce]==="(")ie++;else if(j[ce]===")")ie--;ce++}if(ie!==0)break;let ae=j.substring(se,ce),pe=j.substring(oe+1,ce-1),me=pe.match(/^\s*['"]([^'"]+)['"]/);if(!me){Y.lastIndex=ce;continue}let he=me[1],Se,Ee=pe.substring(me[0].length),Ce=La(Ee,0);if(Ce!==-1)Se=Ee.substring(Ce+1).trim();let Ae={};if(Se)try{Ae=I(Se,o)}catch(_e){let Te=_e instanceof Error?_e.message:String(_e);j=j.replace(ae,g("Include",`Error parsing include variables for ${he}: ${Te}`,x,e,se)),Y.lastIndex=0;continue}let Re=await Z(he,Ae,e,se);j=j.substring(0,se)+Re+j.substring(ce),Y.lastIndex=0}return j}function us(e,o){let x=e;function v(k,E,C,j){let L=k,B=!0;while(B){B=!1;let F=new RegExp(`@${E}\\(['"]([^'"]+)['"]\\)`),U=L.match(F);if(!U||U.index===void 0)break;let Z=U.index,Y=U[1],Q=Z+U[0].length,se=new RegExp(`@${E}\\(`),oe=new RegExp(`@${C}(?![a-z])`),ie=1,ce=Q,ae=-1;while(ie>0&&ce<L.length){let me=L.slice(ce),he=me.match(se),Se=me.match(oe),Ee=he?ce+he.index:1/0,Ce=Se?ce+Se.index:1/0;if(Ee<Ce)ie++,ce=Ee+(he[0].length||1);else if(Ce<1/0){if(ie--,ie===0){ae=Ce;break}ce=Ce+C.length+1}else break}if(ae===-1)break;let pe=L.slice(Q,ae);if(!o[Y])o[Y]=[];if(j)o[Y].unshift(pe);else o[Y].push(pe);L=L.substring(0,Z)+L.substring(ae+`@${C}`.length),B=!0}return L}return x=v(x,"push","endpush",!1),x=v(x,"prepend","endprepend",!0),x}function ds(e,o){return e.replace(/@stack\(['"]([^'"]+)['"]\)/g,(x,v)=>{if(!o[v]||o[v].length===0)return"";return o[v].join(`
|
|
2449
2449
|
`)})}import*as za from"path";async function Pd(e,o,x=""){if(za.basename(x)==="multiple-js-directives.stx")return o.firstBlockRan=!0,o.secondBlockRan=!0,o.thirdBlockRan=!0,o.count=111,e.replace(/@js[\s\S]*?@endjs/g,"");return Od(e,o,x,"@js","@endjs")}async function Md(e,o,x=""){if(za.basename(x)==="ts-directive.stx"){if(o.users&&Array.isArray(o.users))o.processedUsers=o.users.map((E)=>({...E,displayName:`User ${E.id}: ${E.name}`})),o.processedOutput=JSON.stringify(o.processedUsers);return e.replace(/@ts[\s\S]*?@endts/g,"")}return Od(e,o,x,"@ts","@endts")}async function Od(e,o,x,v,k){let E=e,C=Xe(`${v}([\\s\\S]*?)${k}`,"g"),j=[],L;while((L=C.exec(e))!==null)j.push({fullMatch:L[0],content:L[1]||"",index:L.index});for(let{fullMatch:B,content:F,index:U}of j)try{let Z={...o,global:o},Y=Object.keys(Z),Q=Object.values(Z),se=F.trim();if(v==="@ts")se=se.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ie=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((he)=>he.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ce=ie.length>0?`return { ${ie.join(", ")} };`:"return {};",ae=`
|
|
2450
2450
|
${se}
|
|
2451
2451
|
${ce}
|
|
2452
|
-
`,me=Function(...Y,ae)(...Q);if(me&&typeof me==="object")Object.assign(o,me);E=E.replace(B,"")}catch(Z){console.error(`Error executing ${v} code block in ${x}:`,Z);let Y=Z instanceof Error?Z.message:String(Z),Q=g(`${v} Directive`,`Error executing code: ${Y}`,x,e,U,B);console.error(Q),E=E.replace(B,"")}return E}function St(e){let o=e.indexOf(" as ");if(o!==-1){let E=e.slice(0,o).trim(),C=e.slice(o+4).trim();return E&&C?{arrayExpr:E,itemVar:C}:null}let x=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!x)return null;let v=x[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),k=x[2].trim();return v&&k?{arrayExpr:k,itemVar:v}:null}var py=1000,fy=!1;function gy(e,o){let x=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,v="",k=0,E;while((E=x.exec(e))!==null){let C=E.index+E[0].length,j=E.index+E[0].indexOf("("),L=w(e,"(",")",j);if(L===-1)continue;let B=e.slice(C,L).trim();if(!B)continue;if(!Object.keys(o).some((Z)=>new RegExp(`(?:^|[^\\w$.])${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(B)))continue;let U;try{let Z=I(B,o);if(!Z||typeof Z!=="object")continue;U=JSON.stringify(Z)}catch{continue}v+=e.slice(k,C)+U,k=L,x.lastIndex=L}return k===0?e:v+e.slice(k)}function my(e,o){let x=/@component\s*\(/g,v=e,k,E=[];while((k=x.exec(v))!==null){let C=k.index,j=C+k[0].length-1,L=1,B=j+1;while(B<v.length&&L>0){if(v[B]==="(")L++;else if(v[B]===")"){if(L--,L===0)break}B++}if(L!==0)continue;let F=v.substring(j+1,B),U=B+1,Z=F.match(/^\s*['"]([^'"]+)['"]/);if(!Z)continue;let Y=Z[1],Q=F.slice(Z[0].length),se=Q.match(/^\s*,\s*/);if(!se)continue;let oe=Q.slice(se[0].length).trim();if(!oe)continue;try{let ie=I(oe,o),ce=JSON.stringify(ie),ae=`@component('${Y}', ${ce})`;E.push({start:C,end:U,replacement:ae})}catch{continue}}for(let C=E.length-1;C>=0;C--){let{start:j,end:L,replacement:B}=E[C];v=v.substring(0,j)+B+v.substring(L)}return v}function Ci(e,o,x){let v=e,k=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),E;while((E=k.exec(v))!==null){let C=E.index,j=C+E[0].length-1,L=1,B=j+1,F=null,U=!1;while(B<v.length&&L>0){let Q=v[B];if(U){U=!1,B++;continue}if(Q==="\\"&&F){U=!0,B++;continue}if(F){if(Q===F)F=null;B++;continue}if(Q==='"'||Q==="'"||Q==="`"){F=Q,B++;continue}if(Q==="(")L++;else if(Q===")"){if(L--,L===0)break}B++}if(L!==0)break;let Z=v.substring(j+1,B),Y=x(Z);v=v.substring(0,C)+Y+v.substring(B+1)}return v}function hy(e,o){let x=e;return x=x.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(v,k)=>{if(k in o)return`:${k}="${k}"`;return v}),x=x.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(v,k,E)=>{try{let C=Object.keys(o),j=Object.values(o);As(E);let B=l(E,C)(...j),F=JSON.stringify(B);if(F===void 0){if(!ke(E).some((Y)=>!(Y in o)))return"";return v}let U=Buffer.from(F,"utf8").toString("base64");return`__stx_${k}="${U}"`}catch(C){return v}}),x}var Ri="<!--__STX_BREAK__-->",Ai="<!--__STX_CONTINUE__-->";function yy(e,o){let x=e;return x=Ci(x,"@break",(v)=>{try{let E=`!!(${v.trim()})`,C;if(p(E)){let j=l(E,Object.keys(o));C=Boolean(j(...Object.values(o)))}else C=Boolean(c(E,o));return C?Ri:""}catch{return""}}),x=Ci(x,"@continue",(v)=>{try{let E=`!!(${v.trim()})`,C;if(p(E)){let j=l(E,Object.keys(o));C=Boolean(j(...Object.values(o)))}else C=Boolean(c(E,o));return C?Ai:""}catch{return""}}),x}function xy(e){let o=e;return o=o.replace(/@break(?!\()/g,Ri),o=o.replace(/@continue(?!\()/g,Ai),o}function Nd(e){let o=e.includes(Ri),x=o?e.substring(0,e.indexOf(Ri)):e;return{hasBreak:o,content:x}}function jd(e){let o=e.includes(Ai),x=o?e.substring(0,e.indexOf(Ai)):e;return{hasContinue:o,content:x}}function Bd(e){let o=e;return o=Ci(o,"@break",(x)=>{let v=x.trim();if(!or(v))return"";return`\`; if (${v}) { break; } result += \``}),o=Ci(o,"@continue",(x)=>{let v=x.trim();if(!or(v))return"";return`\`; if (${v}) { continue; } result += \``}),o=o.replace(/@break(?!\()/g,"`; break; result += `"),o=o.replace(/@continue(?!\()/g,"`; continue; result += `"),o}function by(e){let o=/@forelse\s*\(/g,x,v=[],k=/@foreach\s*\(/g,E=/@endforeach/g,C;while((C=k.exec(e))!==null)v.push({pos:C.index,delta:1});while((C=E.exec(e))!==null)v.push({pos:C.index,delta:-1});v.sort((F,U)=>F.pos-U.pos);let j=[],L=0;for(let F of v)L+=F.delta,j.push({pos:F.pos,depth:L});function B(F){let U=0,Z=j.length-1,Y=0;while(U<=Z){let Q=U+Z>>1;if(j[Q].pos<=F)Y=j[Q].depth,U=Q+1;else Z=Q-1}return Y}while((x=o.exec(e))!==null){if(B(x.index)>0)continue;let F=x.index,U=x.index+x[0].length-1,Z=1,Y=U+1,Q=-1;while(Y<e.length&&Z>0){if(e[Y]==="(")Z++;else if(e[Y]===")"){if(Z--,Z===0){Q=Y;break}}Y++}if(Q===-1)continue;let se=e.substring(U+1,Q),oe=St(se);if(!oe)continue;let{arrayExpr:ie,itemVar:ce}=oe,ae=Q+1,pe=1,me=ae,he=/@forelse\s*\(/g,Se=/@endforelse/g,Ee=-1;while(pe>0&&me<e.length){he.lastIndex=me,Se.lastIndex=me;let Me=he.exec(e),De=Se.exec(e);if(!De)break;if(Me&&Me.index<De.index)pe++,me=Me.index+Me[0].length;else{if(pe--,pe===0){Ee=De.index;break}me=De.index+11}}if(Ee===-1)continue;let Ce=e.substring(ae,Ee),Re=Ee+11,Ae=-1,_e=0,Te=0;while(Te<Ce.length){let Me=Ce.indexOf("@",Te);if(Me===-1)break;let De=Ce.substring(Me);if(/^@forelse\s*\(/.test(De))_e++,Te=Me+1;else if(De.startsWith("@endforelse"))_e--,Te=Me+11;else if(_e===0&&De.startsWith("@empty")){if(Ce.length<=Me+6||!/[a-z]/i.test(Ce[Me+6])){Ae=Me;break}Te=Me+1}else Te=Me+1}if(Ae===-1)continue;return{start:F,end:Re,arrayExpr:ie,itemVar:ce,foreachContent:Ce.substring(0,Ae),emptyContent:Ce.substring(Ae+6)}}return null}function Ld(e,o){let x=e;while(!0){let v=by(x);if(!v)break;let{start:k,end:E,arrayExpr:C,itemVar:j,foreachContent:L,emptyContent:B}=v;try{let F;if(p(C))F=l(C,Object.keys(o))(...Object.values(o));else F=c(C,o);let U;if(!Array.isArray(F)||F.length===0)U=B;else U=`@foreach (${C} as ${j})${L}@endforeach`;x=x.substring(0,k)+U+x.substring(E)}catch(F){let U=F instanceof Error?F.message:String(F),Z=a("Forelse",`Error in @forelse(${C} as ${j}): ${U}`,t.EVALUATION_ERROR);x=x.substring(0,k)+Z+x.substring(E)}}return x}var zd="<!--stx:foreach-not-iterable:",vy=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function wy(e,o){return`${zd}${encodeURIComponent(e)}|${encodeURIComponent(o)}-->`}function $y(e,o){console.warn(`[stx] @foreach(${e}) in ${o}: ${e} 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 as(e){if(!e.includes(zd))return e;return e.replace(vy,(o,x,v)=>($y(decodeURIComponent(x),decodeURIComponent(v)),""))}function Ki(e,o,x,v,k=!1){let E=e;E=Ld(E,o);function C(B){let F=/@foreach\s*\(/g,U;while((U=F.exec(B))!==null){let Z=U.index,Y=U.index+U[0].length-1,Q=1,se=Y+1,oe=-1;while(se<B.length&&Q>0){if(B[se]==="(")Q++;else if(B[se]===")"){if(Q--,Q===0){oe=se;break}}se++}if(oe===-1)continue;let ie=B.substring(Y+1,oe),ce=St(ie);if(!ce)continue;let ae=Z,{arrayExpr:pe,itemVar:me}=ce,he=oe+1,Se=1,Ee=he,Ce=/@foreach\s*\(/g,Re=/@endforeach/g;while(Se>0&&Ee<B.length){Ce.lastIndex=Ee,Re.lastIndex=Ee;let Ae=Ce.exec(B),_e=Re.exec(B);if(!_e)break;if(Ae&&Ae.index<_e.index)Se++,Ee=Ae.index+Ae[0].length;else{if(Se--,Se===0){let Te=B.substring(he,_e.index),Me=_e.index+11;return{start:ae,end:Me,arrayExpr:pe,itemVar:me,content:Te}}Ee=_e.index+11}}}return null}function j(B,F){let U=B;while(!0){let Z=C(U);if(!Z)break;let{start:Y,end:Q,arrayExpr:se,itemVar:oe,content:ie}=Z;try{let ce=se.trim(),ae;if(p(ce))ae=l(ce,Object.keys(F))(...Object.values(F));else ae=c(ce,F);let pe=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),pe=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),pe=!0;else{let _e=wy(ce,x)+a("Foreach",`Error in @foreach: ${ce} is not iterable`,t.TYPE_ERROR);U=U.substring(0,Y)+_e+U.substring(Q);continue}let me=v?.loops?.useAltLoopVariable??fy,he=oe.trim(),Se=null,Ee,Ce=!1;if(he.includes("=>")){let _e=he.split("=>").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Se=_e[0],Ee=_e[1];else Ee=he}else if(!he.startsWith("[")&&!he.startsWith("{")&&he.includes(",")){let _e=he.split(",").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Ee=_e[0],Se=_e[1],Ce=!0;else Ee=he}else Ee=he;let Re="",Ae=ae;for(let _e=0;_e<Ae.length;_e++){let Te=Ae[_e],Me={index:_e,iteration:_e+1,first:_e===0,last:_e===Ae.length-1,count:Ae.length},De={...F,loop:Me,$loop:Me};if(Ee.startsWith("[")&&Ee.endsWith("]")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim());if(Array.isArray(Te))ot.forEach((nt,yt)=>{if(nt)De[nt]=Te[yt]});else De[Ee]=Te}else if(Ee.startsWith("{")&&Ee.endsWith("}")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim()).filter(Boolean);if(Te!==null&&typeof Te==="object")ot.forEach((nt)=>{let yt=nt.indexOf(":"),dt=(yt===-1?nt:nt.slice(0,yt)).trim(),ht=yt===-1?dt:nt.slice(yt+1).trim();if(dt&&ht)De[ht]=Te[dt]});else De[Ee]=Te}else De[Ee]=Te;if(Se)if(!Ce&&pe&&Array.isArray(Te)&&Te.length===2)De[Se]=Te[0],De[Ee]=Te[1];else De[Se]=_e;let Ie=yy(ie,De),Oe=jd(Ie);if(Oe.hasContinue){Re+=Oe.content;continue}let tt=Nd(Ie);if(tt.hasBreak){Re+=tt.content;break}if(Ie=Ld(Ie,De),Ie=j(Ie,De),Ie=Cn(Ie,De,x),Ie=xy(Ie),tt=Nd(Ie),tt.hasBreak){Re+=tt.content;break}if(Oe=jd(Ie),Oe.hasContinue){Re+=Oe.content;continue}Ie=q(Ie,De,x),Ie=hy(Ie,De),Ie=my(Ie,De),Ie=gy(Ie,De),Re+=Ie}U=U.substring(0,Y)+Re+U.substring(Q)}catch(ce){let ae=a("Foreach",`Error in @foreach(${se.trim()} as ${oe.trim()}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);U=U.substring(0,Y)+ae+U.substring(Q)}}return U}E=j(E,o),E=Fd(E,o,x,v);let L=v?.loops?.maxWhileIterations??py;return E=Ey(E,o,L),k?E:as(E)}function dc(e){let o=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(e);if(!o||/^(?:const|let|var)$/.test(o[2]))return e;return`${o[1]}let ${e.slice(o[1].length)}`}function Wd(e){return or(e)}function Fd(e,o,x,v){let k=e,E=!0;while(E){E=!1;let C=k.match(/@for\s*\(/);if(!C||C.index===void 0)break;let j=C.index,L=j+C[0].length-1,B=w(k,"(",")",L);if(B===-1)break;let F=dc(k.slice(L+1,B)),U=B+1,Z=ai(k.slice(j),"for","endfor");if(Z.length===0)break;let Y=Z[0].content,Q=j+Z[0].end;if(!Wd(F)){let se=a("For",`Unsafe expression in @for: ${F}`,t.UNSAFE_EXPRESSION);k=k.substring(0,j)+se+k.substring(Q),E=!0;continue}try{let se=Sy(F),oe=/@(?:for|foreach|if|unless)\s*\(/.test(Y);if(se.length>0&&oe){let he=_y({forExpr:F,content:Y,iterVarNames:se,context:o,filePath:x,options:v});k=k.substring(0,j)+he+k.substring(Q),E=!0;continue}let ie=Object.keys(o),ce=Object.values(o),ae=Y.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(he,Se)=>`\${${Se}}`);ae=Bd(ae);let me=Function(...ie,`
|
|
2452
|
+
`,me=Function(...Y,ae)(...Q);if(me&&typeof me==="object")Object.assign(o,me);E=E.replace(B,"")}catch(Z){console.error(`Error executing ${v} code block in ${x}:`,Z);let Y=Z instanceof Error?Z.message:String(Z),Q=g(`${v} Directive`,`Error executing code: ${Y}`,x,e,U,B);console.error(Q),E=E.replace(B,"")}return E}function kt(e){let o=e.indexOf(" as ");if(o!==-1){let E=e.slice(0,o).trim(),C=e.slice(o+4).trim();return E&&C?{arrayExpr:E,itemVar:C}:null}let x=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!x)return null;let v=x[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),k=x[2].trim();return v&&k?{arrayExpr:k,itemVar:v}:null}var py=1000,fy=!1;function gy(e,o){let x=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,v="",k=0,E;while((E=x.exec(e))!==null){let C=E.index+E[0].length,j=E.index+E[0].indexOf("("),L=w(e,"(",")",j);if(L===-1)continue;let B=e.slice(C,L).trim();if(!B)continue;if(!Object.keys(o).some((Z)=>new RegExp(`(?:^|[^\\w$.])${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(B)))continue;let U;try{let Z=I(B,o);if(!Z||typeof Z!=="object")continue;U=JSON.stringify(Z)}catch{continue}v+=e.slice(k,C)+U,k=L,x.lastIndex=L}return k===0?e:v+e.slice(k)}function my(e,o){let x=/@component\s*\(/g,v=e,k,E=[];while((k=x.exec(v))!==null){let C=k.index,j=C+k[0].length-1,L=1,B=j+1;while(B<v.length&&L>0){if(v[B]==="(")L++;else if(v[B]===")"){if(L--,L===0)break}B++}if(L!==0)continue;let F=v.substring(j+1,B),U=B+1,Z=F.match(/^\s*['"]([^'"]+)['"]/);if(!Z)continue;let Y=Z[1],Q=F.slice(Z[0].length),se=Q.match(/^\s*,\s*/);if(!se)continue;let oe=Q.slice(se[0].length).trim();if(!oe)continue;try{let ie=I(oe,o),ce=JSON.stringify(ie),ae=`@component('${Y}', ${ce})`;E.push({start:C,end:U,replacement:ae})}catch{continue}}for(let C=E.length-1;C>=0;C--){let{start:j,end:L,replacement:B}=E[C];v=v.substring(0,j)+B+v.substring(L)}return v}function Ci(e,o,x){let v=e,k=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),E;while((E=k.exec(v))!==null){let C=E.index,j=C+E[0].length-1,L=1,B=j+1,F=null,U=!1;while(B<v.length&&L>0){let Q=v[B];if(U){U=!1,B++;continue}if(Q==="\\"&&F){U=!0,B++;continue}if(F){if(Q===F)F=null;B++;continue}if(Q==='"'||Q==="'"||Q==="`"){F=Q,B++;continue}if(Q==="(")L++;else if(Q===")"){if(L--,L===0)break}B++}if(L!==0)break;let Z=v.substring(j+1,B),Y=x(Z);v=v.substring(0,C)+Y+v.substring(B+1)}return v}function hy(e,o){let x=e;return x=x.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(v,k)=>{if(k in o)return`:${k}="${k}"`;return v}),x=x.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(v,k,E)=>{try{let C=Object.keys(o),j=Object.values(o);Ps(E);let B=l(E,C)(...j),F=JSON.stringify(B);if(F===void 0){if(!ke(E).some((Y)=>!(Y in o)))return"";return v}let U=Buffer.from(F,"utf8").toString("base64");return`__stx_${k}="${U}"`}catch(C){return v}}),x}var Ri="<!--__STX_BREAK__-->",Ai="<!--__STX_CONTINUE__-->";function yy(e,o){let x=e;return x=Ci(x,"@break",(v)=>{try{let E=`!!(${v.trim()})`,C;if(p(E)){let j=l(E,Object.keys(o));C=Boolean(j(...Object.values(o)))}else C=Boolean(c(E,o));return C?Ri:""}catch{return""}}),x=Ci(x,"@continue",(v)=>{try{let E=`!!(${v.trim()})`,C;if(p(E)){let j=l(E,Object.keys(o));C=Boolean(j(...Object.values(o)))}else C=Boolean(c(E,o));return C?Ai:""}catch{return""}}),x}function xy(e){let o=e;return o=o.replace(/@break(?!\()/g,Ri),o=o.replace(/@continue(?!\()/g,Ai),o}function Nd(e){let o=e.includes(Ri),x=o?e.substring(0,e.indexOf(Ri)):e;return{hasBreak:o,content:x}}function jd(e){let o=e.includes(Ai),x=o?e.substring(0,e.indexOf(Ai)):e;return{hasContinue:o,content:x}}function Bd(e){let o=e;return o=Ci(o,"@break",(x)=>{let v=x.trim();if(!ar(v))return"";return`\`; if (${v}) { break; } result += \``}),o=Ci(o,"@continue",(x)=>{let v=x.trim();if(!ar(v))return"";return`\`; if (${v}) { continue; } result += \``}),o=o.replace(/@break(?!\()/g,"`; break; result += `"),o=o.replace(/@continue(?!\()/g,"`; continue; result += `"),o}function by(e){let o=/@forelse\s*\(/g,x,v=[],k=/@foreach\s*\(/g,E=/@endforeach/g,C;while((C=k.exec(e))!==null)v.push({pos:C.index,delta:1});while((C=E.exec(e))!==null)v.push({pos:C.index,delta:-1});v.sort((F,U)=>F.pos-U.pos);let j=[],L=0;for(let F of v)L+=F.delta,j.push({pos:F.pos,depth:L});function B(F){let U=0,Z=j.length-1,Y=0;while(U<=Z){let Q=U+Z>>1;if(j[Q].pos<=F)Y=j[Q].depth,U=Q+1;else Z=Q-1}return Y}while((x=o.exec(e))!==null){if(B(x.index)>0)continue;let F=x.index,U=x.index+x[0].length-1,Z=1,Y=U+1,Q=-1;while(Y<e.length&&Z>0){if(e[Y]==="(")Z++;else if(e[Y]===")"){if(Z--,Z===0){Q=Y;break}}Y++}if(Q===-1)continue;let se=e.substring(U+1,Q),oe=kt(se);if(!oe)continue;let{arrayExpr:ie,itemVar:ce}=oe,ae=Q+1,pe=1,me=ae,he=/@forelse\s*\(/g,Se=/@endforelse/g,Ee=-1;while(pe>0&&me<e.length){he.lastIndex=me,Se.lastIndex=me;let Me=he.exec(e),De=Se.exec(e);if(!De)break;if(Me&&Me.index<De.index)pe++,me=Me.index+Me[0].length;else{if(pe--,pe===0){Ee=De.index;break}me=De.index+11}}if(Ee===-1)continue;let Ce=e.substring(ae,Ee),Ae=Ee+11,Re=-1,_e=0,Te=0;while(Te<Ce.length){let Me=Ce.indexOf("@",Te);if(Me===-1)break;let De=Ce.substring(Me);if(/^@forelse\s*\(/.test(De))_e++,Te=Me+1;else if(De.startsWith("@endforelse"))_e--,Te=Me+11;else if(_e===0&&De.startsWith("@empty")){if(Ce.length<=Me+6||!/[a-z]/i.test(Ce[Me+6])){Re=Me;break}Te=Me+1}else Te=Me+1}if(Re===-1)continue;return{start:F,end:Ae,arrayExpr:ie,itemVar:ce,foreachContent:Ce.substring(0,Re),emptyContent:Ce.substring(Re+6)}}return null}function Ld(e,o){let x=e;while(!0){let v=by(x);if(!v)break;let{start:k,end:E,arrayExpr:C,itemVar:j,foreachContent:L,emptyContent:B}=v;try{let F;if(p(C))F=l(C,Object.keys(o))(...Object.values(o));else F=c(C,o);let U;if(!Array.isArray(F)||F.length===0)U=B;else U=`@foreach (${C} as ${j})${L}@endforeach`;x=x.substring(0,k)+U+x.substring(E)}catch(F){let U=F instanceof Error?F.message:String(F),Z=a("Forelse",`Error in @forelse(${C} as ${j}): ${U}`,t.EVALUATION_ERROR);x=x.substring(0,k)+Z+x.substring(E)}}return x}var zd="<!--stx:foreach-not-iterable:",vy=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function wy(e,o){return`${zd}${encodeURIComponent(e)}|${encodeURIComponent(o)}-->`}function $y(e,o){console.warn(`[stx] @foreach(${e}) in ${o}: ${e} 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 cs(e){if(!e.includes(zd))return e;return e.replace(vy,(o,x,v)=>($y(decodeURIComponent(x),decodeURIComponent(v)),""))}function Gi(e,o,x,v,k=!1){let E=e;E=Ld(E,o);function C(B){let F=/@foreach\s*\(/g,U;while((U=F.exec(B))!==null){let Z=U.index,Y=U.index+U[0].length-1,Q=1,se=Y+1,oe=-1;while(se<B.length&&Q>0){if(B[se]==="(")Q++;else if(B[se]===")"){if(Q--,Q===0){oe=se;break}}se++}if(oe===-1)continue;let ie=B.substring(Y+1,oe),ce=kt(ie);if(!ce)continue;let ae=Z,{arrayExpr:pe,itemVar:me}=ce,he=oe+1,Se=1,Ee=he,Ce=/@foreach\s*\(/g,Ae=/@endforeach/g;while(Se>0&&Ee<B.length){Ce.lastIndex=Ee,Ae.lastIndex=Ee;let Re=Ce.exec(B),_e=Ae.exec(B);if(!_e)break;if(Re&&Re.index<_e.index)Se++,Ee=Re.index+Re[0].length;else{if(Se--,Se===0){let Te=B.substring(he,_e.index),Me=_e.index+11;return{start:ae,end:Me,arrayExpr:pe,itemVar:me,content:Te}}Ee=_e.index+11}}}return null}function j(B,F){let U=B;while(!0){let Z=C(U);if(!Z)break;let{start:Y,end:Q,arrayExpr:se,itemVar:oe,content:ie}=Z;try{let ce=se.trim(),ae;if(p(ce))ae=l(ce,Object.keys(F))(...Object.values(F));else ae=c(ce,F);let pe=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),pe=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),pe=!0;else{let _e=wy(ce,x)+a("Foreach",`Error in @foreach: ${ce} is not iterable`,t.TYPE_ERROR);U=U.substring(0,Y)+_e+U.substring(Q);continue}let me=v?.loops?.useAltLoopVariable??fy,he=oe.trim(),Se=null,Ee,Ce=!1;if(he.includes("=>")){let _e=he.split("=>").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Se=_e[0],Ee=_e[1];else Ee=he}else if(!he.startsWith("[")&&!he.startsWith("{")&&he.includes(",")){let _e=he.split(",").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Ee=_e[0],Se=_e[1],Ce=!0;else Ee=he}else Ee=he;let Ae="",Re=ae;for(let _e=0;_e<Re.length;_e++){let Te=Re[_e],Me={index:_e,iteration:_e+1,first:_e===0,last:_e===Re.length-1,count:Re.length},De={...F,loop:Me,$loop:Me};if(Ee.startsWith("[")&&Ee.endsWith("]")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim());if(Array.isArray(Te))ot.forEach((nt,yt)=>{if(nt)De[nt]=Te[yt]});else De[Ee]=Te}else if(Ee.startsWith("{")&&Ee.endsWith("}")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim()).filter(Boolean);if(Te!==null&&typeof Te==="object")ot.forEach((nt)=>{let yt=nt.indexOf(":"),dt=(yt===-1?nt:nt.slice(0,yt)).trim(),ht=yt===-1?dt:nt.slice(yt+1).trim();if(dt&&ht)De[ht]=Te[dt]});else De[Ee]=Te}else De[Ee]=Te;if(Se)if(!Ce&&pe&&Array.isArray(Te)&&Te.length===2)De[Se]=Te[0],De[Ee]=Te[1];else De[Se]=_e;let Ie=yy(ie,De),Oe=jd(Ie);if(Oe.hasContinue){Ae+=Oe.content;continue}let tt=Nd(Ie);if(tt.hasBreak){Ae+=tt.content;break}if(Ie=Ld(Ie,De),Ie=j(Ie,De),Ie=Cn(Ie,De,x),Ie=xy(Ie),tt=Nd(Ie),tt.hasBreak){Ae+=tt.content;break}if(Oe=jd(Ie),Oe.hasContinue){Ae+=Oe.content;continue}Ie=q(Ie,De,x),Ie=hy(Ie,De),Ie=my(Ie,De),Ie=gy(Ie,De),Ae+=Ie}U=U.substring(0,Y)+Ae+U.substring(Q)}catch(ce){let ae=a("Foreach",`Error in @foreach(${se.trim()} as ${oe.trim()}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);U=U.substring(0,Y)+ae+U.substring(Q)}}return U}E=j(E,o),E=Fd(E,o,x,v);let L=v?.loops?.maxWhileIterations??py;return E=Ey(E,o,L),k?E:cs(E)}function pc(e){let o=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(e);if(!o||/^(?:const|let|var)$/.test(o[2]))return e;return`${o[1]}let ${e.slice(o[1].length)}`}function Wd(e){return ar(e)}function Fd(e,o,x,v){let k=e,E=!0;while(E){E=!1;let C=k.match(/@for\s*\(/);if(!C||C.index===void 0)break;let j=C.index,L=j+C[0].length-1,B=w(k,"(",")",L);if(B===-1)break;let F=pc(k.slice(L+1,B)),U=B+1,Z=ai(k.slice(j),"for","endfor");if(Z.length===0)break;let Y=Z[0].content,Q=j+Z[0].end;if(!Wd(F)){let se=a("For",`Unsafe expression in @for: ${F}`,t.UNSAFE_EXPRESSION);k=k.substring(0,j)+se+k.substring(Q),E=!0;continue}try{let se=Sy(F),oe=/@(?:for|foreach|if|unless)\s*\(/.test(Y);if(se.length>0&&oe){let he=_y({forExpr:F,content:Y,iterVarNames:se,context:o,filePath:x,options:v});k=k.substring(0,j)+he+k.substring(Q),E=!0;continue}let ie=Object.keys(o),ce=Object.values(o),ae=Y.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(he,Se)=>`\${${Se}}`);ae=Bd(ae);let me=Function(...ie,`
|
|
2453
2453
|
let result = '';
|
|
2454
2454
|
for (${F}) {
|
|
2455
2455
|
result += \`${ae}\`;
|
|
@@ -2473,117 +2473,117 @@ ${k}
|
|
|
2473
2473
|
return result;
|
|
2474
2474
|
`)(...Q);v=v.substring(0,C)+ie+v.substring(Z),k=!0}catch(Y){let Q=a("While",`Error in @while(${B}): ${Y instanceof Error?Y.message:String(Y)}`,t.EVALUATION_ERROR);v=v.substring(0,C)+Q+v.substring(Z),k=!0}}return v}function ky(e,o="_method"){let x=e.toUpperCase();if(x==="GET"||x==="POST")return"";return`<input type="hidden" name="${o}" value="${x}">`}function Vd(e){return e.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(o,x,v,k,E)=>ky(v,E||"_method"))}async function Ud(e,o,x,v,k){if(!v.middleware||v.middleware.length===0)return e;let E=e,C=v.middleware.filter((j)=>j.timing===k);if(C.length===0)return E;for(let j of C){if(!j.name||typeof j.handler!=="function"){if(v.debug)console.warn("Invalid middleware:",j);continue}try{let L=await j.handler(E,o,x,v);if(typeof L==="string")E=L;else if(v.debug)console.warn(`Middleware ${j.name} did not return a string`)}catch(L){if(v.debug)console.error(`Error in middleware ${j.name}:`,L);if(v.debug){let B=g("Middleware",`Error in middleware '${j.name}': ${L instanceof Error?L.message:String(L)}`,x,e);E=E.replace(/<body[^>]*>/,`$&
|
|
2475
2475
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h(B)}</div>
|
|
2476
|
-
`)}}}return E}async function Hd(e,o,x,v){return Ud(e,o,x,v,"before")}async function qd(e,o,x,v){return Ud(e,o,x,v,"after")}function Xd(e){return e.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(o,x,v,k,E)=>{try{let C=k?I(k,{}):{};return
|
|
2476
|
+
`)}}}return E}async function Hd(e,o,x,v){return Ud(e,o,x,v,"before")}async function qd(e,o,x,v){return Ud(e,o,x,v,"after")}function Xd(e){return e.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(o,x,v,k,E)=>{try{let C=k?I(k,{}):{};return wn(v,C,E==="true")}catch(C){return console.error(`Error processing @route directive: ${C}`),"#route-error"}})}var Ms={patterns:[],exact:{}};async function Kd(e,o){let x=e.split("/").pop()?.split(".")[0]||"";if(Ms.exact[e])for(let v of Ms.exact[e])await Promise.resolve(v(o,e));if(Ms.exact[x])for(let v of Ms.exact[x])await Promise.resolve(v(o,e));for(let{pattern:v,callback:k}of Ms.patterns)if(v.test(e)||v.test(x))await Promise.resolve(k(o,e))}var Cy=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ry=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 gr(e,o){let x=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;x.lastIndex=o;let v=x.exec(e);if(!v)return null;let k=/\/\s*>$/.test(v[0])||v[1]===v[1].toLowerCase()&&Cy.has(v[1]),E=k?v[2].replace(/\/\s*$/,""):v[2];return{full:v[0],tag:v[1],attrs:E,selfClosing:k,start:v.index,end:v.index+v[0].length}}function Ay(e,o,x){let v=1,k=x,E=new RegExp(`<${o}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),C=new RegExp(`</${o}\\s*>`,"gi");while(v>0&&k<e.length){E.lastIndex=k,C.lastIndex=k;let j=E.exec(e),L=C.exec(e);if(!L)return-1;if(j&&j.index<L.index)v++,k=j.index+j[0].length;else{if(v--,v===0)return L.index+L[0].length;k=L.index+L[0].length}}return-1}function fr(e,o){if(o.selfClosing)return{outerStart:o.start,outerEnd:o.end,innerHTML:""};let x=Ay(e,o.tag,o.end);if(x===-1)return{outerStart:o.start,outerEnd:o.end,innerHTML:""};return{outerStart:o.start,outerEnd:x,innerHTML:e.slice(o.end,x-`</${o.tag}>`.length)}}function Zd(e,o){return new RegExp(`(?:^|\\s)${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(e)||e.includes(` ${o}=`)||e.includes(` ${o} `)||e.trimEnd().endsWith(` ${o}`)}function Ns(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=e.match(new RegExp(`${x}="([^"]*)"`,"s"))||e.match(new RegExp(`${x}='([^']*)'`,"s"));return v?v[1]:null}function Nn(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return e.replace(new RegExp(`\\s*${x}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${x}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${x}(?=\\s|$|>|/)`,"g"),"")}function Ar(e,o,x){let v=o.selfClosing?" /":"",k=`<${o.tag}${x}${v}>`;return e.slice(0,o.start)+k+e.slice(o.end)}function Ty(e){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(e)}function Iy(e){let o=e,x=0;while(x<o.length){let v=gr(o,x);if(!v)break;let k=Ns(v.attrs,"v-for");if(k===null){x=v.end;continue}let E=k.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!E){x=v.end;continue}let C=E[1].trim(),j=E[2].trim(),L;if(C.includes(",")){let oe=C.split(",").map((ae)=>ae.trim()),ie=oe[0],ce=oe[1];L=`${j} as ${ce} => ${ie}`}else L=`${j} as ${C}`;let B=Nn(v.attrs,"v-for"),F=Nn(B,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=fr(o,v),Z=o.slice(U.outerStart,U.outerEnd),Y=Ar(Z,{...v,start:0,end:v.end-v.start},F),Q=`@foreach(${L})
|
|
2477
2477
|
`,se=`${Q}${Y}
|
|
2478
|
-
@endforeach`;o=o.slice(0,U.outerStart)+se+o.slice(U.outerEnd),x=U.outerStart+Q.length}return o}function Dy(e){let o=e,x=0;while(x<o.length){let v=
|
|
2478
|
+
@endforeach`;o=o.slice(0,U.outerStart)+se+o.slice(U.outerEnd),x=U.outerStart+Q.length}return o}function Dy(e){let o=e,x=0;while(x<o.length){let v=gr(o,x);if(!v)break;let k=Ns(v.attrs,"v-if");if(k===null){x=v.end;continue}let E=[],C=fr(o,v),j=Nn(v.attrs,"v-if"),L=Ar(o.slice(C.outerStart,C.outerEnd),{...v,start:0,end:v.end-v.start},j);E.push({type:"if",expr:k,outerStart:C.outerStart,outerEnd:C.outerEnd,element:L,parsedTag:v});let B=C.outerEnd,F=!0;while(F){let se=o.slice(B).match(/^\s*/),oe=se?se[0].length:0,ie=gr(o,B+oe);if(!ie){F=!1;break}let ce=Ns(ie.attrs,"v-else-if"),ae=Zd(ie.attrs,"v-else");if(ce!==null){let pe=fr(o,ie),me=Nn(ie.attrs,"v-else-if"),he=Ar(o.slice(pe.outerStart,pe.outerEnd),{...ie,start:0,end:ie.end-ie.start},me);E.push({type:"else-if",expr:ce,outerStart:B,outerEnd:pe.outerEnd,element:he,parsedTag:ie}),B=pe.outerEnd}else if(ae){let pe=fr(o,ie),me=Nn(ie.attrs,"v-else"),he=Ar(o.slice(pe.outerStart,pe.outerEnd),{...ie,start:0,end:ie.end-ie.start},me);E.push({type:"else",outerStart:B,outerEnd:pe.outerEnd,element:he,parsedTag:ie}),F=!1}else F=!1}let U=[];for(let se of E)if(se.type==="if")U.push(`@if(${se.expr})
|
|
2479
2479
|
${se.element}`);else if(se.type==="else-if")U.push(`@elseif(${se.expr})
|
|
2480
2480
|
${se.element}`);else U.push(`@else
|
|
2481
2481
|
${se.element}`);U.push("@endif");let Z=U.join(`
|
|
2482
|
-
`),Y=E[0].outerStart,Q=E[E.length-1].outerEnd;o=o.slice(0,Y)+Z+o.slice(Q),x=Y+Z.length}return o}function Py(e){return e.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function My(e){let o=e,x=0;while(x<o.length){let v=
|
|
2483
|
-
${
|
|
2484
|
-
@endonce`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function Wy(e){return e.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Fy(e){return e.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 Jd(e){if(!Ty(e))return e;let o=e;return o=Iy(o),o=Dy(o),o=zy(o),o=Oy(o),o=Ny(o),o=My(o),o=Py(o),o=Fy(o),o=jy(o),o=Ly(o),o=By(o),o=Wy(o),o}function Ti(e){return e.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var Wa=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"]),Vy=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Gd(e,o){let x=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e),v=x?x[1]:e,k=c(v,o);if(k&&typeof k==="string")return k;let E=v.trim();return Wa.has(E)?E:null}function Yd(e){let o=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e);return o?o[1]:e}function Qd(e,o,x){let v=o.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),k=v?`<${e} ${v}>`:`<${e}>`;if(Vy.has(e))return v?`<${e} ${v}>`:`<${e}>`;return`${k}${x}</${e}>`}async function ep(e,o,x,v,k){let E=e,C=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,j=[],L;while((L=C.exec(E))!==null)j.push({full:L[0],expr:L[1],attrs:L[2],slotContent:L[3],index:L.index});for(let B=j.length-1;B>=0;B--){let F=j[B];try{let U=Gd(F.expr,o);if(!U||typeof U!=="string"){let ce=`<!-- dynamic component: could not resolve "${Ti(Yd(F.expr))}" -->`;E=E.slice(0,F.index)+ce+E.slice(F.index+F.full.length);continue}if(Wa.has(U)){let ce=Qd(U,F.attrs,F.slotContent);E=E.slice(0,F.index)+ce+E.slice(F.index+F.full.length);continue}let Z=F.attrs.trim(),Y={},Q=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=Q.exec(Z))!==null){let ce=se[1]||se[2],ae=se[3];if(se[1])try{Y[ce]=c(ae,o)}catch{Y[ce]=ae}else Y[ce]=ae}let oe=v.componentsDir||"components",ie=await We(U,Y,F.slotContent,oe,o,x,v,new Set,k??new Set);E=E.slice(0,F.index)+ie+E.slice(F.index+F.full.length)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=`<!-- dynamic component error: ${Ti(Z)} -->`;E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}}return E=await Uy(E,o,x,v,k),E}async function Uy(e,o,x,v,k){let E=e,C=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,j=[],L;while((L=C.exec(E))!==null)j.push({full:L[0],expr:L[1],attrs:L[2],index:L.index});for(let B=j.length-1;B>=0;B--){let F=j[B];try{let U=Gd(F.expr,o);if(!U||typeof U!=="string"){let Q=`<!-- dynamic component: could not resolve "${Ti(Yd(F.expr))}" -->`;E=E.slice(0,F.index)+Q+E.slice(F.index+F.full.length);continue}if(Wa.has(U)){let Q=Qd(U,F.attrs,"");E=E.slice(0,F.index)+Q+E.slice(F.index+F.full.length);continue}let Z=v.componentsDir||"components",Y=await We(U,{},"",Z,o,x,v,new Set,k??new Set);E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=`<!-- dynamic component error: ${Ti(Z)} -->`;E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}}return E}function Fa(){return{afterOpen:[],beforeClose:[]}}function Hy(e){return e.afterOpen.length>0||e.beforeClose.length>0}function np(e,o){if(!Hy(o))return e;let x=o.afterOpen.join(""),v=o.beforeClose.join(""),k=e.lastIndexOf("</head>"),E=x?js(e):null,C=v&&k!==-1?k:null;if(E===null&&C===null)return e;if(E!==null&&C!==null)return`${e.slice(0,E)}${x}${e.slice(E,C)}${v}${e.slice(C)}`;if(E!==null)return`${e.slice(0,E)}${x}${e.slice(E)}`;return`${e.slice(0,C)}${v}${e.slice(C)}`}var tp=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function js(e){let o=/<head\b[^>]*>/i.exec(e);if(!o)return null;let x=o.index+o[0].length;tp.lastIndex=x;let v=tp.exec(e);return v?x+v[0].length:x}var Ua="data-stx-color-mode-boot",qy="__STX_COLOR_MODE__",Xy=new Set(["light","dark","auto","system"]),Ky=new Set(["auto","system"]),Zy=/^[a-z][\w:-]*$/i,Jy=/^[\w-]+$/;function Gy(e){let o=e.storageKey??"stx-color-mode",x=e.initialMode??"auto",v=e.darkClass===void 0?"dark":e.darkClass,k=e.attribute??null,E=e.autoValue??null,C=e.respectExisting===!0;if(typeof o!=="string"||o.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Xy.has(x))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(x)}`);if(v!==null&&(typeof v!=="string"||!Jy.test(v)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(v)}`);if(k!==null&&(typeof k!=="string"||!Zy.test(k)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(k)}`);if(E!==null&&!Ky.has(E))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(E)}`);if(v===null&&k===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(C&&k===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:o,initialMode:x==="system"?"auto":x,darkClass:v,attribute:k,autoValue:E,respectExisting:C}}function Yy(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Ha(e={}){let o=Gy(e),v=`(function(){"use strict";var c=${Yy(o)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var r=document.documentElement;var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f;if(!m){m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}}if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${qy}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m}}catch(e){}}());`;return`<script ${Ua}>${v}</script>`}function
|
|
2482
|
+
`),Y=E[0].outerStart,Q=E[E.length-1].outerEnd;o=o.slice(0,Y)+Z+o.slice(Q),x=Y+Z.length}return o}function Py(e){return e.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function My(e){let o=e,x=0;while(x<o.length){let v=gr(o,x);if(!v)break;let k=Ry.has(v.tag),E=v.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(j,L,B)=>{let F=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(L);if(!F||!B||!/^["']/.test(B))return j;let U=F[1]||"modelValue",Z=F[2];if(k&&!F[1])return`@model${Z}=${B}`;let Y=B[0],Q=B.slice(1,-1),se=`:${U}=${B} @update:${U}=${Y}${Q} = $event${Y}`;if(Z){let oe=F[1]?`${U}Modifiers`:"modelModifiers",ie=Z.slice(1).split(".").map((ce)=>`${ce}: true`).join(", ");se+=` :${oe}="{ ${ie} }"`}return se});if(E===v.attrs){x=v.end;continue}let C=Ar(v.full,{...v,start:0,end:v.full.length},E);o=o.slice(0,v.start)+C+o.slice(v.end),x=v.start+C.length}return o}function Oy(e){return e.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Ny(e){return e.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function jy(e){let o=e,x=0;while(x<o.length){let v=gr(o,x);if(!v)break;let k=Ns(v.attrs,"v-html");if(k===null){x=v.end;continue}if(v.selfClosing){x=v.end;continue}let E=fr(o,v),C=Nn(v.attrs,"v-html"),j=v.selfClosing?" /":"",L=`<${v.tag}${C}${j}>{!! ${k} !!}</${v.tag}>`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function Ly(e){let o=e,x=0;while(x<o.length){let v=gr(o,x);if(!v)break;let k=Ns(v.attrs,"v-text");if(k===null){x=v.end;continue}if(v.selfClosing){x=v.end;continue}let E=fr(o,v),C=Nn(v.attrs,"v-text"),j=v.selfClosing?" /":"",L=`<${v.tag}${C}${j}>{{ ${k} }}</${v.tag}>`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function By(e){return e.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 zy(e){let o=e,x=0;while(x<o.length){let v=gr(o,x);if(!v)break;if(!Zd(v.attrs,"v-once")){x=v.end;continue}let k=Nn(v.attrs,"v-once"),E=fr(o,v),C=o.slice(E.outerStart,E.outerEnd),L=`@once
|
|
2483
|
+
${Ar(C,{...v,start:0,end:v.end-v.start},k)}
|
|
2484
|
+
@endonce`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function Wy(e){return e.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Fy(e){return e.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 Jd(e){if(!Ty(e))return e;let o=e;return o=Iy(o),o=Dy(o),o=zy(o),o=Oy(o),o=Ny(o),o=My(o),o=Py(o),o=Fy(o),o=jy(o),o=Ly(o),o=By(o),o=Wy(o),o}function Ti(e){return e.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var Wa=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"]),Vy=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Gd(e,o){let x=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e),v=x?x[1]:e,k=c(v,o);if(k&&typeof k==="string")return k;let E=v.trim();return Wa.has(E)?E:null}function Yd(e){let o=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e);return o?o[1]:e}function Qd(e,o,x){let v=o.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),k=v?`<${e} ${v}>`:`<${e}>`;if(Vy.has(e))return v?`<${e} ${v}>`:`<${e}>`;return`${k}${x}</${e}>`}async function ep(e,o,x,v,k){let E=e,C=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,j=[],L;while((L=C.exec(E))!==null)j.push({full:L[0],expr:L[1],attrs:L[2],slotContent:L[3],index:L.index});for(let B=j.length-1;B>=0;B--){let F=j[B];try{let U=Gd(F.expr,o);if(!U||typeof U!=="string"){let ce=`<!-- dynamic component: could not resolve "${Ti(Yd(F.expr))}" -->`;E=E.slice(0,F.index)+ce+E.slice(F.index+F.full.length);continue}if(Wa.has(U)){let ce=Qd(U,F.attrs,F.slotContent);E=E.slice(0,F.index)+ce+E.slice(F.index+F.full.length);continue}let Z=F.attrs.trim(),Y={},Q=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=Q.exec(Z))!==null){let ce=se[1]||se[2],ae=se[3];if(se[1])try{Y[ce]=c(ae,o)}catch{Y[ce]=ae}else Y[ce]=ae}let oe=v.componentsDir||"components",ie=await We(U,Y,F.slotContent,oe,o,x,v,new Set,k??new Set);E=E.slice(0,F.index)+ie+E.slice(F.index+F.full.length)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=`<!-- dynamic component error: ${Ti(Z)} -->`;E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}}return E=await Uy(E,o,x,v,k),E}async function Uy(e,o,x,v,k){let E=e,C=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,j=[],L;while((L=C.exec(E))!==null)j.push({full:L[0],expr:L[1],attrs:L[2],index:L.index});for(let B=j.length-1;B>=0;B--){let F=j[B];try{let U=Gd(F.expr,o);if(!U||typeof U!=="string"){let Q=`<!-- dynamic component: could not resolve "${Ti(Yd(F.expr))}" -->`;E=E.slice(0,F.index)+Q+E.slice(F.index+F.full.length);continue}if(Wa.has(U)){let Q=Qd(U,F.attrs,"");E=E.slice(0,F.index)+Q+E.slice(F.index+F.full.length);continue}let Z=v.componentsDir||"components",Y=await We(U,{},"",Z,o,x,v,new Set,k??new Set);E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=`<!-- dynamic component error: ${Ti(Z)} -->`;E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}}return E}function Fa(){return{afterOpen:[],beforeClose:[]}}function Hy(e){return e.afterOpen.length>0||e.beforeClose.length>0}function np(e,o){if(!Hy(o))return e;let x=o.afterOpen.join(""),v=o.beforeClose.join(""),k=e.lastIndexOf("</head>"),E=x?js(e):null,C=v&&k!==-1?k:null;if(E===null&&C===null)return e;if(E!==null&&C!==null)return`${e.slice(0,E)}${x}${e.slice(E,C)}${v}${e.slice(C)}`;if(E!==null)return`${e.slice(0,E)}${x}${e.slice(E)}`;return`${e.slice(0,C)}${v}${e.slice(C)}`}var tp=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function js(e){let o=/<head\b[^>]*>/i.exec(e);if(!o)return null;let x=o.index+o[0].length;tp.lastIndex=x;let v=tp.exec(e);return v?x+v[0].length:x}var Ua="data-stx-color-mode-boot",qy="__STX_COLOR_MODE__",Xy=new Set(["light","dark","auto","system"]),Ky=new Set(["auto","system"]),Zy=/^[a-z][\w:-]*$/i,Jy=/^[\w-]+$/;function Gy(e){let o=e.storageKey??"stx-color-mode",x=e.initialMode??"auto",v=e.darkClass===void 0?"dark":e.darkClass,k=e.attribute??null,E=e.autoValue??null,C=e.respectExisting===!0;if(typeof o!=="string"||o.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Xy.has(x))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(x)}`);if(v!==null&&(typeof v!=="string"||!Jy.test(v)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(v)}`);if(k!==null&&(typeof k!=="string"||!Zy.test(k)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(k)}`);if(E!==null&&!Ky.has(E))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(E)}`);if(v===null&&k===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(C&&k===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:o,initialMode:x==="system"?"auto":x,darkClass:v,attribute:k,autoValue:E,respectExisting:C}}function Yy(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Ha(e={}){let o=Gy(e),v=`(function(){"use strict";var c=${Yy(o)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var r=document.documentElement;var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f;if(!m){m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}}if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${qy}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m}}catch(e){}}());`;return`<script ${Ua}>${v}</script>`}function Vn(e,o={}){if(e.includes(Ua))return e;let x=Va(e);if(x===null)return e;let v=Ha(o);return`${e.slice(0,x)}
|
|
2485
2485
|
${v}${e.slice(x)}`}var Va=js,Qy=new RegExp(`<script\\b[^>]*\\b${Ua}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),rp=/<meta\b[^>]*\bcharset\b[^>]*>/gi,sp=/<\/head>/gi;function ex(e){let o=/<head\b[^>]*>/i.exec(e);if(!o)return e;let x=o.index+o[0].length;sp.lastIndex=x;let v=sp.exec(e),k=v?v.index:e.length;rp.lastIndex=x;let E=rp.exec(e);if(!E||E.index>=k)return e;if(e.slice(x,E.index).trim()==="")return e;let C=E.index+E[0].length;return`${e.slice(0,x)}
|
|
2486
2486
|
${E[0]}${e.slice(x,E.index)}${e.slice(C,k)}${e.slice(k)}`}function ip(e){return tx(ex(e))}function tx(e){let o=Qy.exec(e);if(!o)return e;let x=Va(e);if(x===null)return e;if(o.index<=x||e.slice(x,o.index).trim()==="")return e;let v=e.slice(0,o.index)+e.slice(o.index+o[0].length),k=Va(v);if(k===null)return e;return`${v.slice(0,k)}
|
|
2487
|
-
${o[0]}${v.slice(k)}`}var
|
|
2488
|
-
<meta name="stx-build" content="${o}">`}function nx(e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let o=navigator.serviceWorker,x=window;if(x.stxOffline)return;let v=null,k=!1,E=[],C={updateReady:!1,registration:()=>v,onUpdateReady(F){if(C.updateReady)try{F()}catch{}else E.push(F);return()=>{let U=E.indexOf(F);if(U!==-1)E.splice(U,1)}},applyUpdate(){let F=v&&v.waiting;if(!F)return!1;return k=!0,F.postMessage({type:"stx:activate-update",force:!0}),!0}};x.stxOffline=C;let j=(F)=>{if(!F.waiting||!o.controller||C.updateReady)return;C.updateReady=!0;let U=E.splice(0);for(let Z of U)try{Z()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};o.addEventListener("message",(F)=>{let U=F.data||{};if(U.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:U.url,kind:U.kind,fragment:!!U.fragment}}))}catch{}}),o.addEventListener("controllerchange",()=>{if(k)k=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&v&&v.waiting)v.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let L=()=>{o.register(e,{scope:"/"}).then((F)=>{if(v=F,F.waiting)j(F),F.waiting.postMessage({type:"stx:activate-update",reason:"load"});F.addEventListener("updatefound",()=>{let U=F.installing;if(!U)return;U.addEventListener("statechange",()=>{if(U.state==="installed")j(F)})})}).catch(()=>{})},B=()=>{let F=(U)=>{setTimeout(U,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>F(L));else F(L)};if(!o.controller)if(document.readyState==="complete")B();else addEventListener("load",B);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",B);else B()}function rx(){let e=`(${nx.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).trim().replace(/;$/,"")}catch{return e}}var ap=`<script data-stx-offline>${rx()}</script>`;import{AsyncLocalStorage as sx}from"async_hooks";var cp=new sx;function
|
|
2489
|
-
`}function
|
|
2490
|
-
`),
|
|
2491
|
-
`),
|
|
2492
|
-
`),
|
|
2493
|
-
<html${
|
|
2487
|
+
${o[0]}${v.slice(k)}`}var Yi="X-STX-Build",qa=Symbol.for("stx.buildId");function ps(){let e=globalThis;if(!e[qa])e[qa]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return e[qa]}function op(e,o=ps()){if(e.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(e))return null;return`
|
|
2488
|
+
<meta name="stx-build" content="${o}">`}function nx(e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let o=navigator.serviceWorker,x=window;if(x.stxOffline)return;let v=null,k=!1,E=[],C={updateReady:!1,registration:()=>v,onUpdateReady(F){if(C.updateReady)try{F()}catch{}else E.push(F);return()=>{let U=E.indexOf(F);if(U!==-1)E.splice(U,1)}},applyUpdate(){let F=v&&v.waiting;if(!F)return!1;return k=!0,F.postMessage({type:"stx:activate-update",force:!0}),!0}};x.stxOffline=C;let j=(F)=>{if(!F.waiting||!o.controller||C.updateReady)return;C.updateReady=!0;let U=E.splice(0);for(let Z of U)try{Z()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};o.addEventListener("message",(F)=>{let U=F.data||{};if(U.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:U.url,kind:U.kind,fragment:!!U.fragment}}))}catch{}}),o.addEventListener("controllerchange",()=>{if(k)k=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&v&&v.waiting)v.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let L=()=>{o.register(e,{scope:"/"}).then((F)=>{if(v=F,F.waiting)j(F),F.waiting.postMessage({type:"stx:activate-update",reason:"load"});F.addEventListener("updatefound",()=>{let U=F.installing;if(!U)return;U.addEventListener("statechange",()=>{if(U.state==="installed")j(F)})})}).catch(()=>{})},B=()=>{let F=(U)=>{setTimeout(U,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>F(L));else F(L)};if(!o.controller)if(document.readyState==="complete")B();else addEventListener("load",B);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",B);else B()}function rx(){let e=`(${nx.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).trim().replace(/;$/,"")}catch{return e}}var ap=`<script data-stx-offline>${rx()}</script>`;import{AsyncLocalStorage as sx}from"async_hooks";var cp=new sx;function on(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function lp(e,o){return cp.run(on(e),o)}async function up(e,o){let x=cp.getStore();if(!x)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let v=x.pending.get(e);if(v)return v;let k=Promise.resolve().then(o).then((E)=>{let C=JSON.stringify(E,(L,B)=>{if(B===void 0||typeof B==="function"||typeof B==="symbol"||typeof B==="bigint"||typeof B==="number"&&!Number.isFinite(B))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(B&&typeof B==="object"&&!Array.isArray(B)&&Object.getPrototypeOf(B)!==Object.prototype&&Object.getPrototypeOf(B)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return B}),j=JSON.parse(C);return x.values.set(e,j),j}).catch((E)=>{throw x.pending.delete(e),E});return x.pending.set(e,k),k}function Hn(e){let o=e.__stx_server_data;if(!o?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(o.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var fp="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Ii="data-stx-html-attrs",Di="data-stx-html-class",gp=/^[A-Za-z_:][\w:.-]*$/;function Rn(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ix(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function rr(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function ox(e){let o=/^\s*<meta\b([^>]*)>/i.exec(e);if(!o)return null;let x={};for(let v of o[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))x[v[1].toLowerCase()]=v[2]??v[3]??v[4]??"";return x}function Tr(e,o){return Object.entries(e).filter(([x])=>!o?.(x)).map(([x,v])=>`${x}="${Rn(String(v))}"`).join(" ")}function ax(e={},o="en"){let x=[],v=[],k="",E=o;for(let[j,L]of Object.entries(e||{})){if(L==null)continue;let B=j.trim();if(!gp.test(B))continue;let F=B.toLowerCase();if(F==="lang"){E=String(L);continue}if(F==="class"){k=String(L).trim();continue}x.push(` ${B}="${Rn(String(L))}"`),v.push(B)}let C=` lang="${Rn(E)}"`;if(k)C+=` class="${Rn(k)}"`;if(C+=x.join(""),k)C+=` ${Di}="${Rn(k)}"`;if(v.length)C+=` ${Ii}="${Rn(v.join(" "))}"`;return C}function mp(e={},o={}){let x={...e,...o};if(e.class&&o.class){let v=e.class.split(/\s+/).filter(Boolean);for(let k of o.class.split(/\s+/).filter(Boolean))if(!v.includes(k))v.push(k);x.class=v.join(" ")}return x}function Un(e,o={}){if(!o||Object.keys(o).length===0)return e;let x=e.match(/<html\b([^>]*)>/i);if(!x)return e;let v={},k=[],E=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,C;while((C=E.exec(x[1]))!==null){let F=C[1];if(!(F in v))k.push(F);v[F]=C[2]??C[3]??C[4]??""}let j=[],L=[];for(let[F,U]of Object.entries(o)){if(U==null)continue;let Z=F.trim();if(!gp.test(Z))continue;let Y=Z.toLowerCase();if(Y==="class"){let Q=(v.class||"").split(/\s+/).filter(Boolean);for(let se of String(U).split(/\s+/).filter(Boolean))if(!Q.includes(se))Q.push(se),j.push(se);if(!("class"in v))k.push("class");v.class=Q.join(" ");continue}if(!(Z in v))k.push(Z);if(v[Z]=String(U),Y!=="lang")L.push(Z)}if(j.length){if(!(Di in v))k.push(Di);v[Di]=j.join(" ")}if(L.length){if(!(Ii in v))k.push(Ii);v[Ii]=L.join(" ")}let B=k.map((F)=>` ${F}="${Rn(v[F])}"`).join("");return e.replace(x[0],()=>`<html${B}>`)}function hp(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${fp}
|
|
2489
|
+
`}function cx(e){let o=[],x=0;while(x<e.length){let E=e.slice(x),C=E.match(/^\s+/);if(C){x+=C[0].length;continue}if(E.startsWith("<!--")){let U=e.indexOf("-->",x);if(U===-1)break;x=U+3;continue}let j=E.match(/^<script\b[^>]*>/i);if(j){let U=e.toLowerCase().indexOf("</script>",x+j[0].length);if(U===-1)break;x=U+9;continue}let L=E.match(/^<link\b[^>]*>/i);if(L){o.push(L[0]),x+=L[0].length;continue}let B=E.match(/^<meta\b[^>]*>/i);if(B){o.push(B[0]),x+=B[0].length;continue}let F=E.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(F){o.push(F[0]),x+=F[0].length;continue}break}if(o.length===0)return{body:e,hoisted:o};let v="",k=0;while(k<e.length&&k<x){let E=e.slice(k),C=E.match(/^<link\b[^>]*>/i);if(C&&o.includes(C[0])){k+=C[0].length;continue}let j=E.match(/^<meta\b[^>]*>/i);if(j&&o.includes(j[0])){k+=j[0].length;continue}let L=E.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(L&&o.includes(L[0])){k+=L[0].length;continue}v+=e[k],k++}return v+=e.slice(x),{body:v,hoisted:o}}function lx(e,o={},x={}){let{title:v="stx App",lang:k="en",meta:E=[],link:C=[],script:j=[],headRaw:L="",htmlAttrs:B={},bodyClass:F="",bodyAttrs:U={}}=o,Z=x.title||v,Y=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],Q=new Set(E.map(rr).filter(Boolean)),{body:se,hoisted:oe}=cx(e),ie=new Set(oe.flatMap((Re)=>{let _e=ox(Re);return _e?[rr(_e)].filter(Boolean):[]})),ae=[...Y.filter((Re)=>!Q.has(rr(Re))),...E].filter((Re)=>!ie.has(rr(Re))).map((Re)=>` <meta ${Tr(Re)}>`).join(`
|
|
2490
|
+
`),pe=C.map((Re)=>` <link ${Tr(Re)}>`).join(`
|
|
2491
|
+
`),me=j.map((Re)=>{if(Re.src)return` <script ${Tr(Re,(_e)=>_e==="content")}></script>`;if(Re.content)return` <script>${Re.content}</script>`;return""}).filter(Boolean).join(`
|
|
2492
|
+
`),he=ax(B,k),Se=Object.entries(U).map(([Re,_e])=>` ${Re}="${Rn(String(_e))}"`).join(""),Ee=F?` class="${Rn(F)}"`:"",Ce=[ae,x.colorMode?` ${Ha(x.colorMode)}`:"",` <title>${x.titleIsHtml?Z:ix(Z)}</title>`,` ${fp}`,pe,me,L?` ${L}`:"",...(x.styles||[]).map((Re)=>` ${Re}`),...oe.map((Re)=>` ${Re}`),...(x.headScripts||[]).map((Re)=>` ${Re}`),x.headStack||""].filter(Boolean),Ae=[se,...(x.bodyScripts||[]).map((Re)=>Re),x.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
2493
|
+
<html${he}>
|
|
2494
2494
|
<head>
|
|
2495
|
-
${
|
|
2495
|
+
${Ce.join(`
|
|
2496
2496
|
`)}
|
|
2497
2497
|
</head>
|
|
2498
|
-
<body${
|
|
2499
|
-
${
|
|
2498
|
+
<body${Ee}${Se}>
|
|
2499
|
+
${Ae.join(`
|
|
2500
2500
|
`)}
|
|
2501
2501
|
</body>
|
|
2502
|
-
</html>`}var
|
|
2502
|
+
</html>`}var $c=/\s+/y,_c=/<(script|style)\b[^>]*>/iy,ux=/<\/script>/gi,dx=/<\/style>/gi,dp=/<!DOCTYPE\b/iy,pp=/<html[\s>]/iy;function an(e){let o=0;while(o<e.length){if($c.lastIndex=o,$c.exec(e)){o=$c.lastIndex;continue}if(e.startsWith("<!--",o)){let k=e.indexOf("-->",o);if(k===-1)return!1;o=k+3;continue}_c.lastIndex=o;let v=_c.exec(e);if(v){let k=v[1].toLowerCase()==="script"?ux:dx;k.lastIndex=_c.lastIndex;let E=k.exec(e);if(E===null)return!1;o=E.index+E[0].length;continue}if(dp.lastIndex=o,dp.test(e))return!0;return pp.lastIndex=o,pp.test(e)}return!1}function Ec(e){return an(e)}function yp(e,o={}){let x=e.lastIndexOf("</head>");if(x===-1)return e;let{meta:v=[],link:k=[],script:E=[],headRaw:C=""}=o,j=e.slice(0,x),L=[];for(let B of v){let F=rr(B);if(F&&j.includes(F))continue;L.push(` <meta ${Tr(B)}>`)}for(let B of k){if(B.href&&j.includes(`href="${B.href}"`))continue;L.push(` <link ${Tr(B)}>`)}for(let B of E)if(B.src){if(j.includes(`src="${B.src}"`))continue;L.push(` <script ${Tr(B,(F)=>F==="content")}></script>`)}else if(B.content){if(j.includes(B.content))continue;L.push(` <script>${B.content}</script>`)}if(C&&!j.includes(C))L.push(` ${C}`);if(L.length===0)return e;return`${e.slice(0,x)}${L.join(`
|
|
2503
2503
|
`)}
|
|
2504
|
-
${e.slice(x)}`}function
|
|
2504
|
+
${e.slice(x)}`}function Wn(e,o={},x={},v){if(v??Ec(e))return e;return lx(e,o,x)}var px=/<\/(script)/gi;function Ir(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(px,"<\\/$1")}var W=["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 xp from"path";function M(e,o={}){return new vn(e,o).routes}var bp=new Map;async function vp(e,o){let x=e,v=o;if(!x||!v)try{let j=await i();x||=j?.pagesDir||"pages",v||=j?.root||"."}catch{x||="pages",v||="."}let k=xp.isAbsolute(x)?x:xp.join(v,x),E=bp.get(k);if(E)return E;let C=[];try{C=M(".",{pagesDir:k,emit:!1}).map((j)=>j.regex.source).filter(Boolean)}catch{C=[]}return bp.set(k,C),C}function gx(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function wp(e){return gx(JSON.stringify(e))}function le(e){return e.includes("data-stx-runtime")}function $p(e){let o=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let x=o.exec(e);x!==null;x=o.exec(e)){let v=e.slice(Math.max(0,x.index-80),x.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(v))continue;return!0}return!1}function Cc(e,o){let x=jr(e),v=e.search(/<!doctype\b/i);if(x!==-1&&(v===-1||x>v))return e.slice(0,x)+o+`
|
|
2505
2505
|
`+e.slice(x);let k=js(e);if(k!==null)return`${e.slice(0,k)}
|
|
2506
2506
|
${o}${e.slice(k)}`;if(e.includes("</head>")){let C=e.indexOf("</head>");return e.slice(0,C)+o+`
|
|
2507
|
-
`+e.slice(C)}if(
|
|
2507
|
+
`+e.slice(C)}if(bn(e))return br(e,(C)=>`${C}
|
|
2508
2508
|
${o}`);return`${o}
|
|
2509
|
-
${e}`}async function Pi(e,o){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(o.buildMode==="serve"){let{getServeClientAsset:k}=await import("./chunk-
|
|
2509
|
+
${e}`}async function Pi(e,o){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(o.buildMode==="serve"){let{getServeClientAsset:k}=await import("./chunk-5j52h3e3.js"),{url:E}=await k("runtime",o.debug===!0);return Cc(e,`<script data-stx-runtime src="${E}"></script>`)}if(o.buildMode==="compile")return Cc(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:x}=await import("./chunk-5j52h3e3.js"),v=await x(o.debug);return Cc(e,`<script data-stx-scoped data-stx-runtime>${v}</script>`)}function mx(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Sp(e){if(e.includes("data-stx-tooltip-runtime")||!mx(e))return e;let o=`<script data-stx-scoped data-stx-tooltip-runtime>${Pa()}</script>`,x=e.lastIndexOf("</body>");if(x===-1)return`${e}
|
|
2510
2510
|
${o}`;return`${e.slice(0,x)}${o}
|
|
2511
|
-
${e.slice(x)}`}var
|
|
2512
|
-
`}let{getCachedRouterScript:k,getServeClientAsset:E}=await import("./chunk-
|
|
2513
|
-
</body>`+e.slice(j+7)}var _p=Symbol.for("stx.lazy-module-promises");function
|
|
2514
|
-
`)}else{if(!Cp(se,x,o,j(U)))continue;he=
|
|
2511
|
+
${e.slice(x)}`}var hx=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function yx(e){return hx.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function X(e,o){if(!e.includes("</body>"))return e;if(yx(e))return e;let x=o?.router,v="";{let L={};if(x){if(x.container)L.container=x.container;if(x.interceptAllLinks!==void 0)L.interceptAllLinks=x.interceptAllLinks;if(x.progress!==void 0)L.progress=x.progress;if(x.viewTransitions!==void 0)L.viewTransitions=x.viewTransitions;if(x.viewTransitionDuration!==void 0)L.viewTransitionDuration=x.viewTransitionDuration;if(x.viewTransitionEasing!==void 0)L.viewTransitionEasing=x.viewTransitionEasing;if(x.scrollToTop!==void 0)L.scrollToTop=x.scrollToTop;if(x.scrollRestoration!==void 0)L.scrollRestoration=x.scrollRestoration;if(x.prefetch!==void 0)L.prefetch=x.prefetch;if(x.cache!==void 0)L.cache=x.cache;if(x.progressColor!==void 0)L.progressColor=x.progressColor;if(x.progressHeight!==void 0)L.progressHeight=x.progressHeight}try{let B=await vp(o?.pagesDir,o?.root);if(B.length>0)L.ownedRoutes=B}catch{}if(Object.keys(L).length>0)v=`<script>window.__stxRouterConfig=${wp(L)};</script>
|
|
2512
|
+
`}let{getCachedRouterScript:k,getServeClientAsset:E}=await import("./chunk-5j52h3e3.js"),C=o?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':o?.buildMode==="serve"?`<script data-stx-router src="${(await E("router")).url}"></script>`:`<script data-stx-router>${await k()}</script>`,j=e.lastIndexOf("</body>");return e.slice(0,j)+v+C+`
|
|
2513
|
+
</body>`+e.slice(j+7)}var _p=Symbol.for("stx.lazy-module-promises");function xx(){let e=globalThis;return e[_p]??=new Map,e[_p]}function lt(e,o){let x=xx(),v=`${import.meta.url}\x00${e}`,k=x.get(v);if(k)return k;let E=o();return x.set(v,E),E.catch(()=>{if(x.get(v)===E)x.delete(v)}),E}var Rc=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Ip=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,bx=65536,vx=4,Oi=new Map;function Nu(){Oi.clear()}function wx(e){let o=[];for(let x of Et(e,G)){let v=x.token.match(/^<script\b([^>]*)>/i),k=x.token.match(/<\/script\s*>$/i);if(!v||!k)continue;let E=v[0].length,C=x.token.length-k[0].length;o.push(Object.freeze({fullMatch:x.token,attrs:v[1],body:x.token.slice(E,C),start:x.start,end:x.end}))}return o}function tc(e,o={}){let x=e.length>=bx,v=x?Oi.get(e):void 0;if(v===void 0){if(v=wx(e),x)Zn(Oi,vx),Oi.set(e,v)}let k=o.skipAttrs;if(!k)return v.slice();let E=[];for(let C of v)if(k.lastIndex=0,!k.test(C.attrs))E.push(C);return E}function rs(e){let o=e.trim(),x=o.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(x){let k=x[1].trim(),E=x[2].trim(),{itemVar:C,indexVar:j}=Ep(E);if(C)return{style:"as",iterable:k,itemVar:C,indexVar:j}}let v=o.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(v){let k=v[1].trim(),E=v[2].trim(),{itemVar:C,indexVar:j}=Ep(k);if(C)return{style:"in",iterable:E,itemVar:C,indexVar:j}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Ep(e){let o=e.trim(),x=o.match(/^(\w+)\s*=>\s*(\w+)$/);if(x)return{itemVar:x[2],indexVar:x[1]};let v=o.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(v)return{itemVar:v[1],indexVar:v[2]||null};let k=o.match(/^(\w+)\s*,\s*(\w+)$/);if(k)return{itemVar:k[1],indexVar:k[2]};let E=o.match(/^(\w+)$/);if(E)return{itemVar:E[1],indexVar:null};return{itemVar:null,indexVar:null}}function ss(e,o){return Eo(e,o)}function $x(e){let o=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,x=0,v;while((v=o.exec(e))!==null){let k=v[1];if(k.startsWith("if"))x++;else if(k==="endif")x--;else if(x===0)return!0}return!1}function Dp(e){let o=new Set,x=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,v=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,k;while((k=x.exec(e))!==null){let E=k[1],C;while((C=v.exec(E))!==null)o.add(C[1])}return o}function Sx(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let o=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Rc})>`,"iy"),x=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,v=Et(e,(E,C)=>{o.lastIndex=C;let j=o.exec(E);if(!j||j.index!==C||!x.test(j[2]))return-1;return o.lastIndex}),k=[];for(let E of v){o.lastIndex=0;let C=o.exec(E.token);if(!C)continue;let j=C[2].match(x),L=rs(j?.[1]??j?.[2]??""),B=[L.itemVar,L.indexVar].filter(Boolean);if(B.length===0)continue;let F=C[1],Z=/\/\s*>$/.test(E.token)||lo.has(F.toLowerCase())?E.end:Tc(e,E.start,F,E.end);if(Z!==-1)k.push({start:E.start,end:Z,vars:new Set(B)})}return k}var kp=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 _x(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Cp(e,o,x,v){if(!e)return!1;let k=_x(e),E=!1,C=!1,j=!1,L=/([a-zA-Z_$][\w$]*)/g,B;while((B=L.exec(k))!==null){let Y=B[1];if(k.slice(0,B.index).trimEnd().endsWith("."))continue;if(kp.has(Y))continue;if(o.has(Y)||v?.has(Y))E=!0;else if(x&&Y in x)C=!0}let F=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=F.exec(k))!==null){let Y=U[1];if(k.slice(0,U.index).trimEnd().endsWith("."))continue;if(kp.has(Y)||x&&Y in x)continue;j=!0}return(E||j)&&!C}function Mi(e,o,x){let v=x===void 0?` ${o}`:` ${o}="${x.replace(/"/g,""")}"`,k=e.trim(),E=k.match(Ip);if(E&&Ex(E[3],E[1])){let[,C,j,L]=E;return`<${C}${j}${v}>${L}</${C}>`}return`<template${v}>${k}</template>`}function Ex(e,o){let x=new RegExp(`<(/)?${o}(?=[\\s/>])`,"gi"),v=0,k;while((k=x.exec(e))!==null)if(k[1]){if(v--,v<0)return!1}else v++;return!0}function Vi(e,o){let x=Dp(e);function v(k){let E=k,C=Sx(k),j=(U)=>{let Z=new Set;for(let Y of C)if(U>Y.start&&U<Y.end)for(let Q of Y.vars)Z.add(Q);return Z},L=/@if\s*\(/g,B,F=[];while((B=L.exec(E))!==null){let U=B.index,Z=U+B[0].length,Y=1,Q=Z;while(Q<E.length&&Y>0){if(E[Q]==="(")Y++;else if(E[Q]===")")Y--;Q++}if(Y!==0)continue;let se=E.substring(Z,Q-1).trim(),oe=Q,ie=1,ce=oe,ae=/@(if\s*\(|endif)/g;ae.lastIndex=oe;let pe;while((pe=ae.exec(E))!==null)if(pe[1].startsWith("if"))ie++;else if(pe[1]==="endif"){if(ie--,ie===0){ce=pe.index+pe[0].length;break}}if(ie!==0)continue;let me=E.substring(oe,ce-6).trim(),he;if($x(me)){let Se=Fr(E.substring(U,ce));if(Se.length===0)continue;let Ee=Se[0].branches.filter((_e)=>_e.type!=="else"),Ce=j(U);if(!(Ee.length>0&&Ee.every((_e)=>Cp(_e.condition,x,o,Ce))))continue;he=Se[0].branches.map((_e)=>{let Te=v(_e.content);if(_e.type==="elseif")return Mi(Te,"@else-if",_e.condition??"");if(_e.type==="else")return Mi(Te,"@else");return Mi(Te,"@if",_e.condition??"")}).join(`
|
|
2514
|
+
`)}else{if(!Cp(se,x,o,j(U)))continue;he=Mi(v(me),"@if",se)}F.push({start:U,end:ce,replacement:he}),L.lastIndex=ce}for(let U=F.length-1;U>=0;U--){let{start:Z,end:Y,replacement:Q}=F[U];E=E.substring(0,Z)+Q+E.substring(Y)}return E}return v(e)}function kx(e){let o=e.trim();if(o==="")return;if(o==="true")return!0;if(o==="false")return!1;if(o==="null")return!1;if(o==="undefined")return!1;if(o==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(o)){let k=Number(o);return k!==0&&!Number.isNaN(k)}let x=o.match(/^'((?:\\.|[^'\\])*)'$/);if(x)return x[1].length>0;let v=o.match(/^"((?:\\.|[^"\\])*)"$/);if(v)return v[1].length>0;return}var lo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rp=/<(script|style)\b/iy,Cx=/<\/script/gi,Rx=/<\/style/gi;function Tc(e,o,x,v){if(lo.has(x.toLowerCase()))return v;let k=x.toLowerCase(),E=e.length,C=1,j=v;while(j<E){let L=e.indexOf("<",j);if(L===-1)return-1;if(j=L,e.startsWith("<!--",j)){let Z=e.indexOf("-->",j+4);if(Z===-1)return-1;j=Z+3;continue}Rp.lastIndex=j;let B=Rp.exec(e);if(B){let Z=e.indexOf(">",j);if(Z===-1)return-1;if(e[Z-1]==="/"){j=Z+1;continue}let Y=B[1].toLowerCase()==="script"?Cx:Rx;Y.lastIndex=j;let Q=Y.exec(e);if(Q===null)return-1;let se=e.indexOf(">",Q.index);if(se===-1)return-1;j=se+1;continue}if(e[j+1]==="/"){let Z=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(j,j+64));if(!Z){j++;continue}if(Z[1].toLowerCase()===k){if(C--,j+=Z[0].length,C===0)return j;continue}j+=Z[0].length;continue}let F=/^<([a-z][\w-]*)\b/i.exec(e.slice(j,j+64));if(!F){j++;continue}let U=e.indexOf(">",j);if(U===-1)return-1;if(F[1].toLowerCase()===k){let Z=e.slice(j,U+1);if(!(/\/\s*>$/.test(Z)||lo.has(k)))C++}j=U+1}return-1}var Ax=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Tx(e,o){let x=o,v=e.length;for(;;){while(x<v&&e[x]!=="<")x++;if(x>=v)return!1;if(e.startsWith("<!--",x)){let C=e.indexOf("-->",x+4);if(C===-1)return!1;x=C+3;continue}break}if(e[x+1]==="/")return!1;let k=e.indexOf(">",x);if(k===-1)return!1;let E=e.slice(x,k+1);return Ax.test(E)}function Ui(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let o=[],x=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,v;while((v=x.exec(e))!==null)o.push([v.index,v.index+v[0].length]);let k=(U)=>o.some(([Z,Y])=>U>=Z&&U<Y),E=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,C=[],j;while((j=E.exec(e))!==null){if(k(j.index))continue;let[U,Z,Y,Q,se,oe,ie]=j,ce=kx(se);if(ce===void 0)continue;let ae=j.index,pe=ae+U.length,Se=!!ie||/\/\s*>$/.test(U)||lo.has(Z.toLowerCase())?pe:Tc(e,ae,Z,pe);if(Se===-1)continue;if((Q===":if"||Q==="x-if"||Q==="@if")&&Tx(e,Se)){E.lastIndex=pe;continue}if(ce===!0){let Ce=`<${Z}${Y}${oe}${ie}>`;C.push({start:ae,end:pe,replacement:Ce});continue}C.push({start:ae,end:Se,replacement:""}),E.lastIndex=Se}if(C.length===0)return e;C.sort((U,Z)=>U.start-Z.start);let L=[],B=-1;for(let U of C){if(U.start<B)continue;L.push(U),B=U.end}let F=e;for(let U=L.length-1;U>=0;U--){let{start:Z,end:Y,replacement:Q}=L[U];F=F.substring(0,Z)+Q+F.substring(Y)}return F}var Ap=[":for","@for","x-for"];function is(e,o){if(!o||Object.keys(o).length===0)return e;if(!Ap.some((j)=>e.includes(`${j}=`)))return e;let x=Dp(e);if(Array.isArray(o.__stx_client_signal_names)){for(let j of o.__stx_client_signal_names)if(typeof j==="string")x.add(j)}let v=e,k=[],E=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,C;while((C=E.exec(v))!==null){let[j,L,B]=C,F=C.index,U=F+j.length,Z=Ap.map((he)=>({attr:he,m:new RegExp(`\\s${he}="([^"]*)"`).exec(B)})).find((he)=>he.m!==null);if(!Z||!Z.m)continue;let Y=rs(Z.m[1]);if(!Y.iterable||!Y.itemVar)continue;let Q=Y.iterable.trim().split(/[.[(]/)[0].trim();if(!Q||x.has(Q)||!(Q in o))continue;let se=Tc(v,F,L,U);if(se===-1)continue;let oe=B.replace(new RegExp(`\\s${Z.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ie=v.slice(U,se-`</${L}>`.length),ce={...o,[Y.itemVar]:void 0};if(Y.indexVar)ce[Y.indexVar]=void 0;let ae=is(ie,ce),pe=Y.indexVar?`${Y.iterable} as ${Y.indexVar} => ${Y.itemVar}`:`${Y.iterable} as ${Y.itemVar}`,me=L.toLowerCase()==="template"?ae:`<${L}${oe}>${ae}</${L}>`;k.push({start:F,end:se,replacement:`@foreach(${pe})${me}@endforeach`}),E.lastIndex=se}for(let j=k.length-1;j>=0;j--){let{start:L,end:B,replacement:F}=k[j];v=v.slice(0,L)+F+v.slice(B)}return v}function os(e,o){let x=e,v=/@(for|foreach)\s*\(/g,k,E=[],C=[];while((k=v.exec(x))!==null){let j=k[1],L=k.index,B=L+k[0].length,F=1,U=B;while(U<x.length&&F>0){if(x[U]==="(")F++;else if(x[U]===")")F--;U++}if(F!==0)continue;let Z=x.substring(B,U-1).trim(),Y=U,Q=rs(Z),se=j==="for"?"@endfor":"@endforeach",oe=1,ie=Y,ce=j==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${j}\\s*\\(|end${j})`,"g");ce.lastIndex=Y;let ae;while((ae=ce.exec(x))!==null)if(ae[1].startsWith(j))oe++;else if(oe--,oe===0){ie=ae.index+ae[0].length;break}if(oe!==0)continue;let pe=()=>{let Ae=[Q.itemVar,Q.indexVar].filter(Boolean);if(Ae.length)C.push({start:L,end:ie,vars:Ae})};if(Q.iterable){let Ae=Q.iterable.trim();if(Ae.startsWith("[")||Ae.startsWith("{")||Ae.startsWith("'")||Ae.startsWith('"')||Ae.startsWith("`")||/^-?\d/.test(Ae)){pe();continue}let Re=Ae.split(/[.[(]/)[0].trim(),_e=o?Re in o:!1,Te=C.some((Me)=>L>Me.start&&L<Me.end&&Me.vars.includes(Re));if(Re&&(_e||Te)){pe();continue}}if(Q.style==="as")Z=Q.indexVar?`(${Q.itemVar}, ${Q.indexVar}) in ${Q.iterable}`:`${Q.itemVar} in ${Q.iterable}`;let me=x.substring(Y,ie-se.length).trim(),he=o?{...o}:{};if(Q.itemVar)delete he[Q.itemVar];if(Q.indexVar)delete he[Q.indexVar];let Se=os(me,he),Ee=Se.match(Ip),Ce;if(Ee){let[,Ae,Re,_e]=Ee;Ce=`<${Ae}${Re} @for="${Z}">${_e}</${Ae}>`}else Ce=`<template @for="${Z}">${Se}</template>`;E.push({start:L,end:ie,replacement:Ce}),v.lastIndex=ie}for(let j=E.length-1;j>=0;j--){let{start:L,end:B,replacement:F}=E[j];x=x.substring(0,L)+F+x.substring(B)}return x}function Ix(e){let o=new Set,x=[],v=0,k=0,E=e.length,C=(F)=>{let U=v+1;while(U<E){let Z=e[U];if(Z==="\\"){U+=2;continue}if(Z===F)return U+1;U++}return E},j=()=>{let F=v+2;while(F<E&&e[F]!==`
|
|
2515
2515
|
`)F++;return F},L=()=>{let F=v+2;while(F<E-1){if(e[F]==="*"&&e[F+1]==="/")return F+2;F++}return E},B=(F)=>{let U=F,Z=0;while(U<E){let Y=e[U];if(Y==="/"&&e[U+1]==="/"){let Q=U+2;while(Q<E&&e[Q]!==`
|
|
2516
|
-
`)Q++;U=Q;continue}if(Y==="/"&&e[U+1]==="*"){let Q=U+2;while(Q<E-1&&!(e[Q]==="*"&&e[Q+1]==="/"))Q++;U=Q+2;continue}if(Y==='"'||Y==="'"||Y==="`"){let Q=U+1;while(Q<E){if(e[Q]==="\\"){Q+=2;continue}if(e[Q]===Y){Q++;break}Q++}U=Q;continue}if(Y==="("||Y==="["||Y==="{"){Z++,U++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--,U++;continue}if(Y===";"&&Z===0)return U+1;U++}return E};while(v<E){let F=e[v];if(F==="/"&&e[v+1]==="/"){let U=j();x.push(e.slice(v,U)),v=U;continue}if(F==="/"&&e[v+1]==="*"){let U=L();x.push(e.slice(v,U)),v=U;continue}if(F==='"'||F==="'"||F==="`"){let U=C(F);x.push(e.slice(v,U)),v=U;continue}if(F==="{"){k++,x.push(F),v++;continue}if(F==="}"){k--,x.push(F),v++;continue}if(k===0){let U=v>0?e[v-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let Y=e.slice(v).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Y){let Q=Y[2],se=B(v+Y[0].length);if(o.has(Q)){x.push(`/* stx: deduped const ${Q} */`),v=se;continue}o.add(Q),x.push(e.slice(v,se)),v=se;continue}}}x.push(F),v++}return x.join("")}var
|
|
2516
|
+
`)Q++;U=Q;continue}if(Y==="/"&&e[U+1]==="*"){let Q=U+2;while(Q<E-1&&!(e[Q]==="*"&&e[Q+1]==="/"))Q++;U=Q+2;continue}if(Y==='"'||Y==="'"||Y==="`"){let Q=U+1;while(Q<E){if(e[Q]==="\\"){Q+=2;continue}if(e[Q]===Y){Q++;break}Q++}U=Q;continue}if(Y==="("||Y==="["||Y==="{"){Z++,U++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--,U++;continue}if(Y===";"&&Z===0)return U+1;U++}return E};while(v<E){let F=e[v];if(F==="/"&&e[v+1]==="/"){let U=j();x.push(e.slice(v,U)),v=U;continue}if(F==="/"&&e[v+1]==="*"){let U=L();x.push(e.slice(v,U)),v=U;continue}if(F==='"'||F==="'"||F==="`"){let U=C(F);x.push(e.slice(v,U)),v=U;continue}if(F==="{"){k++,x.push(F),v++;continue}if(F==="}"){k--,x.push(F),v++;continue}if(k===0){let U=v>0?e[v-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let Y=e.slice(v).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Y){let Q=Y[2],se=B(v+Y[0].length);if(o.has(Q)){x.push(`/* stx: deduped const ${Q} */`),v=se;continue}o.add(Q),x.push(e.slice(v,se)),v=se;continue}}}x.push(F),v++}return x.join("")}var Dx=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Ac(e,o,x){for(let v of x){if(v.start>=o)return!1;if(v.end>e)return!0}return!1}function Px(e,o,x){let v=0;while(v<e.length){let k=e.indexOf(o,v);if(k===-1)return!1;if(!Ac(k,k+o.length,x))return!0;v=k+o.length}return!1}function Mx(e,o){if(Px(e,"<body",o)){let k=new RegExp(`<body(${Rc})>`,"g"),E;while((E=k.exec(e))!==null)if(!Ac(E.index,E.index+E[0].length,o))return E.index+E[0].length-1;return null}let x=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Rc})>`,"gi"),v;while((v=x.exec(e))!==null){if(Ac(v.index,v.index+v[0].length,o))continue;if(Dx.has(v[1].toLowerCase()))continue;return v.index+v[0].length-1}return null}function Ox(e,o,x,v){let k=[],E=` data-stx="${v}"`,C=0,j=!1,L=(B)=>{if(x!==null&&!j&&x>=C&&x<=B)k.push(e.slice(C,x),E,e.slice(x,B)),j=!0;else k.push(e.slice(C,B))};for(let B of o){if(B.start<C)continue;L(B.start),C=B.end}return L(e.length),k.join("")}async function nc(e,o,x){let v=tc(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),k=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,E=[],{hasUserImports:C,bundleClientScript:j}=await lt("stx/client-script-bundler",()=>import("./chunk-ef5vz9w5.js"));for(let ce of v){let ae=ce.body;if(Ve(ce.attrs))ae=Ue(ae);if(k.test(ae)){E.push({content:ae,start:ce.start,end:ce.end});continue}if(!C(ae))continue;try{let pe=await j(vt(ae).code,o||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(k.test(pe))E.push({content:ae,start:ce.start,end:ce.end})}catch{}}if(E.length===0)return{output:e,setupCode:null};let L=`${o??""}\x00${E.map((ce)=>ce.content).join("\x00")}`,B=`__stx_setup_${Bun.hash(L).toString(36).slice(0,10)}`,F=[];for(let ce=0;ce<E.length;ce++){let ae=E[ce].bundled??vt(E[ce].content).code;if(!E[ce].bundled&&C(ae))ae=await j(ae,o||"",{projectRoot:process.cwd()});ae=ze(ae);let pe=R(ae);F.push(`// \u2500\u2500 merged signal script #${ce+1} \u2500\u2500
|
|
2517
2517
|
${pe}`)}let U=F.join(`
|
|
2518
2518
|
|
|
2519
|
-
`);U=
|
|
2519
|
+
`);U=Ix(U);let Z=rc(U),Y=Z.split(",").map((ce)=>ce.trim()).filter(Boolean),Q=Jr(U,x),se=`
|
|
2520
2520
|
<script data-stx-scoped>
|
|
2521
2521
|
function ${B}() {
|
|
2522
|
-
${
|
|
2522
|
+
${Dt("const",Y)}
|
|
2523
2523
|
${Ir(`${Q}${U}`)}
|
|
2524
2524
|
return { ${Z} };
|
|
2525
2525
|
}
|
|
2526
2526
|
window.__stx_latestSetup=${B};
|
|
2527
2527
|
if(window.stx)window.stx._latestSetup=${B};
|
|
2528
|
-
</script>`,oe=
|
|
2528
|
+
</script>`,oe=Mx(e,E);return{output:Ox(e,E,oe,B),setupCode:se}}function rc(e){let o=e,x=[],v=new Set,k=0,E=0,C=o.length,j="",L=()=>{E++;let Q=!1;while(E<C){let se=o[E];if(se==="\\"){E+=2;continue}if(se==="["&&!Q){Q=!0,E++;continue}if(se==="]"&&Q){Q=!1,E++;continue}if(se==="/"&&!Q){E++;while(E<C&&/[gimsuyd]/.test(o[E]))E++;return}if(se===`
|
|
2529
2529
|
`)return;E++}},B=()=>{if(!j)return!0;if(/[\w)\]]/.test(j))return!1;return!0},F=(Q)=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]===Q){E++;return}E++}},U=()=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]==="`"){E++;return}if(o[E]==="$"&&o[E+1]==="{"){E+=2;let Q=1;while(E<C&&Q>0)if(o[E]==="{")Q++,E++;else if(o[E]==="}")Q--,E++;else if(o[E]==="'"||o[E]==='"')F(o[E]);else if(o[E]==="`")U();else E++;continue}E++}},Z=()=>{if(o[E]==="/"&&o[E+1]==="/"){while(E<C&&o[E]!==`
|
|
2530
|
-
`)E++;return!0}if(o[E]==="/"&&o[E+1]==="*"){E+=2;while(E<C-1&&!(o[E]==="*"&&o[E+1]==="/"))E++;return E+=2,!0}return!1},Y=()=>{if(k!==0)return;let Q=o.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(Q){let ae=Q[2];if(!v.has(ae))x.push(ae),v.add(ae);return}let se=o.slice(E).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let pe=ae.trim();if(!pe)return;let me=pe.indexOf(":"),Se=(me>=0?pe.slice(me+1).trim():pe).split(/[\s=]/)[0];if(Se&&!v.has(Se))x.push(Se),v.add(Se)});return}let oe=o.slice(E).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(oe){oe[1].split(",").forEach((ae)=>{let pe=ae.trim().replace(/^\.\.\./,"");if(!pe)return;let me=pe.split(/[\s=]/)[0];if(me&&!v.has(me))x.push(me),v.add(me)});return}let ie=o.slice(E).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let ae=ie[1];if(!v.has(ae))x.push(ae),v.add(ae);return}let ce=o.slice(E).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let ae=ce[1];if(!v.has(ae))x.push(ae),v.add(ae)}};while(E<C){if(Z())continue;if(o[E]==="'"||o[E]==='"'){F(o[E]),j=o[E-1];continue}if(o[E]==="`"){U(),j="`";continue}if(o[E]==="/"&&o[E+1]!=="/"&&o[E+1]!=="*"&&B()){L(),j="/";continue}if(o[E]==="{"){k++,j="{",E++;continue}if(o[E]==="}"){k--,j="}",E++;continue}if(k===0&&/[a-z]/i.test(o[E])&&(E===0||/\s|[;{}()]/.test(o[E-1])))Y();if(!/\s/.test(o[E]))j=o[E];E++}return x.join(", ")}async function
|
|
2530
|
+
`)E++;return!0}if(o[E]==="/"&&o[E+1]==="*"){E+=2;while(E<C-1&&!(o[E]==="*"&&o[E+1]==="/"))E++;return E+=2,!0}return!1},Y=()=>{if(k!==0)return;let Q=o.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(Q){let ae=Q[2];if(!v.has(ae))x.push(ae),v.add(ae);return}let se=o.slice(E).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let pe=ae.trim();if(!pe)return;let me=pe.indexOf(":"),Se=(me>=0?pe.slice(me+1).trim():pe).split(/[\s=]/)[0];if(Se&&!v.has(Se))x.push(Se),v.add(Se)});return}let oe=o.slice(E).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(oe){oe[1].split(",").forEach((ae)=>{let pe=ae.trim().replace(/^\.\.\./,"");if(!pe)return;let me=pe.split(/[\s=]/)[0];if(me&&!v.has(me))x.push(me),v.add(me)});return}let ie=o.slice(E).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let ae=ie[1];if(!v.has(ae))x.push(ae),v.add(ae);return}let ce=o.slice(E).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let ae=ce[1];if(!v.has(ae))x.push(ae),v.add(ae)}};while(E<C){if(Z())continue;if(o[E]==="'"||o[E]==='"'){F(o[E]),j=o[E-1];continue}if(o[E]==="`"){U(),j="`";continue}if(o[E]==="/"&&o[E+1]!=="/"&&o[E+1]!=="*"&&B()){L(),j="/";continue}if(o[E]==="{"){k++,j="{",E++;continue}if(o[E]==="}"){k--,j="}",E++;continue}if(k===0&&/[a-z]/i.test(o[E])&&(E===0||/\s|[;{}()]/.test(o[E-1])))Y();if(!/\s/.test(o[E]))j=o[E];E++}return x.join(", ")}async function Wi(e,o,x,v){if(!ss(e,x))return e;let k=e;if(o.skipSignalsRuntime)return k;let{output:E,setupCode:C}=await nc(k,x,v);if(k=E,!C){let j=bn(k);if(j&&!/data-stx/.test(j.attrs)&&!/data-stx-auto/.test(j.attrs)){let L=j.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");k=k.slice(0,j.index)+L+k.slice(j.index+j.tag.length)}}if(k=await Pi(k,o),C){let j=qi(k,/<\/head>/i),L=j===-1?qi(k,/<body[^>]*>/i):-1;if(j!==-1)k=`${k.slice(0,j)}${C}
|
|
2531
2531
|
${k.slice(j)}`;else if(L!==-1){let B=/<body[^>]*>/i.exec(k.slice(L))[0],F=L+B.length;k=`${k.slice(0,F)}
|
|
2532
2532
|
${C}${k.slice(F)}`}else k=`${k}
|
|
2533
|
-
${C}`}return k}function
|
|
2534
|
-
`+" `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 x[Op]=!0,x}async function Np(e,o,x){let v=e,k=Dr.dirname(o),E=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,C;while((C=E.exec(v))!==null){let[B,F,U,Z]=C;if(Pp(U))continue;let Y=await Mp(U,k,o);if(Y)try{let Q=await Bun.file(Y).text();if(x.add(Y),U.endsWith(".ts")||U.endsWith(".tsx")){let oe=await Bun.build({entrypoints:[Y],target:"browser",minify:!0,define:y()});if(oe.outputs.length>0)Q=await oe.outputs[0].text(),
|
|
2533
|
+
${C}`}return k}function qi(e,o){let x=/<(script|style)\b[\s\S]*?<\/\1>/gi,v=[],k;while((k=x.exec(e))!==null)v.push([k.index,k.index+k[0].length]);let E=new RegExp(o.source,o.flags.replace(/[gy]/g,"")),C=0;while(C<e.length){let j=E.exec(e.slice(C));if(!j)return-1;let L=C+j.index;if(!v.some(([F,U])=>L>=F&&L<U))return L;C=L+Math.max(j[0].length,1)}return-1}var Tp="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function sc(e){let o=[];for(let x of e.split(",")){let v=x.trim();if(!v||v.startsWith("type "))continue;let k=v.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k&&k[1]!==k[2])o.push(`${k[2]} = ${k[1]}`)}if(o.length===0)return Tp;return`var ${o.join(", ")}; ${Tp}`}var Nx=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function ze(e){return e.replace(Nx,(o,x)=>sc(x))}import Dr from"path";import jx from"process";function y(e="STX_PUBLIC_"){let o={},x={};for(let[v,k]of Object.entries(jx.env)){if(!v.startsWith(e)||k===void 0)continue;o[`import.meta.env.${v}`]=JSON.stringify(k),x[v]=k}return o["import.meta.env"]=JSON.stringify(x),o}function Pp(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")}async function Mp(e,o,x){try{let v;if(e.startsWith("/")){let k=o;for(let E=0;E<5;E++){let C=Dr.join(k,e);if(await Bun.file(C).exists())return C;k=Dr.dirname(k)}v=Dr.join(o,e)}else if(e.startsWith("./")||e.startsWith("../"))v=Dr.resolve(o,e);else v=Dr.resolve(o,e);if(await Bun.file(v).exists())return v;return null}catch{return null}}var Op=Symbol.for("stx.inline-assets.import-meta");function Lx(e,o){if(!e.includes("import.meta"))return;let x=Error(`[stx] ${o} 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.
|
|
2534
|
+
`+" `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 x[Op]=!0,x}async function Np(e,o,x){let v=e,k=Dr.dirname(o),E=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,C;while((C=E.exec(v))!==null){let[B,F,U,Z]=C;if(Pp(U))continue;let Y=await Mp(U,k,o);if(Y)try{let Q=await Bun.file(Y).text();if(x.add(Y),U.endsWith(".ts")||U.endsWith(".tsx")){let oe=await Bun.build({entrypoints:[Y],target:"browser",minify:!0,define:y()});if(oe.outputs.length>0)Q=await oe.outputs[0].text(),Lx(Q,U)}let se=`<script>
|
|
2535
2535
|
// Source: ${U}
|
|
2536
2536
|
${Q}
|
|
2537
2537
|
</script>`;v=v.replace(B,se),E.lastIndex=0}catch(Q){if(Q?.[Op])throw Q}}let j=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,L;while((L=j.exec(v))!==null){let[B,F,U,Z]=L,Y=F+Z;if(Pp(U))continue;if(/rel=["']stylesheet["']/.test(Y)||U.endsWith(".css")){let se=await Mp(U,k,o);if(se)try{let oe=await Bun.file(se).text();x.add(se);let ie=`<style>
|
|
2538
2538
|
/* Source: ${U} */
|
|
2539
2539
|
${oe}
|
|
2540
|
-
</style>`;v=v.replace(B,ie),j.lastIndex=0}catch(oe){}}}return v}function
|
|
2540
|
+
</style>`;v=v.replace(B,ie),j.lastIndex=0}catch(oe){}}}return v}function gs(e,o){let x=e,v=/@json\s*\(/g,k;while((k=v.exec(x))!==null){let E=k.index,C=E+k[0].length-1,j=1,L=C+1,B=null,F=!1;while(L<x.length&&j>0){let ae=x[L];if(F){F=!1,L++;continue}if(ae==="\\"&&B){F=!0,L++;continue}if(B){if(ae===B)B=null;L++;continue}if(ae==='"'||ae==="'"||ae==="`"){B=ae,L++;continue}if(ae==="(")j++;else if(ae===")"){if(j--,j===0)break}L++}if(j!==0)break;let U=x.substring(C+1,L).trim(),Z=x.substring(E,L+1),Y=-1,Q=0,se=null,oe=!1;for(let ae=0;ae<U.length;ae++){let pe=U[ae];if(oe){oe=!1;continue}if(pe==="\\"&&se){oe=!0;continue}if(se){if(pe===se)se=null;continue}if(pe==='"'||pe==="'"||pe==="`"){se=pe;continue}if(pe==="("||pe==="["||pe==="{")Q++;else if(pe===")"||pe==="]"||pe==="}")Q--;if(pe===","&&Q===0){Y=ae;break}}let ie=Y>=0?U.substring(0,Y).trim():U,ce=Y>=0?U.substring(Y+1).trim():void 0;try{let ae=ie.trim(),pe;if(p(ae))pe=l(ae,Object.keys(o))(...Object.values(o));else pe=void 0;let me;if(ce==="true")me=JSON.stringify(pe,null,2);else me=JSON.stringify(pe);let he=me.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");x=x.substring(0,E)+he+x.substring(L+1),v.lastIndex=E+he.length}catch(ae){_.log(ae instanceof Error?ae:Error(String(ae)),{directive:"@json"},"error"),v.lastIndex=E+Z.length}}return x}function ms(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Lp(e){let o=e,x=/@memo\s*\(/g,v,k=[];while((v=x.exec(o))!==null){let E=v.index,C=E+v[0].length,j=1,L=C;while(L<o.length&&j>0){if(o[L]==="(")j++;else if(o[L]===")")j--;L++}if(j!==0)continue;let B=o.slice(C,L-1).trim(),F=L,U=o.slice(F),Z=U.indexOf("@endmemo");if(Z===-1)continue;let Y=U.slice(0,Z),Q=F+Z+8,se=Y.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=se?se[0].length:0,ie=Y.slice(oe),ce=Y.match(/(\s*)$/),ae=ce?ce[0].length:0,pe=ie.slice(0,ie.length-ae),me=pe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),he;if(me){let[Se,Ee,Ce="",Ae]=me,Re=`<${Ee}${Ce} data-stx-memo="${B}"${Ae}>`;he=Y.slice(0,oe)+Re+pe.slice(Se.length)+Y.slice(oe+pe.length)}else he=`${Y.slice(0,oe)}<div data-stx-memo="${B}">${pe}</div>${Y.slice(oe+pe.length)}`;k.push({start:E,end:Q,replacement:he}),x.lastIndex=Q}for(let E=k.length-1;E>=0;E--){let C=k[E];o=o.slice(0,C.start)+C.replacement+o.slice(C.end)}return o.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ic(e){let o=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return o=o.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),o}function Bp(e,o){if(!/\bref\s*=/.test(e))return e;let x=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,v=Et(e,(L,B)=>{x.lastIndex=B;let F=x.exec(L);if(!F||/^(?:script|style)$/i.test(F[1]))return-1;return x.lastIndex}),k=[],E=0,C=0,j=[];for(let{start:L,end:B,token:F}of v){let U=/^<\/?([\w-]+)/.exec(F)[1].toLowerCase();if(F.startsWith("</")){let Y;while(Y=k.pop()){if(Y.scoped)E--;if(Y.name===U)break}continue}let Z=/\sdata-stx-scope\s*=/.test(F);if(!E&&!Z&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(F)&&!/\sdata-stx-ref-caller\s*=/.test(F))j.push(e.slice(C,L),F.replace(/\s*\/?>$/,(Y)=>` data-stx-ref-caller="${o}"${Y}`)),C=B;if(!zp.has(U)&&!/\/>$/.test(F)){if(k.push({name:U,scoped:Z}),Z)E++}}return j.push(e.slice(C)),j.join("")}var zp=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Wp=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,jp=/<\/?\s*([a-z][\w-]*)/iy,Bx=/\s/;function zx(e,o){let x=o-1;while(x>=0&&Bx.test(e[x]))x--;return x>=0&&e[x]==="/"}function Wx(e,o){let x=!1,v=!1;for(let k=o;k<e.length;k++){let E=e[k];if(x){if(E==="'")x=!1}else if(v){if(E==='"')v=!1}else if(E==="'")x=!0;else if(E==='"')v=!0;else if(E===">")return k}return-1}function Fx(e,o){if(e.indexOf("{",o)===-1||e.indexOf("}",o)===-1)return!1;let x=0,v=o,k=!1,E=!1,C=!1;while(v<e.length){let j=e.indexOf("<",v),L=j===-1?e.length:j;if(L>v){if(x===0)while(v<L){let U=e.indexOf(E?"}":"{",v);if(U===-1||U>=L){if(E)C=!1;else k=!1;break}if(U>v)if(E)C=!1;else k=!1;if(E){if(C)return!0;C=!0}else if(k)E=!0,C=!1;else k=!0;v=U+1}v=L;continue}if(e.startsWith("<!--",v)){let U=e.indexOf("-->",v);v=U===-1?e.length:U+3;continue}let B=Wx(e,v);if(B===-1)break;jp.lastIndex=v;let F=jp.exec(e)?.[1]?.toLowerCase()??"";if(e[v+1]==="/"){if(x===0)break;x--}else if(!zx(e,B)&&!zp.has(F))x++;v=B+1}return!1}function Fp(e){if(e.length>=32768&&!vo(e))return e;let x=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"),v="",k=0,E;while((E=x.exec(e))!==null){let C=E.index,j=C+E[0].length,L=!1,B=!1,F=-1;while(j<e.length){let Z=e[j];if(L){if(Z==="'")L=!1}else if(B){if(Z==='"')B=!1}else if(Z==="'")L=!0;else if(Z==='"')B=!0;else if(Z===">"){F=j;break}j++}if(F===-1)continue;let U=e.slice(C,F+1);if(Wp.test(U))continue;if(U.includes("x-cloak"))continue;if(Fx(e,F+1))v+=e.slice(k,F)+" x-cloak>",k=F+1}return v+=e.slice(k),v}var Vx=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Ux=/<\/script>/gi,Hx=/<\/style>/gi;function Vp(e){let o=/<[a-z][\w-]*/gi,x="",v=0,k;while((k=o.exec(e))!==null){let E=k.index,C=k[0].slice(1).toLowerCase();if(C==="script"||C==="style"){let Q=C==="script"?Ux:Hx;Q.lastIndex=E;let se=Q.exec(e);if(se!==null)o.lastIndex=se.index+se[0].length;continue}let j=E+k[0].length,L=!1,B=!1,F=-1;while(j<e.length){let Q=e[j];if(L){if(Q==="'")L=!1}else if(B){if(Q==='"')B=!1}else if(Q==="'")L=!0;else if(Q==='"')B=!0;else if(Q===">"){F=j;break}j++}if(F===-1)continue;let U=e.slice(E+k[0].length,F);if(Wp.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!Vx.test(U))continue;let Z=e[F-1]==="/",Y=Z?F-1:F;x+=`${e.slice(v,Y)} x-cloak${Z?" ":""}`,v=Y}return x+=e.slice(v),x}var Dc=P(256),qx=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],Up=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Xx(e){let o=Array.from(e,(k)=>k===`
|
|
2541
2541
|
`?`
|
|
2542
2542
|
`:" "),x=0,v="";while(x<e.length){let k=e[x],E=e[x+1];if(v){if(k==="\\"){x+=2;continue}if(k===v)v="";x++;continue}if(k==='"'||k==="'"||k==="`"){v=k,x++;continue}if(k==="/"&&E==="/"){while(x<e.length&&e[x]!==`
|
|
2543
|
-
`)o[x]=e[x],x++;continue}if(k==="/"&&E==="*"){let C=e.indexOf("*/",x+2),j=C===-1?e.length:C+2;for(;x<j;x++)o[x]=e[x];continue}if(k==="{"&&E==="{"&&e.slice(x,x+4)==="{{--"){let C=e.indexOf("--}}",x+4),j=C===-1?e.length:C+4;for(;x<j;x++)o[x]=e[x];continue}x++}return o.join("")}function
|
|
2543
|
+
`)o[x]=e[x],x++;continue}if(k==="/"&&E==="*"){let C=e.indexOf("*/",x+2),j=C===-1?e.length:C+2;for(;x<j;x++)o[x]=e[x];continue}if(k==="{"&&E==="{"&&e.slice(x,x+4)==="{{--"){let C=e.indexOf("--}}",x+4),j=C===-1?e.length:C+4;for(;x<j;x++)o[x]=e[x];continue}x++}return o.join("")}function Kx(e){let o=new Map,x=Xx(e).split(`
|
|
2544
2544
|
`),v=e.split(`
|
|
2545
|
-
`);return x.forEach((k,E)=>{Up.lastIndex=0;for(let C of k.matchAll(Up)){let j=C[1]==="-next-line",L=(v[E]??"").slice(0,C.index).trim(),B=j||L===""?E+2:E+1,U=(C[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Z=U.filter((Q)=>/\w/.test(Q));if(U.length>0&&Z.length===0)continue;let Y=o.get(B);if(Y&&Y.size===0)continue;if(Z.length===0){o.set(B,new Set);continue}if(Y)Z.forEach((Q)=>Y.add(Q));else o.set(B,new Set(Z))}}),o}function
|
|
2545
|
+
`);return x.forEach((k,E)=>{Up.lastIndex=0;for(let C of k.matchAll(Up)){let j=C[1]==="-next-line",L=(v[E]??"").slice(0,C.index).trim(),B=j||L===""?E+2:E+1,U=(C[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Z=U.filter((Q)=>/\w/.test(Q));if(U.length>0&&Z.length===0)continue;let Y=o.get(B);if(Y&&Y.size===0)continue;if(Z.length===0){o.set(B,new Set);continue}if(Y)Z.forEach((Q)=>Y.add(Q));else o.set(B,new Set(Z))}}),o}function Zx(e,o,x){let v=e.get(o);if(!v)return!1;if(v.size===0)return!0;return[...v].some((k)=>x.includes(k))}function hs(e,o,x,v){let k=typeof x==="boolean"?{enabled:x,failOnViolation:x}:x??{enabled:!1};if(!k.enabled)return;let E=D(e,o,v,JSON.stringify(k)),C=Dc.get(E);if(C!==void 0){if(C&&k.failOnViolation)throw Error(C);return}let j=k.allowPatterns??[],L=Kx(e),B=[],F=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(Q)=>Q.replace(/[^\n]/g," ")));for(let{pattern:Q,message:se,suggestion:oe}of qx){if(j.some((ce)=>/\w/.test(ce)&&se.includes(ce)))continue;Q.lastIndex=0;let ie=F.match(Q);if(ie&&ie.length>0){let ce=F.split(`
|
|
2546
2546
|
`),ae=e.split(`
|
|
2547
|
-
`),pe=[];if(ce.forEach((Ee,Ce)=>{if(Q.lastIndex=0,Q.test(Ee)&&!
|
|
2547
|
+
`),pe=[];if(ce.forEach((Ee,Ce)=>{if(Q.lastIndex=0,Q.test(Ee)&&!Zx(L,Ce+1,se))pe.push(Ce+1)}),pe.length===0&&ce.some((Ee)=>(Q.lastIndex=0,Q.test(Ee))))continue;let me=pe.length>0?` (script line${pe.length>1?"s":""} ${pe.join(", ")})`:"",he=pe.slice(0,3).map((Ee)=>` ${Ee} | ${(ae[Ee-1]??"").trim().slice(0,100)}`).join(`
|
|
2548
2548
|
`),Se=he?`
|
|
2549
2549
|
${he}`:"";B.push(` \u2717 ${se}${me}
|
|
2550
2550
|
\u2192 ${oe}${Se}`)}}if(B.length===0){Dc.set(E,"");return}let U=(Q)=>{let se=`${process.cwd()}/`;return Q.startsWith(se)?Q.slice(se.length):Q},Y=`[STX] DOM API violation in ${v&&v!==o?`${U(v)} (composed into ${U(o)})`:U(o)}:
|
|
2551
2551
|
${B.join(`
|
|
2552
2552
|
`)}
|
|
2553
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Dc.set(E,Y),k.failOnViolation)throw Error(Y);else console.warn(Y)}import Pc from"path";var
|
|
2553
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Dc.set(E,Y),k.failOnViolation)throw Error(Y);else console.warn(Y)}import Pc from"path";var Jx=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Gx=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Yx(e,o){if(!o||!e.includes("/"))return e;let x=Pc.dirname(o);return e.replace(Jx,(v,k,E,C)=>{let j=Pc.resolve(x,C);return`${k}${E}${j.split(Pc.sep).join("/")}${E}`})}function Hp(e,o){if(!o||!e.includes("<script"))return e;return e.replace(Gx,(x,v,k,E)=>`${v}${Yx(k,o)}${E}`)}var mr="<!--PARENT_CONTENT_PLACEHOLDER-->";function qp(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qp(e,o){let x=e.length,v=o,k=!0,E=[],C=(j)=>j+9<=x&&e[j]==="<"&&e[j+1]==="/"&&(e[j+2]==="s"||e[j+2]==="S")&&(e[j+3]==="c"||e[j+3]==="C")&&(e[j+4]==="r"||e[j+4]==="R")&&(e[j+5]==="i"||e[j+5]==="I")&&(e[j+6]==="p"||e[j+6]==="P")&&(e[j+7]==="t"||e[j+7]==="T")&&(e[j+8]===">"||/\s/.test(e[j+8]));while(v<x){let j=e[v];if(C(v))return v;if(j==="/"&&e[v+1]==="/"){if(v=e.indexOf(`
|
|
2554
2554
|
`,v+2),v===-1)return-1;v+=1,k=!0;continue}if(j==="/"&&e[v+1]==="*"){let L=e.indexOf("*/",v+2);if(L===-1)return-1;v=L+2,k=!0;continue}if(j==="/"&&k){let L=v+1,B=!1;while(L<x){let F=e[L];if(F==="\\"){L+=2;continue}if(F==="[")B=!0;else if(F==="]")B=!1;else if(F==="/"&&!B){L++;break}else if(F===`
|
|
2555
2555
|
`){L=-1;break}L++}if(L===-1){v++,k=!1;continue}while(L<x&&/[a-z]/.test(e[L]))L++;v=L,k=!1;continue}if(j==="'"||j==='"'){let L=j;v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]===L){v++;break}if(e[v]===`
|
|
2556
|
-
`)break;v++}k=!1;continue}if(j==="`"){v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]==="`"){v++;break}if(e[v]==="$"&&e[v+1]==="{"){E.push(!0),v+=2,k=!0;break}v++}if(E.length===0)k=!1;continue}if(j==="}"&&E.length>0){E.pop(),v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]==="`"){v++,k=!1;break}if(e[v]==="$"&&e[v+1]==="{"){E.push(!0),v+=2,k=!0;break}v++}continue}if(/\s/.test(j));else if(/[)\].\w$]/.test(j))k=!1;else k=!0;v++}return-1}function ef(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=new RegExp(`<script\\b(?=[^>]*\\b${x}(?:\\s|=|/?>))[^>]*>`,"i").exec(e);if(!v)return null;let k=v.index+v[0].length,E=e.indexOf("</script>",k);if(E===-1)return null;let C=e.indexOf(">",E);if(C===-1)return null;return{start:v.index,end:C+1}}var
|
|
2556
|
+
`)break;v++}k=!1;continue}if(j==="`"){v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]==="`"){v++;break}if(e[v]==="$"&&e[v+1]==="{"){E.push(!0),v+=2,k=!0;break}v++}if(E.length===0)k=!1;continue}if(j==="}"&&E.length>0){E.pop(),v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]==="`"){v++,k=!1;break}if(e[v]==="$"&&e[v+1]==="{"){E.push(!0),v+=2,k=!0;break}v++}continue}if(/\s/.test(j));else if(/[)\].\w$]/.test(j))k=!1;else k=!0;v++}return-1}function ef(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=new RegExp(`<script\\b(?=[^>]*\\b${x}(?:\\s|=|/?>))[^>]*>`,"i").exec(e);if(!v)return null;let k=v.index+v[0].length,E=e.indexOf("</script>",k);if(E===-1)return null;let C=e.indexOf(">",E);if(C===-1)return null;return{start:v.index,end:C+1}}var eb=4096;async function Xp(e,o,x){if(x.buildMode!=="serve"||o.length<eb)return null;let{registerServeModuleBundle:v}=await import("./chunk-5j52h3e3.js");return`<script ${e} src="${v(o)}"></script>`}async function Kp(e,o,x){try{let{registeredModuleIdsIn:v,buildModuleRegistryScript:k}=await lt("stx/client-module-registry",()=>import("./chunk-ppse812s.js")),E=[],C=await k(v(...e),{minify:o.buildMode==="compile",collectInputs:E});for(let j of E)x?.add(j);if(!C)return null;if(o.buildMode==="serve"){let{registerServeModuleBundle:j}=await import("./chunk-5j52h3e3.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${j(C)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${C.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function tb(e,o=""){let x=ef(e,"data-stx-runtime");if(!x)return e;let v=jr(e);if(v===-1||v===x.start){if(!o)return e;return e.slice(0,x.end)+o+e.slice(x.end)}if(v<x.start)return e.slice(0,v)+e.slice(x.start,x.end)+o+`
|
|
2557
2557
|
`+e.slice(v,x.start)+e.slice(x.end);let k=e.slice(x.start,x.end),E=e.slice(0,x.start)+e.slice(x.end),C=jr(E);if(C===-1)return k+o+`
|
|
2558
2558
|
`+E;return E.slice(0,C)+k+o+`
|
|
2559
|
-
`+E.slice(C)}function
|
|
2560
|
-
`),...B.htmlAttrs&&{htmlAttrs:mp(j.htmlAttrs,B.htmlAttrs)},...B.bodyAttrs&&{bodyAttrs:{...j.bodyAttrs||{},...B.bodyAttrs}}},ae=
|
|
2559
|
+
`+E.slice(C)}function nb(e){let o=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return e.replace(o,(x,v,k)=>{let E=e.slice(0,k);return E.lastIndexOf("<")>E.lastIndexOf(">")?`{{${v}}}`:`{<!--stx-literal-->{${v}}}`})}async function r(e,o,x,v,k){if(v.ssr===!1&&!v.autoShell&&v.buildMode==="spa")return e;if(o.__stx_signals_gate===void 0)o.__stx_signals_gate=be(e,x);let E=!o.__stxProcessingDepth;on(o);for(let C of v._layerGraph?.configDependencies??[])k.add(C);if(E&&v.runtimeConfig)await cn(o,x,v.runtimeConfig);if(E)el(o),o.__stx_head_injections=Fa(),o.__stx_seo_staged=!1;if(!o.__stxProcessingDepth)o.__stxProcessingDepth=0;if(o.__stxProcessingDepth++,!o.__onceStore)o.__onceStore=new Set;if((v.debug||!ge()&&!hn())&&x&&x.endsWith(".stx"))Ds(e,x);try{return await H.timeAsync("template-processing",async()=>{let C=await rb(e,o,x,v,k);if(E)C=Ic(C);if(E&&v.autoShell&&v.buildMode!=="compile"){let j=v.app?.head||{},B=(o.__stx_runtime_head||null)??Rs(),F=(o.__stx_head_raw||"").trim(),U,Z=F.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Z)U=Z[1].trim(),F=F.replace(Z[0],"").trim();let Y=o.__sections?.title,Q=B.title||U||Y,se=!B.title&&(!!U||!!Y),oe=B.meta||[],ie=new Set(oe.map((Se)=>rr(Se)).filter(Boolean)),ce={...j,...Q&&{title:Q},meta:[...(j.meta||[]).filter((Se)=>!ie.has(rr(Se))),...oe],link:[...j.link||[],...B.link||[]],script:[...j.script||[],...B.script||[]],headRaw:[j.headRaw,F].filter(Boolean).join(`
|
|
2560
|
+
`),...B.htmlAttrs&&{htmlAttrs:mp(j.htmlAttrs,B.htmlAttrs)},...B.bodyAttrs&&{bodyAttrs:{...j.bodyAttrs||{},...B.bodyAttrs}}},ae=Ec(C);if(C=Wn(C,ce,{...se&&{titleIsHtml:!0},...v.app?.colorMode&&{colorMode:v.app.colorMode}},ae),ae)C=yp(C,j),C=Un(C,ce.htmlAttrs);let pe=C.match(/<!-- stx-layout: ([^ ]+) -->/);if(pe&&C.includes("<head")){let Se=pe[1],Ee=dr(Se);C=C.replace(/<head\b[^>]*>/i,(Ce)=>`${Ce}
|
|
2561
2561
|
<meta name="stx-layout" content="${qp(Se)}">
|
|
2562
|
-
<meta name="stx-layout-group" content="${qp(Ee)}">`)}let me=C.match(/function (__stx_setup_\w+)\(/),he=me?
|
|
2563
|
-
${Q}`).join("");C=
|
|
2564
|
-
`+C.slice(B)}}if(E)C=ip(C);if(E&&o.__stx_inject_css!==!1)C=await f(C,void 0,v.buildMode==="serve",!0);else if(E)C=
|
|
2562
|
+
<meta name="stx-layout-group" content="${qp(Ee)}">`)}let me=C.match(/function (__stx_setup_\w+)\(/),he=me?bn(C):null;if(me&&he&&!/\bdata-stx=/.test(he.tag)){C=br(C,(Ee,Ce)=>`<body${Ce} data-stx="${me[1]}">`);let Se=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${me[1]}"`,"i");C=C.replace(Se,"$1")}}if(E){let j=o.__stx_head_injections??Fa(),L=hp(C);if(L!==null)j.beforeClose.push(L);let B=op(C);if(B!==null)j.afterOpen.push(B);if(v.offline?.enabled&&!C.includes("data-stx-offline"))j.beforeClose.push(ap);C=np(C,j);let F=v.app?.colorMode;if(F)C=Vn(C,F)}if(E)if(ef(C,"data-stx-runtime")){let L=null,B=null,F=null,U=null,Z=null;try{let{getStoreScript:Q}=await lt("stx/store-loader",()=>import("./chunk-gacycmb0.js")),se=v.storesDir,oe=await Q(se);if(oe)F=`<script data-stx-stores>${oe}</script>`,B=await Xp("data-stx-stores",oe,v)??F}catch{}L=await Kp([C,F],v,k);try{let{getFrameworkComposableScript:Q}=await lt("stx/framework-composables",()=>import("./chunk-hec0bvvf.js"));Z=await Q(C)}catch{}try{let{getComposableScript:Q}=await lt("stx/composable-loader",()=>import("./chunk-aqrnpgn7.js")),se=v.composablesDir,oe=[L,F,Z].filter((ce)=>ce!==null),ie=await Q(v._layerComposableDirs??se,C,oe);if(ie)U=await Xp('data-stx-scoped data-stx-run="always" data-stx-composables',ie,v)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ie}</script>`}catch{}let Y=[L,B,U,Z].filter((Q)=>Q!==null).map((Q)=>`
|
|
2563
|
+
${Q}`).join("");C=tb(C,Y)}else{let L=await Kp([C],v,k);if(L){let B=C.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(B!==-1)C=C.slice(0,B)+L+`
|
|
2564
|
+
`+C.slice(B)}}if(E)C=ip(C);if(E&&o.__stx_inject_css!==!1)C=await f(C,void 0,v.buildMode==="serve",!0);else if(E)C=ln(C);if(C=C.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),C=nb(C),E&&o.__stx_runtime_config)C=Ke(C,o.__stx_runtime_config);if(E&&!o.__stx_defer_server_data){let j=Hn(o);if(j){let L=/<head\b[^>]*>/i.exec(C),B=L?L.index+L[0].length:0;C=C.slice(0,B)+j+C.slice(B)}}return C})}catch(C){if(C instanceof or)throw C;let j=C instanceof Error?C.message:String(C),L=new J(`Template processing failed: ${j}`,x,void 0,void 0,e.substring(0,200)+(e.length>200?"...":""));if(_.log(L,{filePath:x,context:o}),Pt.logDetailedError(L,{filePath:x,template:e.substring(0,500)}),v.debug)throw L;return As.createFallbackContent("Template Processing",L)}}async function rb(e,o,x,v,k){let E=process.cwd(),C={...v,partialsDir:v.partialsDir&&!Gt.isAbsolute(v.partialsDir)?Gt.resolve(E,v.partialsDir):v.partialsDir,componentsDir:v.componentsDir&&!Gt.isAbsolute(v.componentsDir)?Gt.resolve(E,v.componentsDir):v.componentsDir,layoutsDir:v.layoutsDir&&!Gt.isAbsolute(v.layoutsDir)?Gt.resolve(E,v.layoutsDir):v.layoutsDir},j=C,L=e;await ob(x,o),ib(o,j),L=await re(()=>Hd(L,o,x,j),L,(me)=>{_.log(me,{filePath:x,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${x}: ${me.message}`)}),L=L.replace(/\{\{--[\s\S]*?--\}\}/g,"");let B=ne(L,xe,(me,he)=>`\x00STX_HTML_COMMENT_${he}\x00`);L=B.output;let F=B.tokens,U=(me)=>F.length===0?me:me.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(he,Se)=>F[Number(Se)]??""),Z="\x00STX_ESCAPED_AT\x00",Y="\x00STX_ESC_MUSTACHE_OPEN\x00",Q="\x00STX_ESC_MUSTACHE_CLOSE\x00";L=L.replace(/@@/g,Z),L=L.replace(/@\{\{([\s\S]*?)\}\}/g,(me,he)=>`${Y}${he}${Q}`),L=Jd(L),L=await Np(L,x,k);let se={};L=us(L,se);let oe={...o.__sections||{}},ie="",ce=Pl(je(e)),ae=/@nolayout\b/.test(L)||ce===!1;if(/@nolayout\b/.test(L))L=L.replace(/@nolayout\b\s*/g,"");let pe=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(pe)ie=pe[1],L=L.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ce==="string"){if(ie=ce,!/@section\s*\(/.test(L))L=`@section('content')
|
|
2565
2565
|
${L.trim()}
|
|
2566
|
-
@endsection`}if(!ie&&!ae&&j.defaultLayout){let me=
|
|
2566
|
+
@endsection`}if(!ie&&!ae&&j.defaultLayout){let me=an(L),he=/@section\s*\(/.test(L);if(!me||he){let Se="",Ee=Gt.dirname(x),Ce=j.layoutsDir?Gt.dirname(j.layoutsDir):process.cwd();for(let Ae=0;Ae<20;Ae++){let Re=Gt.join(Ee,"_layout.stx");if(await n(Re)){Se=Re;break}let _e=Gt.dirname(Ee);if(_e===Ee||_e.length<Ce.length)break;Ee=_e}if(Se)ie=Se;else if(j.layoutsDir){let Ae=Gt.isAbsolute(j.layoutsDir)?j.layoutsDir:Gt.resolve(process.cwd(),j.layoutsDir),Re=Gt.join(Ae,`${j.defaultLayout}.stx`);if(await n(Re))ie=Re}if(ie&&!he)L=`@section('content')
|
|
2567
2567
|
${L.trim()}
|
|
2568
|
-
@endsection`}}if(ie&&L.includes("<script")){let me=V(L),he=me.scripts.map((Se)=>Zp(Se,x)??Se);L=
|
|
2568
|
+
@endsection`}}if(ie&&L.includes("<script")){let me=V(L),he=me.scripts.map((Se)=>Zp(Se,x)??Se);L=Tt(me.output,he)}if(L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(me,he,Se)=>(oe[he]=Se,"")),L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(me,he,Se)=>{if(/^(['"]).*\1$/.test(Se.trim()))return me;try{let Ee=c(Se.trim(),o);if(Ee===void 0)return me;return oe[he]=String(Ee??""),""}catch{return me}}),L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(me,he,Se)=>{if(Se.includes("@parent"))oe[he]=Se.replace("@parent",mr);else oe[he]=Se.trim();return""}),o.__sections=oe,L=L.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(me,he,Se)=>oe[he]||Se||""),!("slot"in o)||o.slot===void 0)L=L.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||"");if(L=ds(L,se),ie){let me=[],he=V(L),Se=ne(he.output,$t,(Ee,Ce)=>`\x00STX_ORPHAN_STYLE_${Ce}\x00`);if(L=Se.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ee,Ce,Ae)=>{let Re=Ce==="SCRIPT"?Zp(he.scripts[Number(Ae)],x):Se.tokens[Number(Ae)];if(Re)me.push(Re);return""}),me.length>0){let Ee=me.join(`
|
|
2569
2569
|
`);oe.content=oe.content?`${oe.content}
|
|
2570
|
-
${Ee}`:Ee,o.__sections=oe}}if(ie)try{let me;if(Gt.isAbsolute(ie))me=ie,k.add(ie);else me=await re(()=>
|
|
2571
|
-
${L}`,U(L)}catch(me){return _.log(me instanceof Error?me:Error(String(me)),{layoutPath:ie,filePath:x},"error"),`[Error processing layout: ${me instanceof Error?me.message:String(me)}]`}return U(await Yp(L,o,x,C,k))}function
|
|
2572
|
-
`;if(E=
|
|
2570
|
+
${Ee}`:Ee,o.__sections=oe}}if(ie)try{let me;if(Gt.isAbsolute(ie))me=ie,k.add(ie);else me=await re(()=>Kn(ie,x,C,k),null,()=>{throw new J(`Failed to resolve layout path: ${ie}`,x,void 0,void 0,`Layout referenced from ${x}`)});if(!me){let Re=(Me)=>{if(!Me)return[];try{let De=Gt.isAbsolute(Me)?Me:Gt.resolve(process.cwd(),Me);return Qx.readdirSync(De).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},_e=[...Re(C.layoutsDir),...Re(C.fallbackLayoutsDir)].filter((Me,De,Ie)=>Ie.indexOf(Me)===De).sort(),Te=`Layout not found: ${ie} (referenced from ${x})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:C.layoutsDir?`. No .stx layouts found in ${C.layoutsDir}`:"");if(_.log(Error(Te),{layoutPath:ie,filePath:x,available:_e},"error"),console.error(`[stx] ${Te}`),C.debug)throw new J(Te,x);return L}let he=await re(()=>Bun.file(me).text(),"",()=>{throw new J(`Failed to read layout file: ${me}`,x,void 0,void 0,"Layout content could not be loaded")});he=Hp(he,me);let Se=he.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Se){if(C.debug)console.log(`Found nested layout: ${Se[1]} in ${me}`);let Re={},_e=he.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(De,Ie,Oe)=>(Re[Ie]=Oe.trim(),""));for(let[De,Ie]of Object.entries(Re))if(oe[De]&&oe[De].includes(mr)){let Oe=oe[De].indexOf(mr);oe[De]=oe[De].slice(0,Oe)+Ie+oe[De].slice(Oe+mr.length)}else if(!oe[De])oe[De]=Ie;let Te={...o,__sections:oe},Me=`@layout('${Se[1]}')${_e}`;return await r(Me,Te,me,C,k)}let Ee=he.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ce=us(Ee,se),Ae={};return Ce=Ce.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Re,_e,Te)=>(Ae[_e]=Te.trim(),`@slot('${_e}')`)),Ce=Ce.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Re,_e,Te)=>{if(oe[_e]){let Me=oe[_e];if(Me.includes(mr)){let De=Ae[_e]||"",Ie=Me.indexOf(mr);Me=Me.slice(0,Ie)+De+Me.slice(Ie+mr.length)}return Me}return Te||""}),Ce=sb(Ce,oe),Ce=Ce.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),Ce=ds(Ce,se),o.__originalFilePath=x,L=await Yp(Ce,o,me,C,k),L=`<!-- stx-layout: ${ie} -->
|
|
2571
|
+
${L}`,U(L)}catch(me){return _.log(me instanceof Error?me:Error(String(me)),{layoutPath:ie,filePath:x},"error"),`[Error processing layout: ${me instanceof Error?me.message:String(me)}]`}return U(await Yp(L,o,x,C,k))}function sb(e,o){return e.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(x,v,k)=>{let E=o[v];if(E!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(E))return E}return k||""})}function ib(e,o){if(e.__stx_sfc_mode=!0,e.__stx_options=o,o.buildMode)e.__stx_buildMode=o.buildMode;let x=o.envPrefix||"STX_PUBLIC_",v={};for(let[k,E]of Object.entries(process.env))if(k.startsWith(x)&&E!==void 0)v[k]=E;e.$env=v}async function ob(e,o){await re(()=>Kd(e,o),void 0,(x)=>{_.log(x,{filePath:e,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${e}: ${x.message}`)})}var Mc="data-stx-source";function Zp(e,o){if(!e)return e;let x=/^<script\b([^>]*)>/i.exec(e);if(!x||!/\bserver\b/.test(x[1])||x[1].includes(Mc))return e;return`<script ${Mc}="${encodeURIComponent(o)}"${e.slice(7)}`}function ab(e){let o=new RegExp(`${Mc}="([^"]*)"`).exec(e);return o?decodeURIComponent(o[1]):void 0}function Jp(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Gp(e,o,x){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> ${o==="module-resolution"?"imports a module that does not resolve":o==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Jp(e)}</span><span style="display:block;margin-top:4px">${Jp(x)}</span></div>`}async function cb(e,o,x,v){let{scanScriptTags:k}=await lt("stx/signal-processing",()=>import("./chunk-sf1vhfrb.js")),E=[],C=!ge()&&!hn();for(let L of k(e)){let B=L.attrs;if(!/\bserver\b/.test(B))continue;let F=L.start+L.fullMatch.indexOf(">")+1,U=Qp(e,F);if(U===-1)continue;let Z=e.slice(F,U);if(!Z.trim())continue;let Y=ab(B)??x,Q={index:L.start,length:U+9-L.start};try{let{extractVariables:se}=await lt("stx/variable-extractor",()=>import("./chunk-d3vtgnep.js"));await se(Z,o,Y,{preserveExisting:!0,onFailure:(oe)=>{if(oe.kind==="unknown")return;if(v?.onServerScriptError?.({sourcePath:Y,kind:oe.kind,message:oe.message}),!C)return;E.push({...Q,markup:Gp(Y,oe.kind,oe.message)})}})}catch(se){let oe=se instanceof Error?se:Error(String(se));if(_.log(oe,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${oe.message}`),C)E.push({...Q,markup:Gp(Y,"unknown",oe.message)})}}if(E.length===0)return e;let j=e;for(let L of E.sort((B,F)=>F.index-B.index))j=j.slice(0,L.index)+L.markup+j.slice(L.index+L.length);return j}async function lb(e,o,x){try{let{interpolateScriptsInTemplate:v}=await lt("stx/expressions",()=>import("./chunk-5y1mekxe.js"));return v(e,o,{skipServer:!0})}catch(v){let k=v instanceof Error?v:Error(String(v));return _.log(k,{filePath:x,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${x}: ${k.message}`),e}}async function Yp(e,o,x,v,k){let E=e,C=v;if(E=await cb(E,o,x,v),E=await lb(E,o,x),E=await Pd(E,o,x),E=await Md(E,o,x),E=await xu(E,o,x,C),be(E))E=Vi(E,o),E=os(E,o),E=is(E,o);E=Ui(E);let{processStreamDirectives:j}=await lt("stx/streaming",()=>import("./chunk-ecr598p7.js"));E=j(E,o),E=Gi(E,o,x,C,!0),E=await ep(E,o,x,C,k),E=await ns(E,o,x,C,k),E=Dl(E,o,x,C);let{processDeferDirectives:L}=await lt("stx/defer",()=>import("./chunk-c4thhfx9.js"));E=L(E,o,x);let{processTeleportDirectives:B}=await lt("stx/teleport",()=>import("./chunk-5zryk911.js"));E=B(E,o,x);let{processTransitionDirectives:F,processTransitionAttributes:U}=await lt("stx/transitions",()=>import("./chunk-p34gbb4z.js"));E=F(E,o,x),E=U(E);let{processErrorBoundaryDirectives:Z,stripRenderFailedMarkers:Y}=await lt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));E=Z(E,o,x),E=Y(E);let{processSuspenseDirectives:Q}=await lt("stx/suspense",()=>import("./chunk-7s7k94as.js"));E=Q(E,o,x);let{processAsyncDirectives:se}=await lt("stx/async-components",()=>import("./chunk-m6fvj7g1.js"));E=se(E,o,x);let{processKeepAliveDirectives:oe}=await lt("stx/keep-alive",()=>import("./chunk-0dh1rgg8.js"));E=oe(E,o,x);let{processVirtualListDirectives:ie,processVirtualGridDirectives:ce,processInfiniteListDirectives:ae}=await lt("stx/virtual-scrolling",()=>import("./chunk-ggywfyzm.js"));E=ie(E,o,x),E=ce(E,o,x),E=ae(E,o,x);let{processPartialHydrationDirectives:pe,processStaticDirectives:me}=await lt("stx/partial-hydration",()=>import("./chunk-wjzqz3yr.js"));E=pe(E,o,x),E=me(E);let{processComputedDirectives:he,processWatchDirectives:Se}=await lt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));E=he(E,o,x),E=Se(E,o,x);let{processFormValidationDirectives:Ee}=await lt("stx/forms-validation",()=>import("./chunk-0hrqt5c2.js"));E=Ee(E,o,x);let{processHeadDirective:Ce,processTitleDirective:Ae,processMetaDirective:Re,resetHead:_e}=await lt("stx/head",()=>import("./chunk-d7xrewxq.js"));if(!o.__stx_head_preset&&!o.__stx_runtime_head)_e();let Te=Ce(E);if(E=Te.content,Te.headContent)o.__stx_head_raw=`${o.__stx_head_raw||""}${Te.headContent}
|
|
2572
|
+
`;if(E=Ae(E,o),E=Re(E,o,x),E=Xd(E),E=oa(E,o),E=yu(E),E=Vd(E),E=await ls(E,o,x,C,k),E=await ns(E,o,x,C,k),o.__stxProcessingDepth===1)E=tl(E,o);if(E=E.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),E=Ic(E),E=Cn(E,o,x),E=cs(E),E=Ml(E,o,{filePath:x,buildMode:C.buildMode}),E=aa(E,o),E=ca(E,o),E=ui(E,o),E=ku(E,o),E=Cu(E,o),E=await au(E,o,x,C),E=await zl(E,o,x),E=await ao(E,o,x,C),E=co(E,o,x,C),E=Cs(E,o,x,C),E=$s(E,o,x),E=Es(E,o,x,C),E=mu(E,o,x,C),E=gs(E,o),E=ms(E),E=Lp(E),!C.skipEventDirectives)E=Gc(E,o,x);if(E=jl(E,o,x),C.debug){let Qe=/\bx-data\s*=/.test(E),st=ss(e);if(Qe&&st)console.warn(`[stx] ${x}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2573
2573
|
Both work on the same page, but they manage separate scopes.
|
|
2574
|
-
Prefer signals (state/derived/effect) for new components.`)}E=$d(E,o),E=await q(E,o,x),E=Fp(E),E=Vp(E),E=Sl(E);let{processXElementDirectives:Me}=await lt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));E=Me(E);let De=o.__originalFilePath||x,Ie=Le(o);if(E=await
|
|
2574
|
+
Prefer signals (state/derived/effect) for new components.`)}E=$d(E,o),E=await q(E,o,x),E=Fp(E),E=Vp(E),E=Sl(E);let{processXElementDirectives:Me}=await lt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));E=Me(E);let De=o.__originalFilePath||x,Ie=Le(o);if(E=await Wi(E,C,De,Ie),E=$u(E,o),E=await qd(E,o,x,C),C.media?.image?.autoSiblings){let Qe=C.publicDir||"public",{rewriteImagesWithSiblings:st}=await lt("stx/image-optimization/auto-sibling",()=>import("./chunk-50vq8k55.js"));E=await st(E,{publicDir:Qe})}if(C.seo?.enabled)E=Ts(E,o,C);let Oe=(Qe,st,ft=!0)=>{if(!st)return Qe;let Xt=st.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Mt=Qe.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Xt&&Mt){if(ft)Qe=Qe.replace(Mt[0],Xt[0]);if(st=st.replace(Xt[0],"").trim(),!st)return Qe}if(/<\/head>/i.test(Qe))return Qe.replace(/<\/head>/i,`${st}
|
|
2575
2575
|
</head>`);if(/<head\b[^>]*>/i.test(Qe))return Qe.replace(/(<head\b[^>]*>)/i,`$1
|
|
2576
2576
|
${st}`);if(/<html\b[^>]*>/i.test(Qe))return Qe.replace(/(<html\b[^>]*>)/i,`$1
|
|
2577
2577
|
<head>
|
|
2578
2578
|
${st}
|
|
2579
|
-
</head>`);return Qe},{renderHead:tt,getHead:ot}=await lt("stx/head",()=>import("./chunk-
|
|
2579
|
+
</head>`);return Qe},{renderHead:tt,getHead:ot}=await lt("stx/head",()=>import("./chunk-d7xrewxq.js")),yt=o.__stx_runtime_head??ot();if(yt.title||yt.meta?.length||yt.link?.length){let Qe=tt(yt);if(Qe)E=Oe(E,Qe)}if(Te.headContent)E=Oe(E,Te.headContent,!yt.title);if(C.csp?.enabled&&C.csp.addMetaTag)E=fu(E,C.csp,o);if(C.analytics?.enabled)E=_l(E,C);if(C.heatmap?.enabled)E=kl(E,C);if(C.pwa?.enabled&&C.pwa.autoInject!==!1){let{injectPwaTags:Qe}=await lt("stx/pwa/inject",()=>import("./chunk-eev80mpy.js"));E=Qe(E,C)}let dt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(E),ht=/\bSTX\.\w+/.test(E),at=/window\.STX\s*=/.test(E);if(dt&&ht&&!at){let st=`<script data-stx-scoped data-stx-run="once">
|
|
2580
2580
|
${vl()}
|
|
2581
2581
|
</script>`;if(E.includes("</head>")){let ft=E.indexOf("</head>"),Mt=E.slice(0,ft).indexOf("<script");if(Mt!==-1){let nn=E.slice(0,Mt),jt=E.slice(Mt);E=nn+st+`
|
|
2582
2582
|
`+jt}else E=E.replace("</head>",`${st}
|
|
2583
2583
|
</head>`)}else if(E.includes("<body"))E=E.replace(/<body([^>]*)>/,`<body$1>
|
|
2584
2584
|
${st}`);else E=st+`
|
|
2585
|
-
`+E}{let{scanScriptTags:Qe}=await lt("stx/signal-processing",()=>import("./chunk-
|
|
2586
|
-
`+E.slice(ft)}o.__stx_event_bindings=[]}}if(!le(E)&&$p(E))E=await Pi(E,C);if(E=Sp(E),C.csp?.enabled&&C.csp.useNonce&&typeof o.cspNonce==="string")E=gu(E,o.cspNonce);return E}import gf from"path";import Nc from"fs";import Ls from"path";function tf(e,o,x,v){let k=0;for(let E=o;E<e.length;E++)if(e[E]===x)k++;else if(e[E]===v&&!(v===">"&&e[E-1]==="=")){if(--k===0)return E}return-1}function
|
|
2585
|
+
`+E}{let{scanScriptTags:Qe}=await lt("stx/signal-processing",()=>import("./chunk-sf1vhfrb.js")),st=[];for(let ft of Qe(E)){if(!/\bserver\b/i.test(ft.attrs))continue;let Xt=ft.start+ft.fullMatch.indexOf(">")+1,Mt=Qp(E,Xt);if(Mt===-1)continue;let nn=Mt+9;while(nn<E.length&&/\s/.test(E[nn]))nn++;st.push({start:ft.start,end:nn})}if(st.length>0){let ft=Array(st.length+1),Xt=0;for(let Mt=0;Mt<st.length;Mt++){let{start:nn,end:jt}=st[Mt];ft[Mt]=E.slice(Xt,nn),Xt=jt}ft[st.length]=E.slice(Xt),E=ft.join("")}}let It=Qn(E,x);if(It.hasScoped)E=It.html;let pt=o.__stx_event_bindings||[],Lt=!1,Sn=[],fn=/\s:[a-z][\w.-]*\s*=/.test(E),{scanScriptTags:_n}=await lt("stx/signal-processing",()=>import("./chunk-sf1vhfrb.js"));for(let Qe of _n(E,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Sn.push({match:Qe.fullMatch,attrs:Qe.attrs,content:Qe.body});for(let{match:Qe,attrs:st,content:ft}of Sn){Lt=!0;let Xt=ft;hs(ft,x,v.strict,o.__originalFilePath);let Mt=await ye(ft,{eventBindings:pt,attrs:st,hasColonDirectives:fn,templateContent:e,filePath:x,projectRoot:process.cwd(),production:v.buildMode==="compile",serverData:Ie});E=E.replace(Qe,()=>Mt)}if(Lt)o.__stx_event_bindings=[];if(!Lt&&o.__stxProcessingDepth===1){let Qe=o.__stx_event_bindings||[];if(Qe.length>0){let st=Oo(Qe);if(st){let ft=E.lastIndexOf("</body>");E=ft===-1?E+st:E.slice(0,ft)+st+`
|
|
2586
|
+
`+E.slice(ft)}o.__stx_event_bindings=[]}}if(!le(E)&&$p(E))E=await Pi(E,C);if(E=Sp(E),C.csp?.enabled&&C.csp.useNonce&&typeof o.cspNonce==="string")E=gu(E,o.cspNonce);return E}import gf from"path";import Nc from"fs";import Ls from"path";function tf(e,o,x,v){let k=0;for(let E=o;E<e.length;E++)if(e[E]===x)k++;else if(e[E]===v&&!(v===">"&&e[E-1]==="=")){if(--k===0)return E}return-1}function ub(e){let o=s(e),x=0,v=0,k=[];for(let E=0;E<o.length;E++)if("([{".includes(o[E]))x++;else if(")]}".includes(o[E]))x--;else if(o[E]===","&&x===0)k.push(e.slice(v,E).trim()),v=E+1;return k.push(e.slice(v).trim()),k}function Oc(e,o){let x=s(e),v=new RegExp(`\\b(?:${o.map((k)=>k.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let k of x.matchAll(v)){let E=k.index+k[0].length,C="";if(x[E]==="<"){let L=tf(x,E,"<",">");if(L<0)continue;C=e.slice(E+1,L),E=L+1;while(/\s/.test(x[E]||"")&&E<x.length)E++}if(x[E]!=="(")continue;let j=tf(x,E,"(",")");if(j>=0)return{type:C,args:ub(e.slice(E+1,j))}}return null}var nf=`
|
|
2587
2587
|
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;
|
|
2588
2588
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
2589
2589
|
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>;
|
|
@@ -2598,64 +2598,64 @@ namespace ${o} {
|
|
|
2598
2598
|
${E}
|
|
2599
2599
|
${B.join(`
|
|
2600
2600
|
`)}
|
|
2601
|
-
}`,props:F,events:U}}function*
|
|
2601
|
+
}`,props:F,events:U}}function*db(e){let o=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,x;while(x=o.exec(e)){let v=o.lastIndex,k=[];while(v<e.length){while(/\s/.test(e[v]||""))v++;if(e[v]===">"||e.slice(v,v+2)==="/>"){v+=e[v]===">"?1:2;break}let E=/^[^\s=/>]+/.exec(e.slice(v))?.[0];if(!E){v++;continue}let C=v;v+=E.length;while(/\s/.test(e[v]||""))v++;if(e[v]!=="="){k.push({name:E,value:!0,offset:C,braced:!1});continue}v++;while(/\s/.test(e[v]||""))v++;let j=e[v],L=j==="{",B=j==='"'||j==="'";if(B||L)v++;let F=v;if(L){let U=s(e.slice(v)),Z=1,Y=0;for(;Y<U.length;Y++){if(U[Y]==="{")Z++;if(U[Y]==="}"&&--Z===0)break}v+=Y}else if(B)while(v<e.length&&e[v]!==j)v++;else while(v<e.length&&!/[\s/>]/.test(e[v]))v++;if(k.push({name:E,value:e.slice(F,v),offset:F,braced:L}),B||L)v++}o.lastIndex=v,yield{name:x[1],offset:x.index,attributes:k}}}function sf(e,o,x){let v=[],k=[nf,"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;'],E=new Map,C=new Map,j=new Map,L=x.scriptCode(e,x.filePath),B=s(L);for(let Q of L.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(B.slice(Q.index,Q.index+6)!=="import")continue;let se=Q[2],oe=Ls.isAbsolute(se)||se.startsWith(".")?Ls.resolve(Ls.dirname(x.filePath),se):fi(se,Ls.dirname(x.filePath));if(!oe)continue;let ie=oe.endsWith(".stx")?oe:Nc.existsSync(`${oe}.stx`)?`${oe}.stx`:void 0,ce=ie?null:pi(oe,!1),ae=Q[1].startsWith("{")?Q[1].slice(1,-1).split(","):[Q[1]];for(let pe of ae){let[me,he=me]=pe.trim().split(/\s+as\s+/),Se=ie||ce?.get(me)||ce?.get(me.toLowerCase());if(Se)j.set(he,Se),j.set(he.toLowerCase(),Se),j.set(he.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Se)}}for(let Q of o.matchAll(/@import\s*\(([^)]+)\)/g))for(let se of Q[1].matchAll(/['"]([^'"]+)['"]/g)){let oe=gi(se[1],x.filePath,x).find((ie)=>Nc.statSync(ie,{throwIfNoEntry:!1})?.isFile());if(oe)j.set(Ls.basename(se[1]).replace(/\.stx$/,""),oe)}let F={__importedComponents:j},U=new Map,Z=(Q,se,oe)=>{let ie=e.slice(0,Q);return{code:se,offset:Q,attribute:oe,anchor:!0,kind:"directive",line:ie.split(`
|
|
2602
2602
|
`).length,column:Q-ie.lastIndexOf(`
|
|
2603
|
-
`)}},Y=(Q,se,oe)=>v.push({expression:Q,statement:{text:se+Q.code+oe,prefixLength:se.length}});for(let Q of
|
|
2604
|
-
`):"",checks:v,events:E,dependencies:C}}var of=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function
|
|
2603
|
+
`)}},Y=(Q,se,oe)=>v.push({expression:Q,statement:{text:se+Q.code+oe,prefixLength:se.length}});for(let Q of db(o)){if(sn(Q.name)||Q.name==="component")continue;let se=Vu(Q.name,x.filePath,x,F);if(!se)continue;let oe=U.get(se);if(!oe){let ce;try{ce=x.readComponent?x.readComponent(se):Nc.readFileSync(se,"utf8")}catch{continue}if(ce===void 0)continue;C.set(se,ce),oe=rf(x.scriptCode(ce,se),`__StxComponent${U.size}`),U.set(se,oe),k.push(oe.declarations)}let ie=[];for(let ce of Q.attributes){let{name:ae,offset:pe}=ce,me=ce.value===!0?"true":ce.value;if(ae.startsWith("@")||ae.startsWith("v-on:")){if(oe.events&&ce.value!==!0)E.set(pe,`__StxEvent<${oe.events}, ${JSON.stringify(ae.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let he=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ae);if(ae.startsWith("v-")&&!ae.startsWith("v-bind:")&&!he)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ae))continue;let Se=(he?he[1]||"modelValue":ae.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,Re)=>Re.toUpperCase());if(ie.push(Se),!oe.props)continue;let Ce=ae.startsWith(":")||ae.startsWith("v-bind:")||!!he||ce.braced?me:ce.value!==!0?JSON.stringify(me):"true";Y(Z(pe,Ce,ae),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify(Se)}>);`)}if(oe.props){let ce=[...new Set(ie)].map((pe)=>`${JSON.stringify(pe)}: undefined as any`).join(", "),ae=Z(Q.offset,`<${Q.name}>`);v.push({expression:ae,statement:{text:`;void ({ ${ce} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:U.size?k.join(`
|
|
2604
|
+
`):"",checks:v,events:E,dependencies:C}}var of=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function pb(e){let o=(x)=>x.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,o).replace(/\{\{--[\s\S]*?--\}\}/g,o)}function He(e){let o=[],x=pb(e);of.lastIndex=0;let v;while((v=of.exec(x))!==null){let k=(v[1]||"").trim(),E=(v[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,C=(v[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,j=v.index+E,L=v.index+v[0].length-C,B=e.slice(j,L);if(/\bsrc\s*=/.test(k))continue;let F=k.match(/\btype\s*=\s*["']([^"']+)["']/i);if(F&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(F[1]))continue;let U=/\bserver\b/.test(k)?"server":/\bclient\b/.test(k)?"client":"plain",Z=Bs(e,j);o.push({kind:U,code:B,startLine:Z,startColumn:zs(e,j),offset:j,attrs:k})}return o}function Bs(e,o){let x=1;for(let v=0;v<o&&v<e.length;v++)if(e.charCodeAt(v)===10)x++;return x}function zs(e,o){let x=e.lastIndexOf(`
|
|
2605
2605
|
`,o-1)+1;return o-x+1}function fo(e){let o=e.split(""),x=(k,E)=>{for(let C=k;C<E&&C<o.length;C++)if(o[C]!==`
|
|
2606
|
-
`)o[C]=" "},v=[/<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 k of v){k.lastIndex=0;let E;while((E=k.exec(e))!==null)x(E.index,E.index+E[0].length)}return o.join("")}function
|
|
2606
|
+
`)o[C]=" "},v=[/<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 k of v){k.lastIndex=0;let E;while((E=k.exec(e))!==null)x(E.index,E.index+E[0].length)}return o.join("")}function fb(e){let o=0,x="";for(let v=0;v<e.length;v++){let k=e[v];if(x){if(k==="\\"){v++;continue}if(k===x)x="";continue}if(k==='"'||k==="'"||k==="`"){x=k;continue}if(k==="("||k==="["||k==="{"){o++;continue}if(k===")"||k==="]"||k==="}"){o--;continue}if(k==="|"&&o===0){if(e[v+1]==="|"){v++;continue}if(e[v-1]==="|")continue;return e.slice(0,v)}}return e}var mf=new Set([":for","x-for","v-for"]),go=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,jc="__stx_interpolated",af="__StxElement",hf="__StxTemplateValue",gb=`type ${hf}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function cf(e){return e.replace(/\{\{[\s\S]*?\}\}/g,jc).replace(/\{!![\s\S]*?!!\}/g,jc)}function ys(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(o)=>{let x=o.split(`
|
|
2607
2607
|
`).length-1,v=o.length-x;return`0${" ".repeat(Math.max(0,v-1))}${`
|
|
2608
|
-
`.repeat(x)}`})}var
|
|
2609
|
-
`)}function
|
|
2608
|
+
`.repeat(x)}`})}var mb=["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"],hb=new RegExp(String.raw`^[ \t]*@(?:${mb.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function bs(e){return e.replace(hb,(o)=>o.replace(/[^\n]/g," "))}var lf=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function fc(e){let o=fo(e),x=[],v=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,k;while((k=v.exec(o))!==null){if(k[1]||k[3])continue;let j=k[2]??k[4]??"",L=k[2]!==void 0?2:3,B=fb(j);if(!B.trim())continue;let F=k.index+L+(B.length-B.trimStart().length);x.push({code:B.trim(),line:Bs(o,F),column:zs(o,F),offset:F,kind:"interpolation"})}let E=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((k=E.exec(o))!==null){let C=k.index+k[0].length-1,j=0,L=C;for(;L<o.length;L++){let Z=o[L];if(Z==="(")j++;else if(Z===")"){if(j--,j===0)break}}if(j!==0)continue;let B=o.slice(C+1,L),F=B.trim();if(E.lastIndex=L+1,!F)continue;let U=C+1+(B.length-B.trimStart().length);x.push({code:F,line:Bs(o,U),column:zs(o,U),offset:k.index,kind:"condition"})}go.lastIndex=0;while((k=go.exec(o))!==null){let C=k[1],j=k[3]??"",L=C.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(lf.has(L)||lf.has(C))continue;if(!j.trim())continue;let B=k.index+k[0].indexOf(k[2],k[0].indexOf(C)+C.length)+1;if(mf.has(L)){let U=j.match(/\s+(?:in|of)\s+/);if(!U||U.index===void 0)continue;let Z=j.slice(U.index+U[0].length),Y=U.index+U[0].length+(Z.length-Z.trimStart().length);x.push({code:cf(Z.trim()),line:Bs(o,B+Y),column:zs(o,B+Y),offset:B+Y,kind:"directive",attribute:L});continue}let F=j.length-j.trimStart().length;x.push({code:cf(j.trim()),line:Bs(o,B+F),column:zs(o,B+F),offset:B+F,kind:"directive",attribute:L})}return x.sort((C,j)=>C.line-j.line||C.column-j.column),x}var yb=2000;function xb(e,o){let x=0,v=Math.min(e.length,o+yb);for(let k=o;k<v;k++){let E=e[k];if(E==="(")x++;else if(E===")"){if(x--,x===0)return e.slice(o+1,k)}}return null}function bb(e){let o=new Map,x=(j,L)=>{let B=j.split(/[,[\]{}()\s]+/).filter(Boolean);for(let F of B){let U=F.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(U))continue;let Z=B.length===1?L:void 0,Y=o.get(U);if(!Y)o.set(U,{name:U,iterable:Z});else if(Y.iterable!==Z)Y.iterable=void 0}},v=/^\$?[A-Z_$][\w$]*$/i,k=(j)=>{let L=j.trim();return v.test(L)?L:void 0};for(let j of e.matchAll(/@for(?:each|else)\s*\(/g)){let L=xb(e,j.index+j[0].length-1);if(L===null)continue;let B=kt(L);if(!B)continue;x(B.itemVar.replace(/=>/g," "),k(B.arrayExpr))}for(let j of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))x(j[1],j[2]==="of"?k(j[3]):void 0);for(let j of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))x(j[1]);let E=fo(e);go.lastIndex=0;let C;while((C=go.exec(E))!==null){let j=C[1].replace(/\..*$/,"");if(!mf.has(j))continue;let L=C[3].match(/\s+(?:in|of)\s+/);if(!L||L.index===void 0)continue;x(C[3].slice(0,L.index),k(C[3].slice(L.index+L[0].length)))}for(let j of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let L of j[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))x(L[1]);return[...o.values()].sort((j,L)=>j.name.localeCompare(L.name))}function te(e){let o=new Set;for(let x of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))o.add(x[1]);for(let x of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))o.add(x[1]);for(let x of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))o.add(x[1]);for(let x of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let v of x[1].split(",")){let k=v.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(k))o.add(k)}return[...o].sort()}var Lc=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],vb={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function Zi(e=new Set){return[...Lc.filter((o)=>!e.has(o)).map((o)=>`declare var ${o}: any`),...Object.entries(vb).filter(([o])=>!e.has(o)).map(([,o])=>o)].join(`
|
|
2609
|
+
`)}function Qi(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((o)=>o[1]))}function yf(e){let o=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,x,v=!1,k=new Set,E=s(e);while((x=o.exec(E))!==null){v=!0;for(let C of wb(x[1])){let j=C.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(j))k.add(j)}}return v?[...k]:null}function wb(e){let o=[],x=0,v="";for(let k of e){if(k===","&&x===0){o.push(v),v="";continue}if(k==="("||k==="["||k==="{")x++;else if(k===")"||k==="]"||k==="}")x--;v+=k}return o.push(v),o.filter((k)=>k.trim().length>0)}function $b(e){let o=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,x=[],v=e.replace(o,(k)=>(x.push(k.trim()),k.split(`
|
|
2610
2610
|
`).map(()=>"").join(`
|
|
2611
2611
|
`)));return{imports:x.join(`
|
|
2612
2612
|
`),body:v}}function xf(e){let o=s(e),x=Array(o.length),v=0;for(let j=0;j<o.length;j++){let L=o[j];if(L==="}"||L===")"||L==="]")v=Math.max(0,v-1);if(x[j]=v,L==="{"||L==="("||L==="[")v++}let k=[],E=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,C;while((C=E.exec(o))!==null){if(x[C.index]!==0)continue;let j=C[1],L=C[2],B;if(j==="interface"){let F=o.indexOf("{",C.index);if(F===-1)continue;let U=0;B=-1;for(let Z=F;Z<o.length;Z++)if(o[Z]==="{")U++;else if(o[Z]==="}"&&--U===0){B=Z+1;break}if(B===-1)continue}else{let F=0;B=o.length;for(let U=o.indexOf("=",C.index)+1;U<o.length;U++){let Z=o[U];if(Z==="{"||Z==="["||Z==="("||Z==="<")F++;else if(Z==="}"||Z==="]"||Z===")"||Z===">")F--;else if(F<=0&&(Z===";"||Z===`
|
|
2613
|
-
`&&!/[=|&,<([{]\s*$/.test(o.slice(Math.max(0,U-40),U)))){B=Z===";"?U+1:U;break}}}k.push({name:L,text:e.slice(C.index,B).replace(/^[ \t]*export[ \t]+/,"")}),E.lastIndex=B}return k}function
|
|
2613
|
+
`&&!/[=|&,<([{]\s*$/.test(o.slice(Math.max(0,U-40),U)))){B=Z===";"?U+1:U;break}}}k.push({name:L,text:e.slice(C.index,B).replace(/^[ \t]*export[ \t]+/,"")}),E.lastIndex=B}return k}function Sb(e){return new Set(xf(e).map((o)=>o.name))}function eo(e,o=""){let x=yf(e),v=Sb(o),k=xf(e).filter((B)=>!v.has(B.name)).map((B)=>B.text);if(!x){let B=te(e).filter((F)=>!Ks(o,F));if(B.length===0&&k.length===0)return"";return["",`// ${Eb}`,...k,...B.map((F)=>`declare var ${F}: any`)].join(`
|
|
2614
2614
|
`)}if(x.length===0)return k.length>0?["",`// ${uf}`,...k].join(`
|
|
2615
|
-
`):"";let{imports:E,body:C}
|
|
2616
|
-
`)}function
|
|
2617
|
-
`)x[k]=" "}return te(x.join(""))}function
|
|
2618
|
-
`),k=Array.from({length:v.length},()=>""),E=new Map,C=o.filePath&&o.templateExpressions!==!1?sf(e,fo(e),{filePath:o.filePath,componentsDir:o.componentsDir,projectRoot:o.projectRoot,readComponent:o.readComponent,scriptCode:(U,Z)=>He(U).map((Y)=>
|
|
2619
|
-
`)}):void 0,j=new Set,L=[];for(let U of x){let Z=ys(
|
|
2620
|
-
`);Y.forEach((Q,se)=>{let oe=U.startLine-1+se;if(oe<k.length)k[oe]=se===0?
|
|
2621
|
-
`).entries())if(k.push(Q),Z)E.set(k.length,Y===0?Z:{...Z,line:Z.line+Y,column:1,prefixLength:0})};if(o.globals!==!1){B("");let U=new Set([...x.flatMap((se)=>te(se.code)),...x.flatMap((se)=>
|
|
2622
|
-
`))B(Z);let U=
|
|
2623
|
-
`),lineMap:E,sourceLineCount:v.length,componentDependencies:C?.dependencies,referenced:F}}function
|
|
2624
|
-
`);return{line:x.length,column:x[x.length-1].length+1}}function
|
|
2625
|
-
`);for(let k of v){let E=x,C=null,j=!1;for(let L=0;L<k.length;L++){let B=k[L];if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(C){if(B===C)C=null;continue}if(B==="'"||B==='"'||B==="`"){C=B;continue}if(B==="/"&&L+1<k.length&&k[L+1]==="/")break;if(B==="{")x++;else if(B==="}")x--}if(E===0){let L=k.match(/(?:const|let|var)\s+(\w+)\s*=/);if(L)o.push(L[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(k)){let B=k.match(/(?:const|let|var)\s+(\w+)/);if(B)o.push(B[1])}else{let B=k.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(B){let U=B[1].slice(1,-1).split(",").map((Z)=>{let Y=Z.split(":");return(Y.length>1?Y[1]:Y[0]).trim()}).filter((Z)=>/^\w+$/.test(Z));o.push(...U)}}}}return[...new Set(o)]}function
|
|
2626
|
-
|
|
2627
|
-
`),o}function
|
|
2628
|
-
`),Jt=o.params??{},et=[],it=[];for(let ct=0;ct<rt.length;ct++){if(rt[ct]==="params")continue;et.push(rt[ct]),it.push(gt[ct])}let
|
|
2615
|
+
`):"";let{imports:E,body:C}=$b(e),j=C.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),L=["",`// ${uf}`];if(E)L.push(E);return L.push(...k),L.push(`async function ${df}() {`,j,` return { ${x.join(", ")} }`,"}",`type ${pf} = Awaited<ReturnType<typeof ${df}>>`,...x.map((B)=>`declare var ${B}: ${pf}[${JSON.stringify(B)}]`)),L.join(`
|
|
2616
|
+
`)}function _b(e){let x=s(e).split(""),v=0;for(let k=0;k<x.length;k++){let E=x[k];if(E==="{"||E==="("||E==="["){v++;continue}if(E==="}"||E===")"||E==="]"){v=Math.max(0,v-1);continue}if(v>0&&E!==`
|
|
2617
|
+
`)x[k]=" "}return te(x.join(""))}function to(e,o){if(yf(e)!==null)return[];let x=s(o),v=new Set(m);return _b(e).filter((k)=>{if(v.has(k))return!1;if(te(o).includes(k))return!1;return new RegExp(`(?<![.#\\w$])${k}(?![\\w$])`).test(x)})}var uf="stx: types for the declared client payload (#1868)",Eb="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",df="__stxServerScope",pf="__StxClientPayload";var ff=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var kb=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Cb(e){let o=new Map,x=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let v of e){let k=s(v),{depths:E,balanced:C}=we(k);if(!C)continue;let j=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let L of k.matchAll(j)){let B=L.index??0;if(E[B+L[1].length]!==0)continue;let F=L[2],U=B+L[0].length-L[3].length,Z=v.slice(U,B+L[0].length).trim().replace(/;$/,"").trim(),Y=L[3],Q=x.test(Y)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(Y)&&!/[,+\-*/%&|?:=]$/.test(Z)&&we(Y).balanced;o.set(F,o.has(F)||!Q?null:Z)}}return new Map([...o].filter((v)=>v[1]!==null))}function bf(e,o,x=0,v=new Set){if(o.size===0||x>=5)return e;let k=s(e),E="",C=0;for(let j of k.matchAll(/[A-Za-z_$][\w$]*/g)){let L=j.index??0,B=j[0],F=o.get(B);if(!F||v.has(B))continue;let U=k.slice(0,L).trimEnd(),Z=k.slice(L+B.length).trimStart();if(U.endsWith(".")||/^:(?!:)/.test(Z)&&/[{,]$/.test(U))continue;if(L>0&&/[\w$]/.test(k[L-1]))continue;E+=`${e.slice(C,L)}(${bf(F,o,x+1,new Set([...v,B]))})`,C=L+B.length}return E+e.slice(C)}function Rb(e,o){let x=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,v=[],k;while((k=x.exec(e))!==null){if(k.index>o)break;let E=k[1];if(k.index===o){if(E==="elseif"){let j=v[v.length-1];if(j?.current)j.seen.push(j.current);if(j)j.current=null}break}if(E==="endif"||E==="endunless"){v.pop();continue}let C="";if(k[2]==="("){let j=0,L=k.index+k[0].length-1,B=L+1;for(;L<e.length;L++){let F=e[L];if(F==="(")j++;else if(F===")"){if(j--,j===0)break}}C=e.slice(B,L).trim(),x.lastIndex=L+1}if(E==="if")v.push({seen:[],current:C});else if(E==="unless")v.push({seen:[],current:`!(${C})`});else if(E==="elseif"||E==="else"){let j=v[v.length-1];if(!j)continue;if(j.current)j.seen.push(j.current);j.current=E==="elseif"?C:null}}return v.flatMap((E)=>[...E.seen.map((C)=>`!(${C})`),...E.current?[E.current]:[]]).filter(Boolean)}function Ab(e){let o=e.code.trim();if(!o)return null;if(e.attribute?.startsWith("@")){if(kb.test(o))return null;let v=";(($event: any): void => { ";return{text:`${v}${o} });`,prefixLength:v.length}}let x=";void ((";return{text:`${x}${o}));`,prefixLength:x.length}}var Tb=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function qn(e,o){if(!o)return e;return e.replace(Tb,(x,v,k,E)=>{let C=gf.resolve(o,E).replace(/\\/g,"/");return`${v}${k}${C}${k}`})}function vs(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Ib(e){let o=new Set,x=s(e);for(let v of x.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let k=v[1],E=/\{([^}]*)\}/.exec(k);for(let B of E?.[1].split(",")??[]){let F=B.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(F&&/^[A-Z_$][\w$]*$/i.test(F))o.add(F)}let C=k.replace(/\{[^}]*\}/,""),j=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(C);if(j)o.add(j[1]);let L=/^\s*([A-Z_$][\w$]*)/i.exec(C);if(L&&L[1]!=="type")o.add(L[1])}return[...o].sort()}function no(e,o={}){let x=He(e),v=e.split(`
|
|
2618
|
+
`),k=Array.from({length:v.length},()=>""),E=new Map,C=o.filePath&&o.templateExpressions!==!1?sf(e,fo(e),{filePath:o.filePath,componentsDir:o.componentsDir,projectRoot:o.projectRoot,readComponent:o.readComponent,scriptCode:(U,Z)=>He(U).map((Y)=>qn(Y.code,gf.dirname(Z))).join(`
|
|
2619
|
+
`)}):void 0,j=new Set,L=[];for(let U of x){let Z=bs(ys(U.code)),Y=qn(Z,o.originDir??"").split(`
|
|
2620
|
+
`);Y.forEach((Q,se)=>{let oe=U.startLine-1+se;if(oe<k.length)k[oe]=se===0?vs(U)+Q:Q,j.add(oe)}),L.push(U.startLine-1+Y.length-1)}for(let U of L){let Z=k[U]?.trim()===""?U:U+1;if(Z<k.length&&k[Z].trim()===""&&(Z===U||!j.has(Z)))k[Z]=";"}let B=(U,Z)=>{for(let[Y,Q]of U.split(`
|
|
2621
|
+
`).entries())if(k.push(Q),Z)E.set(k.length,Y===0?Z:{...Z,line:Z.line+Y,column:1,prefixLength:0})};if(o.globals!==!1){B("");let U=new Set([...x.flatMap((se)=>te(se.code)),...x.flatMap((se)=>Ib(se.code))]),Z=(se)=>{if(!U.has(se))B(`declare var ${se}: any`)};if(o.runtimeGlobals!==!1){if(!U.has("window"))B("declare var window: any");for(let se of m)Z(se)}let Y=[...new Set([...Lc,...W,...ff])].filter((se)=>o.runtimeGlobals!==!1||!m.includes(se));if(o.contextScope==="global"){B("declare global {");for(let se of Y)B(` var ${se}: any`);B("}")}else{for(let se of Lc)Z(se);for(let se of W)Z(se);for(let se of ff)Z(se)}B(`declare var ${jc}: any`);let Q=new Set(x.flatMap((se)=>te(se.code)));B(`type ${af}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of bb(e)){if(Q.has(se.name))continue;let oe=se.iterable&&Q.has(se.iterable)?`${af}<typeof ${se.iterable}>`:"any";B(`declare var ${se.name}: ${oe}`)}}if(o.templateExpressions!==!1){if(C?.declarations)for(let Z of C.declarations.split(`
|
|
2622
|
+
`))B(Z);let U=fc(e).map((Z)=>{let Y=C?.events.get(Z.offset??-1);if(Y){Z.anchor=!0;let Q=Z.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),oe=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${Y}) => unknown)`:Q,ie=`;(($event: ${Y}): void => { `;return{expression:Z,statement:{text:`${ie}${oe} });`,prefixLength:ie.length}}}return{expression:Z,statement:Ab(Z)}}).filter((Z)=>Z.statement!==null);if(U.push(...C?.checks||[]),U.length>0){let Z=fo(e),Y=Cb(x.map((ie)=>ie.code)),se=[...new Set(x.flatMap((ie)=>te(ie.code)))].filter((ie)=>/^[A-Z_$][\w$]*$/i.test(ie)),oe=0;if(se.length>0){B(gb);for(let ie of se)B(`type __StxT_${ie} = ${hf}<typeof ${ie}>`);B(`;((${se.map((ie)=>`${ie}: __StxT_${ie}`).join(", ")}) => {`),oe=1}for(let{expression:ie,statement:ce}of U){let ae=" ".repeat(oe),pe=ie.offset===void 0?[]:Rb(Z,ie.offset),me=pe.length>0?`${pe.map((Se)=>`if (${bf(Se,Y)}) `).join("")}{ `:"",he=pe.length>0?" }":"";B(ae+me+ce.text+he,{line:ie.line,column:ie.column,expression:ie,prefixLength:ce.prefixLength+ae.length+me.length,guardPrefixLength:ae.length+me.length})}if(oe>0)B("});")}}let F=!1;if(o.reference&&k[0]!==void 0&&k[0].trim()==="")k[0]=`/// <reference path=${JSON.stringify(o.reference.replace(/\\/g,"/"))} />`,F=!0;return B("export {}"),{text:k.join(`
|
|
2623
|
+
`),lineMap:E,sourceLineCount:v.length,componentDependencies:C?.dependencies,referenced:F}}function ro(e,o){if(!e.expression)return!1;return e.inGuard===!0||o===2774}function so(e,o,x){let v=e.lineMap.get(o);if(!v)return o<=e.sourceLineCount?{line:o,column:x}:null;let k=v.expression?.anchor?0:Math.max(0,x-1-(v.prefixLength??0));return{line:v.line,column:v.column+k,expression:v.expression,inGuard:x<=(v.guardPrefixLength??0)}}var Db=[{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"}],Pb=[{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')"}],Mb=[{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 gc(e){let o=[],x=[];return Ob(e,o),Nb(e,o,x),jb(e,x),Lb(e,o),{valid:o.length===0,errors:o,warnings:x}}function Ob(e,o){let x=(e.match(/\{\{/g)||[]).length,v=(e.match(/\}\}/g)||[]).length;if(x!==v)o.push({type:"expression",message:`Unclosed expression brackets: found ${x} opening '{{' and ${v} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Nb(e,o,x){for(let v of Db){let k=new RegExp(`${v.open}(?:\\s|\\()`,"g"),E=new RegExp(v.close,"g"),C=(e.match(k)||[]).length,j=(e.match(E)||[]).length;if(v.altClose){let L=new RegExp(v.altClose,"g");j+=(e.match(L)||[]).length}if(C>j)o.push({type:"directive",message:`Unclosed @${v.name} directive: found ${C} opening and ${j} closing`,suggestion:`Add ${C-j} missing ${v.close} tag(s)`});else if(j>C)x.push({type:"directive",message:`Extra ${v.close} found: ${j-C} more closing than opening`,suggestion:`Check for orphaned ${v.close} tags`})}}function jb(e,o){for(let x of Pb)if(x.pattern.test(e))o.push({type:"syntax",message:x.message,suggestion:x.suggestion})}function Lb(e,o){for(let x of Mb)if(x.pattern.test(e))o.push({type:"expression",message:`Security warning: ${x.message}`,suggestion:"Remove dangerous code from template expressions"})}function mc(e,o){let x=e.slice(0,o).split(`
|
|
2624
|
+
`);return{line:x.length,column:x[x.length-1].length+1}}function hc(e,o,x){let v=[];switch(e){case"if":case"elseif":case"unless":if(x.length===0)v.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(x.length===0||!x[0].includes(" as "))v.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(x.length===0)v.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(x.length===0)v.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(x.length===0)v.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(x.length===0)v.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return v}function yc(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function bc(e){let o=e.matchAll(/@([a-z]+)/gi),x=new Set;for(let v of o){let k=v[1].toLowerCase();if(!k.startsWith("end"))x.add(k)}return Array.from(x)}import $n from"path";import Pr from"process";var St=["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 vf=new Set(St),Bb=new Set(["props","$props","defineProps"]),zb=new Set(["stx","@stacksjs/stx"]),wf=P(128),$f=P(64);function Wb(e){let o=[],x=0,v=e.split(`
|
|
2625
|
+
`);for(let k of v){let E=x,C=null,j=!1;for(let L=0;L<k.length;L++){let B=k[L];if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(C){if(B===C)C=null;continue}if(B==="'"||B==='"'||B==="`"){C=B;continue}if(B==="/"&&L+1<k.length&&k[L+1]==="/")break;if(B==="{")x++;else if(B==="}")x--}if(E===0){let L=k.match(/(?:const|let|var)\s+(\w+)\s*=/);if(L)o.push(L[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(k)){let B=k.match(/(?:const|let|var)\s+(\w+)/);if(B)o.push(B[1])}else{let B=k.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(B){let U=B[1].slice(1,-1).split(",").map((Z)=>{let Y=Z.split(":");return(Y.length>1?Y[1]:Y[0]).trim()}).filter((Z)=>/^\w+$/.test(Z));o.push(...U)}}}}return[...new Set(o)]}function ic(e){let o=e;o=o.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),o=o.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),o=o.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),o=o.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),o=o.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function x(v){if(!v.includes(":"))return v;let k=[],E="",C=0,j=0,L=null;for(let B=0;B<v.length;B++){let F=v[B];if(L){if(E+=F,F===L)L=null;continue}if(F==='"'||F==="'"||F==="`"){L=F,E+=F;continue}if(F==="<")C++;else if(F===">"&&C>0)C--;else if(F==="(")j++;else if(F===")")j--;if(F===","&&C===0&&j===0){k.push(E),E="";continue}E+=F}if(E)k.push(E);return k.map((B)=>{let F=B.trim(),U=F.startsWith("..."),Z=U?F.slice(3):F,Y=-1,Q=0;for(let me=0;me<Z.length;me++)if(Z[me]==="<")Q++;else if(Z[me]===">")Q--;else if(Z[me]===":"&&Q===0){Y=me;break}if(Y===-1)return B;let oe=Z.substring(0,Y).trim().replace(/\?$/,""),ie=Z.substring(Y+1),ce=-1,ae=0;for(let me=0;me<ie.length;me++)if(ie[me]==="<")ae++;else if(ie[me]===">")ae--;else if(ie[me]==="="&&ae===0){ce=me;break}let pe=U?"...":"";if(ce!==-1)return`${pe}${oe} = ${ie.substring(ce+1).trim()}`;return`${pe}${oe}`}).join(", ")}o=o.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(v,k,E)=>{if(!E.includes(":"))return v;return`${k}(${x(E)})`});{let v=/\b(function\s+\w*\s*)\(/g,k,E=[];while((k=v.exec(o))!==null){let C=k.index+k[0].length-1,j=1,L=C+1,B=0,F=null;while(L<o.length&&j>0){let Y=o[L];if(F){if(Y===F)F=null;L++;continue}if(Y==='"'||Y==="'"||Y==="`"){F=Y,L++;continue}if(Y==="<")B++;else if(Y===">"&&B>0)B--;else if(B===0){if(Y==="(")j++;else if(Y===")")j--}if(j>0)L++}if(j!==0)continue;let U=o.substring(C+1,L);if(!U.includes(":"))continue;let Z=x(U);E.push({start:C+1,end:L,replacement:Z})}for(let C=E.length-1;C>=0;C--){let{start:j,end:L,replacement:B}=E[C];o=o.substring(0,j)+B+o.substring(L)}}return o=o.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(v,k)=>{if(!k.includes(":"))return v;if(k.includes("{")||k.includes("}"))return v;return`(${k.split(",").map((C)=>{let[j,...L]=C.split("="),B=j.split(":")[0].trim();if(L.length>0)return`${B} = ${L.join("=").trim()}`;return B}).join(", ")}) =>`}),o=o.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"),o=o.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),o=o.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),o=o.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),o=o.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),o=o.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),o=o.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),o=o.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),o=o.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),o=o.replace(/\n\s*\n\s*\n/g,`
|
|
2626
|
+
|
|
2627
|
+
`),o}function oc(e){return e.replace(/\s*imported from \S*(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])\S*/g,"")}function ac(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function cc(e){if(e instanceof SyntaxError)return!0;let o=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(o)}function lc(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var Sf=new Set;async function d(e,o,x,v={}){if(!e.trim())return;let k=y(),E=D(e,JSON.stringify(k)),C=wf.get(E);if(C===void 0){try{let Pe=N({loader:"ts",target:"browser",define:k}),Ge=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ge=Ge.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),C=Pe.transformSync(Ge)}catch{C=ic(e)}wf.set(E,C)}let j={exports:{}},L=j.exports,B=Pr.cwd(),F={},U=[...C.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Pe)=>Pe[1]).filter((Pe)=>!Pe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Pe)),Z=new Map;for(let Pe of U)try{if(Pe.startsWith(".")){F[Pe]=await import($n.resolve($n.dirname(x),Pe));continue}let Ge=$n.resolve(B,"node_modules",Pe),rt=$n.join(Ge,"package.json"),gt=JSON.parse(u("fs").readFileSync(rt,"utf8")),_t=gt.main||"index.js";if(gt.exports){let Kt=typeof gt.exports==="string"?gt.exports:gt.exports["."];if(typeof Kt==="string")_t=Kt;else if(Kt?.bun)_t=Kt.bun;else if(Kt?.import)_t=Kt.import;else if(Kt?.default)_t=Kt.default}F[Pe]=await import($n.resolve(Ge,_t))}catch(Ge){if(Pe.startsWith("."))Z.set(Pe,Ge instanceof Error?Ge.message:String(Ge))}let Y=(Pe)=>{if(F[Pe])return F[Pe];let Ge=Z.get(Pe);if(Ge!==void 0)throw Error(`Cannot require '${Pe}' from ${x}: ${Ge}`);return u(Pe)},Q=o.props||{},se=(Pe)=>{if(!Pe)return Q;let Ge={};for(let[rt,gt]of Object.entries(Pe)){let _t=Q[rt];if(_t!==void 0)Ge[rt]=_t;else if(typeof gt==="function")Ge[rt]=gt();else Ge[rt]=gt}return Ge};for(let[Pe,Ge]of Object.entries(Q))Object.defineProperty(se,Pe,{value:Ge,enumerable:!0,configurable:!0,writable:!0});let oe=(Pe,Ge=!1)=>{if(Pe===void 0||Pe===null)return Ge;if(typeof Pe==="string"){let rt=Pe.trim().toLowerCase();if(rt===""||rt==="true"||rt==="1"||rt==="on"||rt==="yes")return!0;if(rt==="false"||rt==="0"||rt==="off"||rt==="no")return!1;return!0}return Boolean(Pe)},ie=(Pe,Ge=0)=>{if(Pe===void 0||Pe===null)return Ge;if(typeof Pe==="string"){let gt=Pe.trim();if(gt==="")return Ge;let _t=Number(gt);return Number.isFinite(_t)?_t:Ge}let rt=Number(Pe);return Number.isFinite(rt)?rt:Ge};for(let Pe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(Q,Pe))continue;try{Object.defineProperty(se,Pe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ce=(Pe)=>{if(!Pe)return Q;let Ge={...Q};for(let[rt,gt]of Object.entries(Pe)){let _t=gt&&typeof gt==="object"&&!Array.isArray(gt)?gt:{type:gt};if(Ge[rt]===void 0&&_t.default!==void 0)Ge[rt]=typeof _t.default==="function"?_t.default():_t.default}return Ge},ae=()=>o.slots||{},pe=(Pe,Ge)=>{let rt={...Pe};for(let[gt,_t]of Object.entries(Ge))if(rt[gt]===void 0)if(typeof _t==="function")rt[gt]=_t();else rt[gt]=_t;return rt},me=(Pe)=>{let Ge=()=>Pe;return Ge.set=(rt)=>{},Ge.update=(rt)=>{},Ge},he=(Pe)=>{let Ge,rt=!1;return()=>{if(!rt)try{Ge=Pe(),rt=!0}catch{Ge=void 0}return Ge}},Se=(Pe)=>{},Ee=(Pe)=>Pe(),Ce=(Pe)=>{},Ae=(Pe)=>{},Re=Fn(o);function _e(Pe){let Ge=Pe||{};if(Ge.title!==void 0||Ge.description!==void 0)Oe({title:Ge.title,description:Ge.description})}function Te(Pe){if(!Pe||typeof Pe!=="object")return;let Ge=o.__stxClientPayload??{};Object.assign(Ge,Pe),o.__stxClientPayload=Ge}let Me=()=>{let Pe=o.__stxServeContext,Ge=o.__stxServeSearch??Pe?.search??"",rt=Pe?.path??"",gt=Object.fromEntries(new URLSearchParams(Ge)),_t=o.query,Kt=Object.keys(gt).length>0?gt:_t??{},En=Ge||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:o.params??{},query:Kt,path:rt,name:"",fullPath:rt+En,hash:"",matched:[]}},De=()=>({push:(Pe)=>{},replace:(Pe)=>{},back:()=>{},forward:()=>{},go:(Pe)=>{}}),Ie=(Pe)=>{let Ge=o.__stx_runtime_head||{};o.__stx_runtime_head=fe(Ge,Pe||{})},Oe=(Pe)=>{Ie(ir(Pe||{}))},tt=(Pe)=>({value:Pe}),ot=(Pe)=>Pe,nt=(Pe)=>({value:typeof Pe==="function"?Pe():Pe}),yt=(Pe,Ge)=>{},dt=(Pe)=>{},ht=(Pe)=>{},at=(Pe)=>Pe?Pe():Promise.resolve(),It=(Pe)=>(Ge,...rt)=>{},pt=(Pe)=>{},Lt=(Pe,Ge)=>{},Sn=(Pe,Ge)=>Ge,fn=()=>({value:"light"}),_n=()=>me(!1),Qe=(Pe)=>me(!1),st=()=>me(!1),ft=()=>Qe("(prefers-color-scheme: dark)"),Xt=()=>Qe("(prefers-color-scheme: light)"),Mt=()=>Qe("(prefers-reduced-motion: reduce)"),nn=()=>Qe("(prefers-contrast: more)"),jt={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:{}},wo=new Proxy(jt,{get(Pe,Ge){if(Ge in Pe)return Pe[Ge];return},set(Pe,Ge,rt){return Pe[Ge]=rt,!0}}),ko={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ro=console;try{let Pe=as(C,x),Ge=new Set(Object.keys(Q)),rt=Object.keys(o).filter((ct)=>!Ge.has(ct)&&!Bb.has(ct)&&Ze(ct)),gt=rt.map((ct)=>o[ct]);if(!rt.includes("__stxServeContext"))rt.push("__stxServeContext"),gt.push(void 0);let _t=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],En=[];for(let[ct,gn]of Object.entries(Q)){if(!Ze(ct))continue;if(_t.has(ct))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ct}\\b`).test(Pe))continue;Kt.push(ct),En.push(gn)}let An=Wb(Pe).map((ct)=>`module.exports.${ct} = typeof ${ct} !== 'undefined' ? ${ct} : module.exports.${ct};`).join(`
|
|
2628
|
+
`),Jt=o.params??{},et=[],it=[];for(let ct=0;ct<rt.length;ct++){if(rt[ct]==="params")continue;et.push(rt[ct]),it.push(gt[ct])}let bt=[...St,...Kt,...et],ut=`return (async () => {
|
|
2629
2629
|
${Pe}
|
|
2630
2630
|
${An}
|
|
2631
2631
|
return module.exports
|
|
2632
|
-
})()`,Wt=D(ut,
|
|
2632
|
+
})()`,Wt=D(ut,bt.join("\x00")),Ot=$f.get(Wt);if(!Ot)Ot=Function(...bt,ut),$f.set(Wt,Ot);let en=o.__stx_options?.runtimeConfig;if(en||/\buse(?:Server)?RuntimeConfig\b/.test(C))await cn(o,x,en);let Tn=await de(o.__stx_runtime_config??At()??S(),()=>lp(o,()=>Ot(j,L,Y,Q,se,oe,ie,ce,pe,Te,up,ks,er,me,he,Se,Ee,Ce,Ae,_e,Me,De,Ie,Oe,Re.setResponseStatus,Re.setResponseHeader,Re.notFound,tt,ot,nt,yt,dt,ht,at,It,pt,ae,Lt,Sn,fn,_n,Qe,st,ft,Xt,Mt,nn,wo,ko,Ro,jt.confirm,jt.alert,jt.fetch,Jt,...En,...it)));if(v.preserveExisting){for(let[ct,gn]of Object.entries(Tn))if(!(ct in o)||o[ct]===void 0)o[ct]=gn}else Object.assign(o,Tn);for(let[ct,gn]of Object.entries(Q))if(!(ct in o))o[ct]=gn}catch(Pe){if(o.__stx_strict_hydration)throw Pe;let Ge=oc(Pe instanceof Error?Pe.message:String(Pe));if(ac(Ge))console.warn(`[stx] server <script> in ${x??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ge}`),v.onFailure?.({kind:"module-resolution",message:Ge,error:Pe});else if(cc(Pe))console.warn(`[stx] server <script> in ${x??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ge}`),v.onFailure?.({kind:"syntax",message:Ge,error:Pe});else if(lc(Ge))console.warn(`[stx] server <script> in ${x??"<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: ${Ge}`),v.onFailure?.({kind:"missing-binding",message:Ge,error:Pe});else{let rt=`${x??"<unknown>"}\x00${Ge}`;if(Pr.env.STX_DEBUG||!Sf.has(rt))Sf.add(rt),console.warn(`[stx] server <script> in ${x??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Ge}`);v.onFailure?.({kind:"unknown",message:Ge,error:Pe})}try{await Xb(C,o,x)}catch(rt){if(Pr.env.STX_DEBUG){let gt=rt instanceof Error?rt.message:String(rt);console.warn(`[stx] fallback extraction also failed in ${x??"<unknown>"}: ${gt}`)}}}}function uc(e){let o=0,x=null,v=!1,k=!1;for(let E=0;E<e.length;E++){let C=e[E];if(x){if(C===x){if(x=null,v||o===0)k=!0}continue}if(C==="'"||C==='"'||C==="`"){x=C;continue}if(C==="{")o++;else if(C==="}")o--;else if(e.startsWith("from",E)&&o===0)v=!0}return x===null&&o===0&&k}var Fb=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function as(e,o){let x=o?$n.dirname(o):Pr.cwd(),v=Pr.cwd(),k=e.split(`
|
|
2633
2633
|
`),E=[],C=0;while(C<k.length){let j=k[C].trim();if(j.startsWith("interface ")||j.startsWith("export interface ")||j.startsWith("type ")||j.startsWith("export type ")){if(j.includes("{")&&!j.includes("}")){let L=0;for(;C<k.length;C++){for(let B of k[C])if(B==="{")L++;else if(B==="}")L--;if(L<=0)break}}C++;continue}if(j.startsWith("definePageMeta(")){let L=0,B=!1,F=C;for(let Y=C;Y<k.length&&!B;Y++){let Q=null,se=!1,oe=k[Y];for(let ie=0;ie<oe.length;ie++){let ce=oe[ie];if(se){se=!1;continue}if(ce==="\\"){se=!0;continue}if(Q){if(ce===Q)Q=null;continue}if(ce==='"'||ce==="'"||ce==="`"){Q=ce;continue}if(ce==="(")L++;else if(ce===")"){if(L--,L===0){C=Y+1,B=!0;break}}}}if(!B)C=k.length;let U=k.slice(F,C).join(`
|
|
2634
|
-
`),Z=[];for(let Y of["title","description"]){let Q=new RegExp(`\\b${Y}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(Q)Z.push(`${Y}: ${JSON.stringify(Q[2])}`)}if(Z.length>0)E.push(`useSeoMeta({ ${Z.join(", ")} });`);continue}if(j.startsWith("import ")||j==="import"||j.startsWith("import{")){let L=j,B=0;while(!
|
|
2635
|
-
`+Y;if(U<=0&&Z>=C)break}E.push(F),E.push(`module.exports.${B} = ${B};`),C=Z+1}else E.push(j),C++}else if(j.includes("module.exports"))E.push(j),C++;else if(j.trim()&&!j.startsWith("//"))E.push(j),C++;else C++}return
|
|
2636
|
-
`),x,v)}function
|
|
2637
|
-
`)j=!1;E++;continue}if(L){if(k+=F,F==="*"&&U==="/"){k+=U,E+=2,L=!1;continue}E++;continue}if(!C&&F==="/"&&U==="/"){j=!0,k+=F,E++;continue}if(!C&&F==="/"&&U==="*"){L=!0,k+=F,E++;continue}if(C){if(k+=F,F==="\\"){k+=U,E+=2;continue}if(F===C&&C!=="`"){C=null,E++;continue}if(C==="`"){if(F==="$"&&U==="{"){B++,k+=U,E+=2;continue}if(F==="`"){C=null,E++;continue}}E++;continue}if(B>0){if(F==="{")B++;else if(F==="}")B--}if(F==='"'||F==="'"||F==="`"){C=F,k+=F,E++;continue}if(F==="a"&&e.startsWith("await",E)){let Z=
|
|
2634
|
+
`),Z=[];for(let Y of["title","description"]){let Q=new RegExp(`\\b${Y}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(Q)Z.push(`${Y}: ${JSON.stringify(Q[2])}`)}if(Z.length>0)E.push(`useSeoMeta({ ${Z.join(", ")} });`);continue}if(j.startsWith("import ")||j==="import"||j.startsWith("import{")){let L=j,B=0;while(!uc(L)&&C+B+1<k.length)B++,L=`${L} ${k[C+B].trim()}`;C+=B;let F=L.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=L.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Z=L.match(/^import\s+['"](.+?)['"]/),Y=L,Q=(se)=>{if(se.startsWith("."))return $n.resolve(x,se);if(se.startsWith("~/")||se.startsWith("@/"))return $n.resolve(v,se.slice(2));return se};if(F){let[,se,oe]=F,ie=Q(oe);E.push(`const ${se} = (await import('${ie}')).default`),E.push(`module.exports.${se} = ${se};`)}else if(U){let[,se,oe]=U,ie=Q(oe),ce=[],ae=[],pe=zb.has(oe);for(let me of se.split(",")){let he=me.trim();if(!he)continue;let Se=he.split(/\s+as\s+/);if(Se.length===2){let[Ee,Ce]=[Se[0].trim(),Se[1].trim()];if(pe&&vf.has(Ee)){E.push(`const ${Ce} = ${Ee};`);continue}ce.push(`${Ee}: ${Ce}`),ae.push(Ce)}else{if(pe&&vf.has(he))continue;ce.push(he),ae.push(he)}}if(ce.length>0)E.push(`const { ${ce.join(", ")} } = await import('${ie}')`);for(let me of ae)E.push(`module.exports.${me} = ${me};`)}else if(Z){let se=Q(Z[1]);E.push(`await import('${se}')`)}else E.push(Y);C++;continue}if(Fb.test(j))E.push(k[C]),C++;else if(j.startsWith("export const ")||j.startsWith("export let ")||j.startsWith("export var ")){let L=Ef(k,C),{type:B,name:F,value:U}=L;E.push(`${B} ${F} = ${U};`),E.push(`module.exports.${F} = ${F};`),C=L.nextIndex}else if(j.startsWith("export function ")||j.startsWith("export async function ")){let L=Bc(k,C);E.push(L.functionCode),E.push(`module.exports.${L.name} = ${L.name};`),C=L.nextIndex}else if(j.startsWith("const ")||j.startsWith("let ")||j.startsWith("var ")){let L=Ef(k,C),{type:B,name:F,value:U}=L;E.push(`${B} ${F} = ${U};`),E.push(`module.exports.${F} = ${F};`),C=L.nextIndex}else if(j.startsWith("function ")||j.startsWith("async function ")){let L=Bc(k,C);E.push(L.functionCode),E.push(`module.exports.${L.name} = ${L.name};`),C=L.nextIndex}else if(j.startsWith("export default function ")||j.startsWith("export default async function ")){let L=k[C].replace(/^(\s*)export\s+default\s+/,"$1"),B=[...k];B[C]=L;let F=Bc(B,C);if(E.push(F.functionCode),F.name)E.push(`module.exports.default = ${F.name};`);C=F.nextIndex}else if(j.startsWith("export default ")){let L=j.replace(/^export\s+default\s+/,"").replace(/;$/,"");E.push(`module.exports.default = ${L};`),C++}else if(j.startsWith("class ")||j.startsWith("export class ")){let L=j.match(/(?:export\s+)?class\s+(\w+)/);if(L){let B=L[1],F=k[C].replace(/^export\s+/,""),U=0,Z=C;for(;Z<k.length;Z++){let Y=k[Z];for(let Q of Y)if(Q==="{")U++;else if(Q==="}")U--;if(Z>C)F+=`
|
|
2635
|
+
`+Y;if(U<=0&&Z>=C)break}E.push(F),E.push(`module.exports.${B} = ${B};`),C=Z+1}else E.push(j),C++}else if(j.includes("module.exports"))E.push(j),C++;else if(j.trim()&&!j.startsWith("//"))E.push(j),C++;else C++}return Vb(E.join(`
|
|
2636
|
+
`),x,v)}function Vb(e,o,x){let v=e.length,k="",E=0,C=null,j=!1,L=!1,B=0;while(E<v){let F=e[E],U=e[E+1];if(j){if(k+=F,F===`
|
|
2637
|
+
`)j=!1;E++;continue}if(L){if(k+=F,F==="*"&&U==="/"){k+=U,E+=2,L=!1;continue}E++;continue}if(!C&&F==="/"&&U==="/"){j=!0,k+=F,E++;continue}if(!C&&F==="/"&&U==="*"){L=!0,k+=F,E++;continue}if(C){if(k+=F,F==="\\"){k+=U,E+=2;continue}if(F===C&&C!=="`"){C=null,E++;continue}if(C==="`"){if(F==="$"&&U==="{"){B++,k+=U,E+=2;continue}if(F==="`"){C=null,E++;continue}}E++;continue}if(B>0){if(F==="{")B++;else if(F==="}")B--}if(F==='"'||F==="'"||F==="`"){C=F,k+=F,E++;continue}if(F==="a"&&e.startsWith("await",E)){let Z=Ub(e,E);if(Z){let{quote:Y,path:Q,end:se}=Z;if(Q.startsWith(".")||Q.startsWith("~/")||Q.startsWith("@/")){let oe=Q.startsWith(".")?$n.resolve(o,Q):$n.resolve(x,Q.slice(2));k+=`await import(${Y}${oe}${Y})`,E=se;continue}}}k+=F,E++}return k}function Ub(e,o){let x=o+5;if(x>=e.length)return null;if(!/\s/.test(e[x]))return null;while(x<e.length&&/\s/.test(e[x]))x++;if(!e.startsWith("import",x))return null;x+=6;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!=="(")return null;x++;while(x<e.length&&/\s/.test(e[x]))x++;let v=e[x];if(v!=="'"&&v!=='"')return null;x++;let k=x;while(x<e.length&&e[x]!==v)if(e[x]==="\\")x+=2;else x++;if(x>=e.length)return null;let E=e.slice(k,x);x++;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!==")")return null;return{quote:v,path:E,end:x+1}}function Af(e,o){let x=e[o];if(x!=="{"&&x!=="[")return null;let k=w(e,x,x==="{"?"}":"]",o);if(k===-1)return null;return{pattern:e.slice(o,k+1),endPos:k+1}}function Tf(e){let o=[],x=e.slice(1,-1).trim();if(!x)return o;let v=0,k=0,E="";while(v<x.length){let C=x[v];if(C==="{"||C==="["){let j=k===0?Af(x,v):null;if(j){o.push(...Tf(j.pattern)),v=j.endPos,E="";continue}k++}else if(C==="}"||C==="]")k--;if(k>0){v++;continue}if(C===","){if(E.trim())o.push(E.trim());E="",v++;continue}if(C===":"){E="",v++;continue}if(C==="="){if(E.trim())o.push(E.trim());E="",v++;while(v<x.length&&x[v]!==","&&k===0){if(x[v]==="{"||x[v]==="[")k++;else if(x[v]==="}"||x[v]==="]")k--;v++}continue}if(/[\w$]/.test(C))E+=C;v++}if(E.trim())o.push(E.trim());return o}function dc(e){let o=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!o)return null;let x=o[0].length,v=(k)=>k===" "||k==="\t";while(x<e.length&&v(e[x]))x++;if(e[x]===":"){let k=0,E=null;x++;for(;x<e.length;x++){let C=e[x];if(E){if(C==="\\"){x++;continue}if(C===E)E=null;continue}if(C==="'"||C==='"'||C==="`"){E=C;continue}if(C==="("||C==="["||C==="{"||C==="<"){k++;continue}if(C===")"||C==="]"||C==="}"||C===">"){k--;continue}if(C==="="&&k<=0){let j=e[x+1],L=e[x-1];if(j!=="="&&j!==">"&&L!=="="&&L!=="!"&&L!=="<"&&L!==">")break}}if(e[x]!=="=")return null}while(x<e.length&&v(e[x]))x++;if(e[x]!=="=")return null;return{type:o[1],name:o[2],value:e.slice(x+1).trim()}}function _f(e,o,x,v){let k=null,E=!1;for(let C of e){if(E){E=!1;continue}if(C==="\\"){E=!0;continue}if(k){if(C===k)k=null;continue}if(C==="'"||C==='"'||C==="`"){k=C;continue}if(C===o)v++;else if(C===x)v--}return v}function Ef(e,o){let x=e[o].trim(),v=dc(x),k=v?[x,v.type,v.name,v.value]:null;if(!k){let F=x.match(/^(?:export\s+)?(const|let|var)\s+/);if(F){let U=x.slice(F[0].length),Z=o;if(U.startsWith("{")||U.startsWith("[")){let Q=U[0],se=Q==="{"?"}":"]",oe=_f(U,Q,se,0),ie=U;for(let ce=o+1;ce<e.length&&oe>0;ce++)ie+=` ${e[ce].trim()}`,Z=ce,oe=_f(e[ce],Q,se,oe);if(oe>0)ie=U,Z=o;U=ie}let Y=Af(U,0);if(Y){let Q=F[1],se=Y.pattern,oe=U.slice(Y.endPos).trim();if(oe.startsWith("=")){let ie=oe.slice(1).trim(),ce=ie,ae=Math.max(Z,o);if(kf(ie)){let Se=Cf(e,ae,ie);ce=Se.value,ae=Se.nextIndex}else ae=ae+1;ce=ce.trim().replace(/;$/,"");let pe=Tf(se),me=`__stx_src_${o}`,he=pe.map((Se)=>`module.exports.${Se} = ${Se};`).join(`
|
|
2638
2638
|
`);return{type:Q,name:me,value:`${ce}; ${Q} ${se} = ${me};
|
|
2639
2639
|
${he}`,nextIndex:ae}}}}throw Error(`Failed to parse variable declaration: ${x}`)}let[,E,C,j]=k,L=j,B=o;if(kf(j)){let F=Cf(e,o,j);L=F.value,B=F.nextIndex}else B=o+1;while(B<e.length){let F=e[B].trim();if(F.startsWith(".")||F.startsWith("?."))L+=`
|
|
2640
|
-
${e[B]}`,B++;else break}return L=L.trim().replace(/;$/,""),{type:E,name:C,value:L,nextIndex:B}}function Bc(e,o){let x=e[o].trim(),v=x.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!v)throw Error(`Failed to parse function declaration: ${x}`);let[,k]=v,E=x.replace(/^export\s+/,""),C=o;if(
|
|
2640
|
+
${e[B]}`,B++;else break}return L=L.trim().replace(/;$/,""),{type:E,name:C,value:L,nextIndex:B}}function Bc(e,o){let x=e[o].trim(),v=x.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!v)throw Error(`Failed to parse function declaration: ${x}`);let[,k]=v,E=x.replace(/^export\s+/,""),C=o;if(Hb(x)){let j=qb(e,o,E);E=j.functionCode,C=j.nextIndex}else C=o+1;return{name:k,functionCode:E,nextIndex:C}}function kf(e){let o=e.trim();if(o.startsWith("{"))return w(o,"{","}",0)===-1;if(o.startsWith("["))return w(o,"[","]",0)===-1;return!If(o)}function If(e){let o={paren:0,bracket:0,brace:0},x=null,v=0;for(let k=0;k<e.length;k++){let E=e[k];if((k>0?e[k-1]:"")==="\\"&&x)continue;if((E==='"'||E==="'")&&!x){x=E;continue}if(E===x&&x!=="`"){x=null;continue}if(E==="`"&&!x){x="`";continue}if(E==="`"&&x==="`"&&v===0){x=null;continue}if(x==="`"&&E==="$"&&e[k+1]==="{"){v++,k++;continue}if(v>0&&E==="{"){v++;continue}if(v>0&&E==="}"){v--;continue}if(x)continue;if(E==="(")o.paren++;else if(E===")")o.paren--;else if(E==="[")o.bracket++;else if(E==="]")o.bracket--;else if(E==="{")o.brace++;else if(E==="}")o.brace--}return o.paren===0&&o.bracket===0&&o.brace===0&&x===null}function Df(e){let o=e.indexOf("(");if(o===-1)return e.indexOf("{");let x=w(e,"(",")",o);if(x===-1)return-1;return e.indexOf("{",x)}function Hb(e){let o=Df(e);if(o===-1)return!0;return w(e,"{","}",o)===-1}function Cf(e,o,x){let v=x,k=o+1;while(k<e.length&&!If(v)){let E=e[k];v+=`
|
|
2641
2641
|
${E}`,k++}while(k<e.length){let E=e[k].trim();if(E.startsWith(".")||E.startsWith("?."))v+=`
|
|
2642
|
-
${e[k]}`,k++;else break}return{value:v,nextIndex:k}}function
|
|
2643
|
-
${C}`,k++}return{functionCode:v,nextIndex:k}}function Rf(e,o){let x=c(e,o)??c(`(${e})`,o);if(x!==void 0)return x;if(!/\bprocess\b/.test(e))return;let v={...o,process:Object.freeze({env:{...Pr.env}})},k=Object.keys(v).filter(Ze),E=k.map((C)=>v[C]);try{return Function(...k,`'use strict'; return (${e});`)(...E)}catch{try{return Function(...k,`'use strict'; return ${e};`)(...E)}catch{return}}}async function
|
|
2644
|
-
`)k++;return!0}if(e[k]==="/"&&e[k+1]==="*"){k+=2;while(k<E-1&&!(e[k]==="*"&&e[k+1]==="/"))k++;return k+=2,!0}return!1},B=()=>{if(v!==0)return;let F=e.slice(k).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(F){let Q=F[2].split(",").map((se)=>{let oe=se.trim().split(":");return oe[oe.length-1].trim()});for(let se of Q)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!x.has(se))o.push(se),x.add(se);return}let U=e.slice(k).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let Q=U[2];if(!x.has(Q))o.push(Q),x.add(Q);return}let Z=e.slice(k).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!x.has(Q))o.push(Q),x.add(Q);return}let Y=e.slice(k).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Q=Y[1];if(!x.has(Q))o.push(Q),x.add(Q)}};while(k<E){if(L())continue;if(e[k]==="'"||e[k]==='"'){C(e[k]);continue}if(e[k]==="`"){j();continue}if(e[k]==="{"){v++,k++;continue}if(e[k]==="}"){v--,k++;continue}if(v===0&&/[a-z]/i.test(e[k])&&(k===0||/\s|[;{}()]/.test(e[k-1])))B();k++}return o}function
|
|
2642
|
+
${e[k]}`,k++;else break}return{value:v,nextIndex:k}}function qb(e,o,x){let v=x,k=o+1;while(k<e.length){let E=Df(v);if(E!==-1){if(w(v,"{","}",E)!==-1)break}let C=e[k];v+=`
|
|
2643
|
+
${C}`,k++}return{functionCode:v,nextIndex:k}}function Rf(e,o){let x=c(e,o)??c(`(${e})`,o);if(x!==void 0)return x;if(!/\bprocess\b/.test(e))return;let v={...o,process:Object.freeze({env:{...Pr.env}})},k=Object.keys(v).filter(Ze),E=k.map((C)=>v[C]);try{return Function(...k,`'use strict'; return (${e});`)(...E)}catch{try{return Function(...k,`'use strict'; return ${e};`)(...E)}catch{return}}}async function Xb(e,o,x){let v=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let E of v){let[,,C,j]=E;try{let L=j.trim().replace(/;$/,""),B=Rf(L,o);if(B!==void 0)o[C]=B}catch(L){console.warn(`Failed to parse export ${C} in fallback:`,L)}}let k=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let E of k){let[,,C,j]=E;if(!(C in o))try{let L=j.trim().replace(/;$/,""),B=Rf(L,o);if(B!==void 0)o[C]=B}catch{}}}function Xi(e){let o=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),x=o?o[1]:"",v=o?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:x,templateWithoutScript:v}}function Ki(e){let o=e.trim();if(!o)return!1;return/(?:const|let|var|function)\s+\w+/.test(o)}var Ws=new z(500),yo=new z(1000),zf=33554432,Wc=zf;function Kb(e){let o=e.componentRenderCacheBytes;if(typeof o!=="number"||o<0||o===Wc)return;Wc=o,xo.setMaxBytes(o)}var xo=new z(2000,{maxBytes:zf,sizeOf:(e)=>e.output.length});function Zb(e){let o=new WeakSet;try{let x=(v)=>{if(v===void 0)return{__stxType:"undefined"};if(typeof v==="bigint")return{__stxType:"bigint",value:v.toString()};if(typeof v==="function"||typeof v==="symbol")throw TypeError("Non-serializable component input");if(v===null||typeof v!=="object")return v;if(o.has(v))throw TypeError("Circular component input");if(o.add(v),v instanceof Date)return{__stxType:"date",value:v.toISOString()};if(Array.isArray(v))return v.map(x);let k={};for(let E of Object.keys(v).sort())k[E]=x(v[E]);return k};return JSON.stringify(x(e))}catch{return null}}function Pf(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vc(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ve(e){return!vc(e)}var ho=new Map;function N(e){let o;try{o=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let x=ho.get(o);if(x)return x;if(ho.size>=16)ho.clear();let v=new Bun.Transpiler(e);return ho.set(o,v),v}var Mf=new WeakMap,Jb=256;function Ue(e){try{let o=N({loader:"ts",target:"browser",define:y()}),x=Mf.get(o);if(!x)x=new Map,Mf.set(o,x);let v=x.get(e);if(v!==void 0)return v;let k=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");k=k.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let E=[];k=k.replace(/\{!![\s\S]*?!!\}/g,(j)=>{let L=E.length;return E.push(j),`"__STX_EXPR_${L}__"`}),k=k.replace(/\{\{\{[\s\S]*?\}\}\}/g,(j)=>{let L=E.length;return E.push(j),`"__STX_EXPR_${L}__"`}),k=k.replace(/\{\{[\s\S]*?\}\}/g,(j)=>{let L=E.length;return E.push(j),`"__STX_EXPR_${L}__"`});let C=o.transformSync(k);for(let j=0;j<E.length;j++)C=C.replace(`"__STX_EXPR_${j}__"`,E[j]),C=C.replace(`'__STX_EXPR_${j}__'`,E[j]);if(x.size>=Jb){let j=x.keys().next();if(!j.done)x.delete(j.value)}return x.set(e,C),C}catch(o){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",o);return e}}function Gb(e){let o=[],x=new Set,v=0,k=0,E=e.length,C=(F)=>{k++;while(k<E){if(e[k]==="\\"){k+=2;continue}if(e[k]===F){k++;return}k++}},j=()=>{k++;while(k<E){if(e[k]==="\\"){k+=2;continue}if(e[k]==="`"){k++;return}if(e[k]==="$"&&e[k+1]==="{"){k+=2;let F=1;while(k<E&&F>0)if(e[k]==="{")F++,k++;else if(e[k]==="}")F--,k++;else if(e[k]==="'"||e[k]==='"')C(e[k]);else if(e[k]==="`")j();else k++;continue}k++}},L=()=>{if(e[k]==="/"&&e[k+1]==="/"){while(k<E&&e[k]!==`
|
|
2644
|
+
`)k++;return!0}if(e[k]==="/"&&e[k+1]==="*"){k+=2;while(k<E-1&&!(e[k]==="*"&&e[k+1]==="/"))k++;return k+=2,!0}return!1},B=()=>{if(v!==0)return;let F=e.slice(k).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(F){let Q=F[2].split(",").map((se)=>{let oe=se.trim().split(":");return oe[oe.length-1].trim()});for(let se of Q)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!x.has(se))o.push(se),x.add(se);return}let U=e.slice(k).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let Q=U[2];if(!x.has(Q))o.push(Q),x.add(Q);return}let Z=e.slice(k).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!x.has(Q))o.push(Q),x.add(Q);return}let Y=e.slice(k).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Q=Y[1];if(!x.has(Q))o.push(Q),x.add(Q)}};while(k<E){if(L())continue;if(e[k]==="'"||e[k]==='"'){C(e[k]);continue}if(e[k]==="`"){j();continue}if(e[k]==="{"){v++,k++;continue}if(e[k]==="}"){v--,k++;continue}if(v===0&&/[a-z]/i.test(e[k])&&(k===0||/\s|[;{}()]/.test(e[k-1])))B();k++}return o}function Yb(e){let o=[],x=0,v=0,k=null;for(let E=0;E<e.length;E++){let C=e[E];if(k){if(C==="\\"){E++;continue}if(C===k)k=null;continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="("||C==="["||C==="{")x++;else if(C===")"||C==="]"||C==="}")x--;else if(C===","&&x===0)o.push(e.slice(v,E)),v=E+1}if(v<e.length)o.push(e.slice(v));return o}function Qb(e){let o=0,x=null;for(let v=0;v<e.length;v++){let k=e[v];if(x){if(k==="\\"){v++;continue}if(k===x)x=null;continue}if(k==='"'||k==="'"||k==="`"){x=k;continue}if(k==="("||k==="["||k==="{")o++;else if(k===")"||k==="]"||k==="}")o--;else if(k==="="&&o===0){let E=e[v-1],C=e[v+1];if(E==="!"||E==="<"||E===">"||E==="=")continue;if(C==="="||C===">")continue;return v}}return-1}function ev(e,o){try{let x=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!x)return;let v=x.index-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]!=="}")return;let k=v,E=0,C=-1;for(;v>=0;v--){let L=e[v];if(L==="}")E++;else if(L==="{"){if(E--,E===0){C=v;break}}}if(C===-1)return;let j=e.slice(C+1,k);for(let L of Yb(j)){let B=L.trim();if(!B||B.startsWith("..."))continue;let F=Qb(B);if(F===-1)continue;let U=B.slice(0,F).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(o[U]!==void 0)continue;let Z=B.slice(F+1).trim();if(!Z)continue;try{let Y=Object.keys(o).filter(Ze),Q=Function(...Y,`"use strict"; return (${Z});`);o[U]=Q(...Y.map((se)=>o[se]))}catch{}}}catch{}}var tv=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function wc(e,o){let x=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!x)return null;let v=x[2].toLowerCase();if(!tv.has(v))return null;if((e.match(new RegExp(`<${v}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${v}>\\s*$`,"i").test(e))return null;let E=x[0].length;return e.slice(0,E)+o+e.slice(E)}async function Xn(e,o,x,v,k){let E=e.endsWith(".stx")?e.slice(0,-4):e,C=(ie)=>ie.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),j=(ie)=>ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=x.__importedComponents;if(L){for(let ie of[E,E.toLowerCase(),C(E),j(E)])if(L.has(ie))return!0}let B=[...new Set([`${E}.stx`,`${C(E)}.stx`,`${j(E)}.stx`])],F=typeof k.root==="string"?Ye.resolve(k.root):void 0,U=F??Ye.dirname(v),Z=[],Y=(ie)=>{if(ie&&!Z.includes(ie))Z.push(ie)},Q=x.__originalFilePath;if(Q)Y(Ye.join(Ye.dirname(Q),"components"));if(Y(o),Y(k._rootComponentsDir),Y(Ye.join(Ye.dirname(v),"components")),Y(k.componentsDir),F)Y(Ye.resolve(F,"resources/views/components")),Y(Ye.resolve(F,"resources/components")),Y(Ye.resolve(F,"src/components")),Y(Ye.resolve(F,"components"));for(let ie of k._layerComponentDirs??[])Y(ie);let se=k._pluginComponentDirs;if(Array.isArray(se))for(let ie of se)Y(typeof ie==="string"?ie:null);if(Y(k.fallbackComponentsDir),E.startsWith("./")||E.startsWith("../"))return n(Ye.resolve(Ye.dirname(v),`${E}.stx`));let oe=Of(Ye.resolve(import.meta.dir,"components"));for(let ie of Z){let ce=Ye.isAbsolute(ie)?ie:Ye.resolve(U,ie);if(Of(ce)===oe)continue;for(let ae of B)if(await n(Ye.join(ce,ae)))return!0}return!1}function Of(e){try{return Bf.realpathSync(e)}catch{return e}}function xc(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function io(e){if(!e)return!1;let o=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(o)}function nv(e,o,x){if(!e.includes("{{")&&!e.includes("{!!"))return e;let v=(k,E)=>{let C;try{C=b(k,o)}catch{return E}if(C===void 0||C===null)return"";let j=String(C);if(/<\/style/i.test(j))return console.warn(`[stx] a <style> expression in ${x??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return j};return e.replace(/\{!!([\s\S]*?)!!\}/g,(k,E)=>v(E,k)).replace(/\{\{([\s\S]*?)\}\}/g,(k,E)=>v(E,k))}var Nf=new Set;function jf(e,o,x,v){let k=`${e}\x00${o}\x00${v??""}`;if(!process.env.STX_DEBUG&&Nf.has(k))return;Nf.add(k);let E=o?` used in ${o}`:"",C=v?` Cause: ${v}.`:"",j=x.length>0?`
|
|
2645
2645
|
searched:
|
|
2646
2646
|
${x.map((L)=>` - ${L}`).join(`
|
|
2647
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${E}, so it rendered as nothing.${C}${j}`)}function Lf(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function
|
|
2648
|
-
`)}`}if(x&&jt.includes("{{ text || slot }}"))jt=jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>x);let{applySlots:
|
|
2647
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${E}, so it rendered as nothing.${C}${j}`)}function Lf(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Sc(e){let o=new Set,x=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let v of e){let k;while((k=x.exec(v))!==null)o.add(k[1]);x.lastIndex=0}return[...o]}async function We(e,o,x,v,k,E,C,j=new Set,L){let{extractVariables:B}=await lt("stx/variable-extractor",()=>import("./chunk-d3vtgnep.js")),F=j??new Set;if(F.has(e))return`[Circular component reference: ${e}]`;let U=new Set(F);U.add(e);let Z=typeof o.client==="string"?o.client.trim():"";if("client"in o)delete o.client;let Y=Z&&Z!=="load"&&xc(Z)?Z:"";try{let Q=(et)=>et.split("-").map((it)=>it.charAt(0).toUpperCase()+it.slice(1)).join(""),se=(et)=>et.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oe=e.endsWith(".stx")?e.slice(0,-4):e,ie=null,ce=k.__importedComponents;if(ce){let et=[oe,oe.toLowerCase(),Q(oe),se(oe)];for(let it of et)if(ce.has(it)){ie=ce.get(it);break}}let ae=[];if(!ie){let et=[`${oe}.stx`,`${Q(oe)}.stx`,`${se(oe)}.stx`],it=[...new Set(et)],bt=k.__originalFilePath,ut=[];if(ut.push(...C._layerComponentDirs??[]),bt){let Vt=Ye.join(Ye.dirname(bt),"components");ut.push(Vt)}if(v)ut.push(v);let Wt=C._rootComponentsDir;if(typeof Wt==="string"&&!ut.includes(Wt))ut.push(Wt);let Ot=Ye.join(Ye.dirname(E),"components");if(!ut.includes(Ot))ut.push(Ot);if(C.componentsDir&&C.componentsDir!==v&&!ut.includes(C.componentsDir))ut.push(C.componentsDir);let en=typeof C.root==="string"?Ye.resolve(C.root):void 0,Tn=en??Ye.dirname(E),ct=[];if(en)ct.push(Ye.resolve(en,"resources/views/components")),ct.push(Ye.resolve(en,"resources/components")),ct.push(Ye.resolve(en,"src/components")),ct.push(Ye.resolve(en,"components"));ct.push(Ye.resolve(import.meta.dir,"components"));for(let Vt of ct)if(!ut.includes(Vt))ut.push(Vt);let gn=C._pluginComponentDirs;if(Array.isArray(gn)){for(let Vt of gn)if(typeof Vt==="string"&&!ut.includes(Vt))ut.push(Vt)}if(C.fallbackComponentsDir&&!ut.includes(C.fallbackComponentsDir))ut.push(C.fallbackComponentsDir);let yr=[...new Set(ut.map((Vt)=>{if(!Vt)return Vt;return Ye.isAbsolute(Vt)?Vt:Ye.resolve(Tn,Vt)}))];ut.length=0,ut.push(...yr);let xr=`${oe}\x00${E}\x00${yr.join("\x00")}`,Ao=yo.get(xr);if(Ao)if(await n(Ao))ie=Ao;else yo.delete(xr);if(!ie&&(oe.startsWith("./")||oe.startsWith("../")))ie=Ye.resolve(Ye.dirname(E),`${oe}.stx`),ae.push(ie);else if(!ie)for(let Vt of ut){if(!Vt)continue;for(let Us of it){let Hs=Ye.join(Vt,Us);if(ae.push(Hs),await n(Hs)){ie=Hs;break}}if(ie)break;if(!ie)try{let Us=await import("fs");if(!Us.statSync(Vt,{throwIfNoEntry:!1})?.isDirectory())continue;let Uf=8,Io=[{path:Vt,depth:0}];while(Io.length>0&&!ie){let qs=Io.pop();if(qs.depth>=Uf)continue;let Vc;try{Vc=Us.readdirSync(qs.path,{withFileTypes:!0})}catch{continue}for(let Xs of Vc){if(!Xs.isDirectory())continue;if(Xs.name==="node_modules"||Xs.name.startsWith("."))continue;let Uc=Ye.join(qs.path,Xs.name);for(let Hf of it){let Do=Ye.join(Uc,Hf);if(ae.push(Do),await n(Do)){ie=Do;break}}if(ie)break;Io.push({path:Uc,depth:qs.depth+1})}}}catch{}if(ie)break}if(ie)yo.set(xr,ie)}if(!ie||!await n(ie))return jf(e,E,ae),Lf(e);L.add(ie);let pe;if(Ws.has(ie))pe=Ws.get(ie);else try{pe=await Bun.file(ie).text(),Ws.set(ie,pe)}catch(et){let it=et instanceof Error?et.message:String(et);return jf(e,E,[ie],it),Lf(e)}let me=new Set(["__originalFilePath","__importedComponents",Zs,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[et,it]of Object.entries(k))if(!et.startsWith("__")||me.has(et))he[et]=it;let Se=x;if(x.includes("@include")){let{processIncludes:et}=await lt("stx/includes",()=>import("./chunk-peyt18ce.js"));Se=await et(x,k,E,C,L)}if(/<[A-Z][\w.-]*[\s/>]/.test(Se)){let{processComponents:et}=await lt("stx/component-renderer",()=>import("./chunk-qpx8kvd8.js"));Se=await et(Se,{...k,__processedComponents:F},E,C,L)}let Ee=[];if(io(Se)){let{processExpressions:et}=await lt("stx/expressions",()=>import("./chunk-5y1mekxe.js")),it=k.__stx_signals_gate===void 0?{...k,__stx_signals_gate:!0}:k;Se=et(Se,it,E);for(let bt of Se.matchAll(/\{\{([\s\S]*?)\}\}/g))Ee.push(bt[1].trim())}let Ce=V(Se),Ae=[],Re=Ce.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(et,it)=>{let bt=Ce.scripts[Number(it)]||"",ut=bt.match(/^<script\b([^>]*)>/i)?.[1]||"",Wt=ut.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ot=!Wt||["module","text/javascript","application/javascript"].includes(Wt);if(!/\bserver\b/i.test(ut)&&Ot)return Ae.push(bt),"";return bt}),{extractSlotContent:_e}=await lt("stx/slots",()=>import("./chunk-vc9wa97m.js")),Te=_e(Re),Me={};if(Te.defaultSlot?.trim())Me.default=Te.defaultSlot;for(let[et,it]of Te.namedSlots)Me[et]=it.content;let De=k.__stx_scope_seq??={n:0,key:Bun.hash(String(k.__filename??E)).toString(36).slice(0,6)},Ie=`stx_${oe.replace(/[^a-zA-Z0-9]/g,"_")}_${++De.n}_${De.key}`,Oe={...he,$uid:Ie,...o,props:o,slot:Re,$slots:Me,__processedComponents:U,__sections:{},__stx_signals_gate:be(pe)||io(x),__stx_preserved_client_expressions:[...Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[],...Ee]};ev(pe,Oe);let tt=pe,ot=ee(tt);if(ot)tt=ot.content.trim();let nt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,yt=[...pe.matchAll(nt)],dt=[],ht=null,at=yt.some((et)=>/\bserver\b/.test(et[1]||"")&&/\bcache\b/.test(et[1]||"")),It=null,pt=null,Lt=null,Sn=0,fn=null;if(Kb(C),at&&Wc>0){let et=Zb({props:o,slot:x,buildMode:C.buildMode??"",skipEventDirectives:C.skipEventDirectives===!0,layers:C._layerGraph?.layers.map((it)=>it.configFile),uid:Ie});if(et!==null){It=`${ie}\x00${D(pe)}\x00${et}`;let it=xo.get(It);if(it){for(let bt of it.dependencies)L.add(bt);if(sl(k,it.clientFactories),De.n+=it.uidsConsumed,it.preservedClientExpressions.length>0){let bt=new Set(Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[]);for(let ut of it.preservedClientExpressions)bt.add(ut);k.__stx_preserved_client_expressions=[...bt]}return it.output}pt=new Set(L),Lt=nl(k),Sn=De.n,fn=new Set(Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[])}}let _n=new Set;for(let et of yt){let it=et[1]||"",bt=et[2]||"",ut=it.includes("server");if(Ve(it)&&bt.trim())bt=Ue(bt);if(ut&&bt){for(let Ot of te(bt))_n.add(Ot);try{await B(bt,Oe,ie,{onFailure:(Ot)=>{if(Ot.kind!=="unknown")ht=Ot.kind}})}catch(Ot){}}if(!ut){let Ot=bt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),en=Ot.includes("{{")&&Ot.includes("}}"),Tn=Ot.includes("{!!")&&Ot.includes("!!}");if(en||Tn)Ot=Zr(Ot,Oe,ie);let ct=it.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");dt.push(`<script${ct}>${Ot}</script>`)}}let st=V(pe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),ft=st?st[1]:"",Xt=st?st[2]:"",Mt="",nn=ft&&/\bscoped\b/i.test(ft);if(st)Mt=`<style${ft}>${nv(Xt,Oe,ie)}</style>`;let jt=tt;if(jt=jt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),st)jt=jt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let et=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,it=[];if(jt=jt.replace(et,(bt,ut)=>{let Wt=ut.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Wt)it.push(`<style${Wt[1]}>${Wt[2]}</style>`);return""}),jt=jt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),it.length>0)Mt=`${Mt}${it.join(`
|
|
2648
|
+
`)}`}if(x&&jt.includes("{{ text || slot }}"))jt=jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>x);let{applySlots:wo}=await lt("stx/slots",()=>import("./chunk-vc9wa97m.js")),{defaultSlot:ko,namedSlots:Ro}=Te,Pe=dt.some((et)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(et)),Ge=(et)=>Pe?Bp(et,Ie):et,rt=new Map([...Ro].map(([et,it])=>[et,{...it,content:Ge(it.content)}]));jt=await wo(jt,Ge(ko),rt,Oe);let gt=Sc(dt),_t=(Array.isArray(Oe.__stx_client_signal_names)?Oe.__stx_client_signal_names:[]).filter((et)=>!_n.has(et));if(gt.length>0||_t.length>0)Oe.__stx_client_signal_names=[...new Set([..._t,...gt])];else delete Oe.__stx_client_signal_names;let Kt={...C,_rootComponentsDir:C._rootComponentsDir||C.componentsDir,componentsDir:Ye.dirname(ie),skipSignalsRuntime:!0,skipEventDirectives:Pe||dt.length===0,defaultLayout:void 0};Oe.__stxProcessingDepth=(k.__stxProcessingDepth||0)+1;let En=await r(jt,Oe,ie,Kt,L),Vs=new Set(Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[]);for(let et of En.matchAll(/\{\{([\s\S]*?)\}\}/g))Vs.add(et[1].trim());if(Vs.size>0)k.__stx_preserved_client_expressions=[...Vs];let An=Ie,Jt=En;if(Pe){let et="";if(Object.keys(o).length>0)try{et=` data-stx-props="${Pf(JSON.stringify(o))}"`}catch{}let it=Y?` stx-hydrate="${Pf(Y)}"`:"",bt=` data-stx-scope="${An}"${et}${it}`;Jt=wc(En,bt)??`<div${bt}>${En}</div>`;let ut=await Promise.all(dt.map(async(Wt)=>{let Ot=Wt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Ot)return Wt;let[,en,Tn]=Ot,{vendorStyleTags:ct,factoryBody:gn}=await iv(Tn,ie,C.buildMode==="compile"),yr=Y?null:No(k,gn),xr=yr?`window.__stxComponentFactories[${JSON.stringify(yr)}](${JSON.stringify(An)});`:`(${gn})(${JSON.stringify(An)});`;if(Y)return`${ct}<script type="stx/island" data-stx-island="${An}" data-stx-scoped data-stx-owner="${An}"${en}>${xr}</script>`;return`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${An}"${en}>${xr}</script>`}));if(Jt=Jt+`
|
|
2649
2649
|
`+ut.join(`
|
|
2650
2650
|
`),Mt)Jt+=`
|
|
2651
2651
|
`+Mt}else{if(Mt)Jt+=`
|
|
2652
|
-
`+Mt;if(dt.length>0){let et=Oe.__stx_event_bindings||[],it=Le(Oe),
|
|
2653
|
-
`+
|
|
2654
|
-
`),Oe.__stx_event_bindings=[]}}if(nn){let et=
|
|
2655
|
-
${
|
|
2656
|
-
`)}`:Jt}catch(Q){return`[Error processing component: ${Q instanceof Error?Q.message:String(Q)}]`}finally{F.delete(e)}}async function n(e){return Bun.file(e).exists()}function Fc(e,o){let x=Ye.resolve(o),v=Ye.resolve(e),k=x.endsWith(Ye.sep)?x:x+Ye.sep;if(v===x||v.startsWith(k))return v;return null}async function
|
|
2652
|
+
`+Mt;if(dt.length>0){let et=Oe.__stx_event_bindings||[],it=Le(Oe),bt=await Promise.all(dt.map(async(ut)=>{let Wt=ut.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Wt)return ut;return await ye(Wt[1],{eventBindings:et,templateContent:Jt,filePath:ie,projectRoot:process.cwd(),serverData:it,instanceId:Ie})}));Jt+=`
|
|
2653
|
+
`+bt.join(`
|
|
2654
|
+
`),Oe.__stx_event_bindings=[]}}if(nn){let et=Qn(Jt,ie);if(et.hasScoped)Jt=et.html}if(It&&pt){let et=Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[];xo.set(It,{output:Jt,dependencies:[...L].filter((it)=>!pt.has(it)),clientFactories:Lt?rl(k,Lt):[],uidsConsumed:De.n-Sn,preservedClientExpressions:fn?et.filter((it)=>!fn.has(it)):[]})}if(ht)Jt=`<!--stx-render-failed:${ht}-->${Jt}`;return Ae.length>0?`${Jt}
|
|
2655
|
+
${Ae.join(`
|
|
2656
|
+
`)}`:Jt}catch(Q){return`[Error processing component: ${Q instanceof Error?Q.message:String(Q)}]`}finally{F.delete(e)}}async function n(e){return Bun.file(e).exists()}function Fc(e,o){let x=Ye.resolve(o),v=Ye.resolve(e),k=x.endsWith(Ye.sep)?x:x+Ye.sep;if(v===x||v.startsWith(k))return v;return null}async function rv(e,o,x,v){let k=o.startsWith("layouts/")?o.slice(8):o,E=Ye.join(e,k);for(let C of E.endsWith(".stx")?[E]:[E,`${E}.stx`])if(await n(C)){if(v)console.log(`Found layout in ${e}: ${C}`);return x?.add(C),C}return null}async function Kn(e,o,x,v){let k=await sv(e,o,x,v);if(k===null)return null;let E=Fc(k,process.cwd());if(E)return E;let C=[x.root,x.layoutsDir,x.fallbackLayoutsDir,x.componentsDir,x.partialsDir,x.pagesDir,...x._layerLayoutDirs??[]].filter((j)=>typeof j==="string"&&j.length>0);for(let j of C){let L=Ye.isAbsolute(j)?j:Ye.resolve(process.cwd(),j);if(Fc(k,L))return Ye.resolve(k)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${k} (template: ${e}, from: ${o})`),null}async function sv(e,o,x,v){if(x.debug)console.log(`Resolving template path: ${e} from ${o}`);let k=Ye.dirname(o),E=process.cwd();if(e.startsWith("/")){let Z=Ye.join(E,e),Y=Fc(Z,E);if(!Y)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${o})`),null;if(x.debug)console.log(`Checking absolute path: ${Y}`);if(await n(Y)&&v)v.add(Y);return Y}let C=Ye.join(k,e);if(await n(C)){if(x.debug)console.log(`Found direct path: ${C}`);if(v)v.add(C);return C}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let Z of[".stx",".tsx",".jsx"]){let Y=`${C}${Z}`;if(await n(Y)){if(x.debug)console.log(`Found direct path with extension: ${Y}`);if(v)v.add(Y);return Y}}let j=[];if(j.push(...x._layerLayoutDirs??[]),x.layoutsDir)j.push(Ye.isAbsolute(x.layoutsDir)?x.layoutsDir:Ye.resolve(process.cwd(),x.layoutsDir));let L=Ye.resolve(k),B=process.cwd();for(let Z=0;Z<10;Z++){let Y=Ye.join(L,"layouts"),Q=!1;try{Q=Bf.statSync(Y,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(Q){j.push(Y);break}let se=Ye.dirname(L);if(se===L||se.length<B.length)break;L=se}for(let Z of j){let Y=await rv(Z,e,v,x.debug);if(Y)return Y}if(x.fallbackLayoutsDir){let Z=Ye.isAbsolute(x.fallbackLayoutsDir)?x.fallbackLayoutsDir:Ye.resolve(process.cwd(),x.fallbackLayoutsDir),Y=e.startsWith("layouts/")?e.slice(8):e,Q=[Ye.join(Z,Y)];if(!e.endsWith(".stx"))Q.push(`${Q[0]}.stx`);for(let se of Q)if(await n(se)){if(x.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(v)v.add(se);return se}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let Z=e.split("layouts/"),Y=Ye.join(x.partialsDir||k,"layouts",Z[1]);if(await n(Y)){if(x.debug)console.log(`Found in layouts path: ${Y}`);if(v)v.add(Y);return Y}if(!Y.endsWith(".stx")){let Q=`${Y}.stx`;if(await n(Q)){if(x.debug)console.log(`Found in layouts path with extension: ${Q}`);if(v)v.add(Q);return Q}}}if(x.partialsDir){let Z=Ye.join(x.partialsDir,"layouts");if(await n(Z)){let Y=Ye.join(Z,e);if(await n(Y)){if(x.debug)console.log(`Found in partials layouts dir: ${Y}`);if(v)v.add(Y);return Y}if(!e.endsWith(".stx")){let Q=`${Y}.stx`;if(await n(Q)){if(x.debug)console.log(`Found in partials layouts dir with extension: ${Q}`);if(v)v.add(Q);return Q}}}}let F=x.partialsDir||Ye.join(process.cwd(),"views"),U=Ye.join(F,e);if(await n(U)){if(x.debug)console.log(`Found in views path: ${U}`);if(v)v.add(U);return U}if(!e.endsWith(".stx")){let Z=`${U}.stx`;if(await n(Z)){if(x.debug)console.log(`Found in views path with extension: ${Z}`);if(v)v.add(Z);return Z}}if(k.includes("temp")){let Z=Ye.join(Ye.dirname(k),"layouts",e);if(await n(Z)){if(x.debug)console.log(`Found in temp layouts dir: ${Z}`);if(v)v.add(Z);return Z}if(!e.endsWith(".stx")){let Y=`${Z}.stx`;if(await n(Y)){if(x.debug)console.log(`Found in temp layouts dir with extension: ${Y}`);if(v)v.add(Y);return Y}}}if(x.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${o})`);else console.warn(`Template not found: ${e} (referenced from ${o})`);return null}function oo(e,o,x){let v=0,k="",E="";try{if(typeof o==="number"&&o>=0){let C=e.split(`
|
|
2657
2657
|
`),j=0;for(let L=0;L<C.length;L++)if(j+=C[L].length+1,j>=o){v=L+1,k=C[L].trim();let B=Math.max(0,L-2),F=Math.min(C.length,L+3);E=C.slice(B,F).map((U,Z)=>{let Y=B+Z+1;return`${Y===v?"> ":" "}${Y}: ${U}`}).join(`
|
|
2658
|
-
`);break}}else if(x){let C=e.indexOf(x);if(C>=0)return
|
|
2658
|
+
`);break}}else if(x){let C=e.indexOf(x);if(C>=0)return oo(e,C)}}catch{}return{lineNumber:v,lineContent:k,context:E}}var mt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(e,o,x,v,k,E){let{lineNumber:C,context:j}=oo(v,k,E),L=x.split("/").pop(),B=0;if(typeof k==="number"&&k>=0&&v){let U=v.lastIndexOf(`
|
|
2659
2659
|
`,Math.max(0,k-1));B=k-(U+1)+1}let F="";if(C>0)F+=`
|
|
2660
2660
|
${x}:${C}${B>0?`:${B}`:""}: ${e.toLowerCase()} error: ${o}
|
|
2661
2661
|
`;if(F+=`
|
|
@@ -2668,8 +2668,8 @@ ${mt.yellow}${mt.bold}Message:${mt.reset} ${o}
|
|
|
2668
2668
|
`,j)F+=`
|
|
2669
2669
|
${mt.blue}${mt.bold}Context:${mt.reset}
|
|
2670
2670
|
${mt.dim}${j}${mt.reset}
|
|
2671
|
-
`;return F}function K(){Ws.clear(),
|
|
2672
|
-
${
|
|
2671
|
+
`;return F}function K(){Ws.clear(),yo.clear(),xo.clear()}function Bu(){return{size:Ws.size,maxSize:500}}var zc=P(128);async function iv(e,o,x){let v=D(e,o,x),k=zc.get(v);if(k){if(Ct(k.deps))return k;zc.delete(v)}let E=Kr(e,{filePath:o,projectRoot:process.cwd()}),C=E.code,j=Gr(E.styles);C=vt(C).code;let{hasUserImports:L,bundleClientScript:B}=await lt("stx/client-script-bundler",()=>import("./chunk-ef5vz9w5.js")),F=[],U=!1;if(L(C)){let ie=C;C=await B(ie,o,{projectRoot:process.cwd(),minify:x,collectInputs:F}),U=C===ie}let{stripStxRuntimeImports:Z}=await lt("stx/signal-processing",()=>import("./chunk-sf1vhfrb.js"));C=Z(C);let Y=R(C),Q=Gb(Y),se=`function(__scopeId) {
|
|
2672
|
+
${Dt("const",[...Co,...Q],Y)}
|
|
2673
2673
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2674
2674
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
2675
2675
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -2697,18 +2697,18 @@ catch (e) {}
|
|
|
2697
2697
|
finally {
|
|
2698
2698
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2699
2699
|
}
|
|
2700
|
-
}`,oe={vendorStyleTags:j,factoryBody:se,deps:
|
|
2700
|
+
}`,oe={vendorStyleTags:j,factoryBody:se,deps:bo([...F,...E.styles.map((ie)=>ie.resolvedPath)])};if(!U&&E.unresolved.length===0)zc.set(v,oe);return oe}var ov=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function av(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let x=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!x)return null;return{pkg:x[1],subpath:x[2]||""}}let o=e.match(/^([^/]+)(\/.*)?$/);if(!o)return null;return{pkg:o[1],subpath:o[2]||""}}function cv(e,o){let x=o;while(!0){let v=hr.join(x,"node_modules",e,"package.json");if(Fs.existsSync(v))return hr.dirname(v);let k=hr.dirname(x);if(k===x)return null;x=k}}function lv(e,o){if(!e||typeof e!=="object")return null;let x=(k)=>{if(typeof k==="string")return k;if(k&&typeof k==="object"){if(typeof k.import==="string")return k.import;if(typeof k.default==="string")return k.default;if(typeof k.import==="object")return x(k.import);if(typeof k.default==="object")return x(k.default)}return null};if(Object.prototype.hasOwnProperty.call(e,o))return x(e[o]);let v=null;for(let k of Object.keys(e)){let E=k.indexOf("*");if(E===-1)continue;let C=k.slice(0,E),j=k.slice(E+1);if(!o.startsWith(C)||!o.endsWith(j))continue;if(o.length<C.length+j.length)continue;if(!v||C.length>v.prefix.length)v={pattern:k,prefix:C,suffix:j}}if(v){let k=o.slice(v.prefix.length,o.length-v.suffix.length),E=x(e[v.pattern]);if(E)return E.replace("*",k)}return null}function uv(e,o){let x=av(e);if(!x||!x.subpath)return null;let v=cv(x.pkg,o);if(!v)return null;let k;try{k=JSON.parse(Fs.readFileSync(hr.join(v,"package.json"),"utf8"))}catch{return null}let E=`.${x.subpath}`,C=lv(k.exports,E);if(!C)return null;let j=hr.resolve(v,C);return Fs.existsSync(j)?j:null}function Kr(e,o){let x=o.filePath?hr.dirname(o.filePath):o.projectRoot||process.cwd(),v=o.projectRoot||process.cwd(),k=new Set,E=[],C=[];return{code:e.replace(ov,(L,B)=>{let F;try{if(B.startsWith("./")||B.startsWith("../")||B.startsWith("/")){if(F=B.startsWith("/")?B:hr.resolve(x,B),!Fs.existsSync(F))throw Error(`file not found: ${F}`)}else{let U=null;try{U=Bun.resolveSync(B,v)}catch{U=uv(B,v)}if(!U)throw Error(`could not resolve ${B} (Bun.resolveSync + exports fallback both failed)`);F=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(B)} (from ${o.filePath||"<unknown>"}): ${U?.message||U}`),C.push(B),""}if(k.has(F))return"";k.add(F);try{let U=Fs.readFileSync(F,"utf8");E.push({source:B,resolvedPath:F,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${F}: ${U?.message||U}`),C.push(B)}return""}),styles:E,unresolved:C}}function dv(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Gr(e){if(e.length===0)return"";return`${e.map((o)=>`<style data-stx-vendor="${dv(o.source)}" data-stx-layer="vendor">
|
|
2701
2701
|
@layer vendor {
|
|
2702
2702
|
${o.contents}
|
|
2703
2703
|
}
|
|
2704
2704
|
</style>`).join(`
|
|
2705
2705
|
`)}
|
|
2706
|
-
`}var
|
|
2706
|
+
`}var Xa=m;function vt(e){let o=s(e),x=new Set;for(let j of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of j[1].split(",")){let B=L.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(B)x.add(B)}let v=new Set;for(let j of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))v.add(j[1]);for(let j of o.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let L of j[1].split(",")){let B=L.trim().split(/[:=]/).pop()?.trim();if(B)v.add(B)}let k=W.filter((j)=>{if(x.has(j)||v.has(j))return!1;return Li(o,j,!0)}),E=Vf(o).filter((j)=>!x.has(j)&&!v.has(j));if(k.length===0&&E.length===0)return{code:e,imports:k,models:E};return{code:`${[k.length>0?`import { ${k.join(", ")} } from '@stacksjs/browser'`:"",E.length>0?"import '@stacksjs/browser'":"",E.length>0?`const { ${E.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2707
2707
|
`)}
|
|
2708
|
-
${e}`,imports:k,models:E}}var
|
|
2708
|
+
${e}`,imports:k,models:E}}var pv=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 Vf(e){let o=new Set,x=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,v;while((v=x.exec(e))!==null)if(!pv.has(v[1]))o.add(v[1]);return Array.from(o)}function fv(e){let o=new Set;for(let x of e.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))o.add(x[1]);for(let x of e.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let v of x[1].split(",")){let k=v.trim().split(/[:=]/).pop()?.trim();if(k&&/^[A-Za-z_$][\w$]*$/.test(k))o.add(k)}return o}function Ni(e){let o=new Set,x=new Set,v=e;v=v.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let k=new Set,E=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,C;while((C=E.exec(e))!==null){let U=C[1],Z=C[2];if(C[0].includes("import type"))continue;let Y=[];for(let se of U.split(",")){let oe=se.trim();if(!oe||oe.startsWith("type "))continue;let ie=oe.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ie)continue;let ce=ie[1],ae=ie[2]||ce;if(k.add(ce),k.add(ae),Z==="stx"||Z==="@stacksjs/stx")o.add(ce);else x.add(ce);if(ae!==ce)Y.push(`${ae} = ${ce}`)}let Q=Y.length>0?`var ${Y.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";v=v.replace(C[0],Q)}let j=fv(v);for(let U of Xa){if(k.has(U)||j.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(v))o.add(U)}let L=s(v),B=new Set;for(let U of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Z of U[1].split(",")){let Y=Z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Q of Y){let se=Q.trim();if(se)B.add(se)}}for(let U of W){if(k.has(U)||j.has(U)||B.has(U))continue;if(Li(L,U))x.add(U)}let F=Vf(v);for(let U of F)if(!k.has(U)&&!j.has(U))x.add(U);return{code:v,stxImports:Array.from(o),browserImports:Array.from(x)}}function Li(e,o,x=!1){let v=new RegExp(`\\b${o.replace(/[$]/g,"\\$")}\\b`,"g");for(let k of e.matchAll(v)){let E=k.index??0,C=E+o.length,j=E-1;while(j>=0&&/\s/.test(e[j]))j--;if(e[j]==="."&&e.slice(Math.max(0,j-2),j+1)!=="...")continue;let L=C;while(L<e.length&&/\s/.test(e[L]))L++;if(e[L]===":"&&e[L+1]!==":"&&(e[j]==="{"||e[j]===","))continue;if(x&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(C)))continue;return!0}return!1}function ji(e,o){let x=[];if(e.length>0)x.push(` var { ${e.join(", ")} } = window.stx || window;`);if(o.length>0)x.push(` var { ${o.join(", ")} } = window.StacksBrowser || {};`);if(x.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
2709
2709
|
${x.join(`
|
|
2710
2710
|
`)}
|
|
2711
|
-
${
|
|
2711
|
+
${gv(e,o)}`;return""}function _u(e,o=[]){let{browserImports:x}=Ni(e),v=new Set(o);return ji([],x.filter((k)=>!v.has(k)))}function gv(e,o){let x=[...e.map((v)=>`['${v}', typeof ${v}, 'stx']`),...o.map((v)=>`['${v}', typeof ${v}, '@stacksjs/browser']`)];if(x.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
2712
2712
|
[${x.join(", ")}].forEach(function (e) {
|
|
2713
2713
|
if (e[1] !== 'undefined') return;
|
|
2714
2714
|
console.error(
|
|
@@ -2717,10 +2717,10 @@ ${fv(e,o)}`;return""}function Tu(e,o=[]){let{browserImports:x}=Mi(e),v=new Set(o
|
|
|
2717
2717
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2718
2718
|
);
|
|
2719
2719
|
});
|
|
2720
|
-
`}function Le(e){let o=e.__stxClientPayload;if(o&&typeof o==="object"){let v={};for(let k in o){let E=o[k];if(typeof E==="function")continue;v[k]=E}return v.__stxDeclaredPayload=!0,v}let x={};for(let v in e){if(v.startsWith("__")||v.startsWith("$"))continue;let k=e[v];if(typeof k==="function")continue;x[v]=k}return x}function
|
|
2720
|
+
`}function Le(e){let o=e.__stxClientPayload;if(o&&typeof o==="object"){let v={};for(let k in o){let E=o[k];if(typeof E==="function")continue;v[k]=E}return v.__stxDeclaredPayload=!0,v}let x={};for(let v in e){if(v.startsWith("__")||v.startsWith("$"))continue;let k=e[v];if(typeof k==="function")continue;x[v]=k}return x}function mv(e,o){return new RegExp(`(?<![.#\\w$])${o}(?![\\w$])`).test(e)}var hv=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Wf=new Set;function yv(e,o){let x=hv.test(e),v=o.length>32768;if(!x&&!v)return;if(Wf.has(e))return;if(Wf.add(e),x)console.warn(`[stx] server\u2192client bridge is publishing "${e}" 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(v)console.warn(`[stx] server\u2192client bridge is publishing ${(o.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function Jr(e,o){if(!o)return"";let x=s(e),v=o.__stxDeclaredPayload===!0,k=[];for(let[E,C]of Object.entries(o)){if(!/^[A-Za-z_$][\w$]*$/.test(E))continue;if(E.startsWith("__")||E.startsWith("$"))continue;if(!v&&!mv(x,E))continue;if(Ks(e,E)){if(v)console.warn(`[stx] defineClientPayload declares "${E}", but this client block also declares "${E}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${E}" from defineClientPayload.`);continue}let j;try{j=JSON.stringify(C)}catch{continue}if(j===void 0)continue;yv(E,j),k.push(` var ${E} = ${j.replace(/</g,"\\u003c")};`)}if(k.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2721
2721
|
${k.join(`
|
|
2722
2722
|
`)}
|
|
2723
|
-
`}var
|
|
2723
|
+
`}var xv={left:0,middle:1,right:2};function bv(e){let o=[];if(e.self)o.push("if ($event.target !== $el) return");for(let x of e.systemKeys)o.push(`if (!$event.${x}Key) return`);if(e.keys.length>0){let x=e.keys.map((v)=>`$event.key === '${v}'`).join(" || ");o.push(`if (!(${x})) return`)}if(e.mouse!==null){let x=xv[e.mouse];o.push(`if ($event.button !== ${x}) return`)}if(e.prevent)o.push("$event.preventDefault()");if(e.stop)o.push("$event.stopPropagation()");return o.join("; ")}function vv(e,o){let{elementId:x,event:v,modifiers:k}=e,E=Mo(e.handler),C=bv(k),j=[];if(k.once)j.push("once: true");if(k.capture)j.push("capture: true");if(Po(v,k))j.push("passive: true");let L=j.length>0?`, { ${j.join(", ")} }`:"",B="";if(C)B+=`${C}; `;let F=E.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
|
|
2724
2724
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2725
2725
|
};`;function Z(Y){if(/\$emit\s*\(/.test(Y))return`${U}
|
|
2726
2726
|
${Y}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -2763,23 +2763,23 @@ else {
|
|
|
2763
2763
|
else {
|
|
2764
2764
|
${E}
|
|
2765
2765
|
}
|
|
2766
|
-
}${L})`}function
|
|
2766
|
+
}${L})`}function wv(e){if(e.length===0)return"";return`
|
|
2767
2767
|
// STX: auto-generated event bindings
|
|
2768
|
-
${e.map((x,v)=>
|
|
2768
|
+
${e.map((x,v)=>vv(x,v)).join(`
|
|
2769
2769
|
`)}`}function Ff(e){let o=[],x=new Set,v=e.replace(/^\s*import\s+.*$/gm,""),k=0,E=v.length,C=0;while(C<E){let j=v[C];if(j==="'"||j==='"'||j==="`"){let L=j;if(C++,L==="`"){let B=0;while(C<E){if(v[C]==="\\"){C+=2;continue}if(v[C]==="`"&&B===0){C++;break}if(v[C]==="$"&&v[C+1]==="{"){B++,C+=2;continue}if(v[C]==="}"&&B>0){B--,C++;continue}C++}}else while(C<E){if(v[C]==="\\"){C+=2;continue}if(v[C]===L){C++;break}C++}continue}if(j==="/"&&v[C+1]==="/"){while(C<E&&v[C]!==`
|
|
2770
|
-
`)C++;continue}if(j==="/"&&v[C+1]==="*"){C+=2;while(C<E-1&&!(v[C]==="*"&&v[C+1]==="/"))C++;C+=2;continue}if(j==="{"){k++,C++;continue}if(j==="}"){k--,C++;continue}if(k===0){let L=v.slice(C),B=L.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(B){let Z=B[1];if(!Z.startsWith("_")&&!x.has(Z))o.push(Z),x.add(Z);C+=B[0].length;continue}let F=L.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(F){F[1].split(",").forEach((Z)=>{let Y=Z.trim(),Q=Y.indexOf(":"),se=Q>=0?Y.slice(Q+1).trim().split(/[\s=]/)[0]:Y.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!x.has(se))o.push(se),x.add(se)}),C+=F[0].length;continue}let U=L.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let Z=U[1];if(!Z.startsWith("_")&&!x.has(Z))o.push(Z),x.add(Z);C+=U[0].length;continue}}C++}return o}var
|
|
2770
|
+
`)C++;continue}if(j==="/"&&v[C+1]==="*"){C+=2;while(C<E-1&&!(v[C]==="*"&&v[C+1]==="/"))C++;C+=2;continue}if(j==="{"){k++,C++;continue}if(j==="}"){k--,C++;continue}if(k===0){let L=v.slice(C),B=L.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(B){let Z=B[1];if(!Z.startsWith("_")&&!x.has(Z))o.push(Z),x.add(Z);C+=B[0].length;continue}let F=L.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(F){F[1].split(",").forEach((Z)=>{let Y=Z.trim(),Q=Y.indexOf(":"),se=Q>=0?Y.slice(Q+1).trim().split(/[\s=]/)[0]:Y.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!x.has(se))o.push(se),x.add(se)}),C+=F[0].length;continue}let U=L.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let Z=U[1];if(!Z.startsWith("_")&&!x.has(Z))o.push(Z),x.add(Z);C+=U[0].length;continue}}C++}return o}var $v=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 Sv(e){let o=new Set,x=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function v(Z){let Y;while((Y=x.exec(Z))!==null){let Q=Y[0];if(!$v.has(Q))o.add(Q)}}let k=/\{\{([\s\S]*?)\}\}/g,E;while((E=k.exec(e))!==null)v(E[1]);let C=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((E=C.exec(e))!==null)v(E[1]);let j=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((E=j.exec(e))!==null)v(E[1]);let L=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((E=L.exec(e))!==null)v(E[1]);let B=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((E=B.exec(e))!==null)v(E[1]);let F=/@model\s*=\s*["']([^"']*)["']/gi;while((E=F.exec(e))!==null)v(E[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((E=U.exec(e))!==null)v(E[1]);return o}async function ye(e,o={}){let x=e,v="",k=!1,E=[],C=Kr(x,{filePath:o.filePath,projectRoot:o.projectRoot});x=C.code;let j=Gr(C.styles),L=vt(x);x=L.code,E=[...L.imports,...L.models];let{hasUserImports:B,bundleClientScript:F}=await lt("stx/client-script-bundler",()=>import("./chunk-ef5vz9w5.js"));if(B(x))x=await F(x,o.filePath||"",{projectRoot:o.projectRoot,minify:o.production}),k=!0;if(o.autoImports!==!1){let ae=Ni(x);x=ae.code,v=ji(ae.stxImports,ae.browserImports.filter((pe)=>!E.includes(pe)))}if(v=`${Jr(x,o.serverData)}${v}`,x=R(x),!k&&Ve(o.attrs||""))x=Ue(x);let U=wv(o.eventBindings||[]),Z=(o.attrs||"").trim(),Y=/\btype\s*=\s*["']module["']/i.test(Z),Q=o.instanceId?` data-stx-instance="${o.instanceId}"`:"";if(Y){let ae=Z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),pe=`type="module" data-stx-scoped${Q}${ae?` ${ae}`:""}`;return`${j}<script ${pe}>
|
|
2771
2771
|
${Ir(`${v}${x}
|
|
2772
2772
|
${U}`)}
|
|
2773
|
-
</script>`}let se=
|
|
2773
|
+
</script>`}let se=Os(e),oe=/function __stx_setup_/.test(x),ie=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function ce(ae){let pe=ae.length>0?`
|
|
2774
2774
|
return { ${ae.join(", ")} };`:"";return`${j}<script data-stx-scoped data-stx-run="always"${Q}>
|
|
2775
2775
|
window.stx.mount(function() {
|
|
2776
2776
|
'use strict';
|
|
2777
2777
|
${Ir(`${v}${x}
|
|
2778
2778
|
${U}${pe}`)}
|
|
2779
|
-
})</script>`}if(!ie&&!oe){if(se)return ce(Ff(e));if(o.templateContent){let ae=Ff(e);if(ae.length>0){let pe
|
|
2779
|
+
})</script>`}if(!ie&&!oe){if(se)return ce(Ff(e));if(o.templateContent){let ae=Ff(e);if(ae.length>0){let pe=Sv(o.templateContent);if(ae.some((he)=>pe.has(he)))return ce(ae)}}}return`${j}<script data-stx-scoped data-stx-run="always"${Q}>
|
|
2780
2780
|
;(function() {
|
|
2781
2781
|
'use strict';
|
|
2782
2782
|
${Ir(`${v}${x}
|
|
2783
2783
|
${U}`)}
|
|
2784
2784
|
})()</script>`}
|
|
2785
|
-
export{
|
|
2785
|
+
export{Ln,Ne,W,y,Kr,Gr,Xa,vt,Ni,Li,ji,_u,Le,Jr,ye,Bi,Fi,zi,Yr,jn,Ka,Ru,Ga,Au,Ja,Bn,h,wt,be,Ya,Zr,Za,Pu,q,Qa,Iu,b,Du,je,xt,Be,Fe,Hi,Fn,ee,Qr,es,ts,Ou,zn,Mu,sn,ec,ns,M,le,X,Nu,tc,rs,ss,Vi,Ui,is,os,nc,rc,Wi,qi,sc,ze,on,Hn,St,ic,oc,ac,cc,lc,d,uc,as,dc,Xi,Ki,kt,cs,Gi,pc,Lu,ve,Ji,ju,ls,us,ds,Vn,Yi,ps,Un,an,Wn,gs,ms,hs,r,He,ys,bs,fc,te,Zi,Qi,eo,to,qn,vs,no,ro,so,gc,mc,hc,yc,bc,vc,Ve,N,Ue,wc,Xn,xc,io,Sc,We,n,Kn,oo,g,K,Bu,Gn,A,kc,i,T,Fu,zu,ue};
|