@stacksjs/stx 0.2.217 → 0.2.219
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-pdh79z63.js → chunk-02e5r50t.js} +1 -1
- package/dist/chunk-03t9yevc.js +2 -0
- package/dist/{chunk-z47tw39z.js → chunk-0kj7rses.js} +2 -2
- package/dist/{chunk-c0p9kf53.js → chunk-0m7mt6zc.js} +1 -1
- package/dist/{chunk-wbq7cp57.js → chunk-0wwbjhs2.js} +1 -1
- package/dist/chunk-1339ynfv.js +2 -0
- package/dist/{chunk-96kpqgh3.js → chunk-1b0yfasc.js} +1 -1
- package/dist/{chunk-b6jhznkh.js → chunk-1t7cy4zb.js} +1 -1
- package/dist/{chunk-808qy9cq.js → chunk-27crt28c.js} +196 -196
- package/dist/{chunk-xwc4pg5w.js → chunk-29y9cskh.js} +2 -2
- package/dist/{chunk-st5qggks.js → chunk-2v9qzeb5.js} +1 -1
- package/dist/{chunk-1bvstnz4.js → chunk-2w1qaf5b.js} +2 -2
- package/dist/chunk-395dm3a0.js +3 -0
- package/dist/{chunk-w0ng9e1m.js → chunk-3q8c4kex.js} +1 -1
- package/dist/{chunk-xkd164zg.js → chunk-3tm1df07.js} +1 -1
- package/dist/chunk-3v9drr1f.js +2 -0
- package/dist/chunk-40zvzck0.js +2 -0
- package/dist/chunk-4cm1n157.js +2 -0
- package/dist/{chunk-j0tfxbns.js → chunk-4q17c8sg.js} +2 -2
- package/dist/chunk-4v8358s4.js +2 -0
- package/dist/{chunk-j5vyt8wd.js → chunk-54cefpt2.js} +1 -1
- package/dist/chunk-55yz6apk.js +2 -0
- package/dist/chunk-5xg4y72b.js +2 -0
- package/dist/chunk-62ypndze.js +2 -0
- package/dist/{chunk-x8b16v5q.js → chunk-6b80avmh.js} +1 -1
- package/dist/chunk-6shcpcn9.js +2 -0
- package/dist/{chunk-s7dqawk0.js → chunk-6v2pfq30.js} +2 -2
- package/dist/{chunk-n8zpm7xb.js → chunk-6xtajfpz.js} +1 -1
- package/dist/{chunk-bsr7yrxh.js → chunk-71kpxn5y.js} +1 -1
- package/dist/{chunk-mxqp7x07.js → chunk-7az4zfm8.js} +2 -2
- package/dist/{chunk-7md45k52.js → chunk-7ftn4dpc.js} +2 -2
- package/dist/{chunk-y4hkqsgw.js → chunk-81jqzypz.js} +2 -2
- package/dist/{chunk-q8szpd6w.js → chunk-8dz63q4e.js} +1 -1
- package/dist/chunk-8ksdma43.js +2 -0
- package/dist/{chunk-weajy31v.js → chunk-937b32gs.js} +2 -2
- package/dist/{chunk-crmk2jzf.js → chunk-97t2tj98.js} +1 -1
- package/dist/chunk-99ncmbh8.js +2 -0
- package/dist/{chunk-9064gyt5.js → chunk-9k6890an.js} +2 -2
- package/dist/{chunk-pezxve4a.js → chunk-9tmcj4y7.js} +3 -3
- package/dist/{chunk-ymccpdg6.js → chunk-a39thx3m.js} +1 -1
- package/dist/{chunk-cqt6ry1e.js → chunk-a53v1er1.js} +1 -1
- package/dist/chunk-a7zjfav5.js +2 -0
- package/dist/chunk-aca3hetd.js +2 -0
- package/dist/{chunk-7mst8kqm.js → chunk-ags8t27c.js} +1 -1
- package/dist/{chunk-zgvga8rc.js → chunk-ap23bgyb.js} +1 -1
- package/dist/chunk-b9kdezkq.js +2 -0
- package/dist/{chunk-1nnpwrqj.js → chunk-bbrm07kg.js} +2 -2
- package/dist/{chunk-y2jr10y8.js → chunk-bhqcp8b0.js} +2 -2
- package/dist/{chunk-fnkxbnka.js → chunk-bx766t25.js} +1 -1
- package/dist/{chunk-ht51fz7w.js → chunk-c23nyjd0.js} +1 -1
- package/dist/chunk-c6pb88k7.js +2 -0
- package/dist/{chunk-47pge5gz.js → chunk-ch5n6w31.js} +1 -1
- package/dist/chunk-cmz46x9n.js +2 -0
- package/dist/{chunk-m2mhtpwy.js → chunk-cnkex10g.js} +1 -1
- package/dist/{chunk-3es366z4.js → chunk-dve5ehgr.js} +1 -1
- package/dist/{chunk-vgk5v31k.js → chunk-e31kcmmd.js} +1 -1
- package/dist/{chunk-gvm4dw6p.js → chunk-e4mj16za.js} +2 -2
- package/dist/chunk-e5s2b5z3.js +2 -0
- package/dist/{chunk-msjzqne1.js → chunk-es9ygzeh.js} +1 -1
- package/dist/{chunk-p7qqbw2k.js → chunk-ests3gcx.js} +2 -2
- package/dist/{chunk-jmnftb29.js → chunk-fc33v1qf.js} +2 -2
- package/dist/{chunk-q4se9rtw.js → chunk-fk1qyjdw.js} +1 -1
- package/dist/chunk-gdaq67k8.js +2 -0
- package/dist/{chunk-f6jm4hy3.js → chunk-gfvb1926.js} +1 -1
- package/dist/{chunk-9b82d4g5.js → chunk-gnmft4dz.js} +1 -1
- package/dist/{chunk-74gc1x9x.js → chunk-gzjnkskc.js} +2 -2
- package/dist/chunk-h8s4n9vj.js +2 -0
- package/dist/chunk-hdy6e3yf.js +2 -0
- package/dist/chunk-hkh1d5m5.js +18 -0
- package/dist/{chunk-53ajah3v.js → chunk-hnrtm6xb.js} +2 -2
- package/dist/chunk-hzg9r43r.js +2 -0
- package/dist/{chunk-zxb128xa.js → chunk-j0bcnfbq.js} +2 -2
- package/dist/chunk-jde8jz10.js +2 -0
- package/dist/chunk-jn7g22fd.js +2 -0
- package/dist/{chunk-hncp9gz6.js → chunk-jw93tsxz.js} +1 -1
- package/dist/{chunk-3twce5kp.js → chunk-jzavbzn8.js} +1 -1
- package/dist/{chunk-3wd9kfyz.js → chunk-k0cqdptr.js} +1 -1
- package/dist/{chunk-qd1nadff.js → chunk-khxs70kb.js} +2 -2
- package/dist/{chunk-8anh6d36.js → chunk-kqdrjd0e.js} +1 -1
- package/dist/{chunk-fvjh7rx0.js → chunk-kw311y8k.js} +1 -1
- package/dist/{chunk-zat2ndst.js → chunk-m3dcd2j3.js} +347 -347
- package/dist/{chunk-yckd6ks5.js → chunk-m9tpk603.js} +1 -1
- package/dist/{chunk-yf3bmmkk.js → chunk-mt7htpvg.js} +1 -1
- package/dist/{chunk-1nm2xrvq.js → chunk-n09vpazf.js} +1 -1
- package/dist/{chunk-dmb6t0qj.js → chunk-n98pfm3h.js} +2 -2
- package/dist/{chunk-6xg3j487.js → chunk-n98zvmdq.js} +1 -1
- package/dist/{chunk-khrtzbxd.js → chunk-p5ktexx3.js} +1 -1
- package/dist/{chunk-fvpaf9v5.js → chunk-p6dtgqeq.js} +2 -2
- package/dist/{chunk-yk1smsev.js → chunk-p9mx8rh4.js} +1 -1
- package/dist/{chunk-ne8sygmy.js → chunk-q98bqfzh.js} +1 -1
- package/dist/chunk-rr6scjzr.js +2 -0
- package/dist/{chunk-9xh78snm.js → chunk-s6yn1mbm.js} +1 -1
- package/dist/{chunk-1306tswx.js → chunk-sgncfrb3.js} +1 -1
- package/dist/chunk-t1fqr070.js +2 -0
- package/dist/{chunk-rg6v68ya.js → chunk-t9mf6ddw.js} +1 -1
- package/dist/{chunk-css1sfnr.js → chunk-ta43eqe0.js} +1 -1
- package/dist/{chunk-rczpw37w.js → chunk-tmfrweee.js} +1 -1
- package/dist/{chunk-j3njy10j.js → chunk-tpjekhep.js} +2 -2
- package/dist/chunk-tvcf5760.js +2 -0
- package/dist/chunk-tw2ydyww.js +4 -0
- package/dist/chunk-vcw2ft8z.js +2 -0
- package/dist/{chunk-p8pyqr7p.js → chunk-vdqbbqe2.js} +1 -1
- package/dist/chunk-vg9xvtqz.js +2 -0
- package/dist/{chunk-a2rj5ce0.js → chunk-vgtcj29n.js} +2 -2
- package/dist/chunk-vh7h37mn.js +2 -0
- package/dist/chunk-vhajz6q3.js +2 -0
- package/dist/{chunk-x13f5bbe.js → chunk-vhx0v4jv.js} +1 -1
- package/dist/{chunk-c7pvwvse.js → chunk-vswv49x0.js} +1 -1
- package/dist/{chunk-zj44h5kk.js → chunk-vwn8hkr2.js} +1 -1
- package/dist/{chunk-z2sp0k8d.js → chunk-vx8zk4yt.js} +1 -1
- package/dist/{chunk-aw9z3m10.js → chunk-wzjcw1h6.js} +1 -1
- package/dist/{chunk-tryt2h85.js → chunk-xdq4zkqk.js} +1 -1
- package/dist/{chunk-3fwn9edg.js → chunk-xvh1k1a4.js} +1 -1
- package/dist/chunk-y2j14rjd.js +2 -0
- package/dist/chunk-yd3rg2be.js +2 -0
- package/dist/{chunk-7zk48rd8.js → chunk-ynqc1gyr.js} +1 -1
- package/dist/{chunk-hyrjade7.js → chunk-z2gv9n8s.js} +1 -1
- package/dist/{chunk-trtm887x.js → chunk-z3cgw8j4.js} +1 -1
- package/dist/{chunk-whxregkn.js → chunk-zbww31ss.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/dev-server/serve-app.js +29 -7
- package/dist/page-response.d.ts +113 -0
- package/dist/page-response.js +106 -1
- package/dist/process.js +2 -0
- package/dist/production-server.js +7 -3
- package/dist/pwa.js +2 -2
- package/dist/render.d.ts +14 -0
- package/dist/render.js +3 -19
- package/dist/serve.js +19 -10
- package/dist/ssg.js +2 -2
- package/dist/template-compiler.d.ts +1 -0
- package/dist/template-compiler.js +2 -0
- package/dist/template-hydrator.d.ts +1 -1
- package/dist/template-hydrator.js +4 -3
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/variable-extractor.js +6 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-10yft4b7.js +0 -2
- package/dist/chunk-17atrbv2.js +0 -2
- package/dist/chunk-23vxz3hp.js +0 -2
- package/dist/chunk-2me28xee.js +0 -2
- package/dist/chunk-2w5d5tw1.js +0 -2
- package/dist/chunk-2xeq5xnf.js +0 -2
- package/dist/chunk-2z6k7gsa.js +0 -2
- package/dist/chunk-3fxcwk6a.js +0 -2
- package/dist/chunk-4vwxgmg0.js +0 -2
- package/dist/chunk-5gr4vv7m.js +0 -2
- package/dist/chunk-775fabj4.js +0 -2
- package/dist/chunk-8cyv5316.js +0 -2
- package/dist/chunk-8xtvmwpr.js +0 -2
- package/dist/chunk-9db2f09j.js +0 -2
- package/dist/chunk-9h908knr.js +0 -2
- package/dist/chunk-a1ydhf5t.js +0 -3
- package/dist/chunk-ba18hn7n.js +0 -2
- package/dist/chunk-bd0yv6a0.js +0 -2
- package/dist/chunk-cr7s8q08.js +0 -2
- package/dist/chunk-d48tzd8c.js +0 -2
- package/dist/chunk-dcy8hg45.js +0 -2
- package/dist/chunk-e6377wfq.js +0 -4
- package/dist/chunk-jnjxf5t2.js +0 -2
- package/dist/chunk-n4smz31k.js +0 -18
- package/dist/chunk-njkv35c3.js +0 -2
- package/dist/chunk-q3ea7q6t.js +0 -2
- package/dist/chunk-qwzfdq8q.js +0 -2
- package/dist/chunk-r153ybwd.js +0 -2
- package/dist/chunk-tg0w29j1.js +0 -2
- package/dist/chunk-tqhwzjj7.js +0 -2
- package/dist/chunk-vgr8kykv.js +0 -2
- package/dist/chunk-w670sde5.js +0 -2
- package/dist/chunk-x9bsft57.js +0 -2
- package/dist/chunk-y05vd24g.js +0 -2
- package/dist/chunk-yrqnsd3a.js +0 -2
- package/dist/chunk-z0hkt5sk.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{cs as c2,ms as O6,ns as F6}from"./chunk-4q17c8sg.js";import{ss as p0}from"./chunk-kqdrjd0e.js";import{xs as c5}from"./chunk-xvh1k1a4.js";import{Rs as i2}from"./chunk-9tmcj4y7.js";import{Ss as L6,Us as w6,Vs as R6,Xs as _5}from"./chunk-cnkex10g.js";import{Ys as n2,at as t5,ct as Z8}from"./chunk-n98zvmdq.js";import{nt as s2}from"./chunk-fk1qyjdw.js";import{ot as j8,pt as W8,qt as c1,rt as _8,st as f4,tt as X2,ut as L9,vt as S2}from"./chunk-n09vpazf.js";import{Et as a3,Ht as l9,Ot as l3,du as p2,fu as JG,gu as p$,iu as W5}from"./chunk-0kj7rses.js";import{nu as D6}from"./chunk-k0cqdptr.js";import{su as u}from"./chunk-z3cgw8j4.js";import b1 from"path";import k5 from"fs";var C4=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"]),P4={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"},R8=new Set(["ctrl","alt","shift","meta"]),x4={left:0,middle:1,right:2};function v4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(R8.has(J))Z.systemKeys.push(J);else if(J in x4)Z.mouse=J;else if(J in P4||/^[a-z]$/.test(J))Z.keys.push(P4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function g4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,z=`__stx_evt_${X++}`,K=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,O]=B,V=_.split("."),F=V[0];if(!C4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:v4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,O]=B,V=_.split("."),F=V[0];if(!C4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:v4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function D8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=x4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function N8($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function y$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function A8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=D8($),Y=N8(y$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${X}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -53,7 +53,7 @@ else {
|
|
|
53
53
|
__stx_runHandler('${q}', $event, $el);
|
|
54
54
|
}
|
|
55
55
|
}${G});
|
|
56
|
-
})();`}function
|
|
56
|
+
})();`}function S$($){if($.length===0)return"";return`
|
|
57
57
|
<script data-stx-events>
|
|
58
58
|
(function() {
|
|
59
59
|
'use strict';
|
|
@@ -108,13 +108,13 @@ else {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Event listeners
|
|
111
|
-
${$.map(
|
|
111
|
+
${$.map(A8).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function
|
|
115
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
114
|
+
</script>`}function M8($){let Z=g4($);if(Z.length===0)return{template:$,bindings:[]};let X=$,J=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let q=G.match(/id=["']([^"']+)["']/);if(q)for(let U of Q.events)U.elementId=q[1]}for(let q of Q.events){let U=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function h4($,Z,X){if(f4($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:U}=M8($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...U],q}let J=g4($);if(J.length===0)return $;let Y=$;for(let q=J.length-1;q>=0;q--){let U=J[q],W=U.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let K of U.events)K.elementId=z[1]}for(let z of U.events){let K=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(B,"")}Y=Y.slice(0,U.startIndex)+W+Y.slice(U.endIndex)}let Q=S$(J.flatMap((q)=>q.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
115
|
+
`+Y.slice(G);else Y+=Q;return Y}function Dq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function o0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
116
116
|
`});let X=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(X,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
117
|
-
`}),$}function
|
|
117
|
+
`}),$}function Aq($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import mG from"fs";import h from"path";import{createHash as T8}from"crypto";var S5="__stx_component_client_factories";function u4($){let Z=$[S5];return Z instanceof Map?Z:null}function d4($){$[S5]=new Map}function m4($,Z){let X=u4($);if(!X)return null;let J=T8("sha256").update(Z).digest("hex").slice(0,16),Y=X.get(J);if(Y)Y.instances++;else X.set(J,{body:Z,instances:1});return J}function l4($,Z){let X=u4(Z);if(!X?.size)return $;let J=$;for(let[U,W]of X){if(W.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(U)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(z,(K,H)=>`(${W.body})(${H});`)}let Y=[...X].filter(([,U])=>U.instances>1);if(Y.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
118
118
|
(function() {
|
|
119
119
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
120
120
|
${Y.map(([U,W])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.stringify(U)}] || ${W.body}; }
|
|
@@ -123,7 +123,7 @@ ${Y.map(([U,W])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.str
|
|
|
123
123
|
})();
|
|
124
124
|
</script>`,q=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(q<0)return`${G}
|
|
125
125
|
${J}`;return`${J.slice(0,q)}${G}
|
|
126
|
-
${J.slice(q)}`}var
|
|
126
|
+
${J.slice(q)}`}var I8={maxSanitizeDepth:10,allowBracketNotation:!1},p4={...I8};var i4=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],k8=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),n4=new Set(["__proto__","constructor","prototype"]),E8=/[\w)\]]\s*\[\s*['"]/;function b8($){let Z="",X=null,J=!1;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(J){J=!1;continue}if(Q==="\\"&&X){J=!0;continue}if(X){if(X==="`"&&Q==="$"&&Y+1<$.length&&$[Y+1]==="{"){let G=1;Y+=2;while(Y<$.length&&G>0){if($[Y]==="{")G++;else if($[Y]==="}")G--;if(G>0)Z+=$[Y],Y++}continue}if(Q===X)X=null;continue}if(Q==='"'||Q==="'"||Q==="`"){X=Q;continue}Z+=Q}return Z}function y8($,Z){let X=/[$A-Z_a-z][$\w]*/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=$[J.index-1];if(k8.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${Z}`);if(Q==="."&&n4.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${Z}`)}}function S8($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,X;while((X=Z.exec($))!==null){let J=X[2];if(!n4.has(J))continue;let Y=$.slice(0,X.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(X.index+X[0].length).match(/^\s*(\S)/)?.[1];if(!((Y==="{"||Y===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${X[2]}): ${$}`)}}function C5($){let Z=$.trim(),X=b8(Z);y8(X,Z),S8(Z);for(let J of i4)if(J.test(X))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!p4.allowBracketNotation&&E8.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function C8($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[X,J]of Object.entries($)){if(X.startsWith("__")||i4.some((Y)=>Y.test(X)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[X]=C$(J);else Z[X]=J}return Z}function C$($,Z=0){if(Z>=p4.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>C$(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let X={};for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Y&&typeof Y==="object")X[J]=C$(Y,Z+1);else X[J]=Y}return X}function e($,Z){try{let X=C8(Z),J=Object.keys(X),Y=Object.values(X);return Q0($,J)(...Y)}catch{return}}function Y0($){try{return C5($),!0}catch{return!1}}function B0($,Z){try{let X=e($,Z);if(X&&typeof X==="object"&&!Array.isArray(X))return X;return{}}catch{return{}}}var s4=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]);function P5($){return $.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}function Q0($,Z){let X=C5($),J=/^[A-Za-z_$][\w$]*$/,Y=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!J.test(z))continue;if(s4.has(z))continue;Y.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
|
|
127
127
|
'use strict';
|
|
128
128
|
try {
|
|
129
129
|
return ${X};
|
|
@@ -134,7 +134,7 @@ catch (e) {
|
|
|
134
134
|
}
|
|
135
135
|
throw e;
|
|
136
136
|
}
|
|
137
|
-
`),q=G([]);if(Q.length===Z.length)return u4(q,Q,G);return u4((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return q(...K)},Q,G,(W)=>{q=G(W)})}function u4($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],U=new Set(Z);return(...W)=>{for(let K=0;K<=8;K++)try{return G(...W)}catch(z){let H=z instanceof Error?z.message:"",B=Q.exec(H);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(U.has(j)||c4.has(j))return;U.add(j),q.push(j),G=X(q),J?.(q)}return}}function P5($){let Z=$.trim(),X=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of X)if(J.test(Z))return!1;return!0}var p4=0,v5=new Map;function Vq(){p4=0,v5.clear()}function f5($,Z){let X=p4++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return v5.set(J,{type:$,expression:Z}),J}function Fq(){let $={};for(let[Z,X]of v5)$[Z]={type:X.type,expression:X.expression};return $}function Lq($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=v5.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function wq($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function Rq($){return $.includes("<!--__STX_")}var i4=/<script\b[^>]*>/iy,n4=/<\/script\s*>/ig,s4=/<style\b[^>]*>/iy,o4=/<\/style\s*>/ig;function r4($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function Y1($,Z){return r4($,Z,i4,n4)}function S1($,Z){return r4($,Z,s4,o4)}function Q5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function k8($,Z){if($.startsWith("<!--",Z)){let X=Q5($,Z);return X===-1?$.length:X}for(let[X,J]of[[i4,n4],[s4,o4]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function x5($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let q=$[J];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;J++;continue}if(q!=="<"){J++;continue}let U=Z($,J);if(U>J){X.push({start:J,end:U,token:$.slice(J,U)}),J=U;continue}let W=k8($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function c0($,Z,X){let J=x5($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((q)=>q.token),Q="",G=0;for(let q=0;q<J.length;q++){let U=J[q];Q+=$.slice(G,U.start),Q+=X(U.token,q),G=U.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function p0($){let{output:Z,tokens:X}=c0($,Y1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function C1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var G5={},a4=new Map;function E8($){let Z=a4.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),a4.set($,Z)}return Z.lastIndex=0,Z}var g5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return e4(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let U of Q){if(G===void 0||G===null)break;G=G[U]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([U,W])=>{q=q.replace(E8(U),String(W))}),q},t:($,Z,X={})=>{return g5.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let X=String($);return X.charAt(X.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function b8($,Z){if($ in g5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G5[$]=Z}function Eq($){for(let[Z,X]of Object.entries($))b8(Z,X)}function y8(){return{...g5,...G5}}function bq(){for(let $ of Object.keys(G5))delete G5[$]}function S$($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function e4($){return S$($).replace(/\{{2,}/g,(Z)=>S8(Z.length)).replace(/\{(?=!)/g,`{${$7}`)}var $7="⁠";function S8($){return Array.from({length:$},()=>"{").join($7)}function Q1($){let{scripts:Z}=p0($);for(let X of Z){let J=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function t4($,Z){let X=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let W=0;W<J.length;W++){let K=J[W];if(!Q&&K==="`"){Q=!0,G=0;continue}if(Q){if(K==="`"&&G===0){Q=!1;continue}if(K==="$"&&J[W+1]==="{"){G++,W++,Y+=" ";continue}if(K==="}"&&G>0){G--;continue}if(G>0){Y+=K;continue}continue}Y+=K}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,U;while((U=q.exec(J))!==null){let W=U[1];if(!J.substring(0,U.index).trimEnd().endsWith(".")){if(!X.includes(W)&&!(W in Z))return!1}}return!0}function C8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=i0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function C$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=y0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function P8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=y0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return J}}),X}function yq($,Z,X={}){let{output:J,scripts:Y}=p0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),U=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!q||!U||W===-1)return G;let K=q[1],z=q[2];if(/\bdata-raw\b/.test(K))return G;if(X.skipServer&&/\bserver\b/.test(K))return G;let B=`<script${P8(K,Z)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+G.slice(W);return B+C$(z,Z)+G.slice(W)});return C1(J,Q)}function _1($,Z,X){let J=$,Y=(z,H)=>{let B=S1(z,H);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(H,B))?-1:B},Q=(z,H,B,j)=>{let _=B.length,{output:V,tokens:O}=c0(z,H,(F,L)=>j(_+L));return B.push(...O),V},G=[];J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let U=Z?.__stx_signals_gate===!0||Q1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),K=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,H,B)=>{try{let j=y0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,H,B)=>{try{let j=y0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return f5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return f5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,z)}}),J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,H,B)=>{let j=H.trim();if(K.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=j.match(V)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&W.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),N=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=y0(H,Z);if(w)return z;if(U&&!t4(j,Z))return z;if(Z.__stx_buildMode==="compile"&&!U&&(T===void 0||C8(j,Z)))return f5("expr",j);return T!==void 0&&T!==null?e4(String(T)):""}catch(T){if(w)return z;if(U&&!t4(j,Z))return z;if(N)return z;let A=T instanceof Error?T.message:String(T);return W0("Expression",`Error evaluating: {{ ${j} }}: ${A}`,X,$,B,z)}});for(let z=0;z<q.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function v8($,Z,X){if(!Z.trim())return $;let J=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let q=G5[G]||g5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(y8()).join(", ")}`);let U=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);U=[Number.isNaN(z)?K:z]}catch{U=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))U=[y0(`(${z})`,X,!0)];else{let H=[],B="",j=null,_=0,V=0,O=0,F=!1;for(let L=0;L<z.length;L++){let w=z[L];if(F){B+=w,F=!1;continue}if(w==="\\"){B+=w,F=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")V++;else if(w==="]")V--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&_===0&&V===0&&O===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);U=H.map((L)=>{let w=L.trim();return y0(w,X,!0)})}}catch{U=[z]}Y=Y.substring(K).trim()}}try{J=q(J,X,...U)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function f8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let U=$[q],W=$[q+1];if(Z&&G){G=!1;continue}if(Z&&U==="\\"){G=!0;continue}if(G=!1,(U==='"'||U==="'"||U==="`")&&!G){if(!Z)Z=!0,X=U;else if(U===X)Z=!1,X="";continue}if(Z&&X==="`"&&U==="$"&&W==="{"){let K=1;q+=2;while(q<$.length&&K>0){if($[q]==="{")K++;else if($[q]==="}")K--;if(K>0)q++}continue}if(Z)continue;if(U==="(")J++;else if(U===")")J--;else if(U==="[")Y++;else if(U==="]")Y--;else if(U==="{")Q++;else if(U==="}")Q--;if(U==="|"&&J===0&&Y===0&&Q===0){if(W==="|"){q++;continue}if(W==="="){q++;continue}return q}}return-1}function y0($,Z,X=!1){try{let J=$.trim(),Y=f8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=y0(Q,Z,!0);return v8(q,G,Z)}if(!Q0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return X0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(J,Q)(...G)}catch{return X0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=x8(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function x8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=g8($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function g8($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let U=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+U)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function Sq($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}class O1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X!==void 0)this.cache.delete(X)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var P1=new Map,h8=500;function v1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let X=`${$}:${Z||""}`;if(!P1.has(X)){if(P1.size>=h8){let J=P1.keys().next().value;if(J)P1.delete(J)}P1.set(X,new RegExp($,Z))}return P1.get(X)}class Z7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),X=Z.sort().join(","),J=this.pool.find((q)=>q.context.join(",")===X);if(J)return J.func;let Y=this.fnCache,Q=this.fnCacheMaxSize,G=(...q)=>{return(U)=>{try{let W=`${X}:${U}`,K=Y.get(W);if(!K){if(Y.size>=Q){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...Z,`
|
|
137
|
+
`),q=G([]);if(Q.length===Z.length)return c4(q,Q,G);return c4((...W)=>{let z=Array(Y.length);for(let K=0;K<Y.length;K++)z[K]=W[Y[K]];return q(...z)},Q,G,(W)=>{q=G(W)})}function c4($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],U=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(K){let H=K instanceof Error?K.message:"",B=Q.exec(H);if(!(K instanceof ReferenceError)||!B)return;let j=B[1];if(U.has(j)||s4.has(j))return;U.add(j),q.push(j),G=X(q),J?.(q)}return}}function v5($){let Z=$.trim(),X=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of X)if(J.test(Z))return!1;return!0}var o4=0,f5=new Map;function Eq(){o4=0,f5.clear()}function x5($,Z){let X=o4++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return f5.set(J,{type:$,expression:Z}),J}function bq(){let $={};for(let[Z,X]of f5)$[Z]={type:X.type,expression:X.expression};return $}function yq($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=f5.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function Sq($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function Cq($){return $.includes("<!--__STX_")}var r4=/<script\b[^>]*>/iy,a4=/<\/script\s*>/ig,t4=/<style\b[^>]*>/iy,e4=/<\/style\s*>/ig;function $7($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function X1($,Z){return $7($,Z,r4,a4)}function C1($,Z){return $7($,Z,t4,e4)}function Q5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function P8($,Z){if($.startsWith("<!--",Z)){let X=Q5($,Z);return X===-1?$.length:X}for(let[X,J]of[[r4,a4],[t4,e4]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function g5($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let q=$[J];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;J++;continue}if(q!=="<"){J++;continue}let U=Z($,J);if(U>J){X.push({start:J,end:U,token:$.slice(J,U)}),J=U;continue}let W=P8($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function l0($,Z,X){let J=g5($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((q)=>q.token),Q="",G=0;for(let q=0;q<J.length;q++){let U=J[q];Q+=$.slice(G,U.start),Q+=X(U.token,q),G=U.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function c0($){let{output:Z,tokens:X}=l0($,X1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function P1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var G5={},Z7=new Map;function v8($){let Z=Z7.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),Z7.set($,Z)}return Z.lastIndex=0,Z}var h5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return J7(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let U of Q){if(G===void 0||G===null)break;G=G[U]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([U,W])=>{q=q.replace(v8(U),String(W))}),q},t:($,Z,X={})=>{return h5.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let X=String($);return X.charAt(X.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function f8($,Z){if($ in h5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G5[$]=Z}function dq($){for(let[Z,X]of Object.entries($))f8(Z,X)}function x8(){return{...h5,...G5}}function mq(){for(let $ of Object.keys(G5))delete G5[$]}function P$($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function J7($){return P$($).replace(/\{{2,}/g,(Z)=>g8(Z.length)).replace(/\{(?=!)/g,`{${Y7}`)}var Y7="⁠";function g8($){return Array.from({length:$},()=>"{").join(Y7)}function J1($){let{scripts:Z}=c0($);for(let X of Z){let J=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function X7($,Z){let X=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let W=0;W<J.length;W++){let z=J[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&J[W+1]==="{"){G++,W++,Y+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){Y+=z;continue}continue}Y+=z}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,U;while((U=q.exec(J))!==null){let W=U[1];if(!J.substring(0,U.index).trimEnd().endsWith(".")){if(!X.includes(W)&&!(W in Z))return!1}}return!0}function h8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=p0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function v$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=b0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=b0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function u8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=b0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=b0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return J}}),X}function lq($,Z,X={}){let{output:J,scripts:Y}=c0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),U=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!q||!U||W===-1)return G;let z=q[1],K=q[2];if(/\bdata-raw\b/.test(z))return G;if(X.skipServer&&/\bserver\b/.test(z))return G;let B=`<script${u8(z,Z)}>`;if(/\bsrc\s*=/.test(z)||/\btype\s*=\s*["']application\/json["']/.test(z))return B+K+G.slice(W);return B+v$(K,Z)+G.slice(W)});return P1(J,Q)}function _1($,Z,X){let J=$,Y=(K,H)=>{let B=C1(K,H);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(H,B))?-1:B},Q=(K,H,B,j)=>{let _=B.length,{output:O,tokens:V}=l0(K,H,(F,L)=>j(_+L));return B.push(...V),O},G=[];J=Q(J,Y,G,(K)=>`<!--__STX_STYLE_${K}__-->`);let q=[];J=Q(J,X1,q,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let U=Z?.__stx_signals_gate===!0||J1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,H,B)=>{try{let j=b0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return U0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,K)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(K,H,B)=>{try{let j=b0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return x5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return x5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return U0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,K)}}),J=Q(J,X1,q,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),J=Q(J,Y,G,(K)=>`<!--__STX_STYLE_${K}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(K,H,B)=>{let j=H.trim();if(z.has(j))return K;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=j.match(O)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&W.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),N=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=b0(H,Z);if(w)return K;if(U&&!X7(j,Z))return K;if(Z.__stx_buildMode==="compile"&&!U&&(T===void 0||h8(j,Z)))return x5("expr",j);return T!==void 0&&T!==null?J7(String(T)):""}catch(T){if(w)return K;if(U&&!X7(j,Z))return K;if(N)return K;let A=T instanceof Error?T.message:String(T);return U0("Expression",`Error evaluating: {{ ${j} }}: ${A}`,X,$,B,K)}});for(let K=0;K<q.length;K++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>q[K]);for(let K=0;K<G.length;K++)J=J.replace(`<!--__STX_STYLE_${K}__-->`,()=>G[K]);return J}function d8($,Z,X){if(!Z.trim())return $;let J=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let q=G5[G]||h5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(x8()).join(", ")}`);let U=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let K=Number(z);U=[Number.isNaN(K)?z:K]}catch{U=[z]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,z=1;while(W>0&&z<Y.length){if(Y[z]==="(")W++;if(Y[z]===")")W--;z++}if(W===0){let K=Y.substring(1,z-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))U=[b0(`(${K})`,X,!0)];else{let H=[],B="",j=null,_=0,O=0,V=0,F=!1;for(let L=0;L<K.length;L++){let w=K[L];if(F){B+=w,F=!1;continue}if(w==="\\"){B+=w,F=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);U=H.map((L)=>{let w=L.trim();return b0(w,X,!0)})}}catch{U=[K]}Y=Y.substring(z).trim()}}try{J=q(J,X,...U)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function m8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let U=$[q],W=$[q+1];if(Z&&G){G=!1;continue}if(Z&&U==="\\"){G=!0;continue}if(G=!1,(U==='"'||U==="'"||U==="`")&&!G){if(!Z)Z=!0,X=U;else if(U===X)Z=!1,X="";continue}if(Z&&X==="`"&&U==="$"&&W==="{"){let z=1;q+=2;while(q<$.length&&z>0){if($[q]==="{")z++;else if($[q]==="}")z--;if(z>0)q++}continue}if(Z)continue;if(U==="(")J++;else if(U===")")J--;else if(U==="[")Y++;else if(U==="]")Y--;else if(U==="{")Q++;else if(U==="}")Q--;if(U==="|"&&J===0&&Y===0&&Q===0){if(W==="|"){q++;continue}if(W==="="){q++;continue}return q}}return-1}function b0($,Z,X=!1){try{let J=$.trim(),Y=m8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=b0(Q,Z,!0);return d8(q,G,Z)}if(!Y0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return e(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return Q0(J,Q)(...G)}catch{return e(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=l8(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function l8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=c8($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function c8($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let U=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+U)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function cq($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}class V1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X!==void 0)this.cache.delete(X)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var v1=new Map,p8=500;function f1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let X=`${$}:${Z||""}`;if(!v1.has(X)){if(v1.size>=p8){let J=v1.keys().next().value;if(J)v1.delete(J)}v1.set(X,new RegExp($,Z))}return v1.get(X)}class Q7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),X=Z.sort().join(","),J=this.pool.find((q)=>q.context.join(",")===X);if(J)return J.func;let Y=this.fnCache,Q=this.fnCacheMaxSize,G=(...q)=>{return(U)=>{try{let W=`${X}:${U}`,z=Y.get(W);if(!z){if(Y.size>=Q){let K=Y.keys().next().value;if(K)Y.delete(K)}z=Function(...Z,`
|
|
138
138
|
'use strict';
|
|
139
139
|
try {
|
|
140
140
|
return ${U};
|
|
@@ -145,7 +145,7 @@ catch (e) {
|
|
|
145
145
|
}
|
|
146
146
|
throw e;
|
|
147
147
|
}
|
|
148
|
-
`),Y.set(W,
|
|
148
|
+
`),Y.set(W,z)}return z(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}var iq=new Q7;class G7{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,X]of Object.entries($))this.setBudget(Z,X)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,X]of this.budgets.entries())$[Z]=X;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let X=performance.now(),J=Z(),Y=performance.now()-X;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,Z){if(!this.enabled)return Z();let X=performance.now(),J=await Z(),Y=performance.now()-X;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,Z){let X=this.budgets.get($);if(!X)return;let J=Z/X.maxTime*100,Y=X.warnThreshold!==void 0?Z>=X.maxTime*X.warnThreshold&&Z<X.maxTime:!1,Q=Z>=X.maxTime;if(!Y&&!Q)return;let G={label:$,actualTime:Z,budgetTime:X.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let U of this.violationHandlers)try{U(G)}catch{}let q=Y?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${X.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${X.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(X.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(Q)throw Error(q);else console.warn(q);break}}recordTime($,Z){let X=this.metrics.get($);if(X)X.count++,X.totalTime+=Z,X.maxTime=Math.max(X.maxTime,Z),X.minTime=Math.min(X.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let X=this.metrics.get($);if(!X)return{};let J=this.budgets.get($);return{count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}let Z={};for(let[X,J]of this.metrics.entries()){let Y=this.budgets.get(X);Z[X]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,X=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else X++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:X}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var f$=null;function i8(){if(!f$)f$=new G7;return f$}var q7=new Proxy({},{get($,Z){return i8()[Z]}});import YG from"fs";import w0 from"path";var x$=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],U7=/<body\b([^>]*)>/gi;function q5($){let Z=0,X,J=x$.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)U7.lastIndex=Z,X=U7.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let U=0;U<x$.length;U++){let W=x$[U],z=J[U];if(z===void 0||z!==null&&z.index<Z)W.open.lastIndex=Z,z=W.open.exec($),J[U]=z;if(!z)continue;if(z.index<Y&&(Q===-1||z.index<Q))Q=z.index,G=W.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let q=G.exec($);if(!q)return null;Z=q.index+q[0].length}return null}function u5($,Z){let X=q5($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var W7=null;function n8($){if(!W7)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return W7}function oq($){let Z=n8("onUpdate");if(Z)Z.updateHooks.push($)}function z7(){return`
|
|
149
149
|
// STX Lifecycle Runtime
|
|
150
150
|
(function() {
|
|
151
151
|
if (typeof window === 'undefined') return;
|
|
@@ -490,7 +490,7 @@ else {
|
|
|
490
490
|
|
|
491
491
|
console.log('[stx] Lifecycle runtime initialized');
|
|
492
492
|
})();
|
|
493
|
-
`}function
|
|
493
|
+
`}function g$($){return Symbol($)}var rq=g$("theme"),aq=g$("router"),tq=g$("i18n");import*as H7 from"crypto";function K7($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function s8(){return`stx-${H7.randomBytes(4).toString("hex")}`}function o8($){return/\$\w+\./.test($)}function r8($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,q,U)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],z=!1,K=q,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(H)];for(let O of B){let V=O[0],F=O[1],L=O[2];if(o8(L)){z=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:F,expr:R,fullMatch:V,originalAttr:F}),K7(R).forEach((N)=>X.add(N)),F==="text")K=K.replace(V,"");else if(F==="class")K=K.replace(V,'class=""');else if(F==="disabled"||F==="hidden")K=K.replace(V,"");else K=K.replace(V,`${F}=""`)}}}if(!z)return Q;let j=K.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=s8(),K=` id="${_}"${K}`;for(let O of W)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:K7(O.expr)});return`<${G}${K}${U}`}),{html:Y,bindings:Z,stores:X}}function a8($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
|
|
494
494
|
<script>
|
|
495
495
|
(function() {
|
|
496
496
|
'use strict';
|
|
@@ -648,10 +648,10 @@ else {
|
|
|
648
648
|
}
|
|
649
649
|
})();
|
|
650
650
|
</script>
|
|
651
|
-
`,J}function
|
|
651
|
+
`,J}function B7($){let{html:Z,bindings:X,stores:J}=r8($);if(X.length===0)return $;let Y=a8(X,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function j7($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return t8(Z);case"google-analytics":return e8(Z);case"plausible":return $Z(Z);case"self-hosted":return ZZ(Z);case"custom":return XZ(Z);default:return""}}function t8($){let Z=$.fathom;if(!Z?.siteId)return"";let X=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Y=[`data-site="${y0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${y0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
|
|
652
652
|
<!-- Fathom Analytics -->
|
|
653
|
-
<script src="${
|
|
654
|
-
`}function
|
|
653
|
+
<script src="${y0(X)}" ${Y.join(" ")}${J}></script>
|
|
654
|
+
`}function e8($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=y0(Z.measurementId),J=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
|
|
655
655
|
<!-- Google Analytics -->
|
|
656
656
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${X}"></script>
|
|
657
657
|
<script>
|
|
@@ -661,10 +661,10 @@ else {
|
|
|
661
661
|
gtag('config', '${X}');
|
|
662
662
|
${J}
|
|
663
663
|
</script>
|
|
664
|
-
`}function
|
|
664
|
+
`}function $Z($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${y0(Z.domain)}"`],Y=X,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&X==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
665
665
|
<!-- Plausible Analytics -->
|
|
666
|
-
<script defer data-domain="${
|
|
667
|
-
`}function
|
|
666
|
+
<script defer data-domain="${y0(Z.domain)}" src="${y0(Y)}"></script>
|
|
667
|
+
`}function ZZ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=y0(Z.siteId),J=y0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
668
668
|
d.addEventListener('click',function(e){
|
|
669
669
|
var a=e.target.closest('a');
|
|
670
670
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -697,15 +697,15 @@ else {
|
|
|
697
697
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
698
698
|
})();
|
|
699
699
|
</script>
|
|
700
|
-
`}function
|
|
700
|
+
`}function XZ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
701
701
|
<!-- Custom Analytics -->
|
|
702
702
|
<script>
|
|
703
703
|
${Z.inlineScript}
|
|
704
704
|
</script>
|
|
705
|
-
`;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${
|
|
705
|
+
`;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${y0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))X.push(`${y0(Y)}="${y0(Q)}"`);return`
|
|
706
706
|
<!-- Custom Analytics -->
|
|
707
|
-
<script${X.length>0?` ${X.join(" ")}`:""} src="${
|
|
708
|
-
`}function
|
|
707
|
+
<script${X.length>0?` ${X.join(" ")}`:""} src="${y0(Z.scriptUrl)}" defer></script>
|
|
708
|
+
`}function _7($,Z){let X=j7(Z);if(!X)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}return $.replace("</head>",`${X}</head>`)}function y0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var ZU={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return j7(Y)}};var JZ={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function V7($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...JZ,...Z};return`
|
|
709
709
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
710
710
|
<script>
|
|
711
711
|
(function() {
|
|
@@ -1088,7 +1088,7 @@ else {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
})();
|
|
1090
1090
|
</script>
|
|
1091
|
-
`}function
|
|
1091
|
+
`}function O7($,Z){let X=V7(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var F7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};if(Z.length>0){let Q=YZ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return V7(Y)}};function YZ($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of X){let[Y,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class L7{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let X of this.sessions.values())if(X.page===$)Z.push(...X.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((J)=>J.type==="scroll"),X=new Map;for(let J of Z)if(J.depth!==void 0)X.set(J.depth,(X.get(J.depth)||0)+1);return Array.from(X.entries()).map(([J,Y])=>({depth:J,count:Y})).sort((J,Y)=>J.depth-Y.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let J of X)if(J.zone){let Y=Z.get(J.zone)||{clicks:0,hovers:0};if(J.type==="click")Y.clicks++;else if(J.type==="move")Y.hovers++;Z.set(J.zone,Y)}return Z}generateGridData($,Z=20){let X=this.getPageData($),J=[];for(let Q=0;Q<Z;Q++){J[Q]=[];for(let G=0;G<Z;G++)J[Q][G]=0}for(let Q of X){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),q=Math.min(Math.floor(Q.y/100*Z),Z-1);J[q][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of J)for(let G of Q)Y=Math.max(Y,G);return J.map((Q,G)=>Q.map((q,U)=>({x:U,y:G,intensity:Y>0?q/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function JU(){return new L7}var QZ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(QZ||={});var GZ;((J)=>{J.In="in";J.Out="out";J.Both="both"})(GZ||={});var qZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(qZ||={});var r0={duration:300,delay:0,ease:"ease",direction:"both"};function UZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...r0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1092
1092
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1093
1093
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1094
1094
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1098,7 +1098,7 @@ else {
|
|
|
1098
1098
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1099
1099
|
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1100
1100
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1101
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
1101
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function WZ(){return`
|
|
1102
1102
|
<script data-stx-scoped data-stx-run="once">
|
|
1103
1103
|
// Motion preferences handling
|
|
1104
1104
|
(function() {
|
|
@@ -1126,7 +1126,7 @@ else {
|
|
|
1126
1126
|
});
|
|
1127
1127
|
})();
|
|
1128
1128
|
</script>
|
|
1129
|
-
`}function
|
|
1129
|
+
`}function zZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((X)=>X.test($))}function KZ($=0.1,Z="0px"){return`
|
|
1130
1130
|
<script data-stx-scoped data-stx-run="always">
|
|
1131
1131
|
// Intersection Observer for scroll animations
|
|
1132
1132
|
(function() {
|
|
@@ -1169,7 +1169,7 @@ else {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
})();
|
|
1171
1171
|
</script>
|
|
1172
|
-
`}function
|
|
1172
|
+
`}function HZ(){return`
|
|
1173
1173
|
<style id="stx-animation-base">
|
|
1174
1174
|
:root {
|
|
1175
1175
|
--stx-transition-duration: 300ms;
|
|
@@ -1284,7 +1284,7 @@ else {
|
|
|
1284
1284
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1285
1285
|
}
|
|
1286
1286
|
</style>
|
|
1287
|
-
`}function
|
|
1287
|
+
`}function BZ($,Z,X={}){let{staggerDelay:J=50,sequence:Y=!1}=X;return`
|
|
1288
1288
|
<script data-stx-scoped data-stx-run="always">
|
|
1289
1289
|
// Animation Group: ${$}
|
|
1290
1290
|
(function() {
|
|
@@ -1321,21 +1321,21 @@ else {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
})();
|
|
1323
1323
|
</script>
|
|
1324
|
-
`}var
|
|
1325
|
-
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},
|
|
1326
|
-
${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},
|
|
1327
|
-
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let U=
|
|
1328
|
-
`+Y.slice(W)}}return Y}var
|
|
1324
|
+
`}var h$={name:"transition",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||r0.duration:r0.duration,G=Z.length>2?Z[2]||r0.ease:r0.ease,q=Z.length>3?Number.parseInt(Z[3],10)||r0.delay:r0.delay,U=Z.length>4?Z[4]||r0.direction:r0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=UZ(Y,{duration:Q,delay:q,ease:G,direction:U}),K="stx-transition",H="";if(Y==="fade")H="stx-fade";else if(Y==="slide")H="stx-slide";else if(Y==="scale")H="stx-scale";else if(Y==="flip")H="stx-flip";else if(Y==="rotate")H="stx-rotate";return`<div id="${W}" class="${K} ${H} ${U==="out"?"stx-out":""}"
|
|
1325
|
+
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},u$={name:"scrollAnimate",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",q=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,U=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${U}ms; will-change: opacity, transform;`,K="stx-transition stx-observe stx-out";if(Y==="fade")K+=" stx-fade";else if(Y==="slide-up"||Y==="slide")K+=" stx-from-bottom";else if(Y==="slide-down")K+=" stx-from-top";else if(Y==="slide-left")K+=" stx-from-right";else if(Y==="slide-right")K+=" stx-from-left";else if(Y==="scale")K+=" stx-scale";else if(Y.includes("-"))K+=` stx-${Y}`;else K+=` stx-${Y}`;return`<div id="${W}" class="${K}" style="${z}" data-threshold="${q}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},d$={name:"animationGroup",handler:($,Z,X,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=X.staggerDelay||50,q=X.sequence||!0,U=BZ(Y,Q,{staggerDelay:G,sequence:q});return`${$}
|
|
1326
|
+
${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},m$={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=WZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function R7($,Z,X,J){let Y=$;if(J.animation?.enabled===!1)return Y;let Q=X.includes("test")&&X.includes("animation");if(!zZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let q=HZ();Y=Y.replace("</head>",`${q}
|
|
1327
|
+
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let U=KZ(),W=Y.lastIndexOf("</body>");if(W!==-1)Y=Y.slice(0,W)+U+`
|
|
1328
|
+
`+Y.slice(W)}}return Y}var w7={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function jZ($,Z){let X=Z.map((J)=>{let Y=J.offset!==void 0?`${J.offset*100}%`:"from",Q=Object.entries(J.properties).map(([G,q])=>`${G}: ${q}`).join("; ");return`${Y} { ${Q} }`}).join(`
|
|
1329
1329
|
`);return`@keyframes ${$} {
|
|
1330
1330
|
${X}
|
|
1331
|
-
}`}var
|
|
1331
|
+
}`}var _Z={name:"keyframe",hasEndTag:!0,handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",q=Z[3]||"1",U=Z[4]?.replace(/['"`]/g,"")||"normal",W=Z[5]?.replace(/['"`]/g,"")||"forwards",z=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,K=`
|
|
1332
1332
|
animation-name: ${Y};
|
|
1333
1333
|
animation-duration: ${Q}ms;
|
|
1334
1334
|
animation-timing-function: ${G};
|
|
1335
1335
|
animation-iteration-count: ${q};
|
|
1336
1336
|
animation-direction: ${U};
|
|
1337
1337
|
animation-fill-mode: ${W};
|
|
1338
|
-
`.trim().replace(/\s+/g," ");return`<div id="${
|
|
1338
|
+
`.trim().replace(/\s+/g," ");return`<div id="${z}" style="${K}">${$}</div>`},description:"Applies a keyframe animation to an element"};function VZ($,Z,X,J,Y){return`
|
|
1339
1339
|
<script data-stx-scoped data-stx-run="always">
|
|
1340
1340
|
(function() {
|
|
1341
1341
|
const container = document.getElementById('${$}');
|
|
@@ -1349,7 +1349,7 @@ ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1349
1349
|
child.classList.add('${Y}');
|
|
1350
1350
|
});
|
|
1351
1351
|
})();
|
|
1352
|
-
</script>`}var
|
|
1352
|
+
</script>`}var OZ={name:"stagger",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,q=Z[3]?.replace(/['"`]/g,"")||"fade",U=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,W="stx-stagger-item";if(q==="fade")W+=" stx-fade";else if(q==="slide")W+=" stx-from-bottom";else if(q==="scale")W+=" stx-scale";let z=VZ(U,Y,G,Q,W);return`${`
|
|
1353
1353
|
<style>
|
|
1354
1354
|
#${U} .stx-stagger-item {
|
|
1355
1355
|
opacity: 0;
|
|
@@ -1359,12 +1359,12 @@ ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1359
1359
|
from { opacity: 0; transform: translateY(10px); }
|
|
1360
1360
|
to { opacity: 1; transform: translateY(0); }
|
|
1361
1361
|
}
|
|
1362
|
-
</style>`}<div id="${U}" class="stx-stagger-container">${$}</div>${
|
|
1362
|
+
</style>`}<div id="${U}" class="stx-stagger-container">${$}</div>${z}`},description:"Applies staggered animations to child elements"};function FZ($){let{stiffness:Z,damping:X}=$,J=X/(2*Math.sqrt(Z));if(J<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(J<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var LZ={name:"spring",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(w7[Y])Q=w7[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,q=`stx-spring-${Math.random().toString(36).slice(2,9)}`,U=FZ(Q),W=`
|
|
1363
1363
|
transition: all ${G}ms ${U};
|
|
1364
1364
|
--stx-spring-stiffness: ${Q.stiffness};
|
|
1365
1365
|
--stx-spring-damping: ${Q.damping};
|
|
1366
1366
|
--stx-spring-mass: ${Q.mass};
|
|
1367
|
-
`.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${W}">${$}</div>`},description:"Applies spring physics animations to an element"};function
|
|
1367
|
+
`.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${W}">${$}</div>`},description:"Applies spring physics animations to an element"};function QU($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
|
|
1368
1368
|
<script data-stx-scoped data-stx-run="always">
|
|
1369
1369
|
(function() {
|
|
1370
1370
|
const timeline = ${JSON.stringify($)};
|
|
@@ -1401,7 +1401,7 @@ else {
|
|
|
1401
1401
|
runTimeline();
|
|
1402
1402
|
}
|
|
1403
1403
|
})();
|
|
1404
|
-
</script>`}function
|
|
1404
|
+
</script>`}function GU($,Z,X){let J=jZ($,Z),Y=`
|
|
1405
1405
|
.${$}-animation {
|
|
1406
1406
|
animation-name: ${$};
|
|
1407
1407
|
animation-duration: ${X.duration}ms;
|
|
@@ -1411,7 +1411,7 @@ else {
|
|
|
1411
1411
|
animation-direction: ${X.direction||"normal"};
|
|
1412
1412
|
animation-fill-mode: ${X.fill||"forwards"};
|
|
1413
1413
|
}`;return`${J}
|
|
1414
|
-
${Y}`}function
|
|
1414
|
+
${Y}`}function qU($){let Z=$.trim().split(/\s+/),X={duration:300};for(let J=0;J<Z.length;J++){let Y=Z[J];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(J===0)X.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else X.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))X.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))X.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))X.fill=Y;else X.easing=Y}return X}function UU(){return`
|
|
1415
1415
|
<script data-stx-scoped data-stx-run="once">
|
|
1416
1416
|
window.__stxAnimation = {
|
|
1417
1417
|
// Registry of animations
|
|
@@ -1483,7 +1483,7 @@ else {
|
|
|
1483
1483
|
);
|
|
1484
1484
|
}
|
|
1485
1485
|
};
|
|
1486
|
-
</script>`}function
|
|
1486
|
+
</script>`}function WU($){let Z=$.customDirectives||[];return Z.push(h$),Z.push(d$),Z.push(m$),Z.push(u$),Z.push(_Z),Z.push(OZ),Z.push(LZ),{...$,customDirectives:Z}}function D7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function N7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var wZ=100,RZ=599,c$="__stxResponseStatus",U5="__stxResponseHeaders";function d5($){return typeof $==="number"&&Number.isInteger($)&&$>=wZ&&$<=RZ}function BU($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let X=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!X)continue;let J=Number(X[1]);if(d5(J))return J}return}function l$($,Z){if(!$||typeof $!=="object")return!1;let X=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!d5(X))return!1;return $[c$]=X,!0}function DZ($,Z,X){if(!$||typeof $!=="object")return;let J=String(Z??"").trim();if(!J)return;$[U5]={...$[U5],[J]:String(X)}}function NZ($){let Z=$?.[c$];return d5(Z)?Z:void 0}function AZ($){let Z=$?.[U5];if(!Z||typeof Z!=="object")return;let X=Object.entries(Z).map(([J,Y])=>[J,String(Y)]);return X.length>0?Object.fromEntries(X):void 0}function jU($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let X=NZ($);if(X!==void 0)Z[c$]=X;let J=AZ($);if(J)Z[U5]={...Z[U5],...J}}function A7($){return{setResponseStatus:(Z)=>{l$($,Z)},notFound:(Z=404)=>{let X=d5(Z)&&Z>=400?Z:404;l$($,X)},setResponseHeader:(Z,X)=>{DZ($,Z,X)}}}function M7($,Z,X={}){if(!$.includes("@status"))return $;let{filePath:J,buildMode:Y}=X,Q=Y==="compile",G="",q=0,U=/@status\s*\(/g,W;while((W=U.exec($))!==null){let z=MZ($,W.index+W[0].length-1);if(z<0)break;let K=$.slice(W.index+W[0].length,z).trim(),H=/^\d+$/.test(K)?Number(K):e(K,Z),B=J?` in ${J}`:"";if(Q)console.warn(`[stx] @status(${K})${B} 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(${K}) from <script server> instead \u2014 that runs per request.`);else if(!l$(Z,H))console.warn(`[stx] @status(${K})${B} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(q,W.index),q=z+1+($.slice(z+1).match(/^[^\S\n]*\n?/)?.[0].length??0),U.lastIndex=q}return q===0?$:G+$.slice(q)}function MZ($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}var TZ=0,IZ=0;function T7($,Z){let X=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(X)return X[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function kZ($){let Z=[],X=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=X.exec($))!==null){let[Y,Q,G]=J,q=J.index,U=T7(G,"x-data");if(!U)continue;let W=`__stx_scope_${TZ++}`,z=T7(G,"x-init"),K=EZ($,Q,q+Y.length),H=$.slice(q,K.endIndex),B=bZ(H);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:U,initExpr:z,bindings:[],refs:B})}return Z}function EZ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),q=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,q.lastIndex=Y;let U=Q.exec($),W=G.exec($),z=q.exec($);if(z&&z.index<(U?.index??1/0)){Y=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(U&&U.index<W.index)J++,Y=U.index+U[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Y=W.index+W[0].length}}return{endIndex:$.length}}function bZ($){let Z=new Map,X=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(X))!==null){let[,Q,G]=Y,q=yZ(Q);Z.set(G,q)}return Z}function yZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${IZ++}`}function SZ(){return`
|
|
1487
1487
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1488
1488
|
(function() {
|
|
1489
1489
|
var style = document.createElement('style');
|
|
@@ -1690,7 +1690,7 @@ window.__stx_reactive = (function() {
|
|
|
1690
1690
|
|
|
1691
1691
|
return { initScope: initScope, reactive: reactive };
|
|
1692
1692
|
})();
|
|
1693
|
-
`}function
|
|
1693
|
+
`}function I7($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(q,U)=>{try{let W=b0(U,Z,!0);if(W===void 0)return q;return String(W)}catch{return q}}),J="",Y=0,Q=null;while(Y<X.length){let q=X[Y];if(Q&&q==="\\"){J+=q+(X[Y+1]??""),Y+=2;continue}if(q==="{"&&X[Y+1]==="{"){let U=X.indexOf("}}",Y+2);if(U!==-1){let W=X.slice(Y,U+2);J+=G(X.slice(Y+2,U),W,Q),Y=U+2;continue}}if(Q){if(q===Q)Q=null}else if(q==="'"||q==='"'||q==="`")Q=q;J+=q,Y++}return J;function G(q,U,W){let z;try{z=b0(q,Z,!0)}catch{return U}if(z===void 0)return U;if(W){let K=String(z).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?K.replace(/\$\{/g,"\\${"):K}if(typeof z==="string"){let K=z.trim();if(K.startsWith("{")&&K.endsWith("}")||K.startsWith("[")&&K.endsWith("]"))try{return JSON.parse(K),K}catch{}}return JSON.stringify(z)}}function CZ($,Z){if($.length===0)return"";let X=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=I7(J.stateExpr,Z),G=J.initExpr?I7(J.initExpr,Z):null,q=JSON.stringify(Q),U=G?JSON.stringify(G):"null";return`
|
|
1694
1694
|
(function() {
|
|
1695
1695
|
var scopeEl = document.querySelector('${J.selector}');
|
|
1696
1696
|
if (!scopeEl) return;
|
|
@@ -1699,13 +1699,13 @@ window.__stx_reactive = (function() {
|
|
|
1699
1699
|
})();`}).join(`
|
|
1700
1700
|
`);return`
|
|
1701
1701
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1702
|
-
${
|
|
1702
|
+
${SZ()}
|
|
1703
1703
|
${X}
|
|
1704
|
-
</script>`}function
|
|
1705
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
1706
|
-
`)){let q=G.trim();if(!q||q.startsWith("#"))continue;let U=q.indexOf(":");if(U===-1)continue;let W=q.slice(0,U).trim(),
|
|
1707
|
-
`),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),X)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,
|
|
1708
|
-
`).map((
|
|
1704
|
+
</script>`}function k7($,Z,X){if(!vZ($))return $;let J=kZ($);if(J.length===0)return $;let Y=PZ($,J),Q=CZ(J,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
1705
|
+
`+Y.slice(G);else Y+=Q;return Y}function PZ($,Z){let X=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let q=Z[X++];if(!q)return Y;let U=/data-stx-scope="([^"]*)"/.exec(G);if(U)return q.id=U[1],q.selector=`[data-stx-scope="${q.id}"]`,Y;return`<${Q} data-stx-scope="${q.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function vZ($){return/x-data\s*=\s*["']/.test($)}import nX from"fs";import V3 from"path";import{createHighlighter as sX}from"ts-syntax-highlighter";import $$ from"fs";import R0 from"path";import{loadConfigWithResult as uX}from"bunfig";W5();async function fZ($,Z,X,J){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=p$();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var E7={name:"stxRouter",handler:fZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Y1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function y7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,X=$.match(Z);if(!X)return{data:{},content:$.trim()};let J=X[1],Y=$.slice(X[0].length),Q={};for(let G of J.split(`
|
|
1706
|
+
`)){let q=G.trim();if(!q||q.startsWith("#"))continue;let U=q.indexOf(":");if(U===-1)continue;let W=q.slice(0,U).trim(),z=q.slice(U+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[W]=z}return{data:Q,content:Y.trim()}}function z5($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(z,K,H)=>{let B=Q.length,j=K?` class="language-${Y1(K)}"`:"";return Q.push(`<pre><code${j}>${Y1(H.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(z,K)=>`<code>${Y1(K)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),X)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,K,H)=>{return`<img src="${b7(H)?Y1(H):""}" alt="${Y1(K)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,K,H)=>{return`<a href="${b7(H)?Y1(H):""}">${K}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1707
|
+
`),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),X)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,K,H)=>{let j=`<tr>${K.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${Y1(O)}</th>`).join("")}</tr>`,_=H.trim().split(`
|
|
1708
|
+
`).map((O)=>{return`<tr>${O.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<td>${Y1(F)}</td>`).join("")}</tr>`}).join(`
|
|
1709
1709
|
`);return`<table>
|
|
1710
1710
|
<thead>
|
|
1711
1711
|
${j}
|
|
@@ -1714,15 +1714,15 @@ ${j}
|
|
|
1714
1714
|
${_}
|
|
1715
1715
|
</tbody>
|
|
1716
1716
|
</table>`});if(X)Y=Y.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Y=Y.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Y.split(`
|
|
1717
|
-
`),q=[],U=!1,W=[];for(let
|
|
1717
|
+
`),q=[],U=!1,W=[];for(let z of G){let K=z.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(K)||/^\0CODEBLOCK\d+\0$/.test(K)||K===""){if(U&&W.length>0)q.push(`<p>${W.join(J?`<br />
|
|
1718
1718
|
`:`
|
|
1719
|
-
`)}</p>`),W=[],U=!1;q.push(
|
|
1719
|
+
`)}</p>`),W=[],U=!1;q.push(z)}else U=!0,W.push(K)}if(U&&W.length>0)q.push(`<p>${W.join(J?`<br />
|
|
1720
1720
|
`:`
|
|
1721
1721
|
`)}</p>`);if(Y=q.join(`
|
|
1722
1722
|
`),J)Y=Y.replace(/\n/g,`<br />
|
|
1723
|
-
`);for(let
|
|
1724
|
-
`||F==="\r"||F===" "||F===void 0)
|
|
1725
|
-
`)}function
|
|
1723
|
+
`);for(let z=0;z<Q.length;z++)Y=Y.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function S7($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let q=G.index,U=G[0].match(/@markdown\(([^)]*)\)/),W=U?U[1]:"",z=q+G[0].length,K=1,H=z,B=-1;while(K>0&&H<$.length){let O=$.indexOf("@markdown",H),V=$.indexOf("@endmarkdown",H);if(V===-1)break;if(O!==-1&&O<V&&O!==q){let F=$[O+9];if(F==="("||F===`
|
|
1724
|
+
`||F==="\r"||F===" "||F===void 0)K++;H=O+9}else{if(K--,K===0){B=V;break}H=V+12}}if(B===-1)continue;let j=$.slice(z,B),_=$.slice(q,B+12);Y.push({fullMatch:_,options:W,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:U,content:W,index:z}of Y)try{let K={};if(U)U.split(",").forEach((j)=>{let _=j.trim();if(_)K[_]=!0});let H={gfm:K.gfm??!0,breaks:K.breaks??!1},B=z5(W.trim(),H);J=J.split(q).join(B)}catch(K){let H=K instanceof Error?K.message:String(K),B=U0("Markdown Directive",`Error processing markdown: ${H}`,X,$,z,q);J=J.split(q).join(B)}return J}async function C7($,Z,X,J){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),z5($.trim(),Y)}var O1=[320,480,640,768,1024,1280,1536,1920,2560],P7=[1,1.5,2,3],x1=["avif","webp","jpeg"],v7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},xZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function K5($,Z=O1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Q1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function IU($,Z=320,X=2560,J=0.08,Y={},Q){let G=gZ(Z,X,J);return K5($,G,Y,Q)}function gZ($,Z,X=0.08){let J=[],Y=$;while(Y<Z)J.push(Math.round(Y)),Y*=1+X*2;if(J[J.length-1]!==Z)J.push(Z);return J}function i$($,Z,X=P7,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function kU($,Z,X=P7,J=80,Y={},Q){let G={1:J,1.5:Math.round(J*0.9),2:Math.round(J*0.8),3:Math.round(J*0.7),4:Math.round(J*0.6),5:Math.round(J*0.5)};return X.sort((q,U)=>q-U).map((q)=>{let U=Math.round(Z*q),W=G[q]||Math.round(J*Math.max(0.5,1-q*0.1));return`${Q1($,{...Y,w:U,q:W,dpr:q,fm:Q})} ${q}x`}).join(", ")}function n$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return J.push(Z),J.join(", ")}function EU($,Z="100vw"){if(!$||$.length===0)return Z;let J=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return J.push(Z),J.join(", ")}var bU={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Q1($,Z={}){let X=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(X.length===0)return $;let J=X.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function yU($){let[Z,X]=$.split("?"),J={};if(X)new URLSearchParams(X).forEach((Q,G)=>{if(/^\d+$/.test(Q))J[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))J[G]=Number.parseFloat(Q);else if(Q==="true")J[G]=!0;else if(Q==="false")J[G]=!1;else J[G]=Q});return{src:Z,params:J}}function SU($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=x1,baseUrl:G="",params:q={}}=$,U=[];for(let W of Q){let z,K;if(Y!==void 0&&J)z=i$(Z,Y,J,q,W),K=J.map((H)=>({path:"",url:Q1(Z,{...q,w:Math.round(Y*H),fm:W}),width:Math.round(Y*H),height:0,format:W,size:0,dpr:H}));else{let H=X||O1;z=K5(Z,H,q,W),K=H.map((B)=>({path:"",url:Q1(Z,{...q,w:B,fm:W}),width:B,height:0,format:W,size:0}))}U.push({srcset:z,format:W,mimeType:v7[W],variants:K})}return U}function CU($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
|
|
1725
|
+
`)}function PU($,Z){if($.length===0)return;let X=[...$].sort((Y,Q)=>Y.width-Q.width),J=X.find((Y)=>Y.width>=Z);if(J)return J;return X[X.length-1]}function s$($){return v7[$]||"application/octet-stream"}function vU($){return xZ[$]||$}function fU($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var hZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},o$=`
|
|
1726
1726
|
.stx-img-placeholder {
|
|
1727
1727
|
position: relative;
|
|
1728
1728
|
overflow: hidden;
|
|
@@ -1751,9 +1751,9 @@ ${_}
|
|
|
1751
1751
|
filter: blur(0);
|
|
1752
1752
|
transform: scale(1);
|
|
1753
1753
|
}
|
|
1754
|
-
`.trim();async function
|
|
1755
|
-
<rect fill="rgb(${_},${
|
|
1756
|
-
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function
|
|
1754
|
+
`.trim();async function r$(){try{return await import("ts-images")}catch{return null}}async function f7($,Z={}){let X={...hZ,...Z},J=await r$();if(J)try{return await uZ($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return x7($,X)}async function uZ($,Z,X){let{generatePlaceholder:J,generateThumbHash:Y}=X,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:Z.strategy,dominantColor:q.dominantColor,css:q.css}}function x7($,Z){let X=Z.width||20,J=Z.height||X,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${J}" viewBox="0 0 ${X} ${J}"><rect fill="#e5e7eb" width="${X}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:J,aspectRatio:X/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function gU($){let Z=await r$();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await x7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function hU($){let Z=$[0]|$[1]<<8|$[2]<<16,X=(Z&63)/63,J=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,q=$[3]|$[4]<<8,U=(q>>3&63)/63,W=(q>>9&63)/63,z=q>>15!==0,K=Math.max(3,z?G?5:7:G?5:7),H=Math.max(3,z?G?5:7:G?5:7),B=32,j=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),O=Math.max(0,Math.min(255,Math.round(X*255))),V=Math.max(0,Math.min(255,Math.round((X-J)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
1755
|
+
<rect fill="rgb(${_},${O},${V})" width="32" height="32"/>
|
|
1756
|
+
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function uU($,Z=20,X=50){return f7($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function dU($){let Z=await r$();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function mU($,Z=1,X=1){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}"><rect fill="${$}" width="${Z}" height="${X}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`}function g7($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
|
|
1757
1757
|
#${$} {
|
|
1758
1758
|
--stx-img-transition-duration: ${J}ms;
|
|
1759
1759
|
--stx-img-transition-easing: ${Y};
|
|
@@ -1770,8 +1770,8 @@ ${_}
|
|
|
1770
1770
|
#${$}.stx-img-loaded img {
|
|
1771
1771
|
opacity: 1;
|
|
1772
1772
|
}
|
|
1773
|
-
`.trim()}function
|
|
1774
|
-
`):void 0,script:
|
|
1773
|
+
`.trim()}function lU($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var g1=new Map;async function h7($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(g1.has(X))return g1.get(X);let J=await f7($,Z);return g1.set(X,J),J}function cU(){g1.clear()}function pU(){return{size:g1.size,keys:Array.from(g1.keys())}}async function dZ(){try{return await import("./chunk-0m7mt6zc.js")}catch($){if(!u7)console.warn("[stx-media] Image processor not available, some features disabled:",$),u7=!0;return null}}var u7=!1,a$=80,m5="async",l5="lazy",d7=!1;async function H5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return iZ(J,X)}if(X.processedResult?.processed)return $3($,X.processedResult,Z);if(X.responsiveVariants)return c7($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:q,sizes:U,widths:W=O1,dpr:z,formats:K=x1,quality:H=a$,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:F=V?"eager":l5,decoding:L=m5,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:N,referrerpolicy:T}=$,A=$.class,M=$.style,k=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return cZ($);let b,C,g=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!V)try{b=await h7(Y,{strategy:j,..._}),C=g7(g,b,_)}catch{}let x=z!==void 0&&G!==void 0,s;if(x)s=lZ($,g,b,Z);else s=await mZ($,g,b,Z);let c;if(V){let A0=K.includes("webp")?"webp":K[0],g0=K5(Y,W,{...B,q:H},A0),a=typeof U==="object"?n$(U):U||"100vw";c=`<link rel="preload" as="image" imagesrcset="${g0}" imagesizes="${a}" />`}let _0=[];if(!d7&&j!=="none")_0.push(o$),d7=!0;if(C)_0.push(C);let N0=O?l7(g):void 0;return{html:s,preloadLink:c,css:_0.length>0?_0.join(`
|
|
1774
|
+
`):void 0,script:N0}}async function mZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,sizes:U,widths:W=O1,formats:z=x1,quality:K=a$,params:H={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":l5,decoding:O=m5,fetchpriority:V,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,N=$.style,T=$.data||{},A=typeof U==="object"?n$(U):U||"100vw",M=[];for(let y of z){let E=K5(Y,W,{...H,q:K},y),b=s$(y);if(B&&!j)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${A}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${A}" />`)}let k=t$({src:Q1(Y,{...H,q:K}),alt:Q,width:G,height:q,loading:j?void 0:_,decoding:O,fetchpriority:j?"high":V,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R,className:m7(D,X),style:e$(N,F,L,X),lazy:B&&!j,data:T}),I;if(X){let y=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
1775
1775
|
<picture>
|
|
1776
1776
|
${M.join(`
|
|
1777
1777
|
`)}
|
|
@@ -1781,9 +1781,9 @@ ${M.join(`
|
|
|
1781
1781
|
${M.join(`
|
|
1782
1782
|
`)}
|
|
1783
1783
|
<img ${k} />
|
|
1784
|
-
</picture>`;return I}function
|
|
1784
|
+
</picture>`;return I}function lZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,dpr:U=[1,2,3],quality:W=a$,params:z={},lazy:K=!0,priority:H=!1,loading:B=H?"eager":l5,decoding:j=m5,fetchpriority:_,objectFit:O,objectPosition:V,crossorigin:F,referrerpolicy:L}=$,w=$.class,R=$.style,D=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=i$(Y,N,U,{...z,q:W}),A=t$({src:Q1(Y,{...z,w:N,q:W}),alt:Q,width:G,height:q,loading:H?void 0:B,decoding:j,fetchpriority:H?"high":_,objectFit:O,objectPosition:V,crossorigin:F,referrerpolicy:L,className:m7(w,X),style:e$(R,O,V,X),lazy:K&&!H,data:D}),M=K&&!H?`data-srcset="${T}"`:`srcset="${T}"`;if(X){let k=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
|
|
1785
1785
|
<img ${A} ${M} />
|
|
1786
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${A} ${M} />`}function
|
|
1786
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${A} ${M} />`}function cZ($){let{src:Z,alt:X,width:J,height:Y,loading:Q=l5,decoding:G=m5,fetchpriority:q,objectFit:U,objectPosition:W,crossorigin:z,referrerpolicy:K,priority:H=!1}=$,B=$.class,j=$.style,_=$.id,O=$.data||{};return{html:`<img ${t$({src:Z,alt:X,width:J,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":q,objectFit:U,objectPosition:W,crossorigin:z,referrerpolicy:K,className:B,style:e$(j,U,W),id:_,data:O})} />`}}function t$($){let Z=[];if($.lazy)Z.push(`data-src="${h0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${h0($.src)}"`);if(Z.push(`alt="${h0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${h0($.className)}"`);if($.style)Z.push(`style="${h0($.style)}"`);if($.id)Z.push(`id="${h0($.id)}"`);if($.data)for(let[X,J]of Object.entries($.data))Z.push(`data-${X}="${h0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function m7($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function e$($,Z,X,J){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(X)Y.push(`object-position: ${X}`);if(J)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function h0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function l7($){return`
|
|
1787
1787
|
(function() {
|
|
1788
1788
|
const container = document.getElementById('${$}');
|
|
1789
1789
|
if (!container) return;
|
|
@@ -1820,7 +1820,7 @@ ${M.join(`
|
|
|
1820
1820
|
|
|
1821
1821
|
observer.observe(container);
|
|
1822
1822
|
})();
|
|
1823
|
-
`.trim()}function
|
|
1823
|
+
`.trim()}function pZ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],J={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(X))!==null){let[,G,q,U,W,z]=Q,K=U??W??z??!0;if(G===":"&&typeof K==="string")try{J[q]=JSON.parse(K)}catch{J[q]=K}else switch(q){case"src":J.src=String(K);break;case"alt":J.alt=String(K);break;case"width":J.width=Number(K)||K;break;case"height":J.height=Number(K)||K;break;case"sizes":J.sizes=String(K);break;case"quality":J.quality=Number(K);break;case"placeholder":J.placeholder=K;break;case"lazy":J.lazy=K===!0||K==="true";break;case"priority":J.priority=K===!0||K==="true";break;case"class":J.class=String(K);break;case"style":J.style=String(K);break;case"id":J.id=String(K);break;case"loading":J.loading=K;break;case"decoding":J.decoding=K;break;case"fetchpriority":J.fetchpriority=K;break;case"objectFit":J.objectFit=K;break;case"objectPosition":J.objectPosition=String(K);break;case"crossorigin":J.crossorigin=K;break}}if(!J.src||!J.alt)return null;return J}async function oU($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,q=[],U;while((U=X.exec($))!==null)q.push({match:U[0],index:U.index});for(let W=q.length-1;W>=0;W--){let{match:z}=q[W],K=pZ(z);if(K){let H=await H5(K,Z);if(G=G.replace(z,H.html),H.preloadLink)J.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:J,styles:Y,scripts:Q}}async function iZ($,Z){let X=await dZ();if(!X)return H5({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await X.generateResponsiveVariants($.src,$,J);if(Q)return c7($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return $3($,Q,Z)}return H5({...$,process:!1},Z)}async function $3($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:q=!1,objectFit:U,objectPosition:W,crossorigin:z,referrerpolicy:K}=$,H=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],V=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],F=V?.url||$.src,L=O.filter((C)=>C.format===(V?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let g=w.get(C);if(g&&g.length>0){let x=g.map((c)=>`${c.url} ${c.width}w`).join(", "),s=s$(C);if(G&&!q)R.push(` <source type="${s}" data-srcset="${x}" />`);else R.push(` <source type="${s}" srcset="${x}" />`)}}let N=[];if(G&&!q){if(N.push(`data-src="${h0(F)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)N.push(`data-srcset="${L}"`)}else if(N.push(`src="${h0(F)}"`),L)N.push(`srcset="${L}"`);N.push(`alt="${h0(J)}"`);let T=Y||Z.originalWidth,A=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(A)N.push(`height="${A}"`);if(!q)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(z)N.push(`crossorigin="${z}"`);if(K)N.push(`referrerpolicy="${K}"`);let M=[];if(U)M.push(`object-fit: ${U}`);if(W)M.push(`object-position: ${W}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)N.push(`style="${M.join("; ")}"`);let k=[];if(H)k.push(H);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!q)N.push("data-stx-lazy");for(let[C,g]of Object.entries(_))N.push(`data-${C}="${h0(g)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${C}">
|
|
1824
1824
|
<picture>
|
|
1825
1825
|
${R.join(`
|
|
1826
1826
|
`)}
|
|
@@ -1830,11 +1830,11 @@ ${R.join(`
|
|
|
1830
1830
|
${R.join(`
|
|
1831
1831
|
`)}
|
|
1832
1832
|
<img ${N.join(" ")} />
|
|
1833
|
-
</picture>`;let y=[];if(Z.placeholder)y.push(
|
|
1834
|
-
`):void 0,script:E}}async function
|
|
1835
|
-
`+
|
|
1836
|
-
<style>${W.css}</style>`;if(W.script)
|
|
1837
|
-
<script>${W.script}</script>`;return
|
|
1833
|
+
</picture>`;let y=[];if(Z.placeholder)y.push(o$);let E=G?l7(j):void 0,b;if(q&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:I,preloadLink:b,css:y.length>0?y.join(`
|
|
1834
|
+
`):void 0,script:E}}async function c7($,Z,X){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return $3($,J,X)}function nZ(){return c5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,X,J)=>{let{src:Y,alt:Q,options:G}=sZ($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:Y,alt:Q||"",widths:G.widths||O1,formats:G.formats||x1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},U=X.__isDev||!1,W=await H5(q,{isDev:U}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
|
|
1835
|
+
`+z;if(W.css)z+=`
|
|
1836
|
+
<style>${W.css}</style>`;if(W.script)z+=`
|
|
1837
|
+
<script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function sZ($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=oZ(J),Q=Z3(Y[0],X)||"",G=Z3(Y[1],X)||"",q={};if(Y[2]){let U=Z3(Y[2],X);if(typeof U==="object"&&U!==null)q=U;else if(typeof Y[2]==="string")try{q=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:q}}function oZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!J)J=!0,Y=U;else if(U===Y)J=!1,Y="";else X+=U;continue}if(!J){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function Z3($,Z){if(typeof $!=="string")return $;let X=$.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 J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var p7=nZ();async function n7(){try{return await import("./chunk-54cefpt2.js")}catch($){if(!i7)console.warn("[stx-media] Video processor not available, some features disabled:",$),i7=!0;return null}}var i7=!1,s7=!0,o7="metadata",rZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function p5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return ZX(J,X)}if(X.processedResult?.processed)return a7($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await XX(J,X);let{src:Q,sources:G=[],poster:q,posterPlaceholder:U,controls:W=s7,autoplay:z=!1,muted:K=!1,loop:H=!1,preload:B=o7,playsinline:j=!0,lazy:_=!0,player:O="native",type:V,width:F,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,N=Y||q,T=$.class,A=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return tZ($,Z);if(V&&V!=="video")return aZ(Q||"",V,$);let k=G.length>0?G:Q?[{src:Q,type:r7(Q)}]:[],I=[`id="${M}"`];if(W)I.push("controls");if(z)I.push("autoplay");if(K)I.push("muted");if(H)I.push("loop");if(j)I.push("playsinline");if(R)I.push("disablepictureinpicture");if(D)I.push("disableremoteplayback");if(w)I.push(`crossorigin="${w}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${j0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${j0(N)}"`);if(F)I.push(`width="${F}"`);if(L)I.push(`height="${L}"`);if(T)I.push(`class="${j0(T)}"`);if(A)I.push(`style="${j0(A)}"`);let y=k.map((C)=>{return` <source ${_?`data-src="${j0(C.src)}"`:`src="${j0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
1838
1838
|
`),E=`<video ${I.join(" ")}>
|
|
1839
1839
|
${y}
|
|
1840
1840
|
Your browser does not support the video tag.
|
|
@@ -1873,20 +1873,20 @@ ${y}
|
|
|
1873
1873
|
|
|
1874
1874
|
observer.observe(video);
|
|
1875
1875
|
})();
|
|
1876
|
-
`.trim();return{html:E,script:b}}function
|
|
1877
|
-
<iframe ${
|
|
1878
|
-
</div>`}}function
|
|
1876
|
+
`.trim();return{html:E,script:b}}function aZ($,Z,X){let{width:J=640,height:Y=360}=X,Q=X.class,G=X.style,q=X.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,U,W=null;switch(Z){case"youtube":W=eZ($),U=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=$X($),U=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",U=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",U=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:U=$}let z=[`id="${q}"`,`src="${j0(U)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${j0(Q)}"`);if(G)z.push(`style="${j0(G)}"`);if(X.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1877
|
+
<iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1878
|
+
</div>`}}function tZ($,Z={}){let{src:X,sources:J=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:q=!1,loop:U=!1,preload:W="metadata",playsinline:z=!0,lazy:K=!0,width:H,height:B}=$,j=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:X,autoplay:G,loop:U,muted:q,playsinline:z,preload:W,poster:Y,controls:Q,title:$.title},F=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),L=`
|
|
1879
1879
|
<div
|
|
1880
|
-
id="${
|
|
1881
|
-
class="ts-video-player${j?" "+
|
|
1880
|
+
id="${O}"
|
|
1881
|
+
class="ts-video-player${j?" "+j0(j):""}"
|
|
1882
1882
|
style="${F}"
|
|
1883
1883
|
data-ts-video-player
|
|
1884
|
-
data-config='${JSON.stringify(
|
|
1885
|
-
${
|
|
1884
|
+
data-config='${JSON.stringify(V)}'
|
|
1885
|
+
${K?"data-lazy":""}
|
|
1886
1886
|
>
|
|
1887
1887
|
<div class="ts-video-player__container">
|
|
1888
1888
|
${Y?`
|
|
1889
|
-
<div class="ts-video-player__placeholder" style="background-image: url('${
|
|
1889
|
+
<div class="ts-video-player__placeholder" style="background-image: url('${j0(Y)}');">
|
|
1890
1890
|
<button class="ts-video-player__play-button" aria-label="Play video">
|
|
1891
1891
|
<svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
1892
1892
|
<path d="M8 5v14l11-7z"/>
|
|
@@ -1898,7 +1898,7 @@ ${y}
|
|
|
1898
1898
|
</div>
|
|
1899
1899
|
`.trim(),w=`
|
|
1900
1900
|
(function() {
|
|
1901
|
-
var container = document.getElementById('${
|
|
1901
|
+
var container = document.getElementById('${O}');
|
|
1902
1902
|
if (!container) return;
|
|
1903
1903
|
|
|
1904
1904
|
var config = JSON.parse(container.dataset.config || '{}');
|
|
@@ -1912,7 +1912,7 @@ ${y}
|
|
|
1912
1912
|
|
|
1913
1913
|
// Load ts-video-player from CDN
|
|
1914
1914
|
var script = document.createElement('script');
|
|
1915
|
-
script.src = '${
|
|
1915
|
+
script.src = '${rZ}';
|
|
1916
1916
|
script.onload = initPlayer;
|
|
1917
1917
|
script.onerror = function() {
|
|
1918
1918
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -2042,14 +2042,14 @@ else {
|
|
|
2042
2042
|
.ts-video-player__play-button svg {
|
|
2043
2043
|
margin-left: 4px;
|
|
2044
2044
|
}
|
|
2045
|
-
`.trim();return{html:L,script:w,css:R}}function
|
|
2045
|
+
`.trim();return{html:L,script:w,css:R}}function r7($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function eZ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let J=$.match(X);if(J)return J[1]}return null}function $X($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function j0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function ZW($,Z,X){if(Z.src)return{src:String(Z.src),...Z};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=J.indexOf(",");if(Y===-1)return{src:J.replace(/^['"]|['"]$/g,"")};let Q=J.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=J.slice(Y+1).trim();try{let q=JSON.parse(G);return{src:Q,...q}}catch{return{src:Q}}}async function ZX($,Z){let X=await n7();if(!X)return p5({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return a7($,Y,Z);return p5({...$,process:!1},Z)}async function XX($,Z){let X=await n7();if(!X||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await X.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function a7($,Z,X){let{controls:J=s7,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:q=o7,playsinline:U=!0,lazy:W=!0,width:z,height:K,crossorigin:H,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,O=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=r7(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${V}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(U)D.push("playsinline");if(B)D.push("disablepictureinpicture");if(j)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(W){if(D.push(`data-preload="${q}"`),D.push('preload="none"'),R)D.push(`data-poster="${j0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${q}"`),R)D.push(`poster="${j0(R)}"`);let N=z||Z.metadata?.width,T=K||Z.metadata?.height;if(N)D.push(`width="${N}"`);if(T)D.push(`height="${T}"`);if(_)D.push(`class="${j0(_)}"`);if(O)D.push(`style="${j0(O)}"`);let M=` <source ${W?`data-src="${j0(F)}"`:`src="${j0(F)}"`} type="${L}" />`,k=`<video ${D.join(" ")}>
|
|
2046
2046
|
${M}
|
|
2047
2047
|
Your browser does not support the video tag.
|
|
2048
|
-
</video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${
|
|
2048
|
+
</video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${j0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
2049
2049
|
${k}
|
|
2050
2050
|
</div>`;let I;if(W)I=`
|
|
2051
2051
|
(function() {
|
|
2052
|
-
var video = document.getElementById('${
|
|
2052
|
+
var video = document.getElementById('${V}');
|
|
2053
2053
|
if (!video) return;
|
|
2054
2054
|
|
|
2055
2055
|
var observer = new IntersectionObserver(function(entries) {
|
|
@@ -2091,88 +2091,88 @@ ${k}
|
|
|
2091
2091
|
width: 100%;
|
|
2092
2092
|
height: auto;
|
|
2093
2093
|
}
|
|
2094
|
-
`.trim();return{html:k,script:I,css:y}}function
|
|
2095
|
-
<style>${W.css}</style>`;if(W.script)
|
|
2096
|
-
<script>${W.script}</script>`;return
|
|
2097
|
-
Help: ${J}`:X}var
|
|
2098
|
-
${$.message}`),Z&&$.line){let Q=
|
|
2094
|
+
`.trim();return{html:k,script:I,css:y}}function t7(){return c5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,X,J)=>{let{src:Y,options:Q}=JX($,Z,X);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},U={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},W=await p5(G,U),z=W.html;if(W.css)z+=`
|
|
2095
|
+
<style>${W.css}</style>`;if(W.script)z+=`
|
|
2096
|
+
<script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function JX($,Z,X){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=YX(J),Q=e7(Y[0],X)||"",G={};if(Y[1]){let q=e7(Y[1],X);if(typeof q==="object"&&q!==null)G=q;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function YX($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!J)J=!0,Y=U;else if(U===Y)J=!1,Y="";else X+=U;continue}if(!J){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function e7($,Z){if(typeof $!=="string")return $;let X=$.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 J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var X3=t7();var QX={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},i5={},$6="en";function GX($){$6=$}function qX(){return $6}function UX($){i5={...i5,...$}}function WX(){i5={}}function Z6($,Z={}){let X=i5[$]||QX[$]||{message:`Unknown error (code: ${$})`},J=X.message,Y=X.help;for(let[Q,G]of Object.entries(Z)){let q=`{{${Q}}}`;if(J=J.replace(new RegExp(q,"g"),G),Y)Y=Y.replace(new RegExp(q,"g"),G)}return{message:J,help:Y}}function zX($,Z={}){let{message:X,help:J}=Z6($,Z);return J?`${X}
|
|
2097
|
+
Help: ${J}`:X}var p={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function J3($){for(let[Z,X]of Object.entries(p))if(X===$)return Z;return}import KX from"path";function B5(){return!1}function j5(){return!B5()||process.env.STX_DEBUG==="true"}function n5(){return!1}var X6={showRelativePaths:!1,enableAutoRecovery:j5(),logRecoveryWarnings:!0},h1={...X6};function HX($){h1={...h1,...$}}function s5(){return{...h1}}function BX(){h1={...X6}}function o5($){if(!h1.showRelativePaths||!$)return $;let Z=h1.baseDir||process.cwd();try{let X=KX.relative(Z,$);return X.startsWith("..")?$:X}catch{return $}}class F1 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,X,J,Y,Q,G){super($);this.code=Z;this.filePath=X;this.line=J;this.column=Y;this.context=Q;if(this.name="StxError",this.numericCode=G||p.EVALUATION_ERROR,this.filePath)this.filePath=o5(this.filePath)}}class J6 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_SYNTAX_ERROR",Z,X,J,Y,Q||p.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class L1 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_RUNTIME_ERROR",Z,X,J,Y,Q||p.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Y6 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_SECURITY_ERROR",Z,X,J,Y,Q||p.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class Q6 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_FILE_ERROR",Z,X,J,Y,Q||p.FILE_NOT_FOUND);this.name="StxFileError"}}class r5 extends F1{isFatal=!0;constructor($,Z,X,J,Y,Q){super($,"stx_VALIDATION_ERROR",Z,X,J,Y,Q||p.DOM_API_VIOLATION);this.name="StxValidationError"}}function Y3($){let{type:Z,message:X,code:J,filePath:Y,line:Q,column:G,template:q,offset:U,snippet:W,suggestion:z,format:K="text"}=$,H=Q,B=G;if(!H&&q&&U!==void 0){let F=q6(q,U);H=F.line,B=F.column}let j=Y?o5(Y):void 0,_=J?J3(J):void 0,O={type:Z,code:J,codeName:_,message:X,filePath:j,line:H,column:B,snippet:W,suggestion:z,timestamp:new Date().toISOString()},V;switch(K){case"html":V=_X(O);break;case"json":V=JSON.stringify(O,null,2);break;case"console":V=VX(O,q,U);break;case"text":default:V=jX(O,q,U);break}return{formatted:V,data:O}}function jX($,Z,X){let J=[],Y=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Y}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
|
|
2098
|
+
${$.message}`),Z&&$.line){let Q=OX(Z,$.line,2);if(Q)J.push(`
|
|
2099
2099
|
${Q}`)}if($.snippet)J.push(`
|
|
2100
2100
|
Snippet: ${$.snippet}`);if($.suggestion)J.push(`
|
|
2101
|
-
Suggestion: ${$.suggestion}`);return J.join(" ")}function
|
|
2102
|
-
\x1B[90mat\x1B[0m ${
|
|
2101
|
+
Suggestion: ${$.suggestion}`);return J.join(" ")}function _X($){let Z=$.code?` [${$.code}]`:"",X=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${X}: ${G6($.message)}`;if($.suggestion)J+=` | Suggestion: ${G6($.suggestion)}`;return J+=" -->",J}function VX($,Z,X){let W=[],z=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let K=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(K+=`\x1B[90m:${$.line}\x1B[0m`,$.column)K+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
|
|
2102
|
+
\x1B[90mat\x1B[0m ${K}`)}if(W.push(`
|
|
2103
2103
|
|
|
2104
|
-
${$.message}`),Z&&$.line){let
|
|
2104
|
+
${$.message}`),Z&&$.line){let K=FX(Z,$.line,2);if(K)W.push(`
|
|
2105
2105
|
|
|
2106
2106
|
\x1B[90mContext:\x1B[0m
|
|
2107
|
-
${
|
|
2107
|
+
${K}`)}if($.suggestion)W.push(`
|
|
2108
2108
|
|
|
2109
2109
|
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
|
|
2110
|
-
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function
|
|
2110
|
+
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function OX($,Z,X){let J=$.split(`
|
|
2111
2111
|
`),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G=[];for(let q=Y;q<=Q;q++){let U=(q+1).toString().padStart(4),W=q===Z-1?">":" ";G.push(`${W}${U} | ${J[q]}`)}return G.join(`
|
|
2112
|
-
`)}function
|
|
2113
|
-
`),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G="\x1B[90m",q="\x1B[31m",U="\x1B[0m",W=[];for(let
|
|
2114
|
-
`)}function
|
|
2115
|
-
`);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,X){return
|
|
2116
|
-
`),Y=
|
|
2112
|
+
`)}function FX($,Z,X){let J=$.split(`
|
|
2113
|
+
`),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G="\x1B[90m",q="\x1B[31m",U="\x1B[0m",W=[];for(let z=Y;z<=Q;z++){let K=(z+1).toString().padStart(4),H=z===Z-1,B=H?"\x1B[31m>\x1B[0m":" ",j=H?`\x1B[31m${J[z]}\x1B[0m`:`\x1B[90m${J[z]}\x1B[0m`;W.push(`${B}\x1B[90m${K}\x1B[0m | ${j}`)}return W.join(`
|
|
2114
|
+
`)}function G6($){return $.replace(/--/g,"- -").replace(/>/g,">")}function q6($,Z){let J=$.substring(0,Z).split(`
|
|
2115
|
+
`);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,X){return Y3({type:$,message:Z,code:X,format:"html"}).formatted}function LX($,Z,X,J,Y){return Y3({type:$,message:Z,code:Y,filePath:X,line:J,format:"console"}).formatted}function wX($,Z,X){let J=X.template.split(`
|
|
2116
|
+
`),Y=q6(X.template,X.offset),Q=`[${$} Error at line ${Y.line} in ${X.filePath}]: ${Z}
|
|
2117
2117
|
|
|
2118
2118
|
`,G=Math.max(0,Y.line-3),q=Math.min(J.length-1,Y.line+2);Q+=`Context:
|
|
2119
|
-
`;for(let U=G;U<=q;U++){let W=U+1,
|
|
2119
|
+
`;for(let U=G;U<=q;U++){let W=U+1,z=J[U]||"",K=U===Y.line-1?">":" ";Q+=`${K} ${W.toString().padStart(3)}: ${z}
|
|
2120
2120
|
`}if(Y.line-1<J.length){let U=" ".repeat(Y.column+5);Q+=`${U}^
|
|
2121
|
-
`}return Q}function
|
|
2122
|
-
@end${q}`;J.push(`Added ${
|
|
2121
|
+
`}return Q}function RX($,Z,X){try{return $()}catch(J){if(X&&J instanceof Error)X(J);return Z}}async function u1($,Z,X){try{return await $()}catch(J){if(X&&J instanceof Error)X(J);return Z}}var Q3={isEnabled(){return s5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=s5();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let X=$,J=[],Y=(X.match(/\{\{/g)||[]).length,Q=(X.match(/\}\}/g)||[]).length;if(Y>Q){let q=Y-Q;X+="}}".repeat(q),J.push(`Added ${q} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let q of G){let U=(X.match(new RegExp(`@${q}\\b`,"g"))||[]).length,W=(X.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(U>W){let z=U-W;for(let K=0;K<z;K++)X+=`
|
|
2122
|
+
@end${q}`;J.push(`Added ${z} missing @end${q}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:X,fixes:J}},createFallbackContent($,Z){if(j5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};class G3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,X="error"){let J={timestamp:new Date,error:$,context:Z,level:X};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(X))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
|
|
2123
2123
|
`).slice(1).join(`
|
|
2124
2124
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
2125
2125
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let Y=`${this.formatEntry($)}
|
|
2126
2126
|
`;Z.appendFileSync(this.logFilePath,Y,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let X=this.maxLogFiles-1;X>=1;X--){let J=`${this.logFilePath}.${X}`,Y=`${this.logFilePath}.${X+1}`;if($.existsSync(J))if(X>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,Y)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let X of this.errors){let J=X.error.constructor.name;$[J]=($[J]||0)+1;let Y=X.level||"error";Z[Y]=(Z[Y]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let X=await import("fs"),Y=(await import("path")).dirname($);if(!X.existsSync(Y))X.mkdirSync(Y,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));X.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));X.writeFileSync($,Q.join(`
|
|
2127
2127
|
|
|
2128
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var
|
|
2129
|
-
`)}};import
|
|
2130
|
-
`,L+=`<meta name="title" content="${
|
|
2131
|
-
`;if(F.description)L+=`<meta name="description" content="${
|
|
2132
|
-
`;if(F.keywords){let w=Array.isArray(F.keywords)?F.keywords.join(", "):F.keywords;L+=`<meta name="keywords" content="${
|
|
2133
|
-
`}if(F.robots)L+=`<meta name="robots" content="${
|
|
2134
|
-
`;if(F.canonical)L+=`<link rel="canonical" href="${
|
|
2135
|
-
`;if(F.openGraph){let w=F.openGraph;if(L+=`<meta property="og:type" content="${
|
|
2136
|
-
`,w.title||F.title){let R=w.title||F.title||"";L+=`<meta property="og:title" content="${
|
|
2137
|
-
`}if(w.description||F.description){let R=w.description||F.description||"";L+=`<meta property="og:description" content="${
|
|
2138
|
-
`}if(w.url||F.canonical){let R=w.url||F.canonical||"";L+=`<meta property="og:url" content="${
|
|
2139
|
-
`}if(w.image){if(L+=`<meta property="og:image" content="${
|
|
2140
|
-
`,w.imageAlt)L+=`<meta property="og:image:alt" content="${
|
|
2141
|
-
`;if(w.imageWidth)L+=`<meta property="og:image:width" content="${
|
|
2142
|
-
`;if(w.imageHeight)L+=`<meta property="og:image:height" content="${
|
|
2143
|
-
`}if(w.siteName)L+=`<meta property="og:site_name" content="${
|
|
2144
|
-
`}if(F.twitter){let w=F.twitter;if(L+=`<meta name="twitter:card" content="${
|
|
2145
|
-
`,w.title||F.title){let R=w.title||F.title||"";L+=`<meta name="twitter:title" content="${
|
|
2146
|
-
`}if(w.description||F.description){let R=w.description||F.description||"";L+=`<meta name="twitter:description" content="${
|
|
2147
|
-
`}if(w.image||F.openGraph&&F.openGraph.image){let R=w.image||(F.openGraph?F.openGraph.image:"")||"";L+=`<meta name="twitter:image" content="${
|
|
2148
|
-
`}if(w.site)L+=`<meta name="twitter:site" content="${
|
|
2149
|
-
`;if(w.creator)L+=`<meta name="twitter:creator" content="${
|
|
2128
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var u0=new G3,q3={isDevelopment(){return j5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let X=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)X.push(`Context: ${JSON.stringify(Z,null,2)}`);return X.push("========================"),X.join(`
|
|
2129
|
+
`)}};import U3 from"path";var W3={isValidFilePath($,Z){let X=$.replace(/\\/g,"/");if(X.includes("\x00"))return!1;if(X.includes("../")||X.includes("..\\")||X===".."||X.startsWith("../")||X.endsWith("/..")||X.includes("/..\\")||X.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(X))return!1;if(X.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>X===Q.slice(0,-1)||X.startsWith(Q)))return!1}if(/^[a-z]:/i.test(X)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>X.includes(Q)))return!1}if(Z){let Y=U3.resolve(Z,$),Q=U3.resolve(Z);if(!Y.startsWith(Q+U3.sep)&&Y!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((X)=>X.test($))}};function DX($){let Z={"&":"&","<":"<",">":">",'"':""","'":"'"};return $.replace(/[&<>"']/g,(X)=>Z[X]||X)}function a5($,Z={}){let{allowHtml:X=!1,maxLength:J=1e4,allowSpecialChars:Y=!0,customSanitizer:Q}=Z,G=[],q=$,U=!1;if(Q){let z=Q(q);if(z!==q)q=z,U=!0}if(q.includes("\x00"))q=q.replace(/\0/g,""),U=!0,G.push("Null bytes removed from parameter");if(q.length>J)q=q.substring(0,J),U=!0,G.push(`Parameter truncated to ${J} characters`);if(!X&&/<[^>]+>/.test(q))q=DX(q),U=!0,G.push("HTML content was escaped");let W=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:z,replacement:K,name:H}of W)if(z.test(q))q=q.replace(z,K),U=!0,G.push(`Removed ${H} from parameter`);if(!Y){let z=q;if(q=q.split("").filter((K)=>{let H=K.charCodeAt(0);return H>=32&&H!==127}).join(""),q!==z)U=!0,G.push("Control characters removed")}return{value:q,modified:U,warnings:G}}function NX($,Z){let X=$.replace(/\0/g,"");X=X.replace(/\\/g,"/"),X=X.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(X.includes("../")||X.includes("./"))X=X.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!W3.isValidFilePath(X,Z))return null;return X}function AX($){let Z=[],X=$.trim(),J=X!==$,Y=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of Y)if(Q.test(X))Z.push(`Potentially dangerous pattern detected: ${G}`);if(X.includes("\x00"))X=X.replace(/\0/g,""),J=!0,Z.push("Null bytes removed from expression");return{value:X,modified:J,warnings:Z}}function MX($,Z={}){return $.map((X)=>a5(X,Z))}function U6($){let Z={};for(let[X,J]of Object.entries($)){if(!W3.isValidVariableName(X))continue;if(typeof J==="string"){let Y=a5(J);Z[X]=Y.value}else if(Array.isArray(J))Z[X]=J.map((Y)=>typeof Y==="string"?a5(Y).value:Y);else if(typeof J==="object"&&J!==null)Z[X]=U6(J);else Z[X]=J}return Z}function z6($,Z,X,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,U,W)=>{if(!W&&U.includes(":")){let z=U.split(":"),K=U,H=z.length>1?z[1]:"";if(H&&Z[H])W=Z[H];else if(K.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${i(K)}" content="${i(W)}">`:""}return W?`<meta name="${i(U)}" content="${i(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let q=G.index,U=q+G[0].length-1,W=1,z=U+1;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let K=Y.substring(U+1,z).trim(),H=z+1,B=(()=>{try{let j=B0(K,Z);if(!j)return"";let _="<meta";if(j.name)_+=` name="${i(String(j.name))}"`;if(j.property)_+=` property="${i(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${i(String(j.httpEquiv))}"`;if(j.content)_+=` content="${i(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return $0("MetaTag",_,p.EVALUATION_ERROR)}})();Y=Y.substring(0,q)+B+Y.substring(H),Q.lastIndex=0}return Y}function K6($,Z,X){let J=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(J))!==null){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let z=J.substring(q+1,W).trim(),K=W+1,H=(()=>{try{let B=B0(z,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return $0("StructuredData",j,p.EVALUATION_ERROR)}})();J=J.substring(0,G)+H+J.substring(K),Y.lastIndex=0}return J}function H6($,Z,X,J){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let q=Y.indexOf("{",G.index+4),U=1,W=q+1,z=null,K=!1;while(W<Y.length&&U>0){let V=Y[W];if(K){K=!1,W++;continue}if(V==="\\"&&z){K=!0,W++;continue}if(z){if(V===z)z=null;W++;continue}if(V==='"'||V==="'"||V==="`"){z=V,W++;continue}if(V==="{")U++;else if(V==="}")U--;W++}if(U!==0)break;let H=Y.substring(W).match(/^\s*\)/);if(!H)break;let B=W+H[0].length,j=Y.substring(q,W),_=Y.substring(G.index,B),O=((V)=>{try{let F=B0(V,Z);if(!F)return"";let L="";if(F.title)L+=`<title>${i(F.title)}</title>
|
|
2130
|
+
`,L+=`<meta name="title" content="${i(F.title)}">
|
|
2131
|
+
`;if(F.description)L+=`<meta name="description" content="${i(F.description)}">
|
|
2132
|
+
`;if(F.keywords){let w=Array.isArray(F.keywords)?F.keywords.join(", "):F.keywords;L+=`<meta name="keywords" content="${i(w)}">
|
|
2133
|
+
`}if(F.robots)L+=`<meta name="robots" content="${i(F.robots)}">
|
|
2134
|
+
`;if(F.canonical)L+=`<link rel="canonical" href="${i(F.canonical)}">
|
|
2135
|
+
`;if(F.openGraph){let w=F.openGraph;if(L+=`<meta property="og:type" content="${i(w.type||"website")}">
|
|
2136
|
+
`,w.title||F.title){let R=w.title||F.title||"";L+=`<meta property="og:title" content="${i(R)}">
|
|
2137
|
+
`}if(w.description||F.description){let R=w.description||F.description||"";L+=`<meta property="og:description" content="${i(R)}">
|
|
2138
|
+
`}if(w.url||F.canonical){let R=w.url||F.canonical||"";L+=`<meta property="og:url" content="${i(R)}">
|
|
2139
|
+
`}if(w.image){if(L+=`<meta property="og:image" content="${i(w.image)}">
|
|
2140
|
+
`,w.imageAlt)L+=`<meta property="og:image:alt" content="${i(w.imageAlt)}">
|
|
2141
|
+
`;if(w.imageWidth)L+=`<meta property="og:image:width" content="${i(String(w.imageWidth))}">
|
|
2142
|
+
`;if(w.imageHeight)L+=`<meta property="og:image:height" content="${i(String(w.imageHeight))}">
|
|
2143
|
+
`}if(w.siteName)L+=`<meta property="og:site_name" content="${i(w.siteName)}">
|
|
2144
|
+
`}if(F.twitter){let w=F.twitter;if(L+=`<meta name="twitter:card" content="${i(w.card||"summary_large_image")}">
|
|
2145
|
+
`,w.title||F.title){let R=w.title||F.title||"";L+=`<meta name="twitter:title" content="${i(R)}">
|
|
2146
|
+
`}if(w.description||F.description){let R=w.description||F.description||"";L+=`<meta name="twitter:description" content="${i(R)}">
|
|
2147
|
+
`}if(w.image||F.openGraph&&F.openGraph.image){let R=w.image||(F.openGraph?F.openGraph.image:"")||"";L+=`<meta name="twitter:image" content="${i(R)}">
|
|
2148
|
+
`}if(w.site)L+=`<meta name="twitter:site" content="${i(w.site)}">
|
|
2149
|
+
`;if(w.creator)L+=`<meta name="twitter:creator" content="${i(w.creator)}">
|
|
2150
2150
|
`}if(F.structuredData){let w=JSON.stringify(F.structuredData).replace(/<\//g,"<\\/");L+=`<script type="application/ld+json">${w}</script>
|
|
2151
|
-
`}return L.trim()}catch(F){let L=F instanceof Error?F.message:String(F);return $0("SEO",`Error processing @seo directive: ${L}`,
|
|
2151
|
+
`}return L.trim()}catch(F){let L=F instanceof Error?F.message:String(F);return $0("SEO",`Error processing @seo directive: ${L}`,p.EVALUATION_ERROR)}})(j);Y=Y.substring(0,G.index)+O+Y.substring(B),Q.lastIndex=G.index+O.length}return Y}function B6($,Z,X){if(X.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||X.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((K)=>K.property==="og:title"||K.name==="og:title"||K.name==="twitter:title"||K.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(X.seo?.defaultConfig?.title)G=X.seo.defaultConfig.title;else G=X.defaultTitle||"stx Project";let q="";if(Z.description)q=Z.description;else if(Z.meta&&Z.meta.description)q=Z.meta.description;else if(X.seo?.defaultConfig?.description)q=X.seo.defaultConfig.description;else q=X.defaultDescription||"A website built with stx templating engine";let U="";if(Z.image)U=Z.image;else if(Z.meta&&Z.meta.image)U=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)U=Z.openGraph.image;else if(X.seo?.defaultImage)U=X.seo.defaultImage;else if(X.defaultImage)U=X.defaultImage;let W=`
|
|
2152
2152
|
<!-- stx SEO Tags -->
|
|
2153
|
-
<meta name="title" content="${
|
|
2154
|
-
<meta name="description" content="${
|
|
2155
|
-
<meta property="og:title" content="${
|
|
2156
|
-
<meta property="og:description" content="${
|
|
2153
|
+
<meta name="title" content="${i(G)}">
|
|
2154
|
+
<meta name="description" content="${i(q)}">
|
|
2155
|
+
<meta property="og:title" content="${i(G)}">
|
|
2156
|
+
<meta property="og:description" content="${i(q)}">
|
|
2157
2157
|
<meta property="og:type" content="website">
|
|
2158
2158
|
<meta name="twitter:card" content="summary_large_image">
|
|
2159
|
-
<meta name="twitter:title" content="${
|
|
2160
|
-
<meta name="twitter:description" content="${
|
|
2159
|
+
<meta name="twitter:title" content="${i(G)}">
|
|
2160
|
+
<meta name="twitter:description" content="${i(q)}">
|
|
2161
2161
|
`;if(U)W+=`
|
|
2162
|
-
<meta property="og:image" content="${
|
|
2163
|
-
<meta name="twitter:image" content="${
|
|
2164
|
-
`;let
|
|
2165
|
-
<title>${
|
|
2162
|
+
<meta property="og:image" content="${i(U)}">
|
|
2163
|
+
<meta name="twitter:image" content="${i(U)}">
|
|
2164
|
+
`;let z=$;if(!Q)z=z.replace(/<head[^>]*>/,`$&
|
|
2165
|
+
<title>${i(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
|
|
2166
2166
|
${W}
|
|
2167
|
-
`)}function
|
|
2167
|
+
`)}function i($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var TX=["og:","article:","book:","profile:","fb:","music:","video:"];function W6($){let Z=$.trim(),X=Z[0];if((X==="'"||X==='"'||X==="`")&&Z.length>1&&Z.at(-1)===X)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var z3={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",p.INVALID_DIRECTIVE_SYNTAX);let Y=W6(Z[0]).value,Q;if(Z.length>1){let U=W6(Z[1]);Q=U.quoted?U.value:String(X?.[U.value]??U.value)}else{let U=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,W=X?.openGraph;Q=String(X?.[U]??W?.[U]??"")}if(!Q)return"";let q=TX.some((U)=>Y.startsWith(U))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=t5(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},K3={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",p.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return $0("StructuredData","structuredData requires @type property",p.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let Q=Y instanceof Error?Y.message:String(Y);return $0("StructuredData",Q,p.EVALUATION_ERROR)}},hasEndTag:!0};function SW(){return[z3,K3]}function CW($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2168
2168
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
2169
2169
|
${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${X}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
|
|
2170
|
-
<loc>${
|
|
2170
|
+
<loc>${kX(G)}</loc>
|
|
2171
2171
|
<lastmod>${J}</lastmod>
|
|
2172
2172
|
</sitemap>`}).join(`
|
|
2173
2173
|
`)}
|
|
2174
|
-
</sitemapindex>`}async function
|
|
2175
|
-
`).trim()}function
|
|
2174
|
+
</sitemapindex>`}async function PW($,Z){let{extensions:X=[".stx",".html",".htm"],ignore:J=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let q of G.scan($)){if(J.some((H)=>{if(H.startsWith("*"))return q.includes(H.slice(1));return q.startsWith(H)||q.includes(`/${H}`)}))continue;let W=q.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!W.startsWith("/"))W=`/${W}`;if(W!=="/"&&W.endsWith("/"))W=W.slice(0,-1);let z=`${$}/${q}`,K;try{let H=await Bun.file(z).stat();if(H)K=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:W||"/",lastmod:K,priority:W==="/"?1:0.5})}return Y.sort((q,U)=>q.loc.localeCompare(U.loc)),Y}function IX($){let Z=[];for(let X of $.rules){if(Z.push(`User-agent: ${X.userAgent}`),X.allow)for(let J of X.allow)Z.push(`Allow: ${J}`);if(X.disallow)for(let J of X.disallow)Z.push(`Disallow: ${J}`);if(X.crawlDelay!==void 0)Z.push(`Crawl-delay: ${X.crawlDelay}`);Z.push("")}if($.sitemap){let X=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of X)Z.push(`Sitemap: ${J}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
|
|
2175
|
+
`).trim()}function vW($){return IX({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function kX($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}import EX from"fs";import v0 from"path";async function dW($,Z){if(!$.webComponents?.enabled)return[];let X=$.webComponents.components||[],J=[];if(X.length>0){if($.debug)console.log(`Building ${X.length} web components...`);for(let Y of X)try{let Q=await bX(Y,$,Z);if(Q)J.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return J}async function bX($,Z,X){let{name:J,file:Y,tag:Q,extends:G}=$;if(!J||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let q=null;if(v0.isAbsolute(Y)&&await o(Y))q=Y;else if(Z.componentsDir){let _=v0.join(Z.componentsDir,Y);if(await o(_))q=_}if(!q)q=await e5(Y,process.cwd(),Z,X);if(!q)return console.error(`Web component source file not found: ${Y}`),null;let U=await Bun.file(q).text();X.add(q);let z=($.outputFormat||"js")==="ts",K=z?SX({name:J,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):yX({name:J,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await EX.promises.mkdir(H,{recursive:!0});let B=z?"ts":"js",j=v0.join(H,`${Q}.${B}`);if(await Bun.write(j,K),Z.debug)console.log(`Built web component ${J} -> ${j}`);return j}function yX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:U=[]}=$,W=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let z="";if(q)z=`<link rel="stylesheet" href="${q}">`;return`/**
|
|
2176
2176
|
* ${Z} Web Component
|
|
2177
2177
|
* Auto-generated from stx component
|
|
2178
2178
|
*/
|
|
@@ -2187,13 +2187,13 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
|
|
|
2187
2187
|
${G?`
|
|
2188
2188
|
_createTemplate() {
|
|
2189
2189
|
const template = document.createElement('template')
|
|
2190
|
-
template.innerHTML = \`${
|
|
2190
|
+
template.innerHTML = \`${z}${W}\`
|
|
2191
2191
|
${Q?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
|
|
2192
2192
|
this._processSlots()
|
|
2193
2193
|
}
|
|
2194
2194
|
`:`
|
|
2195
2195
|
_render() {
|
|
2196
|
-
${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${
|
|
2196
|
+
${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${z}${W}\`
|
|
2197
2197
|
this._processSlots()
|
|
2198
2198
|
}
|
|
2199
2199
|
`}
|
|
@@ -2239,7 +2239,7 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
|
|
|
2239
2239
|
|
|
2240
2240
|
${U.length>0?`
|
|
2241
2241
|
static get observedAttributes() {
|
|
2242
|
-
return [${U.map((
|
|
2242
|
+
return [${U.map((K)=>`'${K}'`).join(", ")}]
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
2245
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -2264,8 +2264,8 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
|
|
|
2264
2264
|
|
|
2265
2265
|
// Register the web component
|
|
2266
2266
|
customElements.define('${X}', ${Z.replace(/\W/g,"")})
|
|
2267
|
-
`}function
|
|
2268
|
-
`),
|
|
2267
|
+
`}function SX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:U=[],attributeTypes:W={}}=$,z=Z.replace(/\W/g,""),K=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");K=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=q?`<link rel="stylesheet" href="${q}">`:"",B=(R)=>{switch(W[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},j=(R)=>R.replace(/-([a-z])/g,(D,N)=>N.toUpperCase()),_=U.map((R)=>` private _${j(R)}: ${B(R)} | null = null;`).join(`
|
|
2268
|
+
`),O=U.map((R)=>{let D=B(R),N=j(R);return`
|
|
2269
2269
|
get ${N}(): ${D} | null {
|
|
2270
2270
|
return this._${N};
|
|
2271
2271
|
}
|
|
@@ -2279,10 +2279,10 @@ else {
|
|
|
2279
2279
|
this.removeAttribute('${R}');
|
|
2280
2280
|
}
|
|
2281
2281
|
}`}).join(`
|
|
2282
|
-
`),
|
|
2282
|
+
`),V=U.length>0?`/**
|
|
2283
2283
|
* Props interface for ${Z}
|
|
2284
2284
|
*/
|
|
2285
|
-
export interface ${
|
|
2285
|
+
export interface ${z}Props {
|
|
2286
2286
|
${U.map((R)=>{let D=B(R);return` ${j(R)}?: ${D};`}).join(`
|
|
2287
2287
|
`)}
|
|
2288
2288
|
}
|
|
@@ -2314,12 +2314,12 @@ catch { return value; }
|
|
|
2314
2314
|
`:"",L=G?`
|
|
2315
2315
|
private _createTemplate(): void {
|
|
2316
2316
|
const template = document.createElement('template');
|
|
2317
|
-
template.innerHTML = \`${H}${
|
|
2317
|
+
template.innerHTML = \`${H}${K}\`;
|
|
2318
2318
|
${Q?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
|
|
2319
2319
|
this._processSlots();
|
|
2320
2320
|
}`:`
|
|
2321
2321
|
private _render(): void {
|
|
2322
|
-
${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${
|
|
2322
|
+
${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${K}\`;
|
|
2323
2323
|
this._processSlots();
|
|
2324
2324
|
}`;return`/**
|
|
2325
2325
|
* ${Z} Web Component
|
|
@@ -2339,12 +2339,12 @@ interface SlotChangeDetail {
|
|
|
2339
2339
|
assignedNodes: Node[];
|
|
2340
2340
|
}
|
|
2341
2341
|
|
|
2342
|
-
${
|
|
2342
|
+
${V}
|
|
2343
2343
|
/**
|
|
2344
2344
|
* ${Z} custom element class
|
|
2345
2345
|
* @customElement ${X}
|
|
2346
2346
|
*/
|
|
2347
|
-
export class ${
|
|
2347
|
+
export class ${z} extends ${J} {
|
|
2348
2348
|
${_}
|
|
2349
2349
|
private _initialized = false;
|
|
2350
2350
|
${Q?"":"private _slotContent: Node[] = [];"}
|
|
@@ -2392,7 +2392,7 @@ ${Q?`
|
|
|
2392
2392
|
}
|
|
2393
2393
|
}`}
|
|
2394
2394
|
${F}
|
|
2395
|
-
${
|
|
2395
|
+
${O}
|
|
2396
2396
|
|
|
2397
2397
|
connectedCallback(): void {
|
|
2398
2398
|
if (this._initialized) return;
|
|
@@ -2413,16 +2413,16 @@ ${V}
|
|
|
2413
2413
|
// Type augmentation for HTMLElementTagNameMap
|
|
2414
2414
|
declare global {
|
|
2415
2415
|
interface HTMLElementTagNameMap {
|
|
2416
|
-
'${X}': ${
|
|
2416
|
+
'${X}': ${z};
|
|
2417
2417
|
}
|
|
2418
2418
|
}
|
|
2419
2419
|
|
|
2420
2420
|
// Register the web component
|
|
2421
|
-
customElements.define('${X}', ${
|
|
2422
|
-
`}var
|
|
2421
|
+
customElements.define('${X}', ${z});
|
|
2422
|
+
`}var H3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function B3($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function CX($,Z,X={}){let J={...H3,...X},Y=B3(Z);switch(J.strategy){case"shadow":return $;case"prefix":return vX($,J.prefix||Z,J.preserveOriginal);case"attribute":return PX($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return fX($,Z,J.preserveOriginal);default:return $}}function PX($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,q)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${q}`})}function vX($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(J,Y)=>{if(Y.startsWith(Z))return J;let Q=`${Z}__${Y}`;return X?`.${Q}`:`.${Q}`})}function fX($,Z,X){let J=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(J))return`.${J}__${Q}`;return Y}let G=`${J}__${Q}`;return X?`.${G}`:`.${G}`})}function xX($,Z,X={}){let J={...H3,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=B3(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,U,W)=>{if(/^(?:script|style|!--)$/i.test(U))return q;let z=W.trimEnd().endsWith("/"),K=z?W.slice(0,-1):W;return`<${U}${K} ${G}${z?"/":""}>`})}if(J.strategy==="prefix"||J.strategy==="bem"){let Y=J.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):J.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((U)=>{if(!U)return U;if(U.startsWith(Y))return U;return`${Y}__${U}`}).join(" ")}"`})}return $}function mW($,Z={}){let X={...H3,...Z},J=B3($);return`${X.attributeName||"data-v"}-${J}`}function lW($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,q,U)=>{if(/\bscoped\b/i.test(q)||X.strategy!=="shadow")J+=`${CX(U,Z,X)}
|
|
2423
2423
|
`;else J+=`${U}
|
|
2424
|
-
`;return""});return{html:
|
|
2425
|
-
`),
|
|
2424
|
+
`;return""});return{html:xX(Y,Z,X),css:J.trim()}}function d1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function cW($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:z={},state:K={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((T)=>q[T].attribute!==!1).map((T)=>q[T].attribute||d1(T)),_=B.map((T)=>{let A=q[T],M=A.default!==void 0?JSON.stringify(A.default):A.type==="string"?'""':A.type==="number"?"0":A.type==="boolean"?"false":A.type==="array"?"[]":"{}";return` this._${T} = ${M};`}).join(`
|
|
2425
|
+
`),O=B.map((T)=>{let A=q[T],M=A.attribute!==!1?A.attribute||d1(T):null,k=A.reflect&&M?`
|
|
2426
2426
|
if (value !== null && value !== undefined) {
|
|
2427
2427
|
${A.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
|
|
2428
2428
|
else { this.removeAttribute('${M}'); }`:`this.setAttribute('${M}', ${A.type==="object"||A.type==="array"?"JSON.stringify(value)":"String(value)"});`}
|
|
@@ -2445,7 +2445,7 @@ else {
|
|
|
2445
2445
|
bubbles: true
|
|
2446
2446
|
}));
|
|
2447
2447
|
}`}).join(`
|
|
2448
|
-
`),
|
|
2448
|
+
`),V=j.length>0?`
|
|
2449
2449
|
static get observedAttributes() {
|
|
2450
2450
|
return [${j.map((T)=>`'${T}'`).join(", ")}];
|
|
2451
2451
|
}
|
|
@@ -2459,11 +2459,11 @@ else {
|
|
|
2459
2459
|
}
|
|
2460
2460
|
${U.attributeChanged||""}
|
|
2461
2461
|
}`:"",F=Object.entries(W).map(([T,A])=>{return`this._root.addEventListener('${T}', (e) => { ${A} });`}).join(`
|
|
2462
|
-
`),L=Object.entries(
|
|
2462
|
+
`),L=Object.entries(z).map(([T,A])=>{return`
|
|
2463
2463
|
${T}() {
|
|
2464
2464
|
${A}
|
|
2465
2465
|
}`}).join(`
|
|
2466
|
-
`),w=JSON.stringify(Object.fromEntries(B.map((T)=>[T,q[T]]))),R=JSON.stringify(Object.fromEntries(B.filter((T)=>q[T].attribute!==!1).map((T)=>[q[T].attribute||
|
|
2466
|
+
`),w=JSON.stringify(Object.fromEntries(B.map((T)=>[T,q[T]]))),R=JSON.stringify(Object.fromEntries(B.filter((T)=>q[T].attribute!==!1).map((T)=>[q[T].attribute||d1(T),T]))),D=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),N=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
|
|
2467
2467
|
* ${Z} - Reactive Web Component
|
|
2468
2468
|
* Auto-generated with reactive properties and lifecycle management
|
|
2469
2469
|
*
|
|
@@ -2475,7 +2475,7 @@ class ${H} extends ${J} {
|
|
|
2475
2475
|
_attrToProp = ${R};
|
|
2476
2476
|
|
|
2477
2477
|
// Internal state
|
|
2478
|
-
_state = ${JSON.stringify(
|
|
2478
|
+
_state = ${JSON.stringify(K)};
|
|
2479
2479
|
_renderPending = false;
|
|
2480
2480
|
_isConnected = false;
|
|
2481
2481
|
|
|
@@ -2494,7 +2494,7 @@ ${_}
|
|
|
2494
2494
|
// =========================================================================
|
|
2495
2495
|
// Reactive Properties
|
|
2496
2496
|
// =========================================================================
|
|
2497
|
-
${
|
|
2497
|
+
${O}
|
|
2498
2498
|
|
|
2499
2499
|
// =========================================================================
|
|
2500
2500
|
// State Management
|
|
@@ -2591,7 +2591,7 @@ ${V}
|
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
2593
|
|
|
2594
|
-
${
|
|
2594
|
+
${V}
|
|
2595
2595
|
|
|
2596
2596
|
// =========================================================================
|
|
2597
2597
|
// Lifecycle
|
|
@@ -2623,7 +2623,7 @@ customElements.define('${X}', ${H});
|
|
|
2623
2623
|
// Export for module usage
|
|
2624
2624
|
export { ${H} };
|
|
2625
2625
|
export default ${H};
|
|
2626
|
-
`}function
|
|
2626
|
+
`}function pW($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:z={},state:K={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((A)=>q[A].attribute!==!1).map((A)=>q[A].attribute||d1(A)),_=(A)=>{switch(A){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},O=B.length>0?`
|
|
2627
2627
|
/**
|
|
2628
2628
|
* Props interface for ${Z}
|
|
2629
2629
|
*/
|
|
@@ -2631,12 +2631,12 @@ export interface ${H}Props {
|
|
|
2631
2631
|
${B.map((A)=>` ${A}?: ${_(q[A].type)};`).join(`
|
|
2632
2632
|
`)}
|
|
2633
2633
|
}
|
|
2634
|
-
`:"",
|
|
2634
|
+
`:"",V=Object.keys(K).length>0?`
|
|
2635
2635
|
/**
|
|
2636
2636
|
* State interface for ${Z}
|
|
2637
2637
|
*/
|
|
2638
2638
|
export interface ${H}State {
|
|
2639
|
-
${Object.entries(
|
|
2639
|
+
${Object.entries(K).map(([A,M])=>` ${A}: ${typeof M};`).join(`
|
|
2640
2640
|
`)}
|
|
2641
2641
|
}
|
|
2642
2642
|
`:`
|
|
@@ -2644,7 +2644,7 @@ export interface ${H}State {
|
|
|
2644
2644
|
[key: string]: unknown;
|
|
2645
2645
|
}
|
|
2646
2646
|
`,F=B.map((A)=>{let M=q[A],k=_(M.type);return` private _${A}: ${k};`}).join(`
|
|
2647
|
-
`),L=B.map((A)=>{let M=q[A],k=_(M.type),I=M.attribute!==!1?M.attribute||
|
|
2647
|
+
`),L=B.map((A)=>{let M=q[A],k=_(M.type),I=M.attribute!==!1?M.attribute||d1(A):null,y=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}",E=M.reflect&&I?`
|
|
2648
2648
|
if (value !== null && value !== undefined) {
|
|
2649
2649
|
${M.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
|
|
2650
2650
|
else { this.removeAttribute('${I}'); }`:`this.setAttribute('${I}', ${M.type==="object"||M.type==="array"?"JSON.stringify(value)":"String(value)"});`}
|
|
@@ -2683,7 +2683,7 @@ else {
|
|
|
2683
2683
|
}
|
|
2684
2684
|
${U.attributeChanged||""}
|
|
2685
2685
|
}`:"",R=Object.entries(W).map(([A,M])=>{return`this._root.addEventListener('${A}', (e: Event) => { ${M} });`}).join(`
|
|
2686
|
-
`),D=Object.entries(
|
|
2686
|
+
`),D=Object.entries(z).map(([A,M])=>{return`
|
|
2687
2687
|
${A}(): void {
|
|
2688
2688
|
${M}
|
|
2689
2689
|
}`}).join(`
|
|
@@ -2694,8 +2694,8 @@ else {
|
|
|
2694
2694
|
* @customElement ${X}
|
|
2695
2695
|
*/
|
|
2696
2696
|
|
|
2697
|
-
${V}
|
|
2698
2697
|
${O}
|
|
2698
|
+
${V}
|
|
2699
2699
|
|
|
2700
2700
|
/**
|
|
2701
2701
|
* Property definition type
|
|
@@ -2715,10 +2715,10 @@ interface PropertyDefinition {
|
|
|
2715
2715
|
export class ${H} extends ${J} {
|
|
2716
2716
|
// Property definitions
|
|
2717
2717
|
private _propertyDefs: Record<string, PropertyDefinition> = ${JSON.stringify(q)};
|
|
2718
|
-
private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(B.filter((A)=>q[A].attribute!==!1).map((A)=>[q[A].attribute||
|
|
2718
|
+
private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(B.filter((A)=>q[A].attribute!==!1).map((A)=>[q[A].attribute||d1(A),A])))};
|
|
2719
2719
|
|
|
2720
2720
|
// Internal state
|
|
2721
|
-
private _state: ${H}State = ${JSON.stringify(
|
|
2721
|
+
private _state: ${H}State = ${JSON.stringify(K)};
|
|
2722
2722
|
private _renderPending = false;
|
|
2723
2723
|
private _isConnected = false;
|
|
2724
2724
|
private _root: ShadowRoot | HTMLElement;
|
|
@@ -2875,7 +2875,7 @@ declare global {
|
|
|
2875
2875
|
customElements.define('${X}', ${H});
|
|
2876
2876
|
|
|
2877
2877
|
export default ${H};
|
|
2878
|
-
`}function
|
|
2878
|
+
`}function iW(){return`/**
|
|
2879
2879
|
* ReactiveElement Mixin
|
|
2880
2880
|
* Adds reactive properties and lifecycle management to web components
|
|
2881
2881
|
*/
|
|
@@ -2997,7 +2997,7 @@ else {
|
|
|
2997
2997
|
|
|
2998
2998
|
export { ReactiveElement };
|
|
2999
2999
|
export default ReactiveElement;
|
|
3000
|
-
`}function
|
|
3000
|
+
`}function nW(){return`/**
|
|
3001
3001
|
* stx Reactive Web Components Runtime
|
|
3002
3002
|
* Provides base classes and utilities for reactive web components
|
|
3003
3003
|
*/
|
|
@@ -3214,16 +3214,16 @@ else {
|
|
|
3214
3214
|
};
|
|
3215
3215
|
|
|
3216
3216
|
})(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
|
|
3217
|
-
`}function
|
|
3218
|
-
get ${
|
|
3219
|
-
return this.getAttribute('${
|
|
3217
|
+
`}function gX($,Z){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=X?X[1].trim():"",Y=Z,Q=[],G=!0;if(J){let K=J.match(/export\s+default\s+({[\s\S]*})/);if(K)try{let H=K[1],B=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Y=B[1];let j=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=H.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let q=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),U=q?q[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=W?W[1].trim():"";return{tag:Y,props:Q,template:U,styles:z,script:J,shadowDOM:G}}function hX($){let{tag:Z,props:X,template:J,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((K)=>K.charAt(0).toUpperCase()+K.slice(1)).join(""),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),U=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=X.map((K)=>`'${K}'`).join(", "),z=X.map((K)=>`
|
|
3218
|
+
get ${K}() {
|
|
3219
|
+
return this.getAttribute('${K}') || '';
|
|
3220
3220
|
}
|
|
3221
|
-
set ${
|
|
3221
|
+
set ${K}(value) {
|
|
3222
3222
|
if (value) {
|
|
3223
|
-
this.setAttribute('${
|
|
3223
|
+
this.setAttribute('${K}', value);
|
|
3224
3224
|
}
|
|
3225
3225
|
else {
|
|
3226
|
-
this.removeAttribute('${
|
|
3226
|
+
this.removeAttribute('${K}');
|
|
3227
3227
|
}
|
|
3228
3228
|
}`).join(`
|
|
3229
3229
|
`);return`/**
|
|
@@ -3246,7 +3246,7 @@ class ${G} extends HTMLElement {
|
|
|
3246
3246
|
this._render();
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
|
-
${
|
|
3249
|
+
${z}
|
|
3250
3250
|
|
|
3251
3251
|
_render() {
|
|
3252
3252
|
const template = \`${U?`<style>${U}</style>`:""}${q}\`;
|
|
@@ -3265,14 +3265,14 @@ ${K}
|
|
|
3265
3265
|
}
|
|
3266
3266
|
|
|
3267
3267
|
customElements.define('${Z}', ${G});
|
|
3268
|
-
`}async function
|
|
3269
|
-
${
|
|
3270
|
-
</script>`}var V6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:B6,cachePath:".stx/cache",cacheVersion:"1.0.0",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:I7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:U6,hasEndTag:!1,description:"Include a web component in the template"},z6,H6,G3,q3,x$,h$,u$,g$,N7,j7,h7,t$,...O6],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,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 EX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=N0.join(Y,"resources","views"),G=N0.join(Y,"resources","layouts");if(t5.existsSync(Q)&&t5.existsSync(G))return{root:"resources",pagesDir:"views"};let q=N0.join(Y,"resources","views","pages");if(t5.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var W6=new Set,e5=["partialsDir","componentsDir","layoutsDir"],K3=new WeakMap;function bX($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function yX($,Z){let X=!$.root,J=EX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!W6.has(Y))W6.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!K3.has($)){let Y={};for(let Q of e5){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}K3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of e5){let G=$[Q];if(typeof G!=="string"||!G)continue;if(N0.isAbsolute(G)||bX(G,Y))continue;$[Q]=N0.join(Y,G)}}for(let Y of e5){let Q=$[Y];if(typeof Q!=="string"||!Q||N0.isAbsolute(Q))continue;$[Y]=N0.resolve(Z,Q)}return $}function SX($,Z){let X=K3.get($);for(let J of e5){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=N0.isAbsolute(Y)?Y:N0.join(Z,Y);if(t5.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,U=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(U?`, resolved under root "${q}".`:"."))}}function CX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function PX($){if(j6($.stateDir),$.stateDir=_6(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}var d1=null,K6=new Map,$$=null;async function z3($){if(!$){if(d1)return d1;if($$)return $$}let Z=$?N0.resolve($):process.cwd(),X=K6.get(Z);if(X)return X;let J=(async()=>{let Q=(await kX({name:"stx",alias:"ui",cwd:Z,defaultConfig:V6,verbose:!1})).config;if(CX(Q),PX(Q),yX(Q,Z),SX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-p8pyqr7p.js"),q=[],U=[];for(let W of Q.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let H,B;try{H=await import(K),B=N0.dirname(h.resolve(K))}catch{let _=N0.resolve(process.cwd(),K);H=await import(_),B=N0.dirname(_)}let j=H.default||H;if(!G.has(j.name))await G.register(j,Q);if(j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let V of _)q.push(N0.resolve(B,V))}if(j.pages){let _=N0.resolve(B,j.pages),V=z.path||"/";U.push({dir:_,prefix:V})}if(j.setup){let _={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(H){console.warn(`[stx] Failed to load plugin ${K}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(K6.set(Z,J),!$)$$=J,J.then((Y)=>{d1=Y}).catch(()=>{});return J}var F6=new Proxy(V6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!$$)z3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function nW($){return $}function sW($){let Z=[],X=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)X.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.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($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var B3=new Map;async function xX($,Z={}){try{if(!await r($))throw Error(`Markdown file not found: ${$}`);let J=(await vX.promises.stat($)).mtime.getTime();if(Z.cache&&B3.has($)){let z=B3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=M7(Y),q=Z.markdown||F6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)W=await gX(W,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:Q||{}};if(Z.cache)B3.set($,{...K,updatedAt:J});return K}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var Z$=null;async function gX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Z$)try{Z$=await fX({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,U,W,K)=>{let z=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=W||(X?"text":"");if(!H)return q;try{if(!Z$.getSupportedLanguages().includes(H))return q;return(await Z$.highlight(z,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[U,W,K,z]=q,H=await Y(U,W,K,z);Q=Q.replace(U,H)}return Q}async function L6($,Z,X="",J={}){return await hX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,U,W)=>{try{let K=q;if(!H3.isAbsolute(q))K=H3.resolve(H3.dirname(X),q);let z={};if(U)try{try{z=JSON.parse(U)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let F=U.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);z[R]=D}}}}catch(O){if(J.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:H,data:B}=await xX(K,J),j={...Z,...B,...z},_=H,V=/\{\{([^}]+)\}\}/g;return _=_.replace(V,(O,F)=>{let L=F.trim();return j[L]!==void 0?String(j[L]):O}),_}catch(K){let z=K instanceof Error?K.message:String(K);return W0("Markdown File",`Error including markdown file: ${z}`,X,$,W,G)}})}async function hX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],U=Y.index,W=Y;J.push(X(...W).then((K)=>({match:q,replacement:K,index:U})))}let Q=await Promise.all(J);Q.sort((q,U)=>U.index-q.index);let G=$;for(let{match:q,replacement:U}of Q)G=G.replace(q,()=>U);return G}function U1($,Z){try{let X=$.trim();if(Q0(X))return G0(X,Object.keys(Z))(...Object.values(Z));else return X0(X,Z)}catch{return!1}}class X${source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3268
|
+
`}async function j6($,Z,X,J){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",p.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",q=v0.isAbsolute(G)?[v0.join(G,`${Y}.stx`),v0.join(v0.dirname(J),`${Y}.stx`)]:[v0.join(v0.dirname(J),G,`${Y}.stx`),v0.join(process.cwd(),G,`${Y}.stx`),v0.join(v0.dirname(J),`${Y}.stx`)],U=null;for(let K of q)if(await o(K)){U=await Bun.file(K).text();break}if(!U)return $0("WebComponent",`Component file not found: ${Y}.stx`,p.FILE_NOT_FOUND);let W=gX(U,Y);return`<script type="module">
|
|
3269
|
+
${hX(W)}
|
|
3270
|
+
</script>`}var N6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:L6,cachePath:".stx/cache",cacheVersion:"1.0.0",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:C7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:j6,hasEndTag:!1,description:"Include a web component in the template"},O6,F6,z3,K3,h$,d$,m$,u$,E7,F7,p7,X3,...D6],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,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 dX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=R0.join(Y,"resources","views"),G=R0.join(Y,"resources","layouts");if($$.existsSync(Q)&&$$.existsSync(G))return{root:"resources",pagesDir:"views"};let q=R0.join(Y,"resources","views","pages");if($$.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var _6=new Set,Z$=["partialsDir","componentsDir","layoutsDir"],j3=new WeakMap;function mX($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function lX($,Z){let X=!$.root,J=dX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!_6.has(Y))_6.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!j3.has($)){let Y={};for(let Q of Z$){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}j3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of Z$){let G=$[Q];if(typeof G!=="string"||!G)continue;if(R0.isAbsolute(G)||mX(G,Y))continue;$[Q]=R0.join(Y,G)}}for(let Y of Z$){let Q=$[Y];if(typeof Q!=="string"||!Q||R0.isAbsolute(Q))continue;$[Y]=R0.resolve(Z,Q)}return $}function cX($,Z){let X=j3.get($);for(let J of Z$){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=R0.isAbsolute(Y)?Y:R0.join(Z,Y);if($$.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,U=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(U?`, resolved under root "${q}".`:"."))}}function pX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function iX($){if(w6($.stateDir),$.stateDir=R6(),$.cachePath=_5($.cachePath),$.build)$.build.cacheDir=_5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=_5($.media.cache.directory);if($.story)$.story.outDir=_5($.story.outDir)}var m1=null,V6=new Map,X$=null;async function _3($){if(!$){if(m1)return m1;if(X$)return X$}let Z=$?R0.resolve($):process.cwd(),X=V6.get(Z);if(X)return X;let J=(async()=>{let Q=(await uX({name:"stx",alias:"ui",cwd:Z,defaultConfig:N6,verbose:!1})).config;if(pX(Q),iX(Q),lX(Q,Z),cX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-vdqbbqe2.js"),q=[],U=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],K=typeof W==="string"?{}:W[1]||{};try{let H,B;try{H=await import(z),B=R0.dirname(u.resolve(z))}catch{let _=R0.resolve(process.cwd(),z);H=await import(_),B=R0.dirname(_)}let j=H.default||H;if(!G.has(j.name))await G.register(j,Q);if(j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let O of _)q.push(R0.resolve(B,O))}if(j.pages){let _=R0.resolve(B,j.pages),O=K.path||"/";U.push({dir:_,prefix:O})}if(j.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:B,config:Q};await j.setup(K,_)}console.log(`[stx] Plugin loaded: ${j.name||z}`)}catch(H){console.warn(`[stx] Failed to load plugin ${z}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(V6.set(Z,J),!$)X$=J,J.then((Y)=>{m1=Y}).catch(()=>{});return J}var A6=new Proxy(N6,{get($,Z){if(m1&&Z in m1)return m1[Z];if(!X$)_3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function Wz($){return $}function zz($){let Z=[],X=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)X.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.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($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var O3=new Map;async function oX($,Z={}){try{if(!await o($))throw Error(`Markdown file not found: ${$}`);let J=(await nX.promises.stat($)).mtime.getTime();if(Z.cache&&O3.has($)){let K=O3.get($);if(K.updatedAt>=J)return{content:K.content,data:K.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=y7(Y),q=Z.markdown||A6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=z5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)W=await rX(W,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)O3.set($,{...z,updatedAt:J});return z}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var J$=null;async function rX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!J$)try{J$=await sX({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,U,W,z)=>{let K=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=W||(X?"text":"");if(!H)return q;try{if(!J$.getSupportedLanguages().includes(H))return q;return(await J$.highlight(K,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[U,W,z,K]=q,H=await Y(U,W,z,K);Q=Q.replace(U,H)}return Q}async function M6($,Z,X="",J={}){return await aX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,U,W)=>{try{let z=q;if(!V3.isAbsolute(q))z=V3.resolve(V3.dirname(X),q);let K={};if(U)try{try{K=JSON.parse(U)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let F=U.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);K[R]=D}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:H,data:B}=await oX(z,J),j={...Z,...B,...K},_=H,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,F)=>{let L=F.trim();return j[L]!==void 0?String(j[L]):V}),_}catch(z){let K=z instanceof Error?z.message:String(z);return U0("Markdown File",`Error including markdown file: ${K}`,X,$,W,G)}})}async function aX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],U=Y.index,W=Y;J.push(X(...W).then((z)=>({match:q,replacement:z,index:U})))}let Q=await Promise.all(J);Q.sort((q,U)=>U.index-q.index);let G=$;for(let{match:q,replacement:U}of Q)G=G.replace(q,()=>U);return G}function G1($,Z){try{let X=$.trim();if(Y0(X))return Q0(X,Object.keys(Z))(...Object.values(Z));else return e(X,Z)}catch{return!1}}class Y${source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3271
3271
|
`)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readBlockComment($,Z,X){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readString($,Z,X,J){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:X,column:J}}readTemplateString($,Z,X){this.advance();let J=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(J>=Y){this.pos=this.source.length;break}this.advance(2),J++;continue}if(Q==="{"&&J>0){J++,this.advance();continue}if(Q==="}"&&J>0){J--,this.advance();continue}if(Q==="`"&&J===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readNumber($,Z,X){if(this.source[this.pos]==="0"){let J=this.peek(1)?.toLowerCase();if(J==="x"||J==="o"||J==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readIdentifier($,Z,X){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readDirective($,Z,X){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
|
|
3272
|
-
`)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function H0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,U=!1;while(Q<$.length){let W=$[Q];if(G&&U){U=!1,Q++;continue}if(G&&W==="\\"){U=!0,Q++;continue}if(U=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&W==="}"){q--,Q++;continue}if(W==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)Y++;else if(W===X){if(Y--,Y===0)return Q}Q++}return-1}function w6($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function j3($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+=q+$[G+1],G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function W1($,Z){let X=uX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function uX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=H0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function dX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function w1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,q.lastIndex=Q;let U=G.exec($),W=q.exec($),K=U?U.index:1/0,z=W?W.index:1/0;if(K<z)Y++,Q=K+U[0].length;else if(z<1/0){if(Y--,Y===0)return z;Q=z+W[0].length}else break}return-1}function R6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K="if",z=Y.expression,H=0,B=0;while(W<q.length){let j=q.indexOf("@",W);if(j===-1)break;W=j;let _=q.substring(j);if(dX(q,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let V=_.match(/^@elseif\s*/);if(V){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W});let O=W+V[0].length,F=W1(q,O);if(!F){W++;continue}K="elseif",z=F.expression,W=F.endPos,H=W;continue}else if(/^@else(?![a-z])/.test(_)){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W}),K="else",z=void 0,W+=5,H=W;continue}}W++}return U.push({type:K,condition:z,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:U,start:Z,end:G+6}}function _5($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=R6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function J$($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let q=Q.index,U=q+Q[0].length-1,W=H0($,"(",")",U);if(W===-1){Q=Y.exec($);continue}let K=$.slice(U+1,W),z=W+1,H=w1($,Z,X,z);if(H===-1){Q=Y.exec($);continue}let B=$.slice(z,H),j=H+`@${X}`.length;J.push({fullMatch:$.slice(q,j),name:Z,params:K,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function _3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K=null,z=0;while(W<q.length){let H=q.slice(W),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=q[W];W++;continue}let _=H.match(/^@case\s*/),V=H.match(/^@default(?![a-z])/),O=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(K)U.push(K);let F=W+_[0].length,L=W1(q,F);if(!L){W++;continue}K={type:"case",value:L.expression,content:""},W=L.endPos}else if(V&&H.startsWith("@default")){if(K)U.push(K);K={type:"default",content:""},W+=V[0].length}else if(O&&H.startsWith("@break"))W+=O[0].length;else{if(K)K.content+=q[W];W++}}if(K)U.push(K);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:U,start:Z,end:G+10}}function mX($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",U=Q?q==="{{{"?"}}}":"!!}":"}}",W=G+q.length,K=lX($,W,U);if(K===-1){X=G+1;continue}let z=$.slice(W,K).trim(),H=K+U.length;Z.push({fullMatch:$.slice(G,H),expression:z,start:G,end:H,isRaw:Q}),X=H}return Z}function lX($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((q==='"'||q==="'")&&!Y){Y=q,J++;continue}if(q===Y&&Y!=="`"){Y=null,J++;continue}if(q==="`"&&!Y){Y="`",J++;continue}if(q==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&q==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;J++;continue}if(Y){J++;continue}if(q==="(")Q.paren++;else if(q===")")Q.paren--;else if(q==="[")Q.bracket++;else if(q==="]")Q.bracket--;else if(q==="{")Q.brace++;else if(q==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function cX($){let Z=j3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=pX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function pX($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=H0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=A6(G);return{name:J,args:q}}function A6($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function iX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=H0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function nX($){let Z=[],J=new X$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let q=J[Y];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let U=q.value;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let z=Y<J.length?J[Y].start:$.length,H=D6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:K,value:$.slice(z,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(W.type==="PUNCTUATION"&&(W.value==="{"||W.value==="[")){let K=W.start,z=W.value==="{"?"}":"]",H=H0($,W.value,z,K);if(H!==-1){let B=$.slice(K,H+1);if(Y=N6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=D6(J,Y,$);Y=_.nextIndex;let V=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:V,value:`${$.slice(j,_.endPos)}; ${U} ${B} = ${V}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let U=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;Y++;let z=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){z=J[Y].start;break}Y++}if(z!==-1){let H=H0($,"{","}",z);if(H!==-1)Z.push({type:"function",name:K,value:$.slice(U,H+1).replace(/^export\s+/,""),exported:G,start:U,end:H+1}),Y=N6(J,H+1)}}}else Y++}return Z}function D6($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,J++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function N6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function sX($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=_3(J,G);if(!q)break;try{let U;if(Q0(q.expression))U=G0(q.expression,Object.keys(Z))(...Object.values(Z));else U=X0(q.expression,Z);let W="",K=!1;for(let z of q.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let H;if(z.value&&Q0(z.value))H=G0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)H=X0(z.value,Z);if(U===H){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(q.end),Y=!0}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("Switch",`Error evaluating @switch expression: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,G)+K+J.substring(q.end);break}}return J}function oX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function rX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function t0($,Z,X){let{masked:J,scripts:Y}=oX($);return rX(aX(J,Z,X),Y)}function aX($,Z,X){let J=$;J=sX(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=W1(J,q+7);if(!U)break;let W=U.endPos,K=w1(J,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(W,K),H=U.expression,B=-1;{let _=0,V=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=V.exec(z))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(z))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(z))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){B=R.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),V=z.slice(B+5);j=`@if (${H})${V}@else ${_}@endif`}else j=`@if (!(${H}))${z}@endif`;J=J.substring(0,q)+j+J.substring(K+10),Q=!0}}J=V3(J,Z,X),J=F3(J,Z,X),J=O3(J,Z);let Y=()=>{let Q=_5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let U="",W=!1;for(let K of q.branches){if(W)break;if(K.type==="else")U=K.content,W=!0;else try{let z;if(K.condition&&Q0(K.condition))z=G0(K.condition,Object.keys(Z))(...Object.values(Z));else if(K.condition)z=X0(K.condition,Z);if(z)U=K.content,W=!0}catch(z){U=$0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR),W=!0}}J=J.substring(0,q.start)+U+J.substring(q.end)}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("If",`Error processing @if block: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,q.start)+K+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function M6($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function O3($,Z){let X=$;function J(q,U,W,K){let z=1,H=K,B=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(H<q.length&&z>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),V=j.exec(q),O=_?_.index:1/0,F=V?V.index:1/0;if(O<F)z++,H=O+_[0].length;else if(F<1/0){if(z--,z===0)return F;H=F+V[0].length}else break}return-1}function Y(q,U,W){let K=0,z=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=H.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((V,O)=>V.pos-O.pos);for(let V of j)if(V.type==="open")K++;else if(V.type==="close")K--;else if(V.type==="else"&&K===0)return V.pos;return-1}{let q=!0;while(q){q=!1;let U=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+5),B=M6(H);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(X,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"auth","endauth"),O;if(!Z.auth)O=!1;else O=K?U1(`auth?.check && auth?.user?.[${K}]`,Z):U1("auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let U=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+6),B=M6(H);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(X,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"guest","endguest"),O;if(!Z.auth)O=!0;else O=K?U1(`!auth?.check || !auth?.user?.[${K}]`,Z):U1("!auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+9),q=!0}}function Q(q,U,W){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let K=[q];if(U)K.push(U);if(W){let z=U1(W,Z);K.push(z)}return Z.permissions.check(...K)}catch{return!1}return!1}function G(q){let U=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!U)return null;return{ability:U[1],type:U[2],id:U[3]?.trim(),paramsEnd:U[0].length}}for(let q of["can","cannot"]){let U=`end${q}`,W=q==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let z=X.match(new RegExp(`@${q}\\s*\\(`));if(!z||z.index===void 0)break;let H=z.index,B=X.slice(H+`@${q}`.length),j=G(B);if(!j)break;let _=H+`@${q}`.length+j.paramsEnd,V=J(X,q,U,_);if(V===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${U} \u2014 the block was skipped.`);break}let O=X.slice(_,V),F=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${U}(?![a-z])`,"g"),D=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],A;while((A=w.exec(O))!==null)T.push({pos:A.index,type:"open"});while((A=R.exec(O))!==null)T.push({pos:A.index,type:"close"});while((A=D.exec(O))!==null)T.push({pos:A.index,type:"elseDirective"});while((A=N.exec(O))!==null)T.push({pos:A.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)F.push(b)}let M=[],k=0;for(let b=0;b<F.length;b++){let C=F[b];if(M.push({content:O.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=O.slice(C.pos+`@${W}`.length),f=G(x);if(f){M[M.length-1]={content:O.slice(k,C.pos)},k=C.pos+`@${W}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let n=F[b+1],m=n?n.pos:O.length;M.push({content:O.slice(k,m),ability:f.ability,type:f.type,id:f.id}),k=m}}else k=C.pos+5}if(k<O.length){let b=M[M.length-1];if(F.length>0&&F[F.length-1].type==="else")M.push({content:O.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:O.slice(k)})}let I=Q(j.ability,j.type,j.id),y=q==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let x=M[C];if(x.isFinalElse){E=x.content,b=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(q==="can"?f:!f){E=x.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(V+`@${U}`.length),K=!0}}return X}function V3($,Z,X){let J=$;function Y(Q,G,q,U,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${G}\\s*\\(`),H=Q.match(z);if(!H||H.index===void 0)break;let B=H.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,V=w1(Q,G,q,_);if(V===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let O=Q.slice(_,V),F=j.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=U(F.trim()),N;if(L!==-1){let T=O.slice(0,L),A=O.slice(L+5);N=D?T:A}else N=D?O:"";Q=Q.substring(0,B)+N+Q.substring(V+`@${q}`.length),K=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=$0(W,`Error processing @${G} directive: ${N}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(V+`@${q}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=U1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=U1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function F3($,Z,X){let J=$,Y="development";function Q(G,q,U,W){let K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${U}(?![a-z])`),j=G,_=!0;while(_){_=!1,K.lastIndex=0;let V=K.exec(j);if(!V)break;let O=V.index,F=O+V[0].length;if(q==="env"){let I=j.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;F+=I[0].length,W=Y===I[2]}let L=1,w=F,R=-1;while(L>0&&w<j.length){K.lastIndex=w,z.lastIndex=w;let I=K.exec(j),y=z.exec(j),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${O} has no matching @${U} \u2014 the block was skipped.`);break}let D=j.substring(F,R),N=-1,T=0,A=0;while(A<D.length){let I=D.indexOf("@",A);if(I===-1)break;let y=D.substring(I);if(H.test(y)){T++,A=I+1;continue}if(B.test(y)){T--,A=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=I;break}A=I+1}let M;if(N!==-1){let I=D.slice(0,N),y=D.slice(N+5);M=W?I:y}else M=W?D:"";let k=`@${U}`.length;j=j.substring(0,O)+M+j.substring(R+k),_=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var L3=new WeakMap;function T6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function R1($,Z){if(!$)return Z?.nonceGenerator?.()??T6();let X=L3.get($);if(!X)X=Z?.nonceGenerator?.()??T6(),L3.set($,X);return X}function RK($){L3.delete($)}function I6($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function R3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${I6($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var tX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},w3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},eX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},$J={"default-src":["'none'"],"frame-ancestors":["'none'"]};function DK($){return{enabled:!0,directives:{strict:tX,moderate:w3,relaxed:eX,api:$J}[$]||w3,useNonce:$==="strict",addMetaTag:!0}}function NK($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let q=Array.isArray(G)?G:[],U=[...new Set([...q,...Y])];X[Q]=U}}return X}function k6($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?R1(X,Z):void 0,Y=R3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3273
|
-
${Y}`)}function E6($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function b6($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(Z,Q):void 0;return R3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return R1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=R1(Z,Q);return Y}var ZJ={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(X,Q):void 0;return R3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},XJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return R1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function AK(){return[ZJ,XJ]}function MK($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function JJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function TK($,Z){if(!$.enabled)return{};let X=$.useNonce?R1(Z,$):void 0,J=I6($.directives,X);return{[JJ($.reportOnly)]:J}}var IK={enabled:!1,reportOnly:!1,directives:w3,useNonce:!1,addMetaTag:!0};import YJ from"crypto";var QJ=40,y6="_token",D3=null;function GJ($=QJ){let Z=YJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return D3=Z,Z}function qJ(){if(!D3)GJ();return D3}function UJ($=y6){let Z=qJ();return`<input type="hidden" name="${$}" value="${Z}">`}function S6($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return UJ(J||y6)})}async function C6($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await WJ(Y,Q,Z,X,J);else Y=await KJ(Y,Q,Z,X,J)}return Y}async function WJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,U=`@end${Q}`,W=$,K=v1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${U}`,"g"),z=[],H=K.exec(W);while(H!==null){let[B,j="",_=""]=H,V=H.index||0;try{let O=j?P6(j):[],F=_.trim(),L=await G(F,O,X,J);z.push({original:B,processed:L,startIndex:V})}catch(O){let F=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);z.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${F}`,l.EVALUATION_ERROR),startIndex:V})}H=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function KJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,U=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=U.exec(q);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let V=P6(j),O=await G("",V,X,J);W.push({original:B,processed:O,startIndex:_})}catch(V){let O=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${O}`,l.EVALUATION_ERROR),startIndex:_})}K=U.exec(q)}let z=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=z.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let V=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${V}`,l.EVALUATION_ERROR),startIndex:j})}H=z.exec(q)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];q=q.replace(j,_)}return q}function P6($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var v6=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,f6=/^[A-Za-z_$][\w$]*$/,zJ=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function HJ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(X.key,"appearance.key"),D1(X.attribute,"appearance.attribute"),D1(X.default,"appearance.default"),D1(J.key,"colorMode.key"),D1(J.attribute,"colorMode.attribute"),D1(J.default,"colorMode.default"),!f6.test(X.key)||!f6.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!v6.test(X.attribute)||!v6.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.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");if(!zJ.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function BJ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function jJ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${BJ($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function _J($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function x6($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=_J(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),U=X0(`(${q})`,Z),W=jJ(HJ(U));X=X.slice(0,Y.index)+W+X.slice(G+1),J.lastIndex=Y.index+W.length}return X}import OJ from"crypto";function B0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var A3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function VJ($){return{...A3,...$.forms?.classes}}function Y$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function x0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${B0(Z)}"`}function N3($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${B0(`${x0($)}-error`)}"`;return J}function FJ(){return OJ.randomUUID()}function gK($,Z,X,J){let Y=VJ(J),Q=$;return Q=wJ(Q,Z),Q=F5(Q,Z),Q=M3(Q,Z,Y),Q=T3(Q,Z,Y),Q}function F5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=FJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${B0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${B0(Q)}">`;return J}),X}function M3($,Z,X=A3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"POST",z=q||U||"",H=K1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(z)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3274
|
-
${
|
|
3275
|
-
${F5(`@method('${B}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"",z=q||U||"",H=K1(W),B=O5(K,Z),j=B!==void 0&&B!==null?B:z||"",_=H.match(/type=['"]([^'"]+)['"]/i),V=_?_[1]:"text",O=V5(K,Z),F=H.match(/class=['"]([^'"]+)['"]/i),L=Y$(F?F[1]:"",X.input,O,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(V)}" name="${B0(K)}"${m1(H,x0(K))} value="${B0(j)}" class="${L}"${N3(K,O,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let U=K1(G),W=O5(Q,Z)||q.trim(),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=Y$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${N3(Q,K,U)}${B?` ${B}`:""}>${B0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let U=K1(G),W=O5(Q,Z),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=Y$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,""),j=q;if(W!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,V,O)=>{if((Array.isArray(W)?W.some((L)=>String(L)===O):String(W)===O)&&!V.includes("selected"))return V.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${N3(Q,K,U)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=G===void 0?"1":G,W=G===void 0?x0(Q):`${x0(Q)}-${x0(U)}`,K=K1(q),z=O5(Q,Z),H=z!==void 0&&(Array.isArray(z)?z.some((V)=>String(V)===U):z===!0||String(z)===U),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(Q)}"${m1(K,W)} value="${B0(U)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=K1(q),W=O5(Q,Z),K=W!==void 0&&W===G,z=U.match(/class=['"]([^'"]+)['"]/i),H=z?z[1]:X.checkInput,B=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(Q)}"${m1(U,`${x0(Q)}-${x0(G)}`)} value="${B0(G)}" class="${H}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=K1(G),U=q.match(/accept=['"]([^'"]+)['"]/i),W=U?U[1]:"",K=q.includes("multiple"),z=V5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=Y$(H?H[1]:"",X.input,z,X.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${B0(Q)}"${m1(q,x0(Q))}`,`class="${B}"`];if(W)_.push(`accept="${B0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let U=K1(G),W=U.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:X.label,z=U.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(x0(Q))}" class="${K}"${z?` ${z}`:""}>${q}</label>`}),J}function T3($,Z,X=A3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(V5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,U)=>{try{if(U.trim()==="$message"||U.trim()==="message")return g6(Y,Z);if(U.trim().includes("errors.first")||U.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return g6(Y,Z)}let W=U.trim();if(Q0(W)){let K=X0(W,Z);return K!==void 0?String(K):W}return W}catch{return U}});return`<div id="${B0(`${x0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function V5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function g6($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function O5($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var h6={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function hK($,Z){h6[$]=Z}function I3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function LJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=I3(G),U=h6[q.name];if(!U){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let K=`${$}_confirmation`;q.params=[J[K]]}let W=U(Z,q.params||[],$);if(W)Y.push(q.message||W)}return{field:$,valid:Y.length===0,errors:Y}}function uK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=LJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function wJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((U)=>U.trim()),q=[];for(let U of G){let W=I3(U);switch(W.name){case"required":q.push("required");break;case"email":q.push('type="email"');break;case"url":q.push('type="url"');break;case"numeric":case"integer":if(q.push('type="number"'),W.name==="integer")q.push('step="1"');break;case"min":if(W.params?.[0])q.push(`minlength="${W.params[0]}"`);break;case"max":if(W.params?.[0])q.push(`maxlength="${W.params[0]}"`);break;case"regex":if(W.params?.[0])q.push(`pattern="${W.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var u6={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function dK($){u6[$.name]=$}function RJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=I3(Q),q=u6[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let U=q.validate($,G.params||[],X);if(U!==!0)J.push(U)}return{valid:J.length===0,errors:J}}function mK($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=RJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function lK($,Z){let X=JSON.stringify(Z);return`
|
|
3272
|
+
`)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function W0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,U=!1;while(Q<$.length){let W=$[Q];if(G&&U){U=!1,Q++;continue}if(G&&W==="\\"){U=!0,Q++;continue}if(U=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&W==="}"){q--,Q++;continue}if(W==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)Y++;else if(W===X){if(Y--,Y===0)return Q}Q++}return-1}function T6($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function F3($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+=q+$[G+1],G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function q1($,Z){let X=tX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function tX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=W0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function eX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function w1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,q.lastIndex=Q;let U=G.exec($),W=q.exec($),z=U?U.index:1/0,K=W?W.index:1/0;if(z<K)Y++,Q=z+U[0].length;else if(K<1/0){if(Y--,Y===0)return K;Q=K+W[0].length}else break}return-1}function I6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,z="if",K=Y.expression,H=0,B=0;while(W<q.length){let j=q.indexOf("@",W);if(j===-1)break;W=j;let _=q.substring(j);if(eX(q,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let O=_.match(/^@elseif\s*/);if(O){U.push({type:z,condition:K,content:q.substring(H,W),start:Q+H,end:Q+W});let V=W+O[0].length,F=q1(q,V);if(!F){W++;continue}z="elseif",K=F.expression,W=F.endPos,H=W;continue}else if(/^@else(?![a-z])/.test(_)){U.push({type:z,condition:K,content:q.substring(H,W),start:Q+H,end:Q+W}),z="else",K=void 0,W+=5,H=W;continue}}W++}return U.push({type:z,condition:K,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:U,start:Z,end:G+6}}function V5($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=I6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function Q$($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let q=Q.index,U=q+Q[0].length-1,W=W0($,"(",")",U);if(W===-1){Q=Y.exec($);continue}let z=$.slice(U+1,W),K=W+1,H=w1($,Z,X,K);if(H===-1){Q=Y.exec($);continue}let B=$.slice(K,H),j=H+`@${X}`.length;J.push({fullMatch:$.slice(q,j),name:Z,params:z,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function L3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,z=null,K=0;while(W<q.length){let H=q.slice(W),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(K++,z)z.content+=B[0];W+=B[0].length;continue}if(j){if(K--,z)z.content+=j[0];W+=j[0].length;continue}if(K>0){if(z)z.content+=q[W];W++;continue}let _=H.match(/^@case\s*/),O=H.match(/^@default(?![a-z])/),V=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(z)U.push(z);let F=W+_[0].length,L=q1(q,F);if(!L){W++;continue}z={type:"case",value:L.expression,content:""},W=L.endPos}else if(O&&H.startsWith("@default")){if(z)U.push(z);z={type:"default",content:""},W+=O[0].length}else if(V&&H.startsWith("@break"))W+=V[0].length;else{if(z)z.content+=q[W];W++}}if(z)U.push(z);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:U,start:Z,end:G+10}}function $J($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",U=Q?q==="{{{"?"}}}":"!!}":"}}",W=G+q.length,z=ZJ($,W,U);if(z===-1){X=G+1;continue}let K=$.slice(W,z).trim(),H=z+U.length;Z.push({fullMatch:$.slice(G,H),expression:K,start:G,end:H,isRaw:Q}),X=H}return Z}function ZJ($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((q==='"'||q==="'")&&!Y){Y=q,J++;continue}if(q===Y&&Y!=="`"){Y=null,J++;continue}if(q==="`"&&!Y){Y="`",J++;continue}if(q==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&q==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;J++;continue}if(Y){J++;continue}if(q==="(")Q.paren++;else if(q===")")Q.paren--;else if(q==="[")Q.bracket++;else if(q==="]")Q.bracket--;else if(q==="{")Q.brace++;else if(q==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function XJ($){let Z=F3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=JJ(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function JJ($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=W0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=b6(G);return{name:J,args:q}}function b6($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function YJ($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=W0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function QJ($){let Z=[],J=new Y$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let q=J[Y];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let U=q.value;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let z=W.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let K=Y<J.length?J[Y].start:$.length,H=k6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:z,value:$.slice(K,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(W.type==="PUNCTUATION"&&(W.value==="{"||W.value==="[")){let z=W.start,K=W.value==="{"?"}":"]",H=W0($,W.value,K,z);if(H!==-1){let B=$.slice(z,H+1);if(Y=E6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=k6(J,Y,$);Y=_.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(j,_.endPos)}; ${U} ${B} = ${O}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let U=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let z=W.value;Y++;let K=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){K=J[Y].start;break}Y++}if(K!==-1){let H=W0($,"{","}",K);if(H!==-1)Z.push({type:"function",name:z,value:$.slice(U,H+1).replace(/^export\s+/,""),exported:G,start:U,end:H+1}),Y=E6(J,H+1)}}}else Y++}return Z}function k6($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,J++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function E6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function GJ($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=L3(J,G);if(!q)break;try{let U;if(Y0(q.expression))U=Q0(q.expression,Object.keys(Z))(...Object.values(Z));else U=e(q.expression,Z);let W="",z=!1;for(let K of q.cases)if(K.type==="default"){if(!z)W=K.content.trim()}else try{let H;if(K.value&&Y0(K.value))H=Q0(K.value,Object.keys(Z))(...Object.values(Z));else if(K.value)H=e(K.value,Z);if(U===H){W=K.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(q.end),Y=!0}catch(U){let W=U instanceof Error?U.message:String(U),z=$0("Switch",`Error evaluating @switch expression: ${W}`,p.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(q.end);break}}return J}function qJ($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function UJ($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function a0($,Z,X){let{masked:J,scripts:Y}=qJ($);return UJ(WJ(J,Z,X),Y)}function WJ($,Z,X){let J=$;J=GJ(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=q1(J,q+7);if(!U)break;let W=U.endPos,z=w1(J,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=J.slice(W,z),H=U.expression,B=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=O.exec(K))!==null)L.push({pos:w.index,type:"open"});while((w=V.exec(K))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(K))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){B=R.pos;break}}let j;if(B!==-1){let _=K.slice(0,B),O=K.slice(B+5);j=`@if (${H})${O}@else ${_}@endif`}else j=`@if (!(${H}))${K}@endif`;J=J.substring(0,q)+j+J.substring(z+10),Q=!0}}J=R3(J,Z,X),J=D3(J,Z,X),J=w3(J,Z);let Y=()=>{let Q=V5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let U="",W=!1;for(let z of q.branches){if(W)break;if(z.type==="else")U=z.content,W=!0;else try{let K;if(z.condition&&Y0(z.condition))K=Q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)K=e(z.condition,Z);if(K)U=z.content,W=!0}catch(K){U=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${K instanceof Error?K.message:String(K)}`,p.EVALUATION_ERROR),W=!0}}J=J.substring(0,q.start)+U+J.substring(q.end)}catch(U){let W=U instanceof Error?U.message:String(U),z=$0("If",`Error processing @if block: ${W}`,p.EVALUATION_ERROR);J=J.substring(0,q.start)+z+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function y6($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function w3($,Z){let X=$;function J(q,U,W,z){let K=1,H=z,B=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(H<q.length&&K>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),O=j.exec(q),V=_?_.index:1/0,F=O?O.index:1/0;if(V<F)K++,H=V+_[0].length;else if(F<1/0){if(K--,K===0)return F;H=F+O[0].length}else break}return-1}function Y(q,U,W){let z=0,K=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=K.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=H.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((O,V)=>O.pos-V.pos);for(let O of j)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let q=!0;while(q){q=!1;let U=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,z,K,H=X.slice(W+5),B=y6(H);if(B)z=B.value,K=W+5+B.consumed;else K=W+5;let j=J(X,"auth","endauth",K);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(K,j),O=Y(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?G1(`auth?.check && auth?.user?.[${z}]`,Z):G1("auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";X=X.substring(0,W)+F+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let U=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,z,K,H=X.slice(W+6),B=y6(H);if(B)z=B.value,K=W+6+B.consumed;else K=W+6;let j=J(X,"guest","endguest",K);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(K,j),O=Y(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?G1(`!auth?.check || !auth?.user?.[${z}]`,Z):G1("!auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";X=X.substring(0,W)+F+X.substring(j+9),q=!0}}function Q(q,U,W){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[q];if(U)z.push(U);if(W){let K=G1(W,Z);z.push(K)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(q){let U=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!U)return null;return{ability:U[1],type:U[2],id:U[3]?.trim(),paramsEnd:U[0].length}}for(let q of["can","cannot"]){let U=`end${q}`,W=q==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let K=X.match(new RegExp(`@${q}\\s*\\(`));if(!K||K.index===void 0)break;let H=K.index,B=X.slice(H+`@${q}`.length),j=G(B);if(!j)break;let _=H+`@${q}`.length+j.paramsEnd,O=J(X,q,U,_);if(O===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${U} \u2014 the block was skipped.`);break}let V=X.slice(_,O),F=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${U}(?![a-z])`,"g"),D=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],A;while((A=w.exec(V))!==null)T.push({pos:A.index,type:"open"});while((A=R.exec(V))!==null)T.push({pos:A.index,type:"close"});while((A=D.exec(V))!==null)T.push({pos:A.index,type:"elseDirective"});while((A=N.exec(V))!==null)T.push({pos:A.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)F.push(b)}let M=[],k=0;for(let b=0;b<F.length;b++){let C=F[b];if(M.push({content:V.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let g=V.slice(C.pos+`@${W}`.length),x=G(g);if(x){M[M.length-1]={content:V.slice(k,C.pos)},k=C.pos+`@${W}`.length+x.paramsEnd,M.push({content:"",ability:x.ability,type:x.type,id:x.id}),M.pop();let s=F[b+1],c=s?s.pos:V.length;M.push({content:V.slice(k,c),ability:x.ability,type:x.type,id:x.id}),k=c}}else k=C.pos+5}if(k<V.length){let b=M[M.length-1];if(F.length>0&&F[F.length-1].type==="else")M.push({content:V.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:V.slice(k)})}let I=Q(j.ability,j.type,j.id),y=q==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let g=M[C];if(g.isFinalElse){E=g.content,b=!0;break}if(g.ability){let x=Q(g.ability,g.type,g.id);if(q==="can"?x:!x){E=g.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(O+`@${U}`.length),z=!0}}return X}function R3($,Z,X){let J=$;function Y(Q,G,q,U,W){let z=!0;while(z){z=!1;let K=new RegExp(`@${G}\\s*\\(`),H=Q.match(K);if(!H||H.index===void 0)break;let B=H.index,j=q1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,O=w1(Q,G,q,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let V=Q.slice(_,O),F=j.expression,L=-1,w=0,R=0;while(R<V.length){let D=V.indexOf("@",R);if(D===-1)break;let N=V.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=U(F.trim()),N;if(L!==-1){let T=V.slice(0,L),A=V.slice(L+5);N=D?T:A}else N=D?V:"";Q=Q.substring(0,B)+N+Q.substring(O+`@${q}`.length),z=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=$0(W,`Error processing @${G} directive: ${N}`,p.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(O+`@${q}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=G1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=G1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function D3($,Z,X){let J=$,Y="development";function Q(G,q,U,W){let z=new RegExp(`@${q}(?![a-z])`,"g"),K=new RegExp(`@${U}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${U}(?![a-z])`),j=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(j);if(!O)break;let V=O.index,F=V+O[0].length;if(q==="env"){let I=j.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;F+=I[0].length,W=Y===I[2]}let L=1,w=F,R=-1;while(L>0&&w<j.length){z.lastIndex=w,K.lastIndex=w;let I=z.exec(j),y=K.exec(j),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${V} has no matching @${U} \u2014 the block was skipped.`);break}let D=j.substring(F,R),N=-1,T=0,A=0;while(A<D.length){let I=D.indexOf("@",A);if(I===-1)break;let y=D.substring(I);if(H.test(y)){T++,A=I+1;continue}if(B.test(y)){T--,A=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=I;break}A=I+1}let M;if(N!==-1){let I=D.slice(0,N),y=D.slice(N+5);M=W?I:y}else M=W?D:"";let k=`@${U}`.length;j=j.substring(0,V)+M+j.substring(R+k),_=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var N3=new WeakMap;function S6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function R1($,Z){if(!$)return Z?.nonceGenerator?.()??S6();let X=N3.get($);if(!X)X=Z?.nonceGenerator?.()??S6(),N3.set($,X);return X}function xz($){N3.delete($)}function C6($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function M3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${C6($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var zJ={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},A3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},KJ={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},HJ={"default-src":["'none'"],"frame-ancestors":["'none'"]};function gz($){return{enabled:!0,directives:{strict:zJ,moderate:A3,relaxed:KJ,api:HJ}[$]||A3,useNonce:$==="strict",addMetaTag:!0}}function hz($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let q=Array.isArray(G)?G:[],U=[...new Set([...q,...Y])];X[Q]=U}}return X}function P6($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?R1(X,Z):void 0,Y=M3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3273
|
+
${Y}`)}function v6($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function f6($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(Z,Q):void 0;return M3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return R1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=R1(Z,Q);return Y}var BJ={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(X,Q):void 0;return M3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},jJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return R1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function uz(){return[BJ,jJ]}function dz($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function _J($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function mz($,Z){if(!$.enabled)return{};let X=$.useNonce?R1(Z,$):void 0,J=C6($.directives,X);return{[_J($.reportOnly)]:J}}var lz={enabled:!1,reportOnly:!1,directives:A3,useNonce:!1,addMetaTag:!0};import VJ from"crypto";var OJ=40,x6="_token",T3=null;function FJ($=OJ){let Z=VJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return T3=Z,Z}function LJ(){if(!T3)FJ();return T3}function wJ($=x6){let Z=LJ();return`<input type="hidden" name="${$}" value="${Z}">`}function g6($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return wJ(J||x6)})}async function h6($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await RJ(Y,Q,Z,X,J);else Y=await DJ(Y,Q,Z,X,J)}return Y}async function RJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,U=`@end${Q}`,W=$,z=f1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${U}`,"g"),K=[],H=z.exec(W);while(H!==null){let[B,j="",_=""]=H,O=H.index||0;try{let V=j?u6(j):[],F=_.trim(),L=await G(F,V,X,J);K.push({original:B,processed:L,startIndex:O})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${F}`,p.EVALUATION_ERROR),startIndex:O})}H=z.exec(W)}for(let B=K.length-1;B>=0;B--){let{original:j,processed:_}=K[B];W=W.replace(j,_)}return W}async function DJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,U=f1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=U.exec(q);while(z!==null){let[B,j=""]=z,_=z.index||0;try{let O=u6(j),V=await G("",O,X,J);W.push({original:B,processed:V,startIndex:_})}catch(O){let V=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${V}`,p.EVALUATION_ERROR),startIndex:_})}z=U.exec(q)}let K=f1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=K.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${O}`,p.EVALUATION_ERROR),startIndex:j})}H=K.exec(q)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];q=q.replace(j,_)}return q}function u6($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var d6=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,m6=/^[A-Za-z_$][\w$]*$/,NJ=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function AJ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(X.key,"appearance.key"),D1(X.attribute,"appearance.attribute"),D1(X.default,"appearance.default"),D1(J.key,"colorMode.key"),D1(J.attribute,"colorMode.attribute"),D1(J.default,"colorMode.default"),!m6.test(X.key)||!m6.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!d6.test(X.attribute)||!d6.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.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");if(!NJ.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function MJ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function TJ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${MJ($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function IJ($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function l6($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=IJ(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),U=e(`(${q})`,Z),W=TJ(AJ(U));X=X.slice(0,Y.index)+W+X.slice(G+1),J.lastIndex=Y.index+W.length}return X}import kJ from"crypto";function z0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var k3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function EJ($){return{...k3,...$.forms?.classes}}function G$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function f0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function l1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${z0(Z)}"`}function I3($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${z0(`${f0($)}-error`)}"`;return J}function bJ(){return kJ.randomUUID()}function $K($,Z,X,J){let Y=EJ(J),Q=$;return Q=SJ(Q,Z),Q=L5(Q,Z),Q=E3(Q,Z,Y),Q=b3(Q,Z,Y),Q}function L5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=bJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${z0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${z0(Q)}">`;return J}),X}function E3($,Z,X=k3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,U,W="")=>{let z=Q||G||"POST",K=q||U||"",H=U1(W),B=z.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${z0(j)}" action="${z0(K)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3274
|
+
${L5("@csrf",Z)}`,!["GET","POST"].includes(B))_+=`
|
|
3275
|
+
${L5(`@method('${B}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,q,U,W="")=>{let z=Q||G||"",K=q||U||"",H=U1(W),B=O5(z,Z),j=B!==void 0&&B!==null?B:K||"",_=H.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=F5(z,Z),F=H.match(/class=['"]([^'"]+)['"]/i),L=G$(F?F[1]:"",X.input,V,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${z0(O)}" name="${z0(z)}"${l1(H,f0(z))} value="${z0(j)}" class="${L}"${I3(z,V,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let U=U1(G),W=O5(Q,Z)||q.trim(),z=F5(Q,Z),K=U.match(/class=['"]([^'"]+)['"]/i),H=G$(K?K[1]:"",X.input,z,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${z0(Q)}"${l1(U,f0(Q))} class="${H}"${I3(Q,z,U)}${B?` ${B}`:""}>${z0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let U=U1(G),W=O5(Q,Z),z=F5(Q,Z),K=U.match(/class=['"]([^'"]+)['"]/i),H=G$(K?K[1]:"",X.input,z,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,""),j=q;if(W!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(W)?W.some((L)=>String(L)===V):String(W)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${z0(Q)}"${l1(U,f0(Q))} class="${H}"${I3(Q,z,U)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=G===void 0?"1":G,W=G===void 0?f0(Q):`${f0(Q)}-${f0(U)}`,z=U1(q),K=O5(Q,Z),H=K!==void 0&&(Array.isArray(K)?K.some((O)=>String(O)===U):K===!0||String(K)===U),B=z.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${z0(Q)}"${l1(z,W)} value="${z0(U)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=U1(q),W=O5(Q,Z),z=W!==void 0&&W===G,K=U.match(/class=['"]([^'"]+)['"]/i),H=K?K[1]:X.checkInput,B=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${z0(Q)}"${l1(U,`${f0(Q)}-${f0(G)}`)} value="${z0(G)}" class="${H}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=U1(G),U=q.match(/accept=['"]([^'"]+)['"]/i),W=U?U[1]:"",z=q.includes("multiple"),K=F5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=G$(H?H[1]:"",X.input,K,X.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${z0(Q)}"${l1(q,f0(Q))}`,`class="${B}"`];if(W)_.push(`accept="${z0(W)}"`);if(z)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let U=U1(G),W=U.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:X.label,K=U.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${z0(f0(Q))}" class="${z}"${K?` ${K}`:""}>${q}</label>`}),J}function b3($,Z,X=k3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(F5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,U)=>{try{if(U.trim()==="$message"||U.trim()==="message")return c6(Y,Z);if(U.trim().includes("errors.first")||U.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return c6(Y,Z)}let W=U.trim();if(Y0(W)){let z=e(W,Z);return z!==void 0?String(z):W}return W}catch{return U}});return`<div id="${z0(`${f0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function F5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function c6($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function O5($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function U1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var p6={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function ZK($,Z){p6[$]=Z}function y3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function yJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=y3(G),U=p6[q.name];if(!U){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let z=`${$}_confirmation`;q.params=[J[z]]}let W=U(Z,q.params||[],$);if(W)Y.push(q.message||W)}return{field:$,valid:Y.length===0,errors:Y}}function XK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=yJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function SJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((U)=>U.trim()),q=[];for(let U of G){let W=y3(U);switch(W.name){case"required":q.push("required");break;case"email":q.push('type="email"');break;case"url":q.push('type="url"');break;case"numeric":case"integer":if(q.push('type="number"'),W.name==="integer")q.push('step="1"');break;case"min":if(W.params?.[0])q.push(`minlength="${W.params[0]}"`);break;case"max":if(W.params?.[0])q.push(`maxlength="${W.params[0]}"`);break;case"regex":if(W.params?.[0])q.push(`pattern="${W.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var i6={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function JK($){i6[$.name]=$}function CJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=y3(Q),q=i6[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let U=q.validate($,G.params||[],X);if(U!==!0)J.push(U)}return{valid:J.length===0,errors:J}}function YK($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=CJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function QK($,Z){let X=JSON.stringify(Z);return`
|
|
3276
3276
|
<script>
|
|
3277
3277
|
(function() {
|
|
3278
3278
|
const form = document.getElementById('${$}');
|
|
@@ -3324,22 +3324,22 @@ catch { return 'Please enter a valid URL'; } },
|
|
|
3324
3324
|
}
|
|
3325
3325
|
});
|
|
3326
3326
|
})();
|
|
3327
|
-
</script>`.trim()}import
|
|
3328
|
-
`),J=[{obj:Z,indent:-1}];for(let Y of X){let Q=Y.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let q=J[J.length-1].obj,U=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(U){let[,,W,
|
|
3329
|
-
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},
|
|
3327
|
+
</script>`.trim()}import C3 from"path";var w5;async function PJ(){if(w5!==void 0)return w5;try{w5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{w5=null}return w5}var f3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},T0={},d0={},t0={};function zK($){if($)delete T0[$];else for(let Z of Object.keys(T0))delete T0[Z]}function KK(){let $=Object.entries(T0).map(([Z,X])=>({locale:Z,loadedAt:new Date(X.loadedAt),keyCount:s6(X.translations)}));return{size:Object.keys(T0).length,locales:Object.keys(T0),entries:$}}function s6($,Z=0){for(let X of Object.values($))if(Z++,X&&typeof X==="object"&&!Array.isArray(X))Z=s6(X,Z);return Z}function vJ($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function HK($){if(T0[$])return"loaded";return t0[$]||"idle"}function BK($){return t0[$]==="loading"}function jK($){return!!T0[$]}async function fJ($,Z){let{locales:X,parallel:J=!0,priority:Y={},onLocaleLoaded:Q,onComplete:G,onError:q}=$,U=J?X:[...X].sort((W,z)=>(Y[z]||0)-(Y[W]||0));if(J){let W=U.map(async(z)=>{try{await q$(z,Z),Q?.(z)}catch(K){q?.(z,K instanceof Error?K:Error(String(K)))}});await Promise.all(W)}else for(let W of U)try{await q$(W,Z),Q?.(W)}catch(z){q?.(W,z instanceof Error?z:Error(String(z)))}G?.()}function _K($,Z){queueMicrotask(()=>{fJ($,Z).catch((X)=>{if(Z.debug)console.error("Background preload error:",X)})})}async function q$($,Z){if({...f3,...Z.i18n}.cache&&T0[$]){let Y=T0[$],Q=Z.i18n?.cacheMaxAge??0;if(!vJ(Y,Q))return Y.translations}if(d0[$]?.state==="loading")return d0[$].promise;t0[$]="loading";let J=P3($,Z).then((Y)=>{return t0[$]="loaded",delete d0[$],Y}).catch((Y)=>{throw t0[$]="error",d0[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return d0[$]={promise:J,state:"loading"},J}function xJ($){return T0[$]?.translations}async function VK($,Z){let X=xJ($);if(X)return X;return q$($,Z)}async function OK($,Z){if(T0[$])return T0[$].translations;if(d0[$]){if(Z)return Promise.race([d0[$].promise,new Promise((X,J)=>setTimeout(()=>J(Error(`Timeout waiting for locale: ${$}`)),Z))]);return d0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function FK(){return Object.entries(t0).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function LK($){if($)delete d0[$],delete t0[$];else{for(let Z of Object.keys(d0))delete d0[Z];for(let Z of Object.keys(t0))delete t0[Z]}}async function P3($,Z){let X={...f3,...Z.i18n},J=C3.isAbsolute(X.translationsDir)?X.translationsDir:C3.resolve(Z.root||process.cwd(),X.translationsDir);try{let Y=await PJ(),Q=Y?await Y($,{translationsDir:J,defaultLocale:X.defaultLocale,sources:mJ(X.format)}):await gJ($,X,J);if(Q===void 0){if($!==X.defaultLocale)return P3(X.defaultLocale,Z);return{}}let G=Q;if(X.cache)T0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Y){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==X.defaultLocale)return P3(X.defaultLocale,Z);return{}}}async function gJ($,Z,X){let J=C3.join(X,`${$}${hJ(Z.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return uJ(Q);if(Z.format==="json")return JSON.parse(Q);throw Y}catch{return}}}function hJ($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function uJ($){let Z={},X=$.split(`
|
|
3328
|
+
`),J=[{obj:Z,indent:-1}];for(let Y of X){let Q=Y.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let q=J[J.length-1].obj,U=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(U){let[,,W,z]=U,K=W.trim(),H=z.trim();if(H==="")q[K]={},J.push({obj:q[K],indent:G});else q[K]=dJ(H)}}return Z}function dJ($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let X=Number($);if(!Number.isNaN(X)&&$!=="")return X;return $}function mJ($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function lJ($,Z){return q$($,Z)}function cJ($,Z){for(let X of $){let J=X.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10);if(Z===G)return Y[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),q=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=q)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function pJ($,Z={}){return o6($,Z)}function o6($,Z){let X="",J=0;while(J<$.length)if($[J]==="{"){let Y=iJ($,J);if(Y===-1){X+=$[J],J++;continue}let Q=$.slice(J+1,Y);X+=nJ(Q,Z),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")X+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")X+=$[J+1],J+=2;else X+=$[J],J++;else X+=$[J],J++;return X}function iJ($,Z){let X=0;for(let J=Z;J<$.length;J++)if($[J]==="{")X++;else if($[J]==="}"){if(X--,X===0)return J}return-1}function nJ($,Z){let X=sJ($);if(X.length===0)return`{${$}}`;let J=X[0].trim(),Y=Z[J];if(X.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(X[1].trim().toLowerCase()){case"plural":return oJ(Y,X.slice(2).join(","),Z);case"select":return aJ(Y,X.slice(2).join(","));case"selectordinal":return tJ(Y,X.slice(2).join(","));case"number":return $Y(Y,X[2]?.trim());case"date":return ZY(Y,X[2]?.trim());case"time":return XY(Y,X[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function sJ($){let Z=[],X="",J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(Q==="{")J++,X+=Q;else if(Q==="}")J--,X+=Q;else if(Q===","&&J===0)Z.push(X),X="";else X+=Q}if(X)Z.push(X);return Z}function oJ($,Z,X){let J=Number($)||0,Y=x3(Z),Q=`=${J}`;if(Y[Q])return S3(Y[Q],J,X);let G=rJ(J);if(Y[G])return S3(Y[G],J,X);if(Y.other)return S3(Y.other,J,X);return String(J)}function S3($,Z,X){let J=$.replace(/#/g,String(Z));return o6(J,X)}function rJ($){let Z=Math.abs($),X=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(X===1&&J===0)return"one";return"other"}function aJ($,Z){let X=String($||""),J=x3(Z);if(J[X])return J[X];return J.other||String($)}function tJ($,Z){let X=Number($)||0,J=x3(Z),Y=eJ(X);if(J[Y])return J[Y].replace(/#/g,String(X));if(J.other)return J.other.replace(/#/g,String(X));return String(X)}function eJ($){let Z=Math.abs($),X=Z%10,J=Z%100;if(X===1&&J!==11)return"one";if(X===2&&J!==12)return"two";if(X===3&&J!==13)return"few";return"other"}function x3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=X.exec($);while(J!==null)Z[J[1]]=J[2],J=X.exec($);return Z}function $Y($,Z){let X=Number($);if(Number.isNaN(X))return String($);switch(Z){case"integer":return Math.floor(X).toLocaleString();case"percent":return`${(X*100).toFixed(0)}%`;case"currency":return X.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return X.toLocaleString()}}function ZY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return X.toLocaleDateString(void 0,J)}function XY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return X.toLocaleTimeString(void 0,J)}function JY($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function v3($,Z,X=!0,J={}){let Y=$.split("."),Q=Z;for(let q of Y){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return X?$:"";let G=String(Q);if(JY(G))return pJ(G,J);if(G.includes("|")&&"count"in J){let q=Number(J.count),U=G.split("|");G=cJ(U,q)}for(let[q,U]of Object.entries(J)){let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(U))}return G}async function r6($,Z,X,J){let Y=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...f3,...J.i18n},q=await lJ(G.locale,J);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,Y=await n6(Y,Q,async(z,K,H,B,j)=>{try{let _={};if(H)try{let V=[()=>JSON.parse(H),()=>{let F=`{"data":${H}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return B0(H,Z)}];for(let F of V)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return v3(K,q,G.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${K}'): ${_ instanceof Error?_.message:String(_)}`,p.EVALUATION_ERROR)}});let U=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...Y.matchAll(U)];console.warn(`Found ${z.length} @translate matches`),z.forEach((K,H)=>console.warn(`Match ${H}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return Y=await n6(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,K,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let O=`{"data":${H}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return B0(H,Z)}];for(let O of _)try{if(j=O(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return v3(K,q,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${K}'): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR)}}),Y}async function n6($,Z,X){let J=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((U)=>({match:Q,replacement:U}));return J.push(q),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function wK($,Z=!0){return(X,J={})=>{return v3(X,$,Z,J)}}var R5=/<\/?template\b[^>]*>/gi,YY=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function QY($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return YY.test(Z)}function U$($){R5.lastIndex=0;let Z;while((Z=R5.exec($))!==null){if(Z[0].startsWith("</")||QY(Z[0]))continue;let X=Z.index,J=R5.lastIndex,Y=1,Q;while((Q=R5.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:R5.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import G0 from"path";function g3($,Z){let X=0;for(let J=Z;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y===","&&X===0)return J}return-1}function GY($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(J);while(Q){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")")U--;W++}if(U!==0)break;let z=J.substring(q+1,W-1),K=`${X}(${z})`;J=J.substring(0,G)+K+J.substring(W),Y.lastIndex=G+K.length,Q=Y.exec(J)}return J}function qY($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function t6($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q=(K)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===K){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let K=1;while(Q<G&&K>0)if(Z[Q]==="{")K++,Q++;else if(Z[Q]==="}")K--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')q(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3329
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(Y!==0)return;let K=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!J.has(j))X.push(j),J.add(j);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!J.has(j))X.push(j),J.add(j);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))X.push(j),J.add(j)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]);continue}if(Z[Q]==="`"){U();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return X.join(", ")}function e6($,Z=""){let X=t6($).split(",").map((J)=>J.trim()).filter(Boolean);return`
|
|
3330
3330
|
(function() {
|
|
3331
|
-
${
|
|
3331
|
+
${c1("var",X)}
|
|
3332
3332
|
var __destroyHooks = [];
|
|
3333
3333
|
var __origOnDestroy = onDestroy;
|
|
3334
3334
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
3335
3335
|
|
|
3336
3336
|
${$}
|
|
3337
3337
|
${Z}})();
|
|
3338
|
-
`}function
|
|
3338
|
+
`}function $9($,Z){return`
|
|
3339
3339
|
// Register scope variables for STX runtime
|
|
3340
3340
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3341
3341
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
3342
|
-
${
|
|
3342
|
+
${t6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
3343
3343
|
`)}
|
|
3344
3344
|
// #1767: when the bundler renamed a component const that collided with an
|
|
3345
3345
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -3347,7 +3347,7 @@ ${i6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3347
3347
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
3348
3348
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
3349
3349
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
3350
|
-
`}function
|
|
3350
|
+
`}function UY($,Z){let X=$9($,Z),J=`
|
|
3351
3351
|
(function() {
|
|
3352
3352
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
3353
3353
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -3356,29 +3356,29 @@ ${i6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3356
3356
|
} finally {
|
|
3357
3357
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3358
3358
|
}
|
|
3359
|
-
})();`;return J+
|
|
3359
|
+
})();`;return J+e6($,X)+`
|
|
3360
3360
|
} finally {
|
|
3361
3361
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3362
3362
|
}
|
|
3363
|
-
})();`}function
|
|
3364
|
-
`;continue}if(
|
|
3365
|
-
`}}if(b){let
|
|
3366
|
-
`+M;if(E)
|
|
3367
|
-
`+E;return
|
|
3368
|
-
`)})}import*as
|
|
3363
|
+
})();`}function WY($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var a6=0,CK=new V1(500),Z9=new Set;function PK(){Z9.clear()}function zY($){if($.__onceStore instanceof Set)return $.__onceStore;return Z9}async function h3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||G0.join(G0.dirname(X),"partials");if(G&&!G0.isAbsolute(G))G=G0.resolve(process.cwd(),G);let q=GY($,"@partial","@include"),U=zY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let F=O.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=V.exec(q))!==null){let L=F.index,w=L+F[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),T=g3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){V.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=g3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Y0(C)){let c=Q0(C,Object.keys(Z));g=Boolean(c(...Object.values(Z)))}else g=Boolean(e(C,Z));let x=O?!g:g,s="";if(x){let c=W(I,G,X);if(c&&await Bun.file(c).exists())Y.add(c);s=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+s+q.substring(D),V.lastIndex=0}catch(C){let g=C instanceof Error?C.message:String(C),x=U0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+x+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Y0(y))I=Q0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},g=await H(T,C,$,V);E+=g}else if(k)E=await H(k,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+U0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=B0(M,Z)}catch(g){let x=g instanceof Error?g.message:String(g);if(J.debug){let s=U0("Include",`Error parsing includeFirst variables: ${x}`,X,$,V,D);q=q.replace(D,()=>s)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let g of E){let x=W(g,G,X);if(!x)continue;if(await o(x)){let s=await H(g,b,$,V);q=q.replace(D,()=>s),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let g=U0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>g)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=U0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,O,V){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=G0.resolve(O),w=G0.resolve(G0.dirname(V)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=G0.resolve(O,F);else R=G0.resolve(w,F);let D=G0.normalize(R),N=D.startsWith(L+G0.sep)||D===L,T=D.startsWith(w+G0.sep)||D===w,A=!1,M=G0.dirname(w);if(D.startsWith(M+G0.sep)){if(!G0.relative(M,D).split(G0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let z=G0.resolve(X);Q.add(z);function K(_,O,V,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),U0("Include",O,X,V,F)}async function H(_,O={},V,F){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,F);let w=G0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>G0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(x){let s=x instanceof Error?x.message:String(x);return K(_,`Error loading include file ${_}: ${s}`,V,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await import("./chunk-3v9drr1f.js");R=x(R,Z)}if(R&&(J.debug||!B5()&&!n5()))try{let{warnUnbalancedTags:x}=await import("./chunk-e5s2b5z3.js");x(R,L)}catch{}let D=R;try{let{processESImports:x}=await import("./chunk-40zvzck0.js");await x(R,Z,L,J,Y)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=U$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=J1(R);for(let[x,s]of Object.entries(O))k[x]=s;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let x of y){let s=x[1]||"",c=x[2]||"",_0=s.includes("server"),N0=N1(s),A0="";try{let{extractAndStripCssImports:a,renderVendorStyleTags:F0}=await import("./chunk-jn7g22fd.js"),X0=a(c,{filePath:L,projectRoot:process.cwd()});c=X0.code,A0=F0(X0.styles)}catch(a){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,a instanceof Error?a.message:a)}if(N0&&c.trim())c=A1(c);if(!_0)try{let{hasUserImports:a,bundleClientScript:F0}=await import("./chunk-8ksdma43.js");if(a(c))c=await F0(c,L,{projectRoot:process.cwd()})}catch(a){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,a instanceof Error?a.message:a)}let g0=qY(c);if(g0&&!_0){b=`stx_scope_${G0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++a6}`;let a=o0(c),F0=UY(a,b);E+=`${A0}<script data-stx-scoped data-stx-run="always">${F0}</script>
|
|
3364
|
+
`;continue}if(_0)try{let{extractVariables:a}=await import("./chunk-vh7h37mn.js");await a(c,k,L)}catch(a){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,a)}if(!_0&&!g0){let a=s.replace(/\bclient\b/i,"").trim();b=`stx_scope_${G0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++a6}`;let F0=o0(c),X0=$9(F0,b),K1=e6(F0,X0);E+=`${A0}<script data-stx-scoped data-stx-run="always"${a?` ${a}`:""}>${K1}</script>
|
|
3365
|
+
`}}if(b){let x=WY(D,b);if(D=x.html,x.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await h3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-vcw2ft8z.js"),g=C(D,k,L);if(g=a0(g,k,L),g=_1(g,k,L),M)g+=`
|
|
3366
|
+
`+M;if(E)g+=`
|
|
3367
|
+
`+E;return g}catch(R){let D=R instanceof Error?R.message:String(R);return K(_,`Error processing include ${_}: ${D}`,V,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,O=_+j[0].length-1,V=1,F=O+1;while(F<q.length&&V>0){if(q[F]==="(")V++;else if(q[F]===")")V--;F++}if(V!==0)break;let L=q.substring(_,F),w=q.substring(O+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=g3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=B0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,U0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(F),B.lastIndex=0}return q}function u3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),K=U.match(z);if(!K||K.index===void 0)break;let H=K.index,B=K[1],j=H+K[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,F=j,L=-1;while(V>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(O),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)V++,F=T+(D[0].length||1);else if(A<1/0){if(V--,V===0){L=A;break}F=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function d3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3368
|
+
`)})}import*as m3 from"path";async function X9($,Z,X=""){if(m3.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return Y9($,Z,X,"@js","@endjs")}async function J9($,Z,X=""){if(m3.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return Y9($,Z,X,"@ts","@endts")}async function Y9($,Z,X,J,Y){let Q=$,G=f1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:z,index:K}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=z.trim();if(J==="@ts")_=_.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 V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
|
|
3369
3369
|
${_}
|
|
3370
3370
|
${F}
|
|
3371
|
-
`,R=Function(...B,L)(...j);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let B=H instanceof Error?H.message:String(H),j=
|
|
3371
|
+
`,R=Function(...B,L)(...j);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let B=H instanceof Error?H.message:String(H),j=U0(`${J} Directive`,`Error executing code: ${B}`,X,$,K,W);console.error(j),Q=Q.replace(W,"")}return Q}var KY=1000,HY=!1;function BY($,Z){let X=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index+Q[0].length,q=Q.index+Q[0].indexOf("("),U=W0($,"(",")",q);if(U===-1)continue;let W=$.slice(G,U).trim();if(!W)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let K;try{let H=B0(W,Z);if(!H||typeof H!=="object")continue;K=JSON.stringify(H)}catch{continue}J+=$.slice(Y,G)+K,Y=U,X.lastIndex=U}return Y===0?$:J+$.slice(Y)}function jY($,Z){let X=/@component\s*\(/g,J=$,Y,Q=[];while((Y=X.exec(J))!==null){let G=Y.index,q=G+Y[0].length-1,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)continue;let z=J.substring(q+1,W),K=W+1,H=z.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let B=H[1],j=z.slice(H[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let O=j.slice(_[0].length).trim();if(!O)continue;try{let V=B0(O,Z),F=JSON.stringify(V),L=`@component('${B}', ${F})`;Q.push({start:G,end:K,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];J=J.substring(0,q)+W+J.substring(U)}return J}function W$($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(J))!==null){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1,z=null,K=!1;while(W<J.length&&U>0){let j=J[W];if(K){K=!1,W++;continue}if(j==="\\"&&z){K=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")U++;else if(j===")"){if(U--,U===0)break}W++}if(U!==0)break;let H=J.substring(q+1,W),B=X(H);J=J.substring(0,G)+B+J.substring(W+1)}return J}function _Y($,Z){let X=$;return X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return J}),X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,Q)=>{try{let G=Object.keys(Z),q=Object.values(Z);C5(Q);let W=Q0(Q,G)(...q),z=JSON.stringify(W);if(z===void 0){if(!P5(Q).some((B)=>!(B in Z)))return"";return J}let K=Buffer.from(z,"utf8").toString("base64");return`__stx_${Y}="${K}"`}catch(G){return J}}),X}var z$="<!--__STX_BREAK__-->",K$="<!--__STX_CONTINUE__-->";function VY($,Z){let X=$;return X=W$(X,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Y0(Q)){let q=Q0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?z$:""}catch{return""}}),X=W$(X,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Y0(Q)){let q=Q0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?K$:""}catch{return""}}),X}function OY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,z$),Z=Z.replace(/@continue(?!\()/g,K$),Z}function Q9($){let Z=$.includes(z$),X=Z?$.substring(0,$.indexOf(z$)):$;return{hasBreak:Z,content:X}}function G9($){let Z=$.includes(K$),X=Z?$.substring(0,$.indexOf(K$)):$;return{hasContinue:Z,content:X}}function U9($){let Z=$;return Z=W$(Z,"@break",(X)=>{let J=X.trim();if(!v5(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=W$(Z,"@continue",(X)=>{let J=X.trim();if(!v5(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function FY($){let Z=/@forelse\s*\(/g,X,J=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((z,K)=>z.pos-K.pos);let q=[],U=0;for(let z of J)U+=z.delta,q.push({pos:z.pos,depth:U});function W(z){let K=0,H=q.length-1,B=0;while(K<=H){let j=K+H>>1;if(q[j].pos<=z)B=q[j].depth,K=j+1;else H=j-1}return B}while((X=Z.exec($))!==null){if(W(X.index)>0)continue;let z=X.index,K=X.index+X[0].length-1,H=1,B=K+1,j=-1;while(B<$.length&&H>0){if($[B]==="(")H++;else if($[B]===")"){if(H--,H===0){j=B;break}}B++}if(j===-1)continue;let _=$.substring(K+1,j),O=W9(_);if(!O)continue;let{arrayExpr:V,itemVar:F}=O,L=j+1,w=1,R=L,D=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){D.lastIndex=R,N.lastIndex=R;let E=D.exec($),b=N.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let A=$.substring(L,T),M=T+11,k=-1,I=0,y=0;while(y<A.length){let E=A.indexOf("@",y);if(E===-1)break;let b=A.substring(E);if(/^@forelse\s*\(/.test(b))I++,y=E+1;else if(b.startsWith("@endforelse"))I--,y=E+11;else if(I===0&&b.startsWith("@empty")){if(A.length<=E+6||!/[a-z]/i.test(A[E+6])){k=E;break}y=E+1}else y=E+1}if(k===-1)continue;return{start:z,end:M,arrayExpr:V,itemVar:F,foreachContent:A.substring(0,k),emptyContent:A.substring(k+6)}}return null}function q9($,Z){let X=$;while(!0){let J=FY(X);if(!J)break;let{start:Y,end:Q,arrayExpr:G,itemVar:q,foreachContent:U,emptyContent:W}=J;try{let z;if(Y0(G))z=Q0(G,Object.keys(Z))(...Object.values(Z));else z=e(G,Z);let K;if(!Array.isArray(z)||z.length===0)K=W;else K=`@foreach (${G} as ${q})${U}@endforeach`;X=X.substring(0,Y)+K+X.substring(Q)}catch(z){let K=z instanceof Error?z.message:String(z),H=$0("Forelse",`Error in @forelse(${G} as ${q}): ${K}`,p.EVALUATION_ERROR);X=X.substring(0,Y)+H+X.substring(Q)}}return X}function W9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let X=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!X)return null;let J=X[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=X[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function z9($,Z,X,J){let Y=$;Y=q9(Y,Z);function Q(U){let W=/@foreach\s*\(/g,z;while((z=W.exec(U))!==null){let K=z.index,H=z.index+z[0].length-1,B=1,j=H+1,_=-1;while(j<U.length&&B>0){if(U[j]==="(")B++;else if(U[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let O=U.substring(H+1,_),V=W9(O);if(!V)continue;let F=K,{arrayExpr:L,itemVar:w}=V,R=_+1,D=1,N=R,T=/@foreach\s*\(/g,A=/@endforeach/g;while(D>0&&N<U.length){T.lastIndex=N,A.lastIndex=N;let M=T.exec(U),k=A.exec(U);if(!k)break;if(M&&M.index<k.index)D++,N=M.index+M[0].length;else{if(D--,D===0){let I=U.substring(R,k.index),y=k.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:I}}N=k.index+11}}}return null}function G(U,W){let z=U;while(!0){let K=Q(z);if(!K)break;let{start:H,end:B,arrayExpr:j,itemVar:_,content:O}=K;try{let V=j.trim(),F;if(Y0(V))F=Q0(V,Object.keys(W))(...Object.values(W));else F=e(V,W);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${V}) in ${X}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=$0("Foreach",`Error in @foreach: ${V} is not iterable`,p.TYPE_ERROR);z=z.substring(0,H)+k+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??HY,R=_.trim(),D=null,N,T=!1;if(R.includes("=>")){let k=R.split("=>").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])D=k[0],N=k[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])N=k[0],D=k[1],T=!0;else N=R}else N=R;let A="",M=F;for(let k=0;k<M.length;k++){let I=M[k],y={index:k,iteration:k+1,first:k===0,last:k===M.length-1,count:M.length},E={...W,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((s)=>s.trim());if(Array.isArray(I))x.forEach((s,c)=>{if(s)E[s]=I[c]});else E[N]=I}else E[N]=I;if(D)if(!T&&L&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[N]=I[1];else E[D]=k;let b=VY(O,E),C=G9(b);if(C.hasContinue){A+=C.content;continue}let g=Q9(b);if(g.hasBreak){A+=g.content;break}if(b=q9(b,E),b=G(b,E),b=a0(b,E,X),b=OY(b),g=Q9(b),g.hasBreak){A+=g.content;break}if(C=G9(b),C.hasContinue){A+=C.content;continue}b=_1(b,E,X),b=_Y(b,E),b=jY(b,E),b=BY(b,E),A+=b}z=z.substring(0,H)+A+z.substring(B)}catch(V){let F=$0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,p.EVALUATION_ERROR);z=z.substring(0,H)+F+z.substring(B)}}return z}Y=G(Y,Z),Y=H9(Y,Z,X,J);let q=J?.loops?.maxWhileIterations??KY;return Y=RY(Y,Z,q),Y}function K9($){return v5($)}function H9($,Z,X,J){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=q+G[0].length-1,W=W0(Y,"(",")",U);if(W===-1)break;let z=Y.slice(U+1,W),K=W+1,H=Q$(Y.slice(q),"for","endfor");if(H.length===0)break;let B=H[0].content,j=q+H[0].end;if(!K9(z)){let _=$0("For",`Unsafe expression in @for: ${z}`,p.UNSAFE_EXPRESSION);Y=Y.substring(0,q)+_+Y.substring(j),Q=!0;continue}try{let _=LY(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&O){let D=wY({forExpr:z,content:B,iterVarNames:_,context:Z,filePath:X,options:J});Y=Y.substring(0,q)+D+Y.substring(j),Q=!0;continue}let V=Object.keys(Z),F=Object.values(Z),L=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,N)=>{return`\${${N}}`});L=U9(L);let R=Function(...V,`
|
|
3372
3372
|
let result = '';
|
|
3373
|
-
for (${
|
|
3373
|
+
for (${z}) {
|
|
3374
3374
|
result += \`${L}\`;
|
|
3375
3375
|
}
|
|
3376
3376
|
return result;
|
|
3377
|
-
`)(...F);Y=Y.substring(0,q)+R+Y.substring(j),Q=!0}catch(_){let
|
|
3377
|
+
`)(...F);Y=Y.substring(0,q)+R+Y.substring(j),Q=!0}catch(_){let O=$0("For",`Error in @for(${z}): ${_ instanceof Error?_.message:String(_)}`,p.EVALUATION_ERROR);Y=Y.substring(0,q)+O+Y.substring(j),Q=!0}}return Y}function LY($){let Z=$.trim(),X=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(X){let Q=X[1];return Q.slice(1,-1).split(",").map((q)=>{let U=q.trim();if(!U)return"";let W=U.indexOf(":");if(W>=0&&Q.startsWith("{")){let H=U.slice(W+1).trim(),B=H.indexOf("=");return(B>=0?H.slice(0,B):H).trim()}let z=U.indexOf("="),K=(z>=0?U.slice(0,z):U).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function wY($){let{forExpr:Z,content:X,iterVarNames:J,context:Y,filePath:Q,options:G}=$,q=Object.keys(Y),U=Object.values(Y),W=Function(...q,"__pushIter",`
|
|
3378
3378
|
for (${Z}) {
|
|
3379
3379
|
__pushIter([${J.join(", ")}])
|
|
3380
3380
|
}
|
|
3381
|
-
`),
|
|
3381
|
+
`),z=[];W(...U,(B)=>{z.push(B)});let K=Q??"inline.stx",H="";for(let B of z){let j={...Y};J.forEach((O,V)=>{j[O]=B[V]});let _=H9(X,j,Q,G);_=a0(_,j,K),_=_1(_,j,K),H+=_}return H}function RY($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=G+Q[0].length-1,U=W0(J,"(",")",q);if(U===-1)break;let W=J.slice(q+1,U),z=Q$(J.slice(G),"while","endwhile");if(z.length===0)break;let K=z[0].content,H=G+z[0].end;if(!K9(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,p.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(H),Y=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),_=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(F,L)=>{return`\${${L}}`});_=U9(_);let V=Function(...B,`
|
|
3382
3382
|
let result = '';
|
|
3383
3383
|
let maxIterations = ${X}; // Configurable safety limit
|
|
3384
3384
|
let counter = 0;
|
|
@@ -3390,31 +3390,31 @@ ${i6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3390
3390
|
result += '<!-- [While Error [1104]]: Maximum iterations (${X}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3391
3391
|
}
|
|
3392
3392
|
return result;
|
|
3393
|
-
`)(...j);J=J.substring(0,G)+
|
|
3394
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${
|
|
3395
|
-
`)}}}return Q}async function
|
|
3393
|
+
`)(...j);J=J.substring(0,G)+V+J.substring(H),Y=!0}catch(B){let j=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,p.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(H),Y=!0}}return J}function DY($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function B9($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return DY(J,Q||"_method")})}async function j9($,Z,X,J,Y){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((q)=>q.timing===Y);if(G.length===0)return Q;for(let q of G){if(!q.name||typeof q.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",q);continue}try{let U=await q.handler(Q,Z,X,J);if(typeof U==="string")Q=U;else if(J.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(U){if(J.debug)console.error(`Error in middleware ${q.name}:`,U);if(J.debug){let W=U0("Middleware",`Error in middleware '${q.name}': ${U instanceof Error?U.message:String(U)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
3394
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${P$(W)}</div>
|
|
3395
|
+
`)}}}return Q}async function _9($,Z,X,J){return j9($,Z,X,J,"before")}async function V9($,Z,X,J){return j9($,Z,X,J,"after")}W5();W5();function O9($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?B0(Y,{}):{};return l3(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var m0={patterns:[],exact:{}};function JH($,Z){if(!m0.exact[$])m0.exact[$]=[];m0.exact[$].push(Z)}function YH($,Z){let X=typeof $==="string"?new RegExp($):$;m0.patterns.push({pattern:X,callback:Z})}async function F9($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(m0.exact[$])for(let J of m0.exact[$])await Promise.resolve(J(Z,$));if(m0.exact[X])for(let J of m0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of m0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function QH(){m0.patterns=[],m0.exact={}}var NY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),AY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function MY($){let Z=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=X.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=J.index,G=Q+J[0].length,q=J[1].toLowerCase();if(J[0].endsWith("/>")||AY.has(q)){Z.push([Q,G]);continue}let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${U}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=G;let z=1,K=G,H;while((H=W.exec($))!==null)if(H[0].startsWith("</")){if(z--,z===0){K=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))z++;Z.push([Q,K])}return Z}function w9($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>w9(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function R9($,Z){if(!/:[\w-]+=/.test($))return $;let X=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=J.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...MY($));function G(W){return Y.some(([z,K])=>W>=z&&W<K)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,U=[];while((Q=q.exec(X))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let K=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,B=z,j=!1;while((H=K.exec(z))!==null){let _=H[1],O=H[2];if(L9(_))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),F=Object.values(Z),L=O.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!V.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let R=Function(...V,`return (${O})`)(...F);if(_==="class"){let D=w9(R);if(D){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${D}"`);else B=B.replace(H[0],` class="${D}"`)}else B=B.replace(H[0],"");j=!0;continue}if(NY.has(_)){if(R)B=B.replace(H[0],` ${_}`);else B=B.replace(H[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)B=B.replace(H[0],"");else{let D=String(R).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");B=B.replace(H[0],` ${_}="${D}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",V=`<${Q[1]}${B}${_}>`;U.push({start:Q.index,end:Q.index+W.length,replacement:V})}}for(let W=U.length-1;W>=0;W--){let{start:z,end:K,replacement:H}=U[W];X=X.slice(0,z)+H+X.slice(K)}return X}var TY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),IY=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 M1($,Z){let X=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;X.lastIndex=Z;let J=X.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&TY.has(J[1]),Q=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function kY($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let q=Q.exec($),U=G.exec($);if(!U)return-1;if(q&&q.index<U.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return U.index+U[0].length;Y=U.index+U[0].length}}return-1}function i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=kY($,Z.tag,Z.end);if(X===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:X,innerHTML:$.slice(Z.end,X-`</${Z.tag}>`.length)}}function D9($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function p1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function W1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${X}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${X}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${X}(?=\\s|$|>|/)`,"g"),"")}function z1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function EY($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function bY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=p1(J.attrs,"v-for");if(Y===null){X=J.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){X=J.end;continue}let G=Q[1].trim(),q=Q[2].trim(),U;if(G.includes(",")){let O=G.split(",").map((L)=>L.trim()),V=O[0],F=O[1];U=`${q} as ${F} => ${V}`}else U=`${q} as ${G}`;let W=W1(J.attrs,"v-for"),z=W1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),K=i0(Z,J),H=Z.slice(K.outerStart,K.outerEnd),B=z1(H,{...J,start:0,end:J.end-J.start},z),j=`@foreach(${U})
|
|
3396
3396
|
`,_=`${j}${B}
|
|
3397
|
-
@endforeach`;Z=Z.slice(0,
|
|
3398
|
-
${_.element}`);else if(_.type==="else-if")
|
|
3399
|
-
${_.element}`);else
|
|
3400
|
-
${_.element}`);
|
|
3401
|
-
`),B=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+H+Z.slice(j),X=B+H.length}return Z}function
|
|
3402
|
-
${
|
|
3403
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function
|
|
3404
|
-
|
|
3405
|
-
`)}function
|
|
3406
|
-
`)})}else Z.push({selector:`@${
|
|
3397
|
+
@endforeach`;Z=Z.slice(0,K.outerStart)+_+Z.slice(K.outerEnd),X=K.outerStart+j.length}return Z}function yY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=p1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=i0(Z,J),q=W1(J.attrs,"v-if"),U=z1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},q);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:U,parsedTag:J});let W=G.outerEnd,z=!0;while(z){let _=Z.slice(W).match(/^\s*/),O=_?_[0].length:0,V=M1(Z,W+O);if(!V){z=!1;break}let F=p1(V.attrs,"v-else-if"),L=D9(V.attrs,"v-else");if(F!==null){let w=i0(Z,V),R=W1(V.attrs,"v-else-if"),D=z1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else-if",expr:F,outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:V}),W=w.outerEnd}else if(L){let w=i0(Z,V),R=W1(V.attrs,"v-else"),D=z1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:V}),z=!1}else z=!1}let K=[];for(let _ of Q)if(_.type==="if")K.push(`@if(${_.expr})
|
|
3398
|
+
${_.element}`);else if(_.type==="else-if")K.push(`@elseif(${_.expr})
|
|
3399
|
+
${_.element}`);else K.push(`@else
|
|
3400
|
+
${_.element}`);K.push("@endif");let H=K.join(`
|
|
3401
|
+
`),B=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+H+Z.slice(j),X=B+H.length}return Z}function SY($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function CY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=Y.match(G);while(q){Q=!0;let z=q[1],K=q[2],H=q[3];Y=Y.replace(q[0],""),Y+=` :${z}="${H}" @update:${z}="${H} = $event"`,q=Y.match(G)}if(Q){let z=i0(Z,J),K=Z.slice(z.outerStart,z.outerEnd),H=z1(K,{...J,start:0,end:J.end-J.start},Y);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),X=z.outerStart+H.length;continue}let U=p1(J.attrs,"v-model");if(U===null){X=J.end;continue}if(IY.has(J.tag)){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${U}"`,K=i0(Z,J),H=Z.slice(K.outerStart,K.outerEnd),B=z1(H,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,K.outerStart)+B+Z.slice(K.outerEnd),X=K.outerStart+B.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${U}" @update:modelValue="${U} = $event"`;let K=i0(Z,J),H=Z.slice(K.outerStart,K.outerEnd),B=z1(H,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,K.outerStart)+B+Z.slice(K.outerEnd),X=K.outerStart+B.length}}return Z}function PY($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function vY($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function fY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=p1(J.attrs,"v-html");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=i0(Z,J),G=W1(J.attrs,"v-html"),q=J.selfClosing?" /":"",U=`<${J.tag}${G}${q}>{!! ${Y} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function xY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=p1(J.attrs,"v-text");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=i0(Z,J),G=W1(J.attrs,"v-text"),q=J.selfClosing?" /":"",U=`<${J.tag}${G}${q}>{{ ${Y} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function gY($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function hY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;if(!D9(J.attrs,"v-once")){X=J.end;continue}let Y=W1(J.attrs,"v-once"),Q=i0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),U=`@once
|
|
3402
|
+
${z1(G,{...J,start:0,end:J.end-J.start},Y)}
|
|
3403
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function uY($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function dY($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function N9($){if(!EY($))return $;let Z=$;return Z=bY(Z),Z=yY(Z),Z=hY(Z),Z=PY(Z),Z=vY(Z),Z=CY(Z),Z=SY(Z),Z=dY(Z),Z=fY(Z),Z=xY(Z),Z=gY(Z),Z=uY(Z),Z}function H$($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var c3=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"]),mY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function A9($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=X?X[1]:$,Y=e(J,Z);if(Y&&typeof Y==="string")return Y;let Q=J.trim();return c3.has(Q)?Q:null}function M9($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function T9($,Z,X){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(mY.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${X}</${$}>`}async function I9($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],U;while((U=G.exec(Q))!==null)q.push({full:U[0],expr:U[1],attrs:U[2],slotContent:U[3],index:U.index});for(let W=q.length-1;W>=0;W--){let z=q[W];try{let K=A9(z.expr,Z);if(!K||typeof K!=="string"){let F=`<!-- dynamic component: could not resolve "${H$(M9(z.expr))}" -->`;Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length);continue}if(c3.has(K)){let F=T9(K,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length);continue}let H=z.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(H))!==null){let F=_[1]||_[2],L=_[3];if(_[1])try{B[F]=e(L,Z)}catch{B[F]=L}else B[F]=L}let O=J.componentsDir||"components",V=await T1(K,B,z.slotContent,O,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,z.index)+V+Q.slice(z.index+z.full.length)}catch(K){let H=K instanceof Error?K.message:String(K),B=`<!-- dynamic component error: ${H$(H)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q=await lY(Q,Z,X,J,Y),Q}async function lY($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],U;while((U=G.exec(Q))!==null)q.push({full:U[0],expr:U[1],attrs:U[2],index:U.index});for(let W=q.length-1;W>=0;W--){let z=q[W];try{let K=A9(z.expr,Z);if(!K||typeof K!=="string"){let j=`<!-- dynamic component: could not resolve "${H$(M9(z.expr))}" -->`;Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}if(c3.has(K)){let j=T9(K,z.attrs,"");Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}let H=J.componentsDir||"components",B=await T1(K,{},"",H,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}catch(K){let H=K instanceof Error?K.message:String(K),B=`<!-- dynamic component error: ${H$(H)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q}function k9($,Z=""){let X=`${$}${Z}`,J=0;for(let Y=0;Y<X.length;Y++){let Q=X.charCodeAt(Y);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function E9($,Z,X={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let q=p3($),U=[],W=new Map;if(Q)for(let z of q){let K=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(K){let H=K[1],B=`${Z}_${H}`;W.set(H,B)}}for(let z of q){let K=b9(z,Z,J,Y,W,G);U.push(K)}return U.join(`
|
|
3404
|
+
|
|
3405
|
+
`)}function p3($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",Q=!1,G="";for(let q=0;q<X.length;q++){let U=X[q];if(U==="@"&&J===0)Q=!0;if(U==="{")J++;else if(U==="}"){if(J--,J===0){if(Q){G+=U;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,z,K,H]=W;if(z==="keyframes")Z.push({selector:`@keyframes ${K.trim()}`,declarations:H.trim()});else if(z==="media"||z==="supports"||z==="container"){let B=p3(H);Z.push({selector:`@${z} ${K.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
|
|
3406
|
+
`)})}else Z.push({selector:`@${z} ${K.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=U;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(Q)G+=U;else Y+=U}return Z}function b9($,Z,X,J,Y,Q){let{selector:G,declarations:q}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(z)||z} { ${q} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let K=p3(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>b9(H,Z,X,J,Y,Q)).join(`
|
|
3407
3407
|
`);return`${G} {
|
|
3408
|
-
${
|
|
3409
|
-
}`}return`${G} { ${q} }`}let U=
|
|
3410
|
-
${J}${$.slice(X)}`}function
|
|
3411
|
-
${Q[0]}`+G+$.slice(X+Y.length)}function
|
|
3412
|
-
${Z[0]}${J.slice(Y)}`}var
|
|
3413
|
-
<meta name="stx-build" content="${Z}">${$.slice(J)}`}var
|
|
3414
|
-
${$.slice(Z)}`}function
|
|
3415
|
-
`),
|
|
3416
|
-
`),F=q.map((M)=>{if(M.src)return` <script ${
|
|
3417
|
-
`),L=
|
|
3408
|
+
${K}
|
|
3409
|
+
}`}return`${G} { ${q} }`}let U=cY(G,Z,X,J),W=q;for(let[z,K]of Y)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),K);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${U} { ${W} }`}function cY($,Z,X,J){let Y=$.split(",").map((G)=>G.trim()),Q=[];for(let G of Y){if(G.startsWith(":host")){if(J)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let q=X?`${X} .${Z}`:`.${Z}`;Q.push(`${q} ${G}`);let U=pY(G,Z);if(U)Q.push(X?`${X} ${U}`:U)}return Q.join(", ")}function pY($,Z){let X=0,J=$.length;for(let U=0;U<$.length;U++){let W=$[U];if(W==="["||W==="(")X++;else if(W==="]"||W===")")X--;else if(X===0&&(W===" "||W===">"||W==="+"||W==="~")){J=U;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(W==="["||W==="(")q++;else if(W==="]"||W===")")q--;else if(X===0&&q===0&&W===":"){G=U;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var i3=String.raw`(?<![\w-])scoped(?![\w-])`,iY=new RegExp(`<style\\s+[^>]*${i3}`,"i");function S9($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let J=X.trim();if(Z.has(J))return"";return Z.add(J),X})}function B$($,Z){if(!iY.test($))return{html:$,hasScoped:!1};let X=k9(Z),J=`data-v-${X}`,Y=$,Q=new RegExp(`<style\\s+([^>]*${i3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Y=Y.replace(Q,(q,U,W)=>{G=!0;let z=nY(W,J),K=U.replace(new RegExp(i3,"gi"),"").trim(),H=K?` ${K}`:"";return`<style data-stx-scoped="${X}"${H}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return Y=oY(Y,J),{html:Y,hasScoped:!0}}function nY($,Z){return E9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var sY=($)=>`\x00stx-scope-mask-${$}\x00`,y9=/\u0000stx-scope-mask-(\d+)\u0000/g;function oY($,Z){let X=l0($,(Y,Q)=>{let G=X1(Y,Q);return G>Q?G:C1(Y,Q)},(Y,Q)=>sY(Q)),J=rY(X.output,Z);return y9.lastIndex=0,J.replace(y9,(Y,Q)=>X.tokens[Number(Q)])}function rY($,Z){let X=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,Q)=>{if(X.has(Y.toLowerCase()))return J;if(J.includes(Z))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(Q)return J.replace(`<${Y}${Q}`,`<${Y} ${Z}${Q}`);if(J.endsWith("/>"))return`<${Y} ${Z} />`;return`<${Y} ${Z}>`})}var FH="data-stx-color-mode-boot",LH="__STX_COLOR_MODE__",aY=new Set(["light","dark","auto","system"]),tY=new Set(["auto","system"]),eY=/^[a-z][\w:-]*$/i,$Q=/^[\w-]+$/;function ZQ($){let Z=$.storageKey??"stx-color-mode",X=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!aY.has(X))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!$Q.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!eY.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!tY.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:X==="system"?"auto":X,darkClass:J,attribute:Y,autoValue:Q}}function XQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function s3($={}){let Z=ZQ($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${XQ(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function C9($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let X=n3($);if(X===null)return $;let J=s3(Z);return`${$.slice(0,X)}
|
|
3410
|
+
${J}${$.slice(X)}`}function n3($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(X));if(J)X+=J[0].length;return X}var JQ=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),YQ=/<meta\b[^>]*\bcharset\b[^>]*>/i;function QQ($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length,J=$.toLowerCase().indexOf("</head>",X),Y=$.slice(X,J===-1?$.length:J),Q=YQ.exec(Y);if(!Q||Y.slice(0,Q.index).trim()==="")return $;let G=Y.slice(0,Q.index)+Y.slice(Q.index+Q[0].length);return $.slice(0,X)+`
|
|
3411
|
+
${Q[0]}`+G+$.slice(X+Y.length)}function P9($){return GQ(QQ($))}function GQ($){let Z=JQ.exec($);if(!Z)return $;let X=n3($);if(X===null)return $;if(Z.index<=X||$.slice(X,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=n3(J);if(Y===null)return $;return`${J.slice(0,Y)}
|
|
3412
|
+
${Z[0]}${J.slice(Y)}`}var RH="stx-build",DH="X-STX-Build",j$=null;function qQ(){if(j$===null)j$=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return j$}function NH($){j$=$}function v9($,Z=qQ()){if($.includes('name="stx-build"'))return $;let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let J=X.index+X[0].length;return`${$.slice(0,J)}
|
|
3413
|
+
<meta name="stx-build" content="${Z}">${$.slice(J)}`}var f9="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",_$="data-stx-html-attrs",V$="data-stx-html-class",x9=/^[A-Za-z_:][\w:.-]*$/;function e0($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function UQ($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function n1($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function i1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${e0(String(J))}"`).join(" ")}function WQ($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[q,U]of Object.entries($||{})){if(U==null)continue;let W=q.trim();if(!x9.test(W))continue;let z=W.toLowerCase();if(z==="lang"){Q=String(U);continue}if(z==="class"){Y=String(U).trim();continue}X.push(` ${W}="${e0(String(U))}"`),J.push(W)}let G=` lang="${e0(Q)}"`;if(Y)G+=` class="${e0(Y)}"`;if(G+=X.join(""),Y)G+=` ${V$}="${e0(Y)}"`;if(J.length)G+=` ${_$}="${e0(J.join(" "))}"`;return G}function g9($={},Z={}){let X={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);X.class=J.join(" ")}return X}function h9($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let X=$.match(/<html\b([^>]*)>/i);if(!X)return $;let J={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(X[1]))!==null){let z=G[1];if(!(z in J))Y.push(z);J[z]=G[2]??G[3]??G[4]??""}let q=[],U=[];for(let[z,K]of Object.entries(Z)){if(K==null)continue;let H=z.trim();if(!x9.test(H))continue;let B=H.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(K).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(H in J))Y.push(H);if(J[H]=String(K),B!=="lang")U.push(H)}if(q.length){if(!(V$ in J))Y.push(V$);J[V$]=q.join(" ")}if(U.length){if(!(_$ in J))Y.push(_$);J[_$]=U.join(" ")}let W=Y.map((z)=>` ${z}="${e0(J[z])}"`).join("");return $.replace(X[0],()=>`<html${W}>`)}function u9($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${f9}
|
|
3414
|
+
${$.slice(Z)}`}function zQ($){let Z=[],X=0;while(X<$.length){let Q=$.slice(X),G=Q.match(/^\s+/);if(G){X+=G[0].length;continue}if(Q.startsWith("<!--")){let K=$.indexOf("-->",X);if(K===-1)break;X=K+3;continue}let q=Q.match(/^<script\b[^>]*>/i);if(q){let K=$.toLowerCase().indexOf("</script>",X+q[0].length);if(K===-1)break;X=K+9;continue}let U=Q.match(/^<link\b[^>]*>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}let W=Q.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),X+=W[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),X+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",Y=0;while(Y<$.length&&Y<X){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U&&Z.includes(U[0])){Y+=U[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function KQ($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:q=[],headRaw:U="",htmlAttrs:W={},bodyClass:z="",bodyAttrs:K={}}=Z,H=X.title||J,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(Q.map(n1).filter(Boolean)),O=[...B.filter((M)=>!j.has(n1(M))),...Q].map((M)=>{return` <meta ${i1(M)}>`}).join(`
|
|
3415
|
+
`),V=G.map((M)=>{return` <link ${i1(M)}>`}).join(`
|
|
3416
|
+
`),F=q.map((M)=>{if(M.src)return` <script ${i1(M,(k)=>k==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
|
|
3417
|
+
`),L=WQ(W,Y),w=Object.entries(K).map(([M,k])=>` ${M}="${e0(String(k))}"`).join(""),R=z?` class="${e0(z)}"`:"",{body:D,hoisted:N}=zQ($),T=[O,X.colorMode?` ${s3(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:UQ(H)}</title>`,` ${f9}`,V,F,U?` ${U}`:"",...(X.styles||[]).map((M)=>` ${M}`),...N.map((M)=>` ${M}`),...(X.headScripts||[]).map((M)=>` ${M}`),X.headStack||""].filter(Boolean),A=[D,...(X.bodyScripts||[]).map((M)=>M),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3418
3418
|
<html${L}>
|
|
3419
3419
|
<head>
|
|
3420
3420
|
${T.join(`
|
|
@@ -3424,9 +3424,9 @@ ${T.join(`
|
|
|
3424
3424
|
${A.join(`
|
|
3425
3425
|
`)}
|
|
3426
3426
|
</body>
|
|
3427
|
-
</html>`}function
|
|
3427
|
+
</html>`}function o3($){let Z=0;while(Z<$.length){let X=$.slice(Z),J=X.match(/^\s+/);if(J){Z+=J[0].length;continue}if(X.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let Q=`</${Y[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+Y[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(X)||/^<html[\s>]/i.test(X)}return!1}function r3($){return o3($)}function d9($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,q=$.slice(0,X),U=[];for(let W of J){let z=n1(W);if(z&&q.includes(z))continue;U.push(` <meta ${i1(W)}>`)}for(let W of Y){if(W.href&&q.includes(`href="${W.href}"`))continue;U.push(` <link ${i1(W)}>`)}for(let W of Q)if(W.src){if(q.includes(`src="${W.src}"`))continue;U.push(` <script ${i1(W,(z)=>z==="content")}></script>`)}else if(W.content){if(q.includes(W.content))continue;U.push(` <script>${W.content}</script>`)}if(G&&!q.includes(G))U.push(` ${G}`);if(U.length===0)return $;return`${$.slice(0,X)}${U.join(`
|
|
3428
3428
|
`)}
|
|
3429
|
-
${$.slice(X)}`}function
|
|
3429
|
+
${$.slice(X)}`}function m9($,Z={},X={}){if(r3($))return $;return KQ($,Z,X)}var HQ=/<\/(script)/gi;function s1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(HQ,"<\\/$1")}W5();W5();function c9($,Z={}){return new l9($,Z).routes}function CH($,Z){let X=a3($,Z);return X?X.params:null}var p9=new Map;async function i9($){let Z=$;if(!Z)try{Z=(await _3())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=p9.get(X);if(J)return J;let Y=[];try{Y=c9(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return p9.set(X,Y),Y}function BQ($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function n9($){return BQ(JSON.stringify($))}function t3(){return`
|
|
3430
3430
|
(function(){
|
|
3431
3431
|
var tip=null,hideTimer=null,currentEl=null;
|
|
3432
3432
|
|
|
@@ -3529,48 +3529,48 @@ document.addEventListener("focusout",function(e){
|
|
|
3529
3529
|
if(el) hideTip();
|
|
3530
3530
|
});
|
|
3531
3531
|
})();
|
|
3532
|
-
`}function
|
|
3532
|
+
`}function s9($){return $.includes("data-stx-runtime")}function o9($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let X=Z.exec($);X!==null;X=Z.exec($)){let J=$.slice(Math.max(0,X.index-80),X.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function e3($,Z){let X=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(X!==-1&&(J===-1||X>J))return $.slice(0,X)+Z+`
|
|
3533
3533
|
`+$.slice(X);let Y=/<head\b[^>]*>/i.exec($);if(Y){let G=Y.index+Y[0].length;return`${$.slice(0,G)}
|
|
3534
3534
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3535
|
-
`+$.slice(G)}if(q5($))return
|
|
3535
|
+
`+$.slice(G)}if(q5($))return u5($,(G)=>`${G}
|
|
3536
3536
|
${Z}`);return`${Z}
|
|
3537
|
-
${$}`}async function
|
|
3537
|
+
${$}`}async function O$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return e3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return e3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-a7zjfav5.js"),J=await X(Z.debug);return e3($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function jQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function r9($){if($.includes("data-stx-tooltip-runtime")||!jQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${t3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3538
3538
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3539
|
-
${$.slice(X)}`}async function
|
|
3540
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3541
|
-
</body>`+$.slice(G+7)}var
|
|
3542
|
-
`)}else{if(
|
|
3543
|
-
`)
|
|
3544
|
-
`)j++;
|
|
3545
|
-
${F}`)}let
|
|
3546
|
-
|
|
3547
|
-
`);
|
|
3539
|
+
${$.slice(X)}`}async function _Q($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let U=await i9(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${n9(q)};</script>
|
|
3540
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-a7zjfav5.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
3541
|
+
</body>`+$.slice(G+7)}var a9=Symbol.for("stx.lazy-module-promises");function VQ(){let $=globalThis;return $[a9]??=new Map,$[a9]}function r($,Z){let X=VQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var OQ=0,Z4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,J2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function FQ($,Z={}){let X=[];for(let J of g5($,X1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function Y2($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=t9(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=t9(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function t9($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function J4($){return X2($)}function LQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function wQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function RQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Z4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=g5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=Y2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let z=G[1],H=/\/\s*>$/.test(Q.token)||L$.has(z.toLowerCase())?Q.end:G2($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var e9=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 DQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function $2($,Z,X,J){if(!$)return!1;let Y=DQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(e9.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=z.exec(Y))!==null){let B=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(e9.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function F$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(J2);if(Q&&NQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function NQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function Q2($,Z){let X=wQ($);function J(Y){let Q=Y,G=RQ(Y),q=(K)=>{let H=new Set;for(let B of G)if(K>B.start&&K<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,z=[];while((W=U.exec(Q))!==null){let K=W.index,H=K+W[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),O=j,V=1,F=O,L=/@(if\s*\(|endif)/g;L.lastIndex=O;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){F=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(O,F-6).trim(),D;if(LQ(R)){let N=V5(Q.substring(K,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(K);if(!(T.length>0&&T.every((I)=>$2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return F$(y,"@else-if",I.condition??"");if(I.type==="else")return F$(y,"@else");return F$(y,"@if",I.condition??"")}).join(`
|
|
3542
|
+
`)}else{if(!$2(_,X,Z,q(K)))continue;D=F$(J(R),"@if",_)}z.push({start:K,end:F,replacement:D}),U.lastIndex=F}for(let K=z.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=z[K];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function AQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var L$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function G2($,Z,X,J){if(L$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(U,U+8));if(z){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!K){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(K[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||L$.has(Y)))q++}U=H+1}return-1}var MQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function TQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return MQ.test(Q)}function q2($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(K)=>Z.some(([H,B])=>K>=H&&K<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[K,H,B,j,_,O,V]=q,F=AQ(_);if(F===void 0)continue;let L=q.index,w=L+K.length,N=!!V||/\/\s*>$/.test(K)||L$.has(H.toLowerCase())?w:G2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&TQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${O}${V}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((K,H)=>K.start-H.start);let U=[],W=-1;for(let K of G){if(K.start<W)continue;U.push(K),W=K.end}let z=$;for(let K=U.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=U[K];z=z.substring(0,H)+j+z.substring(B)}return z}function U2($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,z=1,K=W;while(K<X.length&&z>0){if(X[K]==="(")z++;else if(X[K]===")")z--;K++}if(z!==0)continue;let H=X.substring(W,K-1).trim(),B=K,j=Y2(H),_=q==="for"?"@endfor":"@endforeach",O=1,V=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))O++;else if(O--,O===0){V=L.index+L[0].length;break}if(O!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:V,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,V-_.length).trim(),D=R.match(J2),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:V,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:z}=Q[q];X=X.substring(0,U)+z+X.substring(W)}return X}function IQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(z)=>{let K=J+1;while(K<Q){let H=$[K];if(H==="\\"){K+=2;continue}if(H===z)return K+1;K++}return Q},q=()=>{let z=J+2;while(z<Q&&$[z]!==`
|
|
3543
|
+
`)z++;return z},U=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let K=z,H=0;while(K<Q){let B=$[K];if(B==="/"&&$[K+1]==="/"){let j=K+2;while(j<Q&&$[j]!==`
|
|
3544
|
+
`)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function kQ($,Z,X){let J=FQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let V=O.body;if(N1(O.attrs))V=A1(V);if(Y.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${OQ++}`,{hasUserImports:q,bundleClientScript:U}=await r("stx/client-script-bundler",()=>import("./chunk-8ksdma43.js")),W=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=D5(V).code,q(V))V=await U(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>bQ(w));let F=o0(V);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
3545
|
+
${F}`)}let z=W.join(`
|
|
3546
|
+
|
|
3547
|
+
`);z=IQ(z);let K=EQ(z),H=K.split(",").map((O)=>O.trim()).filter(Boolean),B=X4(z,X),j=`
|
|
3548
3548
|
<script data-stx-scoped>
|
|
3549
3549
|
function ${G}() {
|
|
3550
|
-
${
|
|
3551
|
-
${
|
|
3552
|
-
return { ${
|
|
3550
|
+
${c1("const",H)}
|
|
3551
|
+
${s1(`${B}${z}`)}
|
|
3552
|
+
return { ${K} };
|
|
3553
3553
|
}
|
|
3554
3554
|
window.__stx_latestSetup=${G};
|
|
3555
3555
|
if(window.stx)window.stx._latestSetup=${G};
|
|
3556
|
-
</script>`,_=$;for(let
|
|
3557
|
-
`)return;Q++}},W=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},
|
|
3558
|
-
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(Y!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let L=j[2];if(!J.has(L))X.push(L),J.add(L);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))X.push(N),J.add(N)});return}let
|
|
3559
|
-
${Y.slice(
|
|
3556
|
+
</script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${Z4})>`),`<body$1 data-stx="${G}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],V=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Z4})>`,"gi"),(F,L,w)=>{if(V||O.includes(L.toLowerCase()))return F;return V=!0,`<${L}${w} data-stx="${G}">`})}return{output:_,setupCode:j}}function EQ($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q="",U=()=>{Q++;let j=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!j){j=!0,Q++;continue}if(_==="]"&&j){j=!1,Q++;continue}if(_==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
|
|
3557
|
+
`)return;Q++}},W=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},z=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3558
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(Y!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let L=j[2];if(!J.has(L))X.push(L),J.add(L);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))X.push(N),J.add(N)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))X.push(R),J.add(R)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let L=V[1];if(!J.has(L))X.push(L),J.add(L);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!J.has(L))X.push(L),J.add(L)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),q=Z[Q-1];continue}if(Z[Q]==="`"){K(),q="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){U(),q="/";continue}if(Z[Q]==="{"){Y++,q="{",Q++;continue}if(Z[Q]==="}"){Y--,q="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))q=Z[Q];Q++}return X.join(", ")}async function W2($,Z,X,J){if(!J4($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await kQ(Y,X,J);if(Y=Q,Y=await O$(Y,Z),G){let z=$4(Y,/<\/head>/i),K=z===-1?$4(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
|
|
3559
|
+
${Y.slice(z)}`;else if(K!==-1){let H=/<body[^>]*>/i.exec(Y.slice(K))[0],B=K+H.length;Y=`${Y.slice(0,B)}
|
|
3560
3560
|
${G}${Y.slice(B)}`}else Y=`${Y}
|
|
3561
|
-
${G}`}let U=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=U&&/data-stx/.test(U[1]);if(!G&&!W&&U&&!/data-stx-auto/.test(U[1])){let
|
|
3562
|
-
`}if(L){let E=[];if(
|
|
3561
|
+
${G}`}let U=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=U&&/data-stx/.test(U[1]);if(!G&&!W&&U&&!/data-stx-auto/.test(U[1])){let z=/<body[^>]*>/i,K=$4(Y,z);if(K!==-1){let H=Y.slice(0,K),B=Y.slice(K).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+B}}return Y}function $4($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=X.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let q=Q.exec($.slice(G));if(!q)return-1;let U=G+q.index;if(!J.some(([z,K])=>U>=z&&U<K))return U;G=U+Math.max(q[0].length,1)}return-1}var Z2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function bQ($){let Z=[];for(let X of $.split(",")){let J=X.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return Z2;return`var ${Z.join(", ")}; ${Z2}`}import x0 from"path";import Y4 from"fs";function z2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function K2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class H2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,X,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let B=[Y,Y.toLowerCase(),z2(Y),K2(Y)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${Y}.stx`,`${z2(Y)}.stx`,`${K2(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=x0.resolve(x0.dirname(Z),`${Y}.stx`);if(await o(B))return B;return null}let q=[],U=X.componentsDir||"",W=J?.__originalFilePath;if(W)q.push(x0.join(x0.dirname(W),"components"));if(U)q.push(U);let z=x0.join(x0.dirname(Z),"components");if(!q.includes(z))q.push(z);let K=process.cwd(),H=[x0.resolve(K,"src/components"),x0.resolve(K,"components"),x0.resolve(import.meta.dir,"components")];for(let B of H)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of G){let _=x0.join(B,j);if(await o(_))return _}try{if(!Y4.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=Y4.readdirSync(B,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let V=x0.join(B,O.name);for(let F of G){let L=x0.join(V,F);if(await o(L))return L}}}catch{}}return null}}var I0=new H2;function H0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var I1="\x00stx-boolean-attribute";function Q4($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function o1($,Z){let X=[];for(let[J,Y]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)X.push(H0(Q));continue}if(Y===I1){X.push(H0(Q));continue}X.push(`${H0(Q)}="${H0(Q4(String(Y)))}"`)}return X}function r1($,Z){let X=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(Z.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[J]??J;if(Y===!0){X.push(H0(Q));continue}if(typeof Y==="object")continue;X.push(`${H0(Q)}="${H0(Q4(String(Y)))}"`)}return X}function N5($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yQ($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var G4={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=yQ($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",q=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,U=[];if(J.reactive)U.push(`:href="${N5(J.value)}"`);else U.push(`href="${N5(J.value)}"`);if(Y)U.push(`class="${N5(Y)}"`);if(U.push("data-stx-link"),U.push(`data-stx-active-class="${N5(Q)}"`),U.push(`data-stx-exact-active-class="${N5(G)}"`),q)U.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return U.push(...o1($,W)),U.push(...r1($,W)),`<a ${U.join(" ")}>${Z}</a>`}};var SQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},q4=[320,640,768,1024,1280,1536,1920];function L0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function D0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function U4($,Z,X=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return X}function B2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=SQ[Y];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let q=Number.parseInt(Y);if(!Number.isNaN(q))X.push(`(max-width: ${q}px) ${Q}`)}}else X.push(J);return X.join(", ")}function W4($,Z,X,J){return Z.map((Y)=>`${A5($,Y,void 0,X,J)} ${Y}w`).join(", ")}function CQ($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${A5($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function A5($,Z,X,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function PQ($,Z,X="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${X}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var z4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,X){let J=D0($,"src")||"",Y=D0($,"alt")||"",Q=D0($,"width"),G=D0($,"height"),q=D0($,"sizes"),U=D0($,"srcset"),W=D0($,"densities"),z=D0($,"format"),K=D0($,"placeholder"),H=D0($,"placeholderColor")||"#e5e7eb",B=D0($,"provider"),j=D0($,"class")||D0($,"className")||"",_=D0($,"style")||"",O=D0($,"quality"),V=U4($,"lazy",!0),F=U4($,"preload",!1),L=U4($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,D=U||"",N="";if(!D&&q)D=W4(J,q4,B,z),N=B2(q);else if(!D&&W){let E=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));D=CQ(J,E,w,B,z)}else if(q)N=B2(q);let T=[];if(_)T.push(_);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(K==="blur"||K==="color"||K==="thumbhash"){let E=PQ(w||16,R||9,H);T.push(`background-image:url(${E})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")T.push(`background-image:url(${L0(K)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let A=A5(J,w,R,B,z),M=[];if(M.push(`src="${L0(A)}"`),M.push(`alt="${L0(Y)}"`),Q)M.push(`width="${L0(Q)}"`);if(G)M.push(`height="${L0(G)}"`);if(V)M.push('loading="lazy"');if(M.push('decoding="async"'),j)M.push(`class="${L0(j)}"`);if(T.length>0)M.push(`style="${L0(T.join(";"))}"`);if(D)M.push(`srcset="${L0(D)}"`);if(N)M.push(`sizes="${L0(N)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...o1($,k)),M.push(...r1($,k));let I=`<img ${M.join(" ")} />`,y="";if(F){let b=z==="webp"?"image/webp":z==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${L0(A)}"${b?` type="${b}"`:""}${D?` imagesrcset="${L0(D)}"`:""}${N?` imagesizes="${L0(N)}"`:""} />
|
|
3562
|
+
`}if(L){let E=[];if(z==="avif"||z==="auto"){let b=A5(J,w,R,B,"avif"),C=D?W4(J,q4,B,"avif"):`${b}`;E.push(`<source type="image/avif" srcset="${L0(C)}"${N?` sizes="${L0(N)}"`:""} />`)}if(z==="webp"||z==="auto"){let b=A5(J,w,R,B,"webp"),C=D?W4(J,q4,B,"webp"):`${b}`;E.push(`<source type="image/webp" srcset="${L0(C)}"${N?` sizes="${L0(N)}"`:""} />`)}return`${y}<picture>
|
|
3563
3563
|
${E.join(`
|
|
3564
3564
|
`)}
|
|
3565
3565
|
${I}
|
|
3566
|
-
</picture>`}return`${y}${I}`}};var
|
|
3566
|
+
</picture>`}return`${y}${I}`}};var j2="/images/safe-image-default.svg";function M5($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function a1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var vQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${j2}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,K4={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let J=a1($,"src")||"",Y=a1($,"alt")||"",Q=a1($,"fallback")||j2,G=a1($,"class")||a1($,"className")||"",q=a1($,"fallbackClassName")||"",U=[];if(U.push(`src="${M5(J)}"`),U.push(`alt="${M5(Y)}"`),G)U.push(`class="${M5(G)}"`);if(U.push(`data-fallback="${M5(Q)}"`),q)U.push(`data-fallback-class="${M5(q)}"`);U.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);U.push(...o1($,W)),U.push(...r1($,W));let z=`<img ${U.join(" ")} />`,K=X.context;if(!K.__safeImageHandlerEmitted)return K.__safeImageHandlerEmitted=!0,`${vQ}${z}`;return z}};function H4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function T5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function w$($,Z,X){let J=T5($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var B4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let J=H4(T5($,"color")||"#6366f1"),Y=H4(T5($,"initialColor")||T5($,"initial-color")||""),Q=H4(T5($,"height")||"3px"),G=w$($,"duration",2000),q=w$($,"throttle",200),U=w$($,"zIndex",999999)||w$($,"z-index",999999),W=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
|
|
3567
3567
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${W};z-index:${U};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
3568
3568
|
<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>
|
|
3569
3569
|
</div>
|
|
3570
3570
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
3571
3571
|
<script>
|
|
3572
3572
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${q})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
3573
|
-
</script>`}};function
|
|
3573
|
+
</script>`}};function V2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function fQ($,Z,X){let J=V2($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var _2={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},j4={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let J=H0(V2($,"position")||"top-right"),Y=fQ($,"max",5),Q=_2[J]||_2["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
3574
3574
|
<style>
|
|
3575
3575
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
3576
3576
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -3578,7 +3578,7 @@ ${I}
|
|
|
3578
3578
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
3579
3579
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
3580
3580
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
3581
|
-
</style>`}};function
|
|
3581
|
+
</style>`}};function R$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var O2={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},_4={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let J=R$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=H0(J),Q=R$($,"size")||"md",G=R$($,"closeOnBackdrop")!=="false",q=R$($,"closeOnEscape")!=="false",U=O2[Q]||O2.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
3582
3582
|
<div class="stx-modal-panel" style="${U};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
3583
3583
|
<div style="padding:1.5rem">${Z}</div>
|
|
3584
3584
|
</div>
|
|
@@ -3587,8 +3587,8 @@ ${I}
|
|
|
3587
3587
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
3588
3588
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
3589
3589
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
3590
|
-
</style>`}};function
|
|
3591
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${
|
|
3590
|
+
</style>`}};function t1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var F2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},V4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let J=t1($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=H0(J),Q=t1($,"side")||"right",G=t1($,"size")||"md",q=t1($,"closeOnBackdrop")!=="false",U=t1($,"closeOnEscape")!=="false",W=t1($,"overlay")!=="false",z=F2[G]||F2.md,K=Q==="left",H=K?"left:0":"right:0",B=K?"translateX(-100%)":"translateX(100%)",j=K?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${q}" data-close-escape="${U}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
|
|
3591
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${z};max-width:100vw;transform:${B};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">
|
|
3592
3592
|
<div style="padding:1.5rem">${Z}</div>
|
|
3593
3593
|
</div>
|
|
3594
3594
|
</div>
|
|
@@ -3596,81 +3596,81 @@ ${I}
|
|
|
3596
3596
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
3597
3597
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3598
3598
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3599
|
-
</style>`}};import{existsSync as
|
|
3600
|
-
`||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){Y=H;continue}let w=$.slice(H,L),R=L+V.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function w9($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function R9($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import N$ from"fs";import C0 from"path";var D9=!1,bQ=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 yQ($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let K=i0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&Y.has(z))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(T9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(J.static[z]=K,z!==W)J.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));J.serverDynamic[H]=R9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(C5(B).some((L)=>!O.has(L)&&!j.includes(L))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=V,H!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=z.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":w9(K))}return J}var SQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function CQ($,Z,X){if(!$.includes("@"))return $;if(!SQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,X)}catch{return $}}function PQ($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=I1}return Z}function N9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${vQ(X)}"`).join(" ")}function vQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function fQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(E0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var A9=new Map;function xQ($){let Z=A9.get($);if(Z)return Z;let X=new Map,J=[C0.join($,"src"),C0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=N$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return A9.set($,X),X}function gQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=C0.join(X,"node_modules",$);try{if(N$.statSync(J).isDirectory())return J}catch{}let Y=C0.dirname(X);if(Y===X)return null;X=Y}}async function hQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,z)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=H.exec(z))!==null){let[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(N$.statSync(A).isFile())R=A}catch{try{if(N$.statSync(T).isDirectory())w=T}catch{}}}}else w=gQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?xQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function uQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of z){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(J.componentsDir||"components",`${H}.stx`),C0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),J.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function dQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[0].length-1,H=1,B=z+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(z+1,B),_=B+1,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function mQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=p0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,bQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=L9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?R$(w.tagName):w.tagName,D=PQ(CQ(w.attributes,Z,X)),N=yQ(D,Z,J),T=E0.getBuiltin(w.tagName),A=T?await D$(R,G,Z,X,J):!1;if(T&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=M9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=N9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await D$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.clientReactive).length>0)I=M9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=I9(I);if(y){let E=N9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function M9($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([K])=>!X.has(K)),Q=Y.filter(([K])=>!J.has(K)).map(([K])=>R$(K)).join(" "),G=$,q=Y.length>0?I9(G):null;if(q){let K=Y.map(([H,B])=>`:${R$(H)}="${B.replace(/"/g,""")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function I9($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function O4($,Z,X,J,Y){if(!D9)F9(),D9=!0;let Q=await hQ($,Z,X,J,Y);Q=await uQ(Q,Z,X,J,Y),Q=await dQ(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=c0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await mQ(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=fQ(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import $5 from"path";import k9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(k9.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function Yj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(k9.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function E9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function b9($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=$5.join(Y,$);if(await Bun.file(G).exists())return G;Y=$5.dirname(Y)}J=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=$5.resolve(Z,$);else J=$5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function y9($,Z,X){let J=$,Y=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,K,z,H]=G;if(E9(z))continue;let B=await b9(z,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
|
|
3601
|
-
// Source: ${
|
|
3599
|
+
</style>`}};import{existsSync as xQ,readFileSync as gQ}from"fs";var k1=new Map,L2=new Set;function w2($){if(L2.has($))return;L2.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function R2($){let Z=process.cwd();for(let X of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(xQ(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return u.resolve(X)}catch{}return null}function hQ($){if(k1.has($))return k1.get($);let Z=R2($);if(!Z)return w2($),null;try{let X=JSON.parse(gQ(Z,"utf8"));return k1.set($,X.icons),X.icons}catch{return null}}async function uQ($,Z=!1){if(k1.has($))return k1.get($);let X=R2($);if(!X){if(!Z)w2($);return null}try{let J=await Bun.file(X).json();return k1.set($,J.icons),J.icons}catch{return null}}function e1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var O4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=e1($,"name")??e1($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let F=J.split(":");Y=F[0],Q=F[1]}let G=H0(e1($,"size")||"24"),q=H0(e1($,"color")||"currentColor"),U=H0(e1($,"class")||""),W=H0(e1($,"style")||""),z=k1.get(Y)??hQ(Y);if(!z)return`<!-- Icon: collection "${Y}" not loaded -->`;let K=z[Q];if(!K)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=K.width||24,B=K.height||24,j=`0 0 ${H} ${B}`,_=K.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let O=U?` class="${U}"`:"",V=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${O}${V}>${_}</svg>`}};async function dQ($="lucide",Z={}){await uQ($,Z.speculative??!0)}function D2($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}function N2($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(X);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var F4={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=N2(Z,"fallback"),Y=J.rest,Q=N2(Y,"error"),G=Q.rest,q=J.region??D2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',U=Q.region??D2($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${U}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function D$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}var L4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(D$($,"name")||"v").replace(/["'<>]/g,""),Y=(D$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=D$($,"class"),G=D$($,"id"),q=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${q}>${Z}</${Y}>`}};function A2(){I0.registerBuiltin(G4),I0.registerBuiltin(z4),I0.registerBuiltin(K4),I0.registerBuiltin(B4),I0.registerBuiltin(j4),I0.registerBuiltin(_4),I0.registerBuiltin(V4),I0.registerBuiltin(O4),I0.registerBuiltin(F4),I0.registerBuiltin(L4)}function N$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function M2($,Z,X){let J=[],Y=0;while(Y<$.length){let Q=$.indexOf("<",Y);if(Q===-1)break;let q=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!q){Y=Q+1;continue}let U=q[1];if(X&&X.has(U.toLowerCase())){let _=Q+1+U.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=Q+1+U.length,z=null,K=W,H=-1,B=!1;while(W<$.length){let _=$[W];if(z){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===z)z=null;W++;continue}if(_==='"'||_==="'"){z=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){H=W+2,B=!0;break}if(_===">"){H=W+1;break}W++}if(H===-1){Y=Q+1;continue}let j=$.slice(K,B?H-2:H-1).trim();if(B)J.push({fullMatch:$.slice(Q,H),tagName:U,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),Y=H;else{let _=`<${U}`,O=`</${U}>`,V=1,F=H,L=-1;while(V>0&&F<$.length){let D=$.indexOf(_,F),N=$.indexOf(O,F);if(N===-1)break;if(D!==-1&&D<N){let T=$[D+_.length];if(T===" "||T===">"||T==="/"||T===`
|
|
3600
|
+
`||T==="\t")V++;F=D+_.length}else{if(V--,V===0){L=N;break}F=N+O.length}}if(L===-1){Y=H;continue}let w=$.slice(H,L),R=L+O.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function T2($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function I2($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import M$ from"fs";import S0 from"path";var k2=!1,mQ=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 lQ($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let z=p0(W),K=z.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&Y.has(K))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(z))return!0}return!1},G=new Set(S2),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(z,K)=>K.toUpperCase())},U=(W,z)=>{let K=q(W);if(J.static[K]=z,K!==W)J.staticNames[K]=W};for(let[W,z]of Object.entries($)){let K=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(K.startsWith("@")){J.events[K]=z;continue}if(K.startsWith("__stx_")){let H=q(K.slice(6));J.serverDynamic[H]=I2(z,X);continue}if(K.startsWith(":")){let H=q(K.slice(1)),B=z===I1?H:z;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!Y0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),O=Q0(B,j)(...Object.values(Z));if(O===void 0){let V=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(P5(B).some((L)=>!V.has(L)&&!j.includes(L))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=O,H!==K.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=K.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof z==="string"&&z.includes("{{")&&z.includes("}}")){let H=z.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Y0(B)){let _=Q0(B,Object.keys(Z))(...Object.values(Z));U(K,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${K}: ${B}`);U(K,z)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${K}:`,B);U(K,z)}else{let B=z,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(z))!==null)try{let O=_[1];if(!Y0(O)){if(X.debug)console.error(`Unsafe expression in ${K}: ${O}`);continue}let F=Q0(O,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(O){if(X.debug)console.error(`Error evaluating expression in ${K}:`,O)}U(K,B)}continue}U(K,z===I1?"true":T2(z))}return J}var cQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function pQ($,Z,X){if(!$.includes("@"))return $;if(!cQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return a0($,Z,X)}catch{return $}}function iQ($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=I1}return Z}function E2($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${nQ(X)}"`).join(" ")}function nQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function sQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(I0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var b2=new Map;function oQ($){let Z=b2.get($);if(Z)return Z;let X=new Map,J=[S0.join($,"src"),S0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=M$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=S0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let z=U.name.slice(0,-4);if(!X.has(z))X.set(z,W);let K=z.toLowerCase();if(!X.has(K))X.set(K,W);let H=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return b2.set($,X),X}function rQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=S0.join(X,"node_modules",$);try{if(M$.statSync(J).isDirectory())return J}catch{}let Y=S0.dirname(X);if(Y===X)return null;X=Y}}async function aQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=S0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,z,K)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,j,_=[];while((j=H.exec(K))!==null){let[O,V,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=S0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(M$.statSync(A).isFile())R=A}catch{try{if(M$.statSync(T).isDirectory())w=T}catch{}}}}else w=rQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(F&&R)N(F,R),D=!0;else if(V){let T=V.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?oQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+O.length})}if(_.length===0)return W;for(let O=_.length-1;O>=0;O--)B=B.slice(0,_[O].start)+B.slice(_[O].end);return`<script${z}>${B}</script>`}),q}async function tQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,z]=U,K=z.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of K){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,F=[S0.resolve(S0.dirname(X),`${H}.stx`),S0.resolve(S0.dirname(X),H),S0.resolve(J.componentsDir||"components",`${H}.stx`),S0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){V=L;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let L=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,V),Y.add(V),J.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function eQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let z=W.index,K=z+W[0].length-1,H=1,B=K+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(K+1,B),_=B+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){U.lastIndex=0;continue}let V=O[1],F,L=j.slice(O[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=B0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(V,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,z)+M+Q.substring(N),U.lastIndex=0}return Q}async function $G($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=c0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,mQ),Q=P1(Q,U.scripts),Q;async function H(B,j,_,O){if(!B)return B;let V=B,F=M2(V,j,O);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?N$(w.tagName):w.tagName,D=iQ(pQ(w.attributes,Z,X)),N=lQ(D,Z,J),T=I0.getBuiltin(w.tagName),A=T?await A$(R,G,Z,X,J):!1;if(T&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=y2(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=E2(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}V=V.substring(0,w.startIndex)+E+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await A$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,P1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.clientReactive).length>0)I=y2(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=C2(I);if(y){let E=E2(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+I+V.substring(w.endIndex)}return V}}function y2($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([z])=>!X.has(z)),Q=Y.filter(([z])=>!J.has(z)).map(([z])=>N$(z)).join(" "),G=$,q=Y.length>0?C2(G):null;if(q){let z=Y.map(([H,B])=>`:${N$(H)}="${B.replace(/"/g,""")}"`).join(" "),K=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${K} ${z}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function C2($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function w4($,Z,X,J,Y){if(!k2)A2(),k2=!0;let Q=await aQ($,Z,X,J,Y);Q=await tQ(Q,Z,X,J,Y),Q=await eQ(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=l0(Q,Q5,(z,K)=>`\x00STX_COMPONENT_COMMENT_${G.length+K}\x00`);G.push(...U.tokens);let W=Q;if(Q=await $G(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=sQ(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import Z5 from"path";import P2 from"process";function $5($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(P2.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function wj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(P2.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function v2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function f2($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Z5.join(Y,$);if(await Bun.file(G).exists())return G;Y=Z5.dirname(Y)}J=Z5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=Z5.resolve(Z,$);else J=Z5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function x2($,Z,X){let J=$,Y=Z5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,z,K,H]=G;if(v2(K))continue;let B=await f2(K,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let O=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:$5()});if(O.outputs.length>0)j=await O.outputs[0].text()}let _=`<script>
|
|
3601
|
+
// Source: ${K}
|
|
3602
3602
|
${j}
|
|
3603
|
-
</script>`;J=J.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(J))!==null){let[W,K,
|
|
3604
|
-
/* Source: ${
|
|
3605
|
-
${
|
|
3606
|
-
</style>`;J=J.replace(W,
|
|
3603
|
+
</script>`;J=J.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(J))!==null){let[W,z,K,H]=U,B=z+H;if(v2(K))continue;if(/rel=["']stylesheet["']/.test(B)||K.endsWith(".css")){let _=await f2(K,Y,Z);if(_)try{let O=await Bun.file(_).text();X.add(_);let V=`<style>
|
|
3604
|
+
/* Source: ${K} */
|
|
3605
|
+
${O}
|
|
3606
|
+
</style>`;J=J.replace(W,V),q.lastIndex=0}catch(O){}}}return J}function R4($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,q=1,U=G+1,W=null,z=!1;while(U<X.length&&q>0){let L=X[U];if(z){z=!1,U++;continue}if(L==="\\"&&W){z=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0)break}U++}if(q!==0)break;let K=X.substring(G+1,U).trim(),H=X.substring(Q,U+1),B=-1,j=0,_=null,O=!1;for(let L=0;L<K.length;L++){let w=K[L];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=L;break}}let V=B>=0?K.substring(0,B).trim():K,F=B>=0?K.substring(B+1).trim():void 0;try{let L=V.trim(),w;if(Y0(L))w=Q0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(F==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");X=X.substring(0,Q)+D+X.substring(U+1),J.lastIndex=Q+D.length}catch(L){u0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function D4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function g2($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,q=1,U=G;while(U<Z.length&&q>0){if(Z[U]==="(")q++;else if(Z[U]===")")q--;U++}if(q!==0)continue;let W=Z.slice(G,U-1).trim(),z=U,K=Z.slice(z),H=K.indexOf("@endmemo");if(H===-1)continue;let B=K.slice(0,H),j=z+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,V=B.slice(O),F=B.match(/(\s*)$/),L=F?F[0].length:0,w=V.slice(0,V.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[N,T,A="",M]=R,k=`<${T}${A} data-stx-memo="${W}"${M}>`;D=B.slice(0,O)+k+w.slice(N.length)+B.slice(O+w.length)}else D=`${B.slice(0,O)}<div data-stx-memo="${W}">${w}</div>${B.slice(O+w.length)}`;Y.push({start:Q,end:j,replacement:D}),X.lastIndex=j}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function N4($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function h2($){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"),J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index,q=G+Q[0].length,U=!1,W=!1,z=-1;while(q<$.length){let _=$[q];if(U){if(_==="'")U=!1}else if(W){if(_==='"')W=!1}else if(_==="'")U=!0;else if(_==='"')W=!0;else if(_===">"){z=q;break}q++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let H=$.slice(z+1),B=H.indexOf("</"),j=B>=0?H.slice(0,B):H.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,z)+" x-cloak>",Y=z+1}return J+=$.slice(Y),J}var ZG=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/;function u2($){let Z=/<[a-z][\w-]*/gi,X="",J=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,_=$.toLowerCase().indexOf(j,Q);if(_!==-1)Z.lastIndex=_+j.length;continue}let q=Q+Y[0].length,U=!1,W=!1,z=-1;while(q<$.length){let j=$[q];if(U){if(j==="'")U=!1}else if(W){if(j==='"')W=!1}else if(j==="'")U=!0;else if(j==='"')W=!0;else if(j===">"){z=q;break}q++}if(z===-1)continue;let K=$.slice(Q+Y[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!ZG.test(K))continue;let H=$[z-1]==="/",B=H?z-1:z;X+=`${$.slice(J,B)} x-cloak${H?" ":""}`,J=B}return X+=$.slice(J),X}var XG=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}];function A4($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1},Q=Y.allowPatterns??[],G=[],q=p0($.replace(/\{\{--[\s\S]*?--\}\}/g,(U)=>U.replace(/[^\n]/g," ")));for(let{pattern:U,message:W,suggestion:z}of XG){if(Q.some((H)=>/\w/.test(H)&&W.includes(H)))continue;U.lastIndex=0;let K=q.match(U);if(K&&K.length>0){let H=q.split(`
|
|
3607
3607
|
`),B=$.split(`
|
|
3608
|
-
`),j=[];H.forEach((F,L)=>{if(U.lastIndex=0,U.test(F))j.push(L+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",
|
|
3609
|
-
`),O
|
|
3610
|
-
${
|
|
3611
|
-
\u2192 ${
|
|
3608
|
+
`),j=[];H.forEach((F,L)=>{if(U.lastIndex=0,U.test(F))j.push(L+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",O=j.slice(0,3).map((F)=>` ${F} | ${(B[F-1]??"").trim().slice(0,100)}`).join(`
|
|
3609
|
+
`),V=O?`
|
|
3610
|
+
${O}`:"";G.push(` \u2717 ${W}${_}
|
|
3611
|
+
\u2192 ${z}${V}`)}}if(G.length>0&&Y.enabled){let U=(K)=>{let H=`${process.cwd()}/`;return K.startsWith(H)?K.slice(H.length):K},z=`[STX] DOM API violation in ${J&&J!==Z?`${U(J)} (composed into ${U(Z)})`:U(Z)}:
|
|
3612
3612
|
${G.join(`
|
|
3613
3613
|
`)}
|
|
3614
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(
|
|
3615
|
-
`,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(q==="/"&&$[J+1]==="*"){let U=$.indexOf("*/",J+2);if(U===-1)return-1;J=U+2,Y=!0;continue}if(q==="/"&&Y){let U=J+1,W=!1;while(U<X){let
|
|
3614
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(z);else console.warn(z)}}JG();var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function d2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function QG($,Z){let X=$.length,J=Z,Y=!0,Q=[],G=(q)=>q+9<=X&&$[q]==="<"&&$[q+1]==="/"&&($[q+2]==="s"||$[q+2]==="S")&&($[q+3]==="c"||$[q+3]==="C")&&($[q+4]==="r"||$[q+4]==="R")&&($[q+5]==="i"||$[q+5]==="I")&&($[q+6]==="p"||$[q+6]==="P")&&($[q+7]==="t"||$[q+7]==="T")&&($[q+8]===">"||/\s/.test($[q+8]));while(J<X){let q=$[J];if(G(J))return J;if(q==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
3615
|
+
`,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(q==="/"&&$[J+1]==="*"){let U=$.indexOf("*/",J+2);if(U===-1)return-1;J=U+2,Y=!0;continue}if(q==="/"&&Y){let U=J+1,W=!1;while(U<X){let z=$[U];if(z==="\\"){U+=2;continue}if(z==="[")W=!0;else if(z==="]")W=!1;else if(z==="/"&&!W){U++;break}else if(z===`
|
|
3616
3616
|
`){U=-1;break}U++}if(U===-1){J++,Y=!1;continue}while(U<X&&/[a-z]/.test($[U]))U++;J=U,Y=!1;continue}if(q==="'"||q==='"'){let U=q;J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]===U){J++;break}if($[J]===`
|
|
3617
|
-
`)break;J++}Y=!1;continue}if(q==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))Y=!1;else Y=!0;J++}return-1}function
|
|
3617
|
+
`)break;J++}Y=!1;continue}if(q==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))Y=!1;else Y=!0;J++}return-1}function X5($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function m2($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Q=$.indexOf("-->",X+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(X),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let Q=$.toLowerCase().indexOf("</style>",X+Y[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return X;Z=X+1}return-1}function GG($){let Z=X5($,"data-stx-runtime");if(!Z)return $;let X=m2($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=m2(Y);if(Q===-1)return J+`
|
|
3618
3618
|
`+Y;return Y.slice(0,Q)+J+`
|
|
3619
|
-
`+Y.slice(Q)}async function
|
|
3620
|
-
`),...W.htmlAttrs&&{htmlAttrs:
|
|
3621
|
-
<meta name="stx-layout" content="${
|
|
3622
|
-
<meta name="stx-layout-group" content="${
|
|
3623
|
-
`+
|
|
3624
|
-
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await
|
|
3625
|
-
`+
|
|
3619
|
+
`+Y.slice(Q)}async function M4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($);let Q=!Z.__stxProcessingDepth;if(Q)d4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!B5()&&!n5())&&X&&X.endsWith(".stx"))s2($,X);try{return await q7.timeAsync("template-processing",async()=>{let G=await qG($,Z,X,J,Y);if(Q)G=N4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??n2(),z=(Z.__stx_head_raw||"").trim(),K,H=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)K=H[1].trim(),z=z.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||K||B,_=!W.title&&(!!K||!!B),O=W.meta||[],V=new Set(O.map((N)=>n1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!V.has(n1(N))),...O],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
|
|
3620
|
+
`),...W.htmlAttrs&&{htmlAttrs:g9(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=r3(G);if(G=m9(G,F,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=d9(G,q),G=h9(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=p2(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
3621
|
+
<meta name="stx-layout" content="${d2(N)}">
|
|
3622
|
+
<meta name="stx-layout-group" content="${d2(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=u5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=u9(G);let q=J.app?.colorMode;if(q)G=C9(G,q);G=v9(G),G=GG(G)}if(Q)try{let{getStoreScript:q}=await r("stx/store-loader",()=>import("./chunk-jde8jz10.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=X5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3623
|
+
`+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await r("stx/framework-composables",()=>import("./chunk-97t2tj98.js")),U=await q(G);if(U){let W=X5(G,"data-stx-stores")||X5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
|
|
3624
|
+
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await r("stx/composable-loader",()=>import("./chunk-aca3hetd.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=X5(G,"data-stx-stores")||X5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3625
|
+
`+z+G.slice(K.end)}}catch{}if(Q)G=P9(G);if(Q&&Z.__stx_inject_css!==!1)G=await i2(G,void 0,J.buildMode==="serve");if(Q)G=S9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof r5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(u0.log(U,{filePath:X,context:Z}),q3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return Q3.createFallbackContent("Template Processing",U)}}async function qG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!w0.isAbsolute(J.partialsDir)?w0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!w0.isAbsolute(J.componentsDir)?w0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!w0.isAbsolute(J.layoutsDir)?w0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await zG(X,Z),WG(Z,q),U=await u1(()=>_9(U,Z,X,q),U,(L)=>{u0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=l0(U,Q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let z=W.tokens,K=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=N9(U),U=await x2(U,X,Y);let B={};U=u3(U,B);let j={...Z.__sections||{}},_="",O=N7(D7($)),V=/@nolayout\b/.test(U)||O===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(U))U=`@section('content')
|
|
3626
3626
|
${U.trim()}
|
|
3627
|
-
@endsection`}if(!_&&!
|
|
3627
|
+
@endsection`}if(!_&&!V&&q.defaultLayout){let L=o3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=w0.dirname(X),N=q.layoutsDir?w0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=w0.join(D,"_layout.stx");if(await o(A)){R=A;break}let M=w0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=w0.isAbsolute(q.layoutsDir)?q.layoutsDir:w0.resolve(process.cwd(),q.layoutsDir),A=w0.join(T,`${q.defaultLayout}.stx`);if(await o(A))_=A}if(_&&!w)U=`@section('content')
|
|
3628
3628
|
${U.trim()}
|
|
3629
|
-
@endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=
|
|
3629
|
+
@endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=e(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",E1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=d3(U,B),_){let L=[],w=c0(U),R=l0(w.output,C1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
|
|
3630
3630
|
`);j.content=j.content?`${j.content}
|
|
3631
|
-
${D}`:D,Z.__sections=j}}if(_)try{let L;if(
|
|
3632
|
-
${U}`,
|
|
3633
|
-
`;if(Q=A(Q,Z),Q=M(Q,Z),Q=
|
|
3631
|
+
${D}`:D,Z.__sections=j}}if(_)try{let L;if(w0.isAbsolute(_))L=_,Y.add(_);else L=await u1(()=>e5(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=w0.isAbsolute(I)?I:w0.resolve(process.cwd(),I);return YG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(u0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new L1(k,X);return U}let w=await u1(()=>Bun.file(L).text(),"",()=>{throw new L1(`Failed to read layout file: ${L}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(E1)){let b=j[y].indexOf(E1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+E1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await M4(I,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=u3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),N=UG(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=d3(N,B),Z.__originalFilePath=X,U=await l2(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
|
|
3632
|
+
${U}`,K(U)}catch(L){return u0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await l2(U,Z,X,G,Y))}function UG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function WG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function zG($,Z){await u1(()=>F9($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function KG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await r("stx/variable-extractor",()=>import("./chunk-vh7h37mn.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));u0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function HG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await r("stx/expressions",()=>import("./chunk-vg9xvtqz.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return u0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function l2($,Z,X,J,Y){let Q=$,G=J;if(await KG(Q,Z,X),Q=await HG(Q,Z,X),Q=await X9(Q,Z,X),Q=await J9(Q,Z,X),Q=await h6(Q,Z,X,G),J1(Q))Q=Q2(Q,Z),Q=U2(Q,Z);Q=q2(Q);let{processStreamDirectives:q}=await r("stx/streaming",()=>import("./chunk-3v9drr1f.js"));Q=q(Q,Z),Q=z9(Q,Z,X,G),Q=await I9(Q,Z,X,G,Y),Q=await w4(Q,Z,X,G,Y),Q=R7(Q,Z,X,G);let{processDeferDirectives:U}=await r("stx/defer",()=>import("./chunk-5xg4y72b.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await r("stx/teleport",()=>import("./chunk-tvcf5760.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await r("stx/transitions",()=>import("./chunk-q98bqfzh.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await r("stx/error-boundaries",()=>import("./chunk-xdq4zkqk.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await r("stx/suspense",()=>import("./chunk-03t9yevc.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await r("stx/async-components",()=>import("./chunk-tmfrweee.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await r("stx/keep-alive",()=>import("./chunk-vswv49x0.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:F}=await r("stx/virtual-scrolling",()=>import("./chunk-0wwbjhs2.js"));Q=O(Q,Z,X),Q=V(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await r("stx/partial-hydration",()=>import("./chunk-gfvb1926.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await r("stx/computed",()=>import("./chunk-jzavbzn8.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await r("stx/forms-validation",()=>import("./chunk-cmz46x9n.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await r("stx/head",()=>import("./chunk-t9mf6ddw.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3633
|
+
`;if(Q=A(Q,Z),Q=M(Q,Z),Q=O9(Q),Q=w3(Q,Z),Q=g6(Q),Q=B9(Q),Q=await h3(Q,Z,X,G,Y),Q=await w4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=l4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=N4(Q),Q=a0(Q,Z,X),Q=M7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=R3(Q,Z),Q=D3(Q,Z),Q=L5(Q,Z),Q=E3(Q,Z),Q=b3(Q,Z),Q=await M6(Q,Z,X,G),Q=await S7(Q,Z,X),Q=await r6(Q,Z,X,G),Q=c2(Q,Z,X,G),Q=z6(Q,Z,X,G),Q=K6(Q,Z,X),Q=H6(Q,Z,X,G),Q=f6(Q,Z,X,G),Q=R4(Q,Z),Q=D4(Q),Q=g2(Q),!G.skipEventDirectives)Q=h4(Q,Z,X);if(Q=k7(Q,Z,X),G.debug){let n=/\bx-data\s*=/.test(Q),t=J4($);if(n&&t)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3634
3634
|
Both work on the same page, but they manage separate scopes.
|
|
3635
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=
|
|
3636
|
-
</head>`);if(/<head\b[^>]*>/i.test(
|
|
3637
|
-
${
|
|
3635
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=R9(Q,Z),Q=await _1(Q,Z,X),Q=h2(Q),Q=u2(Q),Q=B7(Q);let{processXElementDirectives:y}=await r("stx/x-element",()=>import("./chunk-ch5n6w31.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=T$(Z);if(Q=await W2(Q,G,E,b),Q=l6(Q,Z),Q=await V9(Q,Z,X,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:t}=await r("stx/image-optimization/auto-sibling",()=>import("./chunk-gdaq67k8.js"));Q=await t(Q,{publicDir:n})}if(G.seo?.enabled)Q=B6(Q,Z,G);let C=(n,t,J0=!0)=>{if(!t)return n;let V0=t.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),O0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(V0&&O0){if(J0)n=n.replace(O0[0],V0[0]);if(t=t.replace(V0[0],"").trim(),!t)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${t}
|
|
3636
|
+
</head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
|
|
3637
|
+
${t}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
|
|
3638
3638
|
<head>
|
|
3639
|
-
${
|
|
3640
|
-
</head>`);return
|
|
3641
|
-
${
|
|
3642
|
-
</script>`;if(Q.includes("</head>")){let
|
|
3643
|
-
`+
|
|
3639
|
+
${t}
|
|
3640
|
+
</head>`);return n},{renderHead:g,getHead:x}=await r("stx/head",()=>import("./chunk-t9mf6ddw.js")),c=Z.__stx_runtime_head??x();if(c.title||c.meta?.length||c.link?.length){let n=g(c);if(n)Q=C(Q,n)}if(I.headContent)Q=C(Q,I.headContent,!c.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=P6(Q,G.csp,Z);if(G.analytics?.enabled)Q=_7(Q,G);if(G.heatmap?.enabled)Q=O7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await r("stx/pwa/inject",()=>import("./chunk-c6pb88k7.js"));Q=n(Q,G)}let _0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),N0=/\bSTX\.\w+/.test(Q),A0=/window\.STX\s*=/.test(Q);if(_0&&N0&&!A0){let t=`<script data-stx-scoped data-stx-run="once">
|
|
3641
|
+
${z7()}
|
|
3642
|
+
</script>`;if(Q.includes("</head>")){let J0=Q.indexOf("</head>"),O0=Q.slice(0,J0).indexOf("<script");if(O0!==-1){let C0=Q.slice(0,O0),H1=Q.slice(O0);Q=C0+t+`
|
|
3643
|
+
`+H1}else Q=Q.replace("</head>",`${t}
|
|
3644
3644
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3645
|
-
${
|
|
3646
|
-
`+Q}{let{scanScriptTags:
|
|
3647
|
-
`+Q.slice(
|
|
3648
|
-
`);return{line:X.length,column:X[X.length-1].length+1}}function
|
|
3649
|
-
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let
|
|
3650
|
-
|
|
3651
|
-
`),Z}function
|
|
3652
|
-
`),
|
|
3645
|
+
${t}`);else Q=t+`
|
|
3646
|
+
`+Q}{let{scanScriptTags:n}=await r("stx/signal-processing",()=>import("./chunk-y2j14rjd.js")),t=[];for(let J0 of n(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let V0=J0.start+J0.fullMatch.indexOf(">")+1,O0=QG(Q,V0);if(O0===-1)continue;let C0=O0+9;while(C0<Q.length&&/\s/.test(Q[C0]))C0++;t.push({start:J0.start,end:C0})}for(let J0=t.length-1;J0>=0;J0--){let{start:V0,end:O0}=t[J0];Q=Q.substring(0,V0)+Q.substring(O0)}}let g0=B$(Q,X);if(g0.hasScoped)Q=g0.html;let a=Z.__stx_event_bindings||[],F0=!1,X0=[],K1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await r("stx/signal-processing",()=>import("./chunk-y2j14rjd.js"));for(let n of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))X0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:t,content:J0}of X0){F0=!0;let V0=J0;A4(J0,X,J.strict,Z.__originalFilePath);let O0=await I$(J0,{eventBindings:a,attrs:t,hasColonDirectives:K1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(n,()=>O0)}if(F0)Z.__stx_event_bindings=[];if(!F0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let t=S$(n);if(t){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+t:Q.slice(0,J0)+t+`
|
|
3647
|
+
`+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!s9(Q)&&o9(Q))Q=await O$(Q,G);if(Q=r9(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=v6(Q,Z.cspNonce);return Q}var BG=[{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"}],jG=[{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')"}],_G=[{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 VG($){let Z=[],X=[];return OG($,Z),FG($,Z,X),LG($,X),wG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function OG($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function FG($,Z,X){for(let J of BG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function LG($,Z){for(let X of jG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function wG($,Z){for(let X of _G)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function RG($,Z){let X=$.slice(0,Z).split(`
|
|
3648
|
+
`);return{line:X.length,column:X[X.length-1].length+1}}function DG($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.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)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function NG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function AG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import n0 from"path";import J5 from"process";var X8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],o2=new Set(X8),MG=new Set(["props","$props","defineProps"]),TG=new Set(["stx","@stacksjs/stx"]);function IG($){let Z=[],X=0,J=$.split(`
|
|
3649
|
+
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...K)}}}}return[...new Set(Z)]}function kG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,U=null;for(let W=0;W<J.length;W++){let z=J[W];if(U){if(Q+=z,z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")q++;else if(z===")")q--;if(z===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=z}if(Q)Y.push(Q);return Y.map((W)=>{let z=W.trim(),K=z.startsWith("..."),H=K?z.slice(3):z,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return W;let O=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),F=-1,L=0;for(let R=0;R<V.length;R++)if(V[R]==="<")L++;else if(V[R]===">")L--;else if(V[R]==="="&&L===0){F=R;break}let w=K?"...":"";if(F!==-1)return`${w}${O} = ${V.substring(F+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,U=G+1,W=0,z=null;while(U<Z.length&&q>0){let B=Z[U];if(z){if(B===z)z=null;U++;continue}if(B==='"'||B==="'"||B==="`"){z=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let K=Z.substring(G+1,U);if(!K.includes(":"))continue;let H=X(K);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
3650
|
+
|
|
3651
|
+
`),Z}function EG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function bG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function yG($,Z,X,J={}){if(!$.trim())return;let Y;try{let S=I4({loader:"ts",target:"browser",define:$5()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=S.transformSync(v)}catch{Y=kG($)}let Q={exports:{}},G=Q.exports,q=J5.cwd(),U={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),z=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(n0.resolve(n0.dirname(X),S));continue}let v=n0.resolve(q,"node_modules",S),P=n0.join(v,"package.json"),f=JSON.parse(u("fs").readFileSync(P,"utf8")),l=f.main||"index.js";if(f.exports){let m=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof m==="string")l=m;else if(m?.bun)l=m.bun;else if(m?.import)l=m.import;else if(m?.default)l=m.default}U[S]=await import(n0.resolve(v,l))}catch(v){if(S.startsWith("."))z.set(S,v instanceof Error?v.message:String(v))}let K=(S)=>{if(U[S])return U[S];let v=z.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${v}`);return u(S)},H=Z.props||{},B=(S)=>{if(!S)return H;let v={};for(let[P,f]of Object.entries(S)){let l=H[P];if(l!==void 0)v[P]=l;else if(typeof f==="function")v[P]=f();else v[P]=f}return v};for(let[S,v]of Object.entries(H))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(H,S))continue;try{Object.defineProperty(B,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(S)=>{if(!S)return H;let v={...H};for(let[P,f]of Object.entries(S)){let l=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[P]===void 0&&l.default!==void 0)v[P]=typeof l.default==="function"?l.default():l.default}return v},_=()=>Z.slots||{},O=(S,v)=>{let P={...S};for(let[f,l]of Object.entries(v))if(P[f]===void 0)if(typeof l==="function")P[f]=l();else P[f]=l;return P},V=(S)=>{let v=()=>S;return v.set=(P)=>{},v.update=(P)=>{},v},F=(S)=>{let v,P=!1;return()=>{if(!P)try{v=S(),P=!0}catch{v=void 0}return v}},L=(S)=>{},w=(S)=>S(),R=(S)=>{},D=(S)=>{},N=A7(Z);function T(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function A(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let M=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",P=S?.path??"",f=Object.fromEntries(new URLSearchParams(v)),l=Z.query,m=Object.keys(f).length>0?f:l??{},q0=v||(Object.keys(m).length>0?`?${new URLSearchParams(m).toString()}`:"");return{params:Z.params??{},query:m,path:P,name:"",fullPath:P+q0,hash:"",matched:[]}},k=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),I=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=t5(v,S||{})},y=(S)=>{I(Z8(S||{}))},E=(S)=>({value:S}),b=(S)=>S,C=(S)=>({value:typeof S==="function"?S():S}),g=(S,v)=>{},x=(S)=>{},s=(S)=>{},c=(S)=>S?S():Promise.resolve(),_0=(S)=>(v,...P)=>{},N0=(S)=>{},A0=(S,v)=>{},g0=(S,v)=>v,a=()=>({value:"light"}),F0=()=>V(!1),X0=(S)=>V(!1),K1=()=>V(!1),Y5=()=>X0("(prefers-color-scheme: dark)"),n=()=>X0("(prefers-color-scheme: light)"),t=()=>X0("(prefers-reduced-motion: reduce)"),J0=()=>X0("(prefers-contrast: more)"),V0={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:{}},O0=new Proxy(V0,{get(S,v){if(v in S)return S[v];return},set(S,v,P){return S[v]=P,!0}}),C0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},H1=console;try{let S=J8(Y,X),v=new Set(Object.keys(H)),P=(d)=>/^[a-z_$][\w$]*$/i.test(d),f=Object.keys(Z).filter((d)=>!v.has(d)&&!MG.has(d)&&P(d)),l=f.map((d)=>Z[d]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),l.push(void 0);let m=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),q0=[],K0=[];for(let[d,E0]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(d))continue;if(m.has(d))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${d}\\b`).test(S))continue;q0.push(d),K0.push(E0)}let k0=IG(S).map((d)=>`module.exports.${d} = typeof ${d} !== 'undefined' ? ${d} : module.exports.${d};`).join(`
|
|
3652
|
+
`),M0=Z.params??{},P0=[],j1=[];for(let d=0;d<f.length;d++){if(f[d]==="params")continue;P0.push(f[d]),j1.push(l[d])}let $1=await Function(...X8,...q0,...P0,`return (async () => {
|
|
3653
3653
|
${S}
|
|
3654
|
-
${
|
|
3654
|
+
${k0}
|
|
3655
3655
|
return module.exports
|
|
3656
|
-
})()`)(Q,G,
|
|
3657
|
-
`),Q=[],G=0;while(G<Y.length){let q=Y[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let U=0;for(;G<Y.length;G++){for(let W of Y[G])if(W==="{")U++;else if(W==="}")U--;if(U<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let U=0,W=!1,
|
|
3658
|
-
`),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(
|
|
3659
|
-
`+B;if(
|
|
3660
|
-
`),X,J)}function
|
|
3661
|
-
`)q=!1;Q++;continue}if(U){if(Y+=
|
|
3656
|
+
})()`)(Q,G,K,H,B,j,O,A,V,F,L,w,R,D,T,M,k,I,y,N.setResponseStatus,N.setResponseHeader,N.notFound,E,b,C,g,x,s,c,_0,N0,_,A0,g0,a,F0,X0,K1,Y5,n,t,J0,O0,C0,H1,V0.confirm,V0.alert,V0.fetch,M0,...K0,...j1);if(J.preserveExisting){for(let[d,E0]of Object.entries($1))if(!(d in Z)||Z[d]===void 0)Z[d]=E0}else Object.assign(Z,$1);for(let[d,E0]of Object.entries(H))if(!(d in Z))Z[d]=E0}catch(S){let v=S instanceof Error?S.message:String(S);if(EG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(bG(v))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: ${v}`);else if(J5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await hG(Y,Z,X)}catch(P){if(J5.env.STX_DEBUG){let f=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${f}`)}}}}function SG($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var CG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function J8($,Z){let X=Z?n0.dirname(Z):J5.cwd(),J=J5.cwd(),Y=$.split(`
|
|
3657
|
+
`),Q=[],G=0;while(G<Y.length){let q=Y[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let U=0;for(;G<Y.length;G++){for(let W of Y[G])if(W==="{")U++;else if(W==="}")U--;if(U<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let U=0,W=!1,z=G;for(let B=G;B<Y.length&&!W;B++){let j=null,_=!1,O=Y[B];for(let V=0;V<O.length;V++){let F=O[V];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(j){if(F===j)j=null;continue}if(F==='"'||F==="'"||F==="`"){j=F;continue}if(F==="(")U++;else if(F===")"){if(U--,U===0){G=B+1,W=!0;break}}}}if(!W)G=Y.length;let K=Y.slice(z,G).join(`
|
|
3658
|
+
`),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(j)H.push(`${B}: ${JSON.stringify(j[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let U=q,W=0;while(!SG(U)&&G+W+1<Y.length)W++,U=`${U} ${Y[G+W].trim()}`;G+=W;let z=U.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=U.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=U.match(/^import\s+['"](.+?)['"]/),B=U,j=(_)=>{if(_.startsWith("."))return n0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return n0.resolve(J,_.slice(2));return _};if(z){let[,_,O]=z,V=j(O);Q.push(`const ${_} = (await import('${V}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(K){let[,_,O]=K,V=j(O),F=[],L=[],w=TG.has(O);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let N=D.split(/\s+as\s+/);if(N.length===2){let[T,A]=[N[0].trim(),N[1].trim()];if(w&&o2.has(T)){Q.push(`const ${A} = ${T};`);continue}F.push(`${T}: ${A}`),L.push(A)}else{if(w&&o2.has(D))continue;F.push(D),L.push(D)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${V}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=j(H[1]);Q.push(`await import('${_}')`)}else Q.push(B);G++;continue}if(CG.test(q))Q.push(Y[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let U=a2(Y,G),{type:W,name:z,value:K}=U;Q.push(`${W} ${z} = ${K};`),Q.push(`module.exports.${z} = ${z};`),G=U.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let U=T4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let U=a2(Y,G),{type:W,name:z,value:K}=U;Q.push(`${W} ${z} = ${K};`),Q.push(`module.exports.${z} = ${z};`),G=U.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let U=T4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let U=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[G]=U;let z=T4(W,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(q.startsWith("export default ")){let U=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${U};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let U=q.match(/(?:export\s+)?class\s+(\w+)/);if(U){let W=U[1],z=Y[G].replace(/^export\s+/,""),K=0,H=G;for(;H<Y.length;H++){let B=Y[H];for(let j of B)if(j==="{")K++;else if(j==="}")K--;if(H>G)z+=`
|
|
3659
|
+
`+B;if(K<=0&&H>=G)break}Q.push(z),Q.push(`module.exports.${W} = ${W};`),G=H+1}else Q.push(q),G++}else if(q.includes("module.exports"))Q.push(q),G++;else if(q.trim()&&!q.startsWith("//"))Q.push(q),G++;else G++}return PG(Q.join(`
|
|
3660
|
+
`),X,J)}function PG($,Z,X){let J=$.length,Y="",Q=0,G=null,q=!1,U=!1,W=0;while(Q<J){let z=$[Q],K=$[Q+1];if(q){if(Y+=z,z===`
|
|
3661
|
+
`)q=!1;Q++;continue}if(U){if(Y+=z,z==="*"&&K==="/"){Y+=K,Q+=2,U=!1;continue}Q++;continue}if(!G&&z==="/"&&K==="/"){q=!0,Y+=z,Q++;continue}if(!G&&z==="/"&&K==="*"){U=!0,Y+=z,Q++;continue}if(G){if(Y+=z,z==="\\"){Y+=K,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&K==="{"){W++,Y+=K,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(z==="{")W++;else if(z==="}")W--}if(z==='"'||z==="'"||z==="`"){G=z,Y+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let H=vG($,Q);if(H){let{quote:B,path:j,end:_}=H;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let O=j.startsWith(".")?n0.resolve(Z,j):n0.resolve(X,j.slice(2));Y+=`await import(${B}${O}${B})`,Q=_;continue}}}Y+=z,Q++}return Y}function vG($,Z){let X=Z+5;if(X>=$.length)return null;if(!/\s/.test($[X]))return null;while(X<$.length&&/\s/.test($[X]))X++;if(!$.startsWith("import",X))return null;X+=6;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let J=$[X];if(J!=="'"&&J!=='"')return null;X++;let Y=X;while(X<$.length&&$[X]!==J)if($[X]==="\\")X+=2;else X++;if(X>=$.length)return null;let Q=$.slice(Y,X);X++;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return{quote:J,path:Q,end:X+1}}function Y8($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=W0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function Q8($){let Z=[],X=$.slice(1,-1).trim();if(!X)return Z;let J=0,Y=0,Q="";while(J<X.length){let G=X[J];if(G==="{"||G==="["){let q=Y===0?Y8(X,J):null;if(q){Z.push(...Q8(q.pattern)),J=q.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<X.length&&X[J]!==","&&Y===0){if(X[J]==="{"||X[J]==="[")Y++;else if(X[J]==="}"||X[J]==="]")Y--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function fG($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let X=Z[0].length,J=(Y)=>Y===" "||Y==="\t";while(X<$.length&&J($[X]))X++;if($[X]===":"){let Y=0,Q=null;X++;for(;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let q=$[X+1],U=$[X-1];if(q!=="="&&q!==">"&&U!=="="&&U!=="!"&&U!=="<"&&U!==">")break}}if($[X]!=="=")return null}while(X<$.length&&J($[X]))X++;if($[X]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(X+1).trim()}}function r2($,Z,X,J){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)J++;else if(G===X)J--}return J}function a2($,Z){let X=$[Z].trim(),J=fG(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let z=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let K=X.slice(z[0].length),H=Z;if(K.startsWith("{")||K.startsWith("[")){let j=K[0],_=j==="{"?"}":"]",O=r2(K,j,_,0),V=K;for(let F=Z+1;F<$.length&&O>0;F++)V+=` ${$[F].trim()}`,H=F,O=r2($[F],j,_,O);if(O>0)V=K,H=Z;K=V}let B=Y8(K,0);if(B){let j=z[1],_=B.pattern,O=K.slice(B.endPos).trim();if(O.startsWith("=")){let V=O.slice(1).trim(),F=V,L=Math.max(H,Z);if(t2(V)){let N=e2($,L,V);F=N.value,L=N.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=Q8(_),R=`__stx_src_${Z}`,D=w.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
3662
3662
|
`);return{type:j,name:R,value:`${F}; ${j} ${_} = ${R};
|
|
3663
|
-
${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=Y,U=q,W=Z;if(
|
|
3664
|
-
${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:U,nextIndex:W}}function
|
|
3663
|
+
${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=Y,U=q,W=Z;if(t2(q)){let z=e2($,Z,q);U=z.value,W=z.nextIndex}else W=Z+1;while(W<$.length){let z=$[W].trim();if(z.startsWith(".")||z.startsWith("?."))U+=`
|
|
3664
|
+
${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:U,nextIndex:W}}function T4($,Z){let X=$[Z].trim(),J=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${X}`);let[,Y]=J,Q=X.replace(/^export\s+/,""),G=Z;if(xG(X)){let q=gG($,Z,Q);Q=q.functionCode,G=q.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function t2($){let Z=$.trim();if(Z.startsWith("{"))return W0(Z,"{","}",0)===-1;if(Z.startsWith("["))return W0(Z,"[","]",0)===-1;return!G8(Z)}function G8($){let Z={paren:0,bracket:0,brace:0},X=null,J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&X)continue;if((Q==='"'||Q==="'")&&!X){X=Q;continue}if(Q===X&&X!=="`"){X=null;continue}if(Q==="`"&&!X){X="`";continue}if(Q==="`"&&X==="`"&&J===0){X=null;continue}if(X==="`"&&Q==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(X)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&X===null}function q8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=W0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function xG($){let Z=q8($);if(Z===-1)return!0;return W0($,"{","}",Z)===-1}function e2($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!G8(J)){let Q=$[Y];J+=`
|
|
3665
3665
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3666
|
-
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function
|
|
3667
|
-
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function
|
|
3668
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let
|
|
3666
|
+
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function gG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=q8(J);if(Q!==-1){if(W0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3667
|
+
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function $8($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...J5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function hG($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=$8(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=$8(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function uG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function dG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var I5=new V1(500),E$=new V1(1000),k4=new V1(2000),lG=0;function cG($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function U8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function pG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!pG($)}var k$=new Map;function I4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=k$.get(Z);if(X)return X;if(k$.size>=16)k$.clear();let J=new Bun.Transpiler($);return k$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=I4({loader:"ts",target:"browser",define:$5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function iG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(z)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===z){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let z=1;while(Y<Q&&z>0)if($[Y]==="{")z++,Y++;else if($[Y]==="}")z--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3668
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function nG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function sG($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function oG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of nG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=sG(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function A$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let O of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?h.resolve(Y.root):void 0,K=z??h.dirname(J),H=[],B=(O)=>{if(O&&!H.includes(O))H.push(O)},j=X.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let O of _)B(typeof O==="string"?O:null);if(z)B(h.resolve(z,"resources/views/components")),B(h.resolve(z,"resources/components")),B(h.resolve(z,"src/components")),B(h.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return o(h.resolve(h.dirname(J),`${Q}.stx`));for(let O of H){let V=h.isAbsolute(O)?O:h.resolve(K,O);for(let F of W)if(await o(h.join(V,F)))return!0}return!1}function rG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function aG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function tG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await r("stx/variable-extractor",()=>import("./chunk-vh7h37mn.js")),z=q??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let K=new Set(z);K.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&rG(H)?H:"";try{let j=(P)=>P.split("-").map((f)=>f.charAt(0).toUpperCase()+f.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,F=Y.__importedComponents;if(F){let P=[O,O.toLowerCase(),j(O),_(O)];for(let f of P)if(F.has(f)){V=F.get(f);break}}let L=[];if(!V){let P=[`${O}.stx`,`${j(O)}.stx`,`${_(O)}.stx`],f=[...new Set(P)],l=Y.__originalFilePath,m=[];if(l){let d=h.join(h.dirname(l),"components");m.push(d)}if(J)m.push(J);let q0=G._rootComponentsDir;if(typeof q0==="string"&&!m.includes(q0))m.push(q0);let K0=h.join(h.dirname(Q),"components");if(!m.includes(K0))m.push(K0);if(G.componentsDir&&G.componentsDir!==J&&!m.includes(G.componentsDir))m.push(G.componentsDir);let B1=G._pluginComponentDirs;if(Array.isArray(B1)){for(let d of B1)if(typeof d==="string"&&!m.includes(d))m.push(d)}let k0=typeof G.root==="string"?h.resolve(G.root):void 0,M0=k0??h.dirname(Q),P0=[];if(k0)P0.push(h.resolve(k0,"resources/views/components")),P0.push(h.resolve(k0,"resources/components")),P0.push(h.resolve(k0,"src/components")),P0.push(h.resolve(k0,"components"));P0.push(h.resolve(import.meta.dir,"components"));for(let d of P0)if(!m.includes(d))m.push(d);let j1=[...new Set(m.map((d)=>{if(!d)return d;return h.isAbsolute(d)?d:h.resolve(M0,d)}))];m.length=0,m.push(...j1);let y1=`${O}\x00${Q}\x00${j1.join("\x00")}`,$1=E$.get(y1);if($1)if(await o($1))V=$1;else E$.delete(y1);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=h.resolve(h.dirname(Q),`${O}.stx`),L.push(V);else if(!V)for(let d of m){if(!d)continue;for(let E0 of f){let Z1=h.join(d,E0);if(L.push(Z1),await o(Z1)){V=Z1;break}}if(V)break;if(!V)try{let E0=await import("fs");if(!E0.statSync(d,{throwIfNoEntry:!1})?.isDirectory())continue;let E5=8,S1=[{path:d,depth:0}];while(S1.length>0&&!V){let s0=S1.pop();if(s0.depth>=E5)continue;let b5;try{b5=E0.readdirSync(s0.path,{withFileTypes:!0})}catch{continue}for(let y5 of b5){if(!y5.isDirectory())continue;if(y5.name==="node_modules"||y5.name.startsWith("."))continue;let S4=h.join(s0.path,y5.name);for(let w8 of f){let b$=h.join(S4,w8);if(L.push(b$),await o(b$)){V=b$;break}}if(V)break;S1.push({path:S4,depth:s0.depth+1})}}}catch{}if(V)break}if(V)E$.set(y1,V)}if(!V||!await o(V)){let P=L.length>0?`
|
|
3669
3669
|
Searched paths:
|
|
3670
|
-
${L.map((
|
|
3671
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(
|
|
3672
|
-
`)}`}if(X&&
|
|
3673
|
-
${
|
|
3670
|
+
${L.map((f)=>` - ${f}`).join(`
|
|
3671
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(I5.has(V))w=I5.get(V);else try{w=await Bun.file(V).text(),I5.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",S5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,f]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=f;let N=c0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,f)=>{let l=N.scripts[Number(f)]||"",m=l.match(/^<script\b([^>]*)>/i)?.[1]||"",q0=m.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),K0=!q0||["module","text/javascript","application/javascript"].includes(q0);if(!/\bserver\b/i.test(m)&&K0)return T.push(l),"";return l}),{extractSlotContent:M}=await r("stx/slots",()=>import("./chunk-hdy6e3yf.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,f]of k.namedSlots)I[P]=f.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:K,__sections:{},__stx_signals_gate:J1(w)||aG(X)};oG(w,y);let E=w,b=U$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(C)],x=[],s=g.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&g.every((P)=>/\bserver\b/.test(P[1]||"")),c=null,_0=null;if(s){let P=cG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){c=`${V}\x00${P}`;let f=k4.get(c);if(f){for(let l of f.dependencies)U.add(l);return f.output}_0=new Set(U)}}for(let P of g){let f=P[1]||"",l=P[2]||"",m=f.includes("server");if(N1(f)&&l.trim())l=A1(l);if(m&&l)try{await W(l,y,V)}catch(K0){}if(!m){let K0=l.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),B1=K0.includes("{{")&&K0.includes("}}"),k0=K0.includes("{!!")&&K0.includes("!!}");if(B1||k0)K0=v$(K0,y);let M0=f.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");x.push(`<script${M0}>${K0}</script>`)}}let N0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),A0=N0?N0[1]:"",g0=N0?N0[2]:"",a="",F0=A0&&/\bscoped\b/i.test(A0);if(N0)a=`<style${A0}>${g0}</style>`;let X0=E;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N0)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,f=[];if(X0=X0.replace(P,(l,m)=>{let q0=m.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(q0)f.push(`<style${q0[1]}>${q0[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),f.length>0)a=`${a}${f.join(`
|
|
3672
|
+
`)}`}if(X&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:K1}=await r("stx/slots",()=>import("./chunk-hdy6e3yf.js")),{defaultSlot:Y5,namedSlots:n}=k;X0=await K1(X0,Y5,n,y);let t=x.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),J0=tG(x),V0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(J0.length>0||V0.length>0)y.__stx_client_signal_names=[...new Set([...V0,...J0])];let O0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:t||x.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let C0=await M4(X0,y,V,O0,U),H1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of C0.matchAll(/\{\{([\s\S]*?)\}\}/g))H1.add(P[1].trim());if(H1.size>0)Y.__stx_preserved_client_expressions=[...H1];let S=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++lG}_${Math.random().toString(36).slice(2,8)}`,v=C0;if(t){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${U8(JSON.stringify(Z))}"`}catch{}let f=B?` stx-hydrate="${U8(B)}"`:"";v=`<div data-stx-scope="${S}"${P}${f}>${C0}</div>`;let l=await Promise.all(x.map(async(m)=>{let q0=m.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!q0)return m;let[,K0,B1]=q0,k0=b4(B1,{filePath:V,projectRoot:process.cwd()}),M0=k0.code,P0=y4(k0.styles);M0=D5(M0).code;let{hasUserImports:j1,bundleClientScript:y1}=await r("stx/client-script-bundler",()=>import("./chunk-8ksdma43.js"));if(j1(M0))M0=await y1(M0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:$1}=await r("stx/signal-processing",()=>import("./chunk-y2j14rjd.js"));M0=M0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(s0,b5)=>$1(b5));let d=o0(M0),E0=iG(d),Z1=`function(__scopeId) {
|
|
3673
|
+
${c1("const",[...W8,...E0],d)}
|
|
3674
3674
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3675
3675
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
3676
3676
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -3684,12 +3684,12 @@ ${L.map((u)=>` - ${u}`).join(`
|
|
|
3684
3684
|
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
3685
3685
|
|
|
3686
3686
|
try {
|
|
3687
|
-
${
|
|
3687
|
+
${d}
|
|
3688
3688
|
|
|
3689
3689
|
// Register all defined signals and functions in this scope
|
|
3690
3690
|
const __localVars = {};
|
|
3691
3691
|
try {
|
|
3692
|
-
${
|
|
3692
|
+
${E0.map((s0)=>`if (typeof ${s0} !== 'undefined') __localVars['${s0}'] = ${s0};`).join(`
|
|
3693
3693
|
`)}
|
|
3694
3694
|
}
|
|
3695
3695
|
catch (e) {}
|
|
@@ -3698,41 +3698,41 @@ catch (e) {}
|
|
|
3698
3698
|
finally {
|
|
3699
3699
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
3700
3700
|
}
|
|
3701
|
-
}`,
|
|
3702
|
-
`+
|
|
3703
|
-
`),
|
|
3704
|
-
`+
|
|
3705
|
-
`+
|
|
3706
|
-
`+
|
|
3707
|
-
`),y.__stx_event_bindings=[]}}if(
|
|
3701
|
+
}`,E5=B?null:m4(Y,Z1),S1=E5?`window.__stxComponentFactories[${JSON.stringify(E5)}](${JSON.stringify(S)});`:`(${Z1})(${JSON.stringify(S)});`;if(B)return`${P0}<script type="stx/island" data-stx-island="${S}" data-stx-scoped${K0}>${S1}</script>`;return`${P0}<script data-stx-scoped data-stx-run="always"${K0}>${S1}</script>`}));if(v=v+`
|
|
3702
|
+
`+l.join(`
|
|
3703
|
+
`),a)v+=`
|
|
3704
|
+
`+a}else{if(a)v+=`
|
|
3705
|
+
`+a;if(x.length>0){let P=y.__stx_event_bindings||[],f=T$(y),l=await Promise.all(x.map(async(m)=>{let q0=m.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!q0)return m;return await I$(q0[1],{eventBindings:P,templateContent:v,filePath:V,projectRoot:process.cwd(),serverData:f})}));v+=`
|
|
3706
|
+
`+l.join(`
|
|
3707
|
+
`),y.__stx_event_bindings=[]}}if(F0){let P=B$(v,V);if(P.hasScoped)v=P.html}if(c&&_0)k4.set(c,{output:v,dependencies:[...U].filter((P)=>!_0.has(P))});return T.length>0?`${v}
|
|
3708
3708
|
${T.join(`
|
|
3709
|
-
`)}`:
|
|
3710
|
-
`),q=0;for(let U=0;U<G.length;U++)if(q+=G[U].length+1,q>=Z){J=U+1,Y=G[U].trim();let W=Math.max(0,U-2),
|
|
3711
|
-
`);break}}else if(X){let G=$.indexOf(X);if(G>=0)return
|
|
3712
|
-
`,Math.max(0,Y-1));W=Y-(
|
|
3709
|
+
`)}`:v}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function o($){return Bun.file($).exists()}function E4($,Z){let X=h.resolve(Z),J=h.resolve($),Y=X.endsWith(h.sep)?X:X+h.sep;if(J===X||J.startsWith(Y))return J;return null}async function eG($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=h.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await o(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function e5($,Z,X,J){let Y=await $q($,Z,X,J);if(Y===null)return null;let Q=E4(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of G){let U=h.isAbsolute(q)?q:h.resolve(process.cwd(),q);if(E4(Y,U))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function $q($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=h.join(Q,$),B=E4(H,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${B}`);if(await o(B)&&J)J.add(B);return B}let G=h.join(Y,$);if(await o(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let B=`${G}${H}`;if(await o(B)){if(X.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let q=[];if(X.layoutsDir)q.push(h.isAbsolute(X.layoutsDir)?X.layoutsDir:h.resolve(process.cwd(),X.layoutsDir));let U=h.resolve(Y),W=process.cwd();for(let H=0;H<10;H++){let B=h.join(U,"layouts"),j=!1;try{j=mG.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=h.dirname(U);if(_===U||_.length<W.length)break;U=_}for(let H of q){let B=await eG(H,$,J,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=h.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:h.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[h.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await o(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=h.join(X.partialsDir||Y,"layouts",H[1]);if(await o(B)){if(X.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await o(j)){if(X.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(X.partialsDir){let H=h.join(X.partialsDir,"layouts");if(await o(H)){let B=h.join(H,$);if(await o(B)){if(X.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await o(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let z=X.partialsDir||h.join(process.cwd(),"views"),K=h.join(z,$);if(await o(K)){if(X.debug)console.log(`Found in views path: ${K}`);if(J)J.add(K);return K}if(!$.endsWith(".stx")){let H=`${K}.stx`;if(await o(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(J)J.add(H);return H}}if(Y.includes("temp")){let H=h.join(h.dirname(Y),"layouts",$);if(await o(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let B=`${H}.stx`;if(await o(B)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(X.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function z8($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
3710
|
+
`),q=0;for(let U=0;U<G.length;U++)if(q+=G[U].length+1,q>=Z){J=U+1,Y=G[U].trim();let W=Math.max(0,U-2),z=Math.min(G.length,U+3);Q=G.slice(W,z).map((K,H)=>{let B=W+H+1;return`${B===J?"> ":" "}${B}: ${K}`}).join(`
|
|
3711
|
+
`);break}}else if(X){let G=$.indexOf(X);if(G>=0)return z8($,G)}}catch{}return{lineNumber:J,lineContent:Y,context:Q}}var Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function U0($,Z,X,J,Y,Q){let{lineNumber:G,context:q}=z8(J,Y,Q),U=X.split("/").pop(),W=0;if(typeof Y==="number"&&Y>=0&&J){let K=J.lastIndexOf(`
|
|
3712
|
+
`,Math.max(0,Y-1));W=Y-(K+1)+1}let z="";if(G>0)z+=`
|
|
3713
3713
|
${X}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
3714
|
-
`;if(
|
|
3714
|
+
`;if(z+=`
|
|
3715
3715
|
${Z0.bold}${Z0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Z0.reset}
|
|
3716
|
-
`,
|
|
3717
|
-
`,
|
|
3718
|
-
`,
|
|
3719
|
-
${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${U}${Z0.reset}`,G>0)
|
|
3716
|
+
`,z+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${$} Error${Z0.reset}${" ".repeat(Math.max(0,43-$.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
|
|
3717
|
+
`,z+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
|
|
3718
|
+
`,z+=`
|
|
3719
|
+
${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${U}${Z0.reset}`,G>0)z+=` ${Z0.gray}(line ${G}${W>0?`, col ${W}`:""})${Z0.reset}`;if(z+=`
|
|
3720
3720
|
${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
3721
|
-
`,q)
|
|
3721
|
+
`,q)z+=`
|
|
3722
3722
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3723
3723
|
${Z0.dim}${q}${Z0.reset}
|
|
3724
|
-
`;return
|
|
3724
|
+
`;return z}function WV(){I5.clear(),E$.clear(),k4.clear()}function zV(){return{size:I5.size,maxSize:500}}var Zq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Xq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Jq($,Z){let X=Z;while(!0){let J=b1.join(X,"node_modules",$,"package.json");if(k5.existsSync(J))return b1.dirname(J);let Y=b1.dirname(X);if(Y===X)return null;X=Y}}function Yq($,Z){if(!$||typeof $!=="object")return null;let X=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),q=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:q}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function Qq($,Z){let X=Xq($);if(!X||!X.subpath)return null;let J=Jq(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(k5.readFileSync(b1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=Yq(Y.exports,Q);if(!G)return null;let q=b1.resolve(J,G);return k5.existsSync(q)?q:null}function b4($,Z){let X=Z.filePath?b1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[];return{code:$.replace(Zq,(q,U)=>{let W;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(W=U.startsWith("/")?U:b1.resolve(X,U),!k5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(U,J)}catch{z=Qq(U,J)}if(!z)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(Y.has(W))return"";Y.add(W);try{let z=k5.readFileSync(W,"utf8");Q.push({source:U,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function Gq($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function y4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Gq(Z.source)}" data-stx-layer="vendor">
|
|
3725
3725
|
@layer vendor {
|
|
3726
3726
|
${Z.contents}
|
|
3727
3727
|
}
|
|
3728
3728
|
</style>`}).join(`
|
|
3729
3729
|
`)}
|
|
3730
|
-
`}var
|
|
3730
|
+
`}var qq=j8,V8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];function D5($){let Z=p0($),X=new Set;for(let q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of q[1].split(",")){let W=U.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)X.add(W)}let J=new Set;for(let q of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(q[1]);for(let q of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let U of q[1].split(",")){let W=U.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=V8.filter((q)=>{if(X.has(q)||J.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test(Z)}),Q=O8(Z).filter((q)=>!X.has(q)&&!J.has(q));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
3731
3731
|
`)}
|
|
3732
|
-
${$}`,imports:Y,models:Q}}var
|
|
3732
|
+
${$}`,imports:Y,models:Q}}var Uq=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 O8($){let Z=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,J;while((J=X.exec($))!==null)if(!Uq.has(J[1]))Z.add(J[1]);return Array.from(Z)}function Wq($){let Z=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of X[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function F8($){let Z=new Set,X=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],z=G[2];if(G[0].includes("import type"))continue;let K=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],V=_[2]||O;if(Y.add(O),Y.add(V),z==="stx"||z==="@stacksjs/stx")Z.add(O);else X.add(O);if(V!==O)K.push(`${V} = ${O}`)}let H=K.length>0?`var ${K.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],H)}let q=Wq(J);for(let W of qq){if(Y.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(W)}for(let W of V8){if(Y.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))X.add(W)}let U=O8(J);for(let W of U)if(!Y.has(W)&&!q.has(W))X.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function L8($,Z){let X=[];if($.length>0)X.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)X.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(X.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
3733
3733
|
${X.join(`
|
|
3734
3734
|
`)}
|
|
3735
|
-
${
|
|
3735
|
+
${zq($,Z)}`;return""}function MV($,Z=[]){let{browserImports:X}=F8($),J=new Set(Z);return L8([],X.filter((Y)=>!J.has(Y)))}function zq($,Z){let X=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(X.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
3736
3736
|
[${X.join(", ")}].forEach(function (e) {
|
|
3737
3737
|
if (e[1] !== 'undefined') return;
|
|
3738
3738
|
console.error(
|
|
@@ -3741,15 +3741,15 @@ ${tG($,Z)}`;return""}function qO($,Z=[]){let{browserImports:X}=H8($),J=new Set(Z
|
|
|
3741
3741
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
3742
3742
|
);
|
|
3743
3743
|
});
|
|
3744
|
-
`}function
|
|
3744
|
+
`}function T$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;J[Y]=Q}return J.__stxDeclaredPayload=!0,J}let X={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;X[J]=Y}return X}function K8($,Z){let X=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))X.add(Y)}return X}function Kq($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(K8(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(K8(X[1],!1).has(Z))return!0;return!1}function Hq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Bq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,H8=new Set;function jq($,Z){let X=Bq.test($),J=Z.length>32768;if(!X&&!J)return;if(H8.has($))return;if(H8.add($),X)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function X4($,Z){if(!Z)return"";let X=p0($),J=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!J&&!Hq(X,Q))continue;if(Kq($,Q))continue;let q;try{q=JSON.stringify(G)}catch{continue}if(q===void 0)continue;jq(Q,q),Y.push(` var ${Q} = ${q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
3745
3745
|
${Y.join(`
|
|
3746
3746
|
`)}
|
|
3747
|
-
`}var
|
|
3747
|
+
`}var _q={left:0,middle:1,right:2};function Vq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let X of $.systemKeys)Z.push(`if (!$event.${X}Key) return`);if($.keys.length>0){let X=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if($.mouse!==null){let X=_q[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Oq($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=y$($.handler),G=Vq(Y),q=[];if(Y.once)q.push("once: true");if(Y.capture)q.push("capture: true");if(Y.passive)q.push("passive: true");let U=q.length>0?`, { ${q.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
|
|
3748
3748
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
3749
|
-
};`;function H(B){if(/\$emit\s*\(/.test(B))return`${
|
|
3749
|
+
};`;function H(B){if(/\$emit\s*\(/.test(B))return`${K}
|
|
3750
3750
|
${B}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
3751
3751
|
if (scope && scope.__stx_execute) {
|
|
3752
|
-
scope.__stx_execute('${
|
|
3752
|
+
scope.__stx_execute('${z}', $event, $el);
|
|
3753
3753
|
}
|
|
3754
3754
|
else {
|
|
3755
3755
|
${B}
|
|
@@ -3776,34 +3776,34 @@ else {
|
|
|
3776
3776
|
}${U})
|
|
3777
3777
|
})()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${X}')
|
|
3778
3778
|
if ($el) $el.addEventListener('${J}', function($event) {
|
|
3779
|
-
${W}${
|
|
3779
|
+
${W}${K}
|
|
3780
3780
|
${Q}
|
|
3781
3781
|
}${U})`;return` var $el = document.getElementById('${X}')
|
|
3782
3782
|
if ($el) $el.addEventListener('${J}', function($event) {
|
|
3783
3783
|
${W}var scope = $el.closest('[data-stx-scope]');
|
|
3784
3784
|
if (scope && scope.__stx_execute) {
|
|
3785
|
-
scope.__stx_execute('${
|
|
3785
|
+
scope.__stx_execute('${z}', $event, $el);
|
|
3786
3786
|
}
|
|
3787
3787
|
else {
|
|
3788
3788
|
${Q}
|
|
3789
3789
|
}
|
|
3790
|
-
}${U})`}function
|
|
3790
|
+
}${U})`}function Fq($){if($.length===0)return"";return`
|
|
3791
3791
|
// STX: auto-generated event bindings
|
|
3792
|
-
${$.map((X,J)=>
|
|
3793
|
-
`)}`}function
|
|
3794
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let
|
|
3795
|
-
${
|
|
3796
|
-
${
|
|
3797
|
-
</script>`}let j=
|
|
3792
|
+
${$.map((X,J)=>Oq(X,J)).join(`
|
|
3793
|
+
`)}`}function B8($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3794
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var Lq=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 wq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Lq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function I$($,Z={}){let X=$,J="",Y=!1,Q=[],G=b4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=y4(G.styles),U=D5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await r("stx/client-script-bundler",()=>import("./chunk-8ksdma43.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=F8(X);X=F.code,J=L8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${X4(X,Z.serverData)}${J}`,X=o0(X),!Y&&N1(Z.attrs||""))X=A1(X);let K=Fq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
|
|
3795
|
+
${s1(`${J}${X}
|
|
3796
|
+
${K}`)}
|
|
3797
|
+
</script>`}let j=_8($),_=/function __stx_setup_/.test(X),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(F){let L=F.length>0?`
|
|
3798
3798
|
return { ${F.join(", ")} };`:"";return`${q}<script data-stx-scoped data-stx-run="always">
|
|
3799
3799
|
window.stx.mount(function() {
|
|
3800
3800
|
'use strict';
|
|
3801
|
-
${
|
|
3802
|
-
${
|
|
3803
|
-
})</script>`}if(!
|
|
3801
|
+
${s1(`${J}${X}
|
|
3802
|
+
${K}${L}`)}
|
|
3803
|
+
})</script>`}if(!O&&!_){if(j)return V(B8($));if(Z.templateContent){let F=B8($);if(F.length>0){let L=wq(Z.templateContent);if(F.some((R)=>L.has(R)))return V(F)}}}return`${q}<script data-stx-scoped data-stx-run="always">
|
|
3804
3804
|
;(function() {
|
|
3805
3805
|
'use strict';
|
|
3806
|
-
${
|
|
3807
|
-
${
|
|
3806
|
+
${s1(`${J}${X}
|
|
3807
|
+
${K}`)}
|
|
3808
3808
|
})()</script>`}
|
|
3809
|
-
export{
|
|
3809
|
+
export{QZ as cl,GZ as dl,qZ as el,r0 as fl,h$ as gl,u$ as hl,d$ as il,m$ as jl,R7 as kl,w7 as ll,_Z as ml,OZ as nl,LZ as ol,QU as pl,GU as ql,qU as rl,UU as sl,WU as tl,JZ as ul,V7 as vl,O7 as wl,F7 as xl,L7 as yl,JU as zl,y7 as Al,z5 as Bl,y$ as Cl,S$ as Dl,M8 as El,h4 as Fl,Dq as Gl,o0 as Hl,Aq as Il,$5 as Jl,wj as Kl,b4 as Ll,y4 as Ml,qq as Nl,D5 as Ol,L8 as Pl,MV as Ql,T$ as Rl,X4 as Sl,I$ as Tl,Y0 as Ul,B0 as Vl,P5 as Wl,Q0 as Xl,Eq as Yl,x5 as Zl,bq as _l,yq as $l,Sq as am,Cq as bm,X1 as cm,Q5 as dm,h5 as em,f8 as fm,dq as gm,x8 as hm,mq as im,P$ as jm,J7 as km,J1 as lm,v$ as mm,u8 as nm,lq as om,_1 as pm,d8 as qm,b0 as rm,cq as sm,q7 as tm,oq as um,r8 as vm,a8 as wm,B7 as xm,j7 as ym,_7 as zm,ZU as Am,D7 as Bm,c$ as Cm,U5 as Dm,d5 as Em,BU as Fm,l$ as Gm,DZ as Hm,NZ as Im,AZ as Jm,jU as Km,A7 as Lm,M7 as Mm,G1 as Nm,GX as Om,qX as Pm,UX as Qm,WX as Rm,Z6 as Sm,zX as Tm,p as Um,J3 as Vm,B5 as Wm,j5 as Xm,n5 as Ym,HX as Zm,s5 as _m,BX as $m,o5 as an,F1 as bn,J6 as cn,L1 as dn,Y6 as en,Q6 as fn,r5 as gn,Y3 as hn,$0 as in,LX as jn,wX as kn,RX as ln,u1 as mn,Q3 as nn,G3 as on,u0 as pn,q3 as qn,W3 as rn,a5 as sn,NX as tn,AX as un,MX as vn,U6 as wn,Y$ as xn,W0 as yn,T6 as zn,F3 as An,q1 as Bn,w1 as Cn,I6 as Dn,V5 as En,Q$ as Fn,L3 as Gn,$J as Hn,XJ as In,b6 as Jn,YJ as Kn,QJ as Ln,S6 as Mn,R1 as Nn,xz as On,C6 as Pn,M3 as Qn,zJ as Rn,A3 as Sn,KJ as Tn,HJ as Un,gz as Vn,hz as Wn,P6 as Xn,v6 as Yn,f6 as Zn,BJ as _n,jJ as $n,uz as ao,dz as bo,_J as co,mz as do,lz as eo,h6 as fo,l6 as go,k3 as ho,$K as io,L5 as jo,E3 as ko,b3 as lo,ZK as mo,yJ as no,XK as oo,SJ as po,i6 as qo,JK as ro,CJ as so,YK as to,QK as uo,f3 as vo,zK as wo,KK as xo,HK as yo,BK as zo,jK as Ao,fJ as Bo,_K as Co,q$ as Do,xJ as Eo,VK as Fo,OK as Go,FK as Ho,LK as Io,lJ as Jo,pJ as Ko,JY as Lo,v3 as Mo,r6 as No,wK as Oo,U$ as Po,dQ as Qo,aQ as Ro,w4 as So,X8 as To,kG as Uo,EG as Vo,bG as Wo,yG as Xo,SG as Yo,J8 as Zo,fG as _o,uG as $o,dG as ap,W9 as bp,z9 as cp,CK as dp,Z9 as ep,PK as fp,h3 as gp,u3 as hp,d3 as ip,j9 as jp,_9 as kp,V9 as lp,z6 as mp,K6 as np,H6 as op,B6 as pp,z3 as qp,K3 as rp,SW as sp,CW as tp,PW as up,IX as vp,vW as wp,JH as xp,YH as yp,F9 as zp,QH as Ap,R9 as Bp,EY as Cp,N9 as Dp,I9 as Ep,S9 as Fp,B$ as Gp,FH as Hp,LH as Ip,s3 as Jp,C9 as Kp,P9 as Lp,GQ as Mp,RH as Np,DH as Op,qQ as Pp,NH as Qp,v9 as Rp,f9 as Sp,_$ as Tp,V$ as Up,n1 as Vp,WQ as Wp,g9 as Xp,h9 as Yp,u9 as Zp,zQ as _p,KQ as $p,o3 as aq,r3 as bq,d9 as cq,m9 as dq,c9 as eq,CH as fq,s9 as gq,_Q as hq,FQ as iq,Y2 as jq,J4 as kq,Q2 as lq,q2 as mq,U2 as nq,kQ as oq,EQ as pq,W2 as qq,$4 as rq,bQ as sq,R4 as tq,D4 as uq,A4 as vq,M4 as wq,VG as xq,RG as yq,DG as zq,NG as Aq,AG as Bq,pG as Cq,N1 as Dq,I4 as Eq,A1 as Fq,A$ as Gq,rG as Hq,aG as Iq,tG as Jq,T1 as Kq,o as Lq,e5 as Mq,z8 as Nq,U0 as Oq,WV as Pq,zV as Qq,S7 as Rq,C7 as Sq,O1 as Tq,P7 as Uq,x1 as Vq,v7 as Wq,K5 as Xq,IU as Yq,gZ as Zq,i$ as _q,kU as $q,n$ as ar,EU as br,bU as cr,Q1 as dr,yU as er,SU as fr,CU as gr,PU as hr,vU as ir,fU as jr,hZ as kr,o$ as lr,f7 as mr,gU as nr,hU as or,uU as pr,dU as qr,mU as rr,g7 as sr,lU as tr,h7 as ur,cU as vr,pU as wr,H5 as xr,pZ as yr,oU as zr,nZ as Ar,p7 as Br,p5 as Cr,ZW as Dr,t7 as Er,X3 as Fr,dW as Gr,B3 as Hr,CX as Ir,xX as Jr,mW as Kr,lW as Lr,cW as Mr,pW as Nr,iW as Or,nW as Pr,gX as Qr,hX as Rr,j6 as Sr,N6 as Tr,lX as Ur,_3 as Vr,A6 as Wr,Wz as Xr,zz as Yr,O3 as Zr,oX as _r,M6 as $r};
|