@stacksjs/stx 0.2.674 → 0.2.675
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-szevd7d5.js → chunk-028e9fty.js} +2 -2
- package/dist/{chunk-5vt48yce.js → chunk-03hhanvm.js} +9 -9
- package/dist/{chunk-rr527jt6.js → chunk-078qg8r5.js} +2 -2
- package/dist/{chunk-zmg1peyg.js → chunk-09gchq7d.js} +3 -3
- package/dist/chunk-0gk78x3r.js +2 -0
- package/dist/{chunk-mwnhdsbp.js → chunk-0thxpgtp.js} +2 -2
- package/dist/{chunk-fw413k9q.js → chunk-1b9thkg5.js} +2 -2
- package/dist/chunk-1s2y6f4b.js +2 -0
- package/dist/chunk-1wdawkn8.js +2 -0
- package/dist/chunk-248a88mc.js +2 -0
- package/dist/{chunk-nj343mw2.js → chunk-29wj0c68.js} +5 -5
- package/dist/chunk-2nqtmp8c.js +2 -0
- package/dist/chunk-2pga7zzb.js +4 -0
- package/dist/chunk-2xv29pfj.js +11 -0
- package/dist/{chunk-md2jn67b.js → chunk-374nhgyf.js} +2 -2
- package/dist/chunk-3vwkyjan.js +421 -0
- package/dist/chunk-3wsm9g9c.js +2 -0
- package/dist/chunk-3xx9d934.js +2 -0
- package/dist/chunk-41q5rww8.js +2 -0
- package/dist/chunk-4c5tk71j.js +2 -0
- package/dist/chunk-4e5jrxbn.js +14 -0
- package/dist/{chunk-ham5x7ts.js → chunk-4fhbh04h.js} +4 -4
- package/dist/chunk-4x5dk7a4.js +2 -0
- package/dist/{chunk-hz4x7h0n.js → chunk-54fazdmn.js} +5 -5
- package/dist/chunk-57ege36s.js +2 -0
- package/dist/{chunk-z22zy22p.js → chunk-5fh9m8fm.js} +2 -2
- package/dist/chunk-5n4c99y5.js +2 -0
- package/dist/{chunk-rdr09efy.js → chunk-5z0q3qv3.js} +5 -5
- package/dist/{chunk-6sjtyd0k.js → chunk-5z8mq37c.js} +4 -4
- package/dist/{chunk-p6qd7ad0.js → chunk-5zvrbms2.js} +2 -2
- package/dist/{chunk-ce6zddpf.js → chunk-6beg47t4.js} +2 -2
- package/dist/chunk-6kam8r5y.js +2 -0
- package/dist/{chunk-kdebh22m.js → chunk-6ncvb8gp.js} +10 -10
- package/dist/{chunk-srq9fqq8.js → chunk-6qh2mx6q.js} +38 -38
- package/dist/chunk-6rftdp7c.js +2 -0
- package/dist/{chunk-tddnb5bv.js → chunk-6ycyaf5g.js} +2 -2
- package/dist/chunk-7475sm3m.js +2 -0
- package/dist/{chunk-pb6erpj3.js → chunk-78x52gz3.js} +5 -5
- package/dist/{chunk-zp79zkkd.js → chunk-78yjmbbs.js} +2 -2
- package/dist/{chunk-v21bhhjb.js → chunk-7j7h1eg3.js} +1 -1
- package/dist/{chunk-4bgjrrvz.js → chunk-7q699phs.js} +1 -1
- package/dist/chunk-7s6hypn5.js +2 -0
- package/dist/chunk-7ym269yp.js +2 -0
- package/dist/{chunk-d1a86qx8.js → chunk-81rdyz2n.js} +1 -1
- package/dist/chunk-855h3crg.js +2 -0
- package/dist/chunk-8an7vcxx.js +2 -0
- package/dist/{chunk-bkkpq8dx.js → chunk-8jdbrcgt.js} +10 -10
- package/dist/{chunk-w7t2cfgy.js → chunk-8md2707p.js} +66 -66
- package/dist/chunk-8p92r2sc.js +2 -0
- package/dist/{chunk-rym0309c.js → chunk-8xxc5edr.js} +3 -3
- package/dist/{chunk-trz8z4j4.js → chunk-93z9f2be.js} +37 -37
- package/dist/{chunk-r7fdw2v5.js → chunk-97h9ga3b.js} +3 -3
- package/dist/chunk-9859r1d5.js +2 -0
- package/dist/{chunk-aet1pgw7.js → chunk-9azagdq6.js} +74 -74
- package/dist/{chunk-25zmy8q6.js → chunk-9wdd7eq6.js} +2 -2
- package/dist/{chunk-t0k16vqv.js → chunk-9ybjsfyp.js} +2 -2
- package/dist/chunk-ammn4wbd.js +2 -0
- package/dist/chunk-arh1qgmp.js +2 -0
- package/dist/{chunk-qz5b8ed4.js → chunk-bh19ezq0.js} +5 -5
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/chunk-c2rq9pap.js +2 -0
- package/dist/chunk-cfm6a679.js +2 -0
- package/dist/{chunk-hegfgw27.js → chunk-cxgremn0.js} +5 -5
- package/dist/chunk-dasxbb9y.js +2 -0
- package/dist/{chunk-sqn3y9qt.js → chunk-db5017x8.js} +2 -2
- package/dist/{chunk-hgry3mjd.js → chunk-dba795e1.js} +1 -1
- package/dist/{chunk-7adznted.js → chunk-dera8fmc.js} +2 -2
- package/dist/chunk-e02ne8zd.js +2 -0
- package/dist/chunk-e492je6q.js +2 -0
- package/dist/{chunk-v6peecfp.js → chunk-e4ezpevb.js} +2 -2
- package/dist/chunk-etbpzmxv.js +4 -0
- package/dist/{chunk-4s8zacxg.js → chunk-f26n6y9p.js} +4 -4
- package/dist/chunk-fqa5ej45.js +2 -0
- package/dist/{chunk-dgc1a3yt.js → chunk-fzc98qgn.js} +7 -7
- package/dist/{chunk-4w6baw62.js → chunk-g98gafg7.js} +2 -2
- package/dist/chunk-gc4w2s5n.js +31 -0
- package/dist/{chunk-hb3edeq9.js → chunk-ggf4z3bv.js} +6 -6
- package/dist/chunk-ggwvnpwj.js +2 -0
- package/dist/chunk-gx6wxmbv.js +2 -0
- package/dist/chunk-hamk3dky.js +2 -0
- package/dist/{chunk-vayhx642.js → chunk-haz2ezyk.js} +2 -2
- package/dist/chunk-hfbkbrwk.js +130 -0
- package/dist/chunk-hg0dd64a.js +2 -0
- package/dist/chunk-hh58k0nh.js +3 -0
- package/dist/chunk-hz5eh77e.js +2 -0
- package/dist/chunk-hz8dj5jy.js +21 -0
- package/dist/{chunk-9dtbvjpp.js → chunk-j6x7ryyn.js} +11 -11
- package/dist/{chunk-d09q93yf.js → chunk-jv021x8e.js} +2 -2
- package/dist/{chunk-pg2v1pb5.js → chunk-k06n5bjp.js} +3 -3
- package/dist/{chunk-35ezh7de.js → chunk-k72jqz6a.js} +3 -3
- package/dist/chunk-kqbpkg8n.js +2 -0
- package/dist/{chunk-bsajk82t.js → chunk-kzb04293.js} +19 -19
- package/dist/{chunk-5zhp87wv.js → chunk-mabja59q.js} +2 -2
- package/dist/chunk-mf19qxgv.js +3 -0
- package/dist/{chunk-fd49fahd.js → chunk-mn47s2ef.js} +5 -5
- package/dist/{chunk-hsmcbh0p.js → chunk-mvz825w0.js} +5 -5
- package/dist/chunk-n615cbxq.js +2 -0
- package/dist/chunk-nv0jjhtd.js +2 -0
- package/dist/chunk-nvbyscdh.js +20 -0
- package/dist/chunk-nw44qq6h.js +24 -0
- package/dist/{chunk-s0vtjyyj.js → chunk-p6g58hwg.js} +2 -2
- package/dist/chunk-prc5dxp1.js +2 -0
- package/dist/{chunk-am2w363p.js → chunk-q3gactm1.js} +4 -4
- package/dist/{chunk-w3d98907.js → chunk-q4rejyd2.js} +2 -2
- package/dist/{chunk-7j1zgrnf.js → chunk-q7tfqavs.js} +9 -9
- package/dist/{chunk-4b9s7wgy.js → chunk-qdkwg2b8.js} +2 -2
- package/dist/{chunk-a4p18ybc.js → chunk-qr7a378v.js} +3 -3
- package/dist/chunk-qwdgx34g.js +2 -0
- package/dist/chunk-r6t1712p.js +2 -0
- package/dist/{chunk-cbjabv1w.js → chunk-ram7pa4k.js} +6 -6
- package/dist/{chunk-thceyzj6.js → chunk-rza1p6e4.js} +2 -2
- package/dist/chunk-s5q9ztvj.js +2 -0
- package/dist/chunk-s8qe247r.js +2 -0
- package/dist/chunk-sfpymq5h.js +2 -0
- package/dist/chunk-shft9r9d.js +2 -0
- package/dist/{chunk-6s7tvmqp.js → chunk-sr3hmrah.js} +2 -2
- package/dist/chunk-sswy3tfc.js +2 -0
- package/dist/chunk-swxznm5v.js +2 -0
- package/dist/chunk-t8tst3sk.js +2 -0
- package/dist/chunk-t9bsgbwv.js +3 -0
- package/dist/chunk-tst8p27s.js +12 -0
- package/dist/chunk-tz09earb.js +2 -0
- package/dist/{chunk-ck2e3e47.js → chunk-vd5w1jaz.js} +3 -3
- package/dist/chunk-vf6yaymh.js +2 -0
- package/dist/{chunk-xghcsg3f.js → chunk-vg1pg6yt.js} +1 -1
- package/dist/chunk-w0vpvcj0.js +2 -0
- package/dist/{chunk-s2wptfm1.js → chunk-wav0xbnb.js} +2 -2
- package/dist/{chunk-t9kxhe46.js → chunk-wr1gm35v.js} +1 -1
- package/dist/{chunk-faakv1p6.js → chunk-wscnjtss.js} +2 -2
- package/dist/{chunk-asezs2n3.js → chunk-wtvy9r5w.js} +6 -6
- package/dist/{chunk-t79jfpv6.js → chunk-x4q4bx3q.js} +2 -2
- package/dist/{chunk-y1pcdeg9.js → chunk-x7wr720m.js} +5 -5
- package/dist/chunk-xayfz35c.js +2 -0
- package/dist/{chunk-yx3dpdwc.js → chunk-xdn6rtq2.js} +3 -3
- package/dist/chunk-xh5mh8kn.js +2 -0
- package/dist/chunk-xna6b7km.js +2 -0
- package/dist/chunk-xrrx2ddz.js +2 -0
- package/dist/{chunk-fbmth6xv.js → chunk-xtnxvmdb.js} +13 -13
- package/dist/chunk-xw4rm5zj.js +2 -0
- package/dist/{chunk-5qtthtg3.js → chunk-yaccg2c0.js} +7 -7
- package/dist/chunk-yar7fwrb.js +2 -0
- package/dist/{chunk-2zzc7006.js → chunk-yn9kvsk1.js} +2 -2
- package/dist/chunk-yt33wzqk.js +2 -0
- package/dist/{chunk-j6m8xqh3.js → chunk-z17sy8g3.js} +2 -2
- package/dist/chunk-z4bfgvb3.js +25 -0
- package/dist/chunk-z6mrnh98.js +2 -0
- package/dist/chunk-zq7xbc1k.js +2 -0
- package/dist/cli.js +22 -22
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/headwind-to-style.js +13 -1
- package/dist/native/compiler/html-to-ir.d.ts +2 -0
- package/dist/native/compiler/html-to-ir.js +9 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/compiler/render-screen.js +4 -3
- package/dist/native/compiler/style-config.d.ts +3 -0
- package/dist/native/compiler/style-config.js +5 -0
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/prop-names.js +1 -0
- package/dist/native/runtime/craft-bridge.js +15 -8
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +75 -16
- package/dist/ssg-static-paths.d.ts +12 -0
- package/dist/ssg-static-paths.js +62 -0
- package/dist/ssg.d.ts +2 -4
- package/dist/ssg.js +43 -47
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-0jwdcqj8.js +0 -2
- package/dist/chunk-0mwdq478.js +0 -2
- package/dist/chunk-0nfqgv4n.js +0 -4
- package/dist/chunk-1y6egkty.js +0 -2
- package/dist/chunk-280p4q7a.js +0 -2
- package/dist/chunk-2881tcqt.js +0 -2
- package/dist/chunk-2a775q7x.js +0 -2
- package/dist/chunk-2asdbd5e.js +0 -2
- package/dist/chunk-34yj93hh.js +0 -2
- package/dist/chunk-40tswfe7.js +0 -21
- package/dist/chunk-41de209e.js +0 -2
- package/dist/chunk-506mv7hb.js +0 -3
- package/dist/chunk-5s1ay9mv.js +0 -2
- package/dist/chunk-7kznee1g.js +0 -2
- package/dist/chunk-7mvz972c.js +0 -12
- package/dist/chunk-80zgyaqe.js +0 -2
- package/dist/chunk-84tqb1rn.js +0 -2
- package/dist/chunk-8azm7nha.js +0 -2
- package/dist/chunk-902qnyg0.js +0 -2
- package/dist/chunk-9n6jwcpb.js +0 -2
- package/dist/chunk-a6y8td0d.js +0 -2
- package/dist/chunk-a7kt1ts4.js +0 -2
- package/dist/chunk-a81y8g40.js +0 -2
- package/dist/chunk-aft1zc84.js +0 -2
- package/dist/chunk-bawq4fqy.js +0 -31
- package/dist/chunk-bdp2r0v4.js +0 -2
- package/dist/chunk-brtvm8mb.js +0 -2
- package/dist/chunk-bvzr9zqt.js +0 -2
- package/dist/chunk-cbvgtf3m.js +0 -2
- package/dist/chunk-cfydbaeq.js +0 -2
- package/dist/chunk-dq8c3h4n.js +0 -2
- package/dist/chunk-e36pne7n.js +0 -2
- package/dist/chunk-e62qfexp.js +0 -2
- package/dist/chunk-eq5jzaj5.js +0 -2
- package/dist/chunk-f9zyf9n6.js +0 -421
- package/dist/chunk-fb7t1nn9.js +0 -24
- package/dist/chunk-fr39emcz.js +0 -2
- package/dist/chunk-fsq13amm.js +0 -2
- package/dist/chunk-fxh12vqd.js +0 -2
- package/dist/chunk-gcc9fa33.js +0 -2
- package/dist/chunk-h6t2ney6.js +0 -2
- package/dist/chunk-hvtzw1jh.js +0 -2
- package/dist/chunk-j8g5cvvm.js +0 -2
- package/dist/chunk-jzjpyyw2.js +0 -2
- package/dist/chunk-k1b8x73j.js +0 -2
- package/dist/chunk-nw9bdk2n.js +0 -2
- package/dist/chunk-p4jkswz8.js +0 -2
- package/dist/chunk-p4r90vqf.js +0 -2
- package/dist/chunk-p8bgy5tt.js +0 -2
- package/dist/chunk-pqqe2b6m.js +0 -11
- package/dist/chunk-q6nwcav4.js +0 -2
- package/dist/chunk-qmqavdz2.js +0 -2
- package/dist/chunk-qpw72bty.js +0 -2
- package/dist/chunk-qwnh1kj6.js +0 -2
- package/dist/chunk-qy9m6qdn.js +0 -2
- package/dist/chunk-qychcdsm.js +0 -2
- package/dist/chunk-rj3w1ama.js +0 -2
- package/dist/chunk-rv39s5az.js +0 -20
- package/dist/chunk-sf0r963g.js +0 -2
- package/dist/chunk-ss820yys.js +0 -2
- package/dist/chunk-t4j9g2vh.js +0 -2
- package/dist/chunk-trh7s6k3.js +0 -130
- package/dist/chunk-ttemwrbx.js +0 -2
- package/dist/chunk-twqzn21x.js +0 -14
- package/dist/chunk-v14rq8b4.js +0 -3
- package/dist/chunk-vdxg7e1y.js +0 -4
- package/dist/chunk-vq513cxx.js +0 -2
- package/dist/chunk-vvq8xe3n.js +0 -2
- package/dist/chunk-w8t31bn9.js +0 -2
- package/dist/chunk-x1kz4d7j.js +0 -2
- package/dist/chunk-xaa36b0x.js +0 -3
- package/dist/chunk-xcsyqwxf.js +0 -25
- package/dist/chunk-xn9jrjzh.js +0 -2
- package/dist/chunk-z97bwx8m.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{To,$a,s,Tt,re,S,Pe,cn,Ie,de,G,cr,ln,gs,Ba,dn,dr,hs,ys,Fa,Oo,za,Ha,Va,Ua,Ne,De,bs,je,n,gn,m,d,H,J,we,k,_}from"./chunk-3vwkyjan.js";import{l,p,E,t,ie,V,a,xe,Uo,D,bn,Wo,Lt,qo,rc,mr,sc,rt,oc,hr,ic,vn,Go,ac,yr,vr,Se,Ko}from"./chunk-kzb04293.js";import{Nt}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-0thxpgtp.js";import{h}from"./chunk-6ncvb8gp.js";import{rr,ss}from"./chunk-f26n6y9p.js";import{pa,fa,er,Je,ga,R}from"./chunk-6qh2mx6q.js";import{bo,vo,wo,xo}from"./chunk-yaccg2c0.js";import{aa,Hr}from"./chunk-q7tfqavs.js";import{jr,Br,Fr}from"./chunk-8jdbrcgt.js";import{Vr,lo,uo,Ur,Wr,po}from"./chunk-hz8dj5jy.js";import{Lr,Kn}from"./chunk-z4bfgvb3.js";import{to}from"./chunk-078qg8r5.js";import{ne,oo,io,ao}from"./chunk-e4ezpevb.js";import{Jn,he,la,Yn,ua}from"./chunk-4e5jrxbn.js";import{q,Ke}from"./chunk-5zvrbms2.js";import{ma,ha}from"./chunk-8xxc5edr.js";import{C,wn,Xo}from"./chunk-hh58k0nh.js";import ds from"fs";import ce from"path";function lt(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -347,7 +347,7 @@ else {
|
|
|
347
347
|
|
|
348
348
|
console.log('[stx] Lifecycle runtime initialized');
|
|
349
349
|
})();
|
|
350
|
-
`}function
|
|
350
|
+
`}function Ge(c){return Symbol(c)}var Ts=Ge("theme"),Cs=Ge("router"),As=Ge("i18n");import*as dt from"crypto";function ut(c){let e=/\$(\w+)\./g,u=[],i;while((i=e.exec(c))!==null)if(!u.includes(i[1]))u.push(i[1]);return u}function In(){return`stx-${dt.randomBytes(4).toString("hex")}`}function On(c){return/\$\w+\./.test(c)}function Pn(c){if(!/\{\{[^}]*\$\w/.test(c)||!/\$\w+\./.test(c))return{html:c,bindings:[],stores:new Set};let e=[],u=new Set,i=/<(\w+)([^>]*?)(\s*\/?>)/g,g=c;return g=g.replace(i,(r,f,v,y)=>{if(["script","style","template"].includes(f.toLowerCase()))return r;if(!v.includes("{{"))return r;let x=[],b=!1,w=v,T=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,A=[...v.matchAll(T)];for(let I of A){let P=I[0],N=I[1],U=I[2];if(On(U)){b=!0;let W=U.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(W){let L=W[1];if(x.push({attr:N,expr:L,fullMatch:P,originalAttr:N}),ut(L).forEach((B)=>u.add(B)),N==="text")w=w.replace(P,"");else if(N==="class")w=w.replace(P,'class=""');else if(N==="disabled"||N==="hidden")w=w.replace(P,"");else w=w.replace(P,`${N}=""`)}}}if(!b)return r;let O=w.match(/\bid\s*=\s*"([^"]+)"/),M;if(O)M=O[1];else M=In(),w=` id="${M}"${w}`;for(let I of x)e.push({elementId:M,attribute:I.attr,expression:I.expr,stores:ut(I.expr)});return`<${f}${w}${y}`}),{html:g,bindings:e,stores:u}}function Ln(c,e){if(c.length===0)return"";let u=Array.from(e),i=`
|
|
351
351
|
<script>
|
|
352
352
|
(function() {
|
|
353
353
|
'use strict';
|
|
@@ -363,12 +363,12 @@ else {
|
|
|
363
363
|
// Store references for expressions
|
|
364
364
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
365
365
|
var $state = {};
|
|
366
|
-
`;for(let g of u)
|
|
367
|
-
`;
|
|
366
|
+
`;for(let g of u)i+=` $state.${g} = stores.${g} ? stores.${g}.get() : {};
|
|
367
|
+
`;i+=`
|
|
368
368
|
// Binding update functions
|
|
369
369
|
function updateBindings() {
|
|
370
|
-
`;for(let g of c){let{elementId:
|
|
371
|
-
var el = document.getElementById('${
|
|
370
|
+
`;for(let g of c){let{elementId:r,attribute:f,expression:v}=g,y=v.replace(/\$(\w+)\./g,"$state.$1.");if(f==="text")i+=` (function() {
|
|
371
|
+
var el = document.getElementById('${r}');
|
|
372
372
|
if (el) {
|
|
373
373
|
try {
|
|
374
374
|
el.textContent = ${y};
|
|
@@ -376,8 +376,8 @@ else {
|
|
|
376
376
|
catch (e) { console.error('Binding error:', e); }
|
|
377
377
|
}
|
|
378
378
|
})();
|
|
379
|
-
`;else if(f==="html")
|
|
380
|
-
var el = document.getElementById('${
|
|
379
|
+
`;else if(f==="html")i+=` (function() {
|
|
380
|
+
var el = document.getElementById('${r}');
|
|
381
381
|
if (el) {
|
|
382
382
|
try {
|
|
383
383
|
el.innerHTML = ${y};
|
|
@@ -385,8 +385,8 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
385
385
|
catch (e) { console.error('Binding error:', e); }
|
|
386
386
|
}
|
|
387
387
|
})();
|
|
388
|
-
`;else if(f==="class")
|
|
389
|
-
var el = document.getElementById('${
|
|
388
|
+
`;else if(f==="class")i+=` (function() {
|
|
389
|
+
var el = document.getElementById('${r}');
|
|
390
390
|
if (el) {
|
|
391
391
|
try {
|
|
392
392
|
var value = ${y};
|
|
@@ -414,8 +414,8 @@ else {
|
|
|
414
414
|
catch (e) { console.error('Binding error:', e); }
|
|
415
415
|
}
|
|
416
416
|
})();
|
|
417
|
-
`;else if(f==="show")
|
|
418
|
-
var el = document.getElementById('${
|
|
417
|
+
`;else if(f==="show")i+=` (function() {
|
|
418
|
+
var el = document.getElementById('${r}');
|
|
419
419
|
if (el) {
|
|
420
420
|
try {
|
|
421
421
|
el.style.display = (${y}) ? '' : 'none';
|
|
@@ -423,8 +423,8 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
423
423
|
catch (e) { console.error('Binding error:', e); }
|
|
424
424
|
}
|
|
425
425
|
})();
|
|
426
|
-
`;else if(f==="if")
|
|
427
|
-
var el = document.getElementById('${
|
|
426
|
+
`;else if(f==="if")i+=` (function() {
|
|
427
|
+
var el = document.getElementById('${r}');
|
|
428
428
|
if (el) {
|
|
429
429
|
try {
|
|
430
430
|
el.style.visibility = (${y}) ? 'visible' : 'hidden';
|
|
@@ -432,8 +432,8 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
432
432
|
catch (e) { console.error('Binding error:', e); }
|
|
433
433
|
}
|
|
434
434
|
})();
|
|
435
|
-
`;else
|
|
436
|
-
var el = document.getElementById('${
|
|
435
|
+
`;else i+=` (function() {
|
|
436
|
+
var el = document.getElementById('${r}');
|
|
437
437
|
if (el) {
|
|
438
438
|
try {
|
|
439
439
|
var value = ${y};
|
|
@@ -450,7 +450,7 @@ else {
|
|
|
450
450
|
catch (e) { console.error('Binding error:', e); }
|
|
451
451
|
}
|
|
452
452
|
})();
|
|
453
|
-
`}
|
|
453
|
+
`}i+=` }
|
|
454
454
|
|
|
455
455
|
// Subscribe to stores and update on changes. Capture the disposers so
|
|
456
456
|
// SPA fragment swaps can tear down old bindings before the next page's
|
|
@@ -458,7 +458,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
458
458
|
// using reactive-bindings stacked another subscription on every store,
|
|
459
459
|
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
460
460
|
var _disposers = [];
|
|
461
|
-
`;for(let g of u)
|
|
461
|
+
`;for(let g of u)i+=` if (stores.${g}) {
|
|
462
462
|
var _unsub_${g} = stores.${g}.subscribe(function(state) {
|
|
463
463
|
$state.${g} = state;
|
|
464
464
|
updateBindings();
|
|
@@ -467,7 +467,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
467
467
|
// are tolerated here.
|
|
468
468
|
if (typeof _unsub_${g} === 'function') _disposers.push(_unsub_${g});
|
|
469
469
|
}
|
|
470
|
-
`;return
|
|
470
|
+
`;return i+=`
|
|
471
471
|
// Initial update
|
|
472
472
|
updateBindings();
|
|
473
473
|
|
|
@@ -505,10 +505,10 @@ else {
|
|
|
505
505
|
}
|
|
506
506
|
})();
|
|
507
507
|
</script>
|
|
508
|
-
`,
|
|
508
|
+
`,i}function pt(c){let{html:e,bindings:u,stores:i}=Pn(c);if(u.length===0)return c;let g=Ln(u,i),r=e.lastIndexOf("</body>");if(r!==-1)return e.slice(0,r)+g+e.slice(r);return e+g}function jn(c){let e=c.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Nn(e);case"google-analytics":return Hn(e);case"plausible":return Bn(e);case"self-hosted":return Fn(e);case"custom":return qn(e);default:return""}}function Nn(c){let e=c.fathom;if(!e?.siteId)return"";let u=e.scriptUrl||"https://cdn.usefathom.com/script.js",i=e.defer!==!1?" defer":"",g=[`data-site="${pe(e.siteId)}"`];if(e.honorDnt)g.push('data-honor-dnt="true"');if(e.spa)g.push('data-spa="auto"');if(e.canonical)g.push(`data-canonical="${pe(e.canonical)}"`);if(e.auto===!1)g.push('data-auto="false"');return`
|
|
509
509
|
<!-- Fathom Analytics -->
|
|
510
|
-
<script src="${pe(u)}" ${g.join(" ")}${
|
|
511
|
-
`}function
|
|
510
|
+
<script src="${pe(u)}" ${g.join(" ")}${i}></script>
|
|
511
|
+
`}function Hn(c){let e=c.googleAnalytics;if(!e?.measurementId)return"";let u=pe(e.measurementId),i=e.debug?`gtag('config', '${u}', { 'debug_mode': true });`:"";return`
|
|
512
512
|
<!-- Google Analytics -->
|
|
513
513
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${u}"></script>
|
|
514
514
|
<script>
|
|
@@ -516,12 +516,12 @@ else {
|
|
|
516
516
|
function gtag(){dataLayer.push(arguments);}
|
|
517
517
|
gtag('js', new Date());
|
|
518
518
|
gtag('config', '${u}');
|
|
519
|
-
${
|
|
519
|
+
${i}
|
|
520
520
|
</script>
|
|
521
|
-
`}function
|
|
521
|
+
`}function Bn(c){let e=c.plausible;if(!e?.domain)return"";let u=e.scriptUrl||"https://plausible.io/js/script.js",i=[`data-domain="${pe(e.domain)}"`],g=u,r=[];if(e.trackLocalhost)r.push("local");if(e.hashMode)r.push("hash");if(r.length>0&&u==="https://plausible.io/js/script.js")g=`https://plausible.io/js/script.${r.join(".")}.js`;return`
|
|
522
522
|
<!-- Plausible Analytics -->
|
|
523
523
|
<script defer data-domain="${pe(e.domain)}" src="${pe(g)}"></script>
|
|
524
|
-
`}function
|
|
524
|
+
`}function Fn(c){let e=c.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let u=pe(e.siteId),i=pe(e.apiEndpoint),g=e.honorDnt?'if(n.doNotTrack==="1")return;':"",r=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",f=e.trackOutboundLinks?`
|
|
525
525
|
d.addEventListener('click',function(e){
|
|
526
526
|
var a=e.target.closest('a');
|
|
527
527
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -529,7 +529,7 @@ else {
|
|
|
529
529
|
}
|
|
530
530
|
});`:"";return`
|
|
531
531
|
<!-- Self-Hosted Analytics -->
|
|
532
|
-
<script data-site="${u}" data-api="${
|
|
532
|
+
<script data-site="${u}" data-api="${i}" defer>
|
|
533
533
|
(function(){
|
|
534
534
|
'use strict';
|
|
535
535
|
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
@@ -547,22 +547,22 @@ else {
|
|
|
547
547
|
}));
|
|
548
548
|
}
|
|
549
549
|
function pv(){t('pageview');}
|
|
550
|
-
${
|
|
550
|
+
${r}
|
|
551
551
|
${f}
|
|
552
552
|
if(d.readyState==='complete')pv();
|
|
553
553
|
else w.addEventListener('load',pv);
|
|
554
554
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
555
555
|
})();
|
|
556
556
|
</script>
|
|
557
|
-
`}function
|
|
557
|
+
`}function qn(c){let e=c.custom;if(!e)return"";if(e.inlineScript)return`
|
|
558
558
|
<!-- Custom Analytics -->
|
|
559
559
|
<script>
|
|
560
560
|
${e.inlineScript}
|
|
561
561
|
</script>
|
|
562
|
-
`;if(!e.scriptUrl)return"";let u=[];if(e.scriptId)u.push(`id="${pe(e.scriptId)}"`);if(e.attributes)for(let[g,
|
|
562
|
+
`;if(!e.scriptUrl)return"";let u=[];if(e.scriptId)u.push(`id="${pe(e.scriptId)}"`);if(e.attributes)for(let[g,r]of Object.entries(e.attributes))u.push(`${pe(g)}="${pe(r)}"`);return`
|
|
563
563
|
<!-- Custom Analytics -->
|
|
564
564
|
<script${u.length>0?` ${u.join(" ")}`:""} src="${pe(e.scriptUrl)}" defer></script>
|
|
565
|
-
`}function ft(c,e){let u=jn(e);if(!u)return c;if(!c.includes("</head>")){let
|
|
565
|
+
`}function ft(c,e){let u=jn(e);if(!u)return c;if(!c.includes("</head>")){let i=c.lastIndexOf("</body>");if(i!==-1)return c.slice(0,i)+u+c.slice(i);return c+u}return c.replace("</head>",`${u}</head>`)}function pe(c){return c.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function gt(c){let e=c.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function mt(c){let e=c?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}var Vn=0,zn=0;function ht(c,e){let u=c.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));if(u)return u[1];let i=c.match(new RegExp(`${e}\\s*=\\s*'([^']*)'`,"i"));if(i)return i[1];return null}function Wn(c){let e=[],u=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,i;while((i=u.exec(c))!==null){let[g,r,f]=i,v=i.index,y=ht(f,"x-data");if(!y)continue;let x=`__stx_scope_${Vn++}`,b=ht(f,"x-init"),w=Xn(c,r,v+g.length),T=c.slice(v,w.endIndex),A=Gn(T);e.push({id:x,selector:`[data-stx-scope="${x}"]`,stateExpr:y,initExpr:b,bindings:[],refs:A})}return e}function Xn(c,e,u){let i=1,g=u,r=new RegExp(`<${e}(?:\\s|>)`,"gi"),f=new RegExp(`</${e}>`,"gi"),v=new RegExp(`<${e}[^>]*/\\s*>`,"gi");while(i>0&&g<c.length){r.lastIndex=g,f.lastIndex=g,v.lastIndex=g;let y=r.exec(c),x=f.exec(c),b=v.exec(c);if(b&&b.index<(y?.index??1/0)){g=b.index+b[0].length;continue}if(!x)return{endIndex:c.length};if(y&&y.index<x.index)i++,g=y.index+y[0].length;else{if(i--,i===0)return{endIndex:x.index+x[0].length};g=x.index+x[0].length}}return{endIndex:c.length}}function Gn(c){let e=new Map,u=c.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,g;while((g=i.exec(u))!==null){let[,r,f]=g,v=Zn(r);e.set(f,v)}return e}function Zn(c){let e=c.match(/\bid\s*=\s*["']([^"']*)["']/);if(e)return e[1];return`__stx_el_${zn++}`}function Qn(){return`
|
|
566
566
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
567
567
|
(function() {
|
|
568
568
|
var style = document.createElement('style');
|
|
@@ -815,74 +815,74 @@ window.__stx_reactive = (function() {
|
|
|
815
815
|
|
|
816
816
|
return { initScope: initScope, reactive: reactive };
|
|
817
817
|
})();
|
|
818
|
-
`}function yt(c,e){let u=c.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let x=_(y,e,!0);if(x===void 0)return v;return String(x)}catch{return v}}),
|
|
818
|
+
`}function yt(c,e){let u=c.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let x=_(y,e,!0);if(x===void 0)return v;return String(x)}catch{return v}}),i="",g=0,r=null;while(g<u.length){let v=u[g];if(r&&v==="\\"){i+=v+(u[g+1]??""),g+=2;continue}if(v==="{"&&u[g+1]==="{"){let y=u.indexOf("}}",g+2);if(y!==-1){let x=u.slice(g,y+2);i+=f(u.slice(g+2,y),x,r),g=y+2;continue}}if(r){if(v===r)r=null}else if(v==="'"||v==='"'||v==="`")r=v;i+=v,g++}return i;function f(v,y,x){let b;try{b=_(v,e,!0)}catch{return y}if(b===void 0)return y;if(x){let w=String(b).replace(/\\/g,"\\\\").replace(new RegExp(x==="`"?"`":x,"g"),`\\${x}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return x==="`"?w.replace(/\$\{/g,"\\${"):w}if(typeof b==="string"){let w=b.trim();if(w.startsWith("{")&&w.endsWith("}")||w.startsWith("[")&&w.endsWith("]"))try{return JSON.parse(w),w}catch{}}return JSON.stringify(b)}}function tr(c,e){if(c.length===0)return"";let u=c.map((i)=>{let g=JSON.stringify(Object.fromEntries(i.refs)),r=yt(i.stateExpr,e),f=i.initExpr?yt(i.initExpr,e):null,v=JSON.stringify(r),y=f?JSON.stringify(f):"null";return`
|
|
819
819
|
(function() {
|
|
820
|
-
var scopeEl = document.querySelector('${
|
|
820
|
+
var scopeEl = document.querySelector('${i.selector}');
|
|
821
821
|
if (!scopeEl) return;
|
|
822
822
|
var refs = ${g};
|
|
823
823
|
__stx_reactive.initScope(scopeEl, ${v}, [], refs, ${y});
|
|
824
824
|
})();`}).join(`
|
|
825
825
|
`);return`
|
|
826
826
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
827
|
-
${
|
|
827
|
+
${Qn()}
|
|
828
828
|
${u}
|
|
829
|
-
</script>`}function vt(c,e,u){if(!sr(c))return c;let
|
|
830
|
-
`+g.slice(f);else g+=
|
|
831
|
-
${g}`)}function $t(c,e){let u=c;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(o,g)=>{if(g.includes("nonce="))return o;return`<script nonce="${e}"${g}>`}),u=u.replace(/<style([^>]*)>/gi,(o,g)=>{if(g.includes("nonce="))return o;return`<style nonce="${e}"${g}>`}),u}function _t(c,e,u,o){let g=c,i=o.csp;if(g=g.replace(/@csp\b/g,()=>{if(!i?.enabled||!i.directives)return"<!-- CSP not configured -->";let f=i.useNonce?Ue(e,i):void 0;return kt(i.directives,f)}),g=g.replace(/@cspNonce\b/g,()=>{if(!i?.enabled||!i.useNonce)return"";return Ue(e,i)}),i?.enabled&&i.useNonce)e.cspNonce=Ue(e,i);return g}import pr from"crypto";var hr=40,Tt="_token",Ye=null;function vr(c=hr){let e=pr.randomBytes(Math.ceil(c/2)).toString("hex").slice(0,c);return Ye=e,e}function br(){if(!Ye)vr();return Ye}function wr(c=Tt){let e=br();return`<input type="hidden" name="${c}" value="${e}">`}function Ct(c){return c.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,o)=>wr(o||Tt))}async function At(c,e,u,o){if(!o.customDirectives||o.customDirectives.length===0)return c;let g=c;for(let i of o.customDirectives){if(!i.name||typeof i.handler!=="function"){if(o.debug)console.warn("Invalid custom directive:",i);continue}if(i.hasEndTag)g=await xr(g,i,e,u,o);else g=await kr(g,i,e,u,o)}return g}async function xr(c,e,u,o,g){let{name:i,handler:f}=e,v=`@${i}`,y=`@end${i}`,x=c,b=Et(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),w=[],T=b.exec(x);while(T!==null){let[A,O="",M=""]=T,I=T.index||0;try{let P=O?Rt(e,O):[],N=M.trim(),q=await f(N,P,u,o);w.push({original:A,processed:q,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(g.debug)console.error(`Error processing custom directive @${i}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${i}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(x)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];x=x.replace(O,M)}return x}async function kr(c,e,u,o,g){let{name:i,handler:f}=e,v=c,y=[],x=[];if(e.rawParams){for(let T of Vo(v,Et(`(?<![\\w$@])@${i}\\s*\\(`,"g")))if(T.end!==-1)x.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=Et(`@${i}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)x.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of x)try{let M=Rt(e,A),I=await f("",M,u,o);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${i}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${i}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=Et(`@${i}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await f("",[],u,o);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(g.debug)console.error(`Error processing custom directive @${i}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${i}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(c,e){return c.rawParams?Mt(e):Sr(e)}function Sr(c){if(!c.trim())return[];let e=[],u="",o=!1,g="";for(let i=0;i<c.length;i++){let f=c[i];if((f==='"'||f==="'")&&(i===0||c[i-1]!=="\\"))if(!o)o=!0,g=f;else if(f===g)o=!1;else u+=f;else if(f===","&&!o)e.push(u.trim()),u="";else u+=f}if(u.trim())e.push(u.trim());return e.map((i)=>{let f=i.trim();if(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))return f.substring(1,f.length-1);return f})}var Dt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,It=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function Se(c,e){if(typeof c!=="string"||c.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(c){if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap expects an options object");let e=c,{appearance:u,colorMode:o}=e;if(Se(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!o||typeof o!=="object"||Array.isArray(o))throw Error("@appearanceBootstrap colorMode must be an object");if(Se(o.key,"colorMode.key"),Se(o.attribute,"colorMode.attribute"),Se(o.default,"colorMode.default"),!It.test(o.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Dt.test(o.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(o.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(u){if(Se(u.key,"appearance.key"),Se(u.attribute,"appearance.attribute"),Se(u.default,"appearance.default"),!It.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Dt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((i)=>typeof i!=="string"||i.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:o.key,attribute:o.attribute,default:o.default},respectExisting:e.respectExisting===!0}}function _r(c){return JSON.stringify(c).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(c){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(c)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(c,e){let u=1,o=null,g=!1;for(let i=e+1;i<c.length;i++){let f=c[i];if(g){g=!1;continue}if(o){if(f==="\\")g=!0;else if(f===o)o=null;continue}if(f==='"'||f==="'"||f==="`"){o=f;continue}if(f==="(")u++;else if(f===")"&&--u===0)return i}return-1}function Pt(c,e){let u=c,o=/@appearanceBootstrap\s*\(/g,g;while((g=o.exec(u))!==null){let i=g.index+g[0].length-1,f=Cr(u,i);if(f===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(i+1,f).trim(),y=l(`(${v})`,e),x=Tr(Er(y));u=u.slice(0,g.index)+x+u.slice(f+1),o.lastIndex=g.index+x.length}return u}import Ar from"crypto";function Q(c){return z(String(c??""))}var jt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(c,e,u,o){let g=c||e;return u?`${g} ${o}`:g}function ge(c){return String(c).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Re(c,e){if(/\bid\s*=/i.test(c))return"";return` id="${Q(e)}"`}function et(c,e,u){if(!e)return"";let o="";if(!/\baria-invalid\s*=/i.test(u))o+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))o+=` aria-describedby="${Q(`${ge(c)}-error`)}"`;return o}function Rr(){return Ar.randomUUID()}function ze(c,e){let u=c;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let o=Rr();e.csrf={token:o}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(o,g)=>{let i=g.toUpperCase();if(g&&!["GET","POST"].includes(i))return`<input type="hidden" name="_method" value="${Q(i)}">`;return o}),u}function Nt(c,e,u=jt){let o=c;return o=o.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,i,f,v,y,x="")=>{let b=i||f||"POST",w=v||y||"",T=ye(x),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Q(O)}" action="${Q(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
829
|
+
</script>`}function vt(c,e,u){if(!sr(c))return c;let i=Wn(c);if(i.length===0)return c;let g=nr(c,i),r=tr(i,e),f=g.lastIndexOf("</body>");if(f!==-1)g=g.slice(0,f)+r+`
|
|
830
|
+
`+g.slice(f);else g+=r;return g}function nr(c,e){let u=0,i=c.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(g,r,f)=>{let v=e[u++];if(!v)return g;let y=/data-stx-scope="([^"]*)"/.exec(f);if(y)return v.id=y[1],v.selector=`[data-stx-scope="${v.id}"]`,g;return`<${r} data-stx-scope="${v.id}"${f}>`});return i=i.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),i=i.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),i=i.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),i=i.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),i}function sr(c){return/x-data\s*=\s*["']/.test(c)}import ir from"fs";import Ze from"path";import{createHighlighter as or}from"ts-syntax-highlighter";var Qe=new Map;async function $e(c,e={}){try{if(!await n(c))throw Error(`Markdown file not found: ${c}`);let i=(await ir.promises.stat(c)).mtime.getTime();if(e.cache&&Qe.has(c)){let w=Qe.get(c);if(w.updatedAt>=i)return{content:w.content,data:w.data}}let g=await Bun.file(c).text(),{data:r,content:f}=er(g),v=e.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=Je(f,{gfm:!0});if(v.syntaxHighlighting?.enabled&&v.syntaxHighlighting?.serverSide)x=await ar(x,v.syntaxHighlighting?.defaultTheme||"github-dark",v.syntaxHighlighting?.highlightUnknownLanguages||!1);let b={content:x,data:r||{}};if(e.cache)Qe.set(c,{...b,updatedAt:i});return b}catch(u){if(e.debug)console.error(`Error reading/parsing markdown file ${c}:`,u);let i=u instanceof Error?u.message:String(u);return{content:m("Markdown File",`Error reading/parsing markdown file: ${i}`,c,"",0,""),data:{}}}}var qe=null;async function ar(c,e,u){let i=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!qe)try{qe=await or({theme:e||"github-dark",cache:!0})}catch(v){return console.error("Failed to initialize ts-syntax-highlighter:",v),c}let g=async(v,y,x,b)=>{let w=b.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),T=x||(u?"text":"");if(!T)return v;try{if(!qe.getSupportedLanguages().includes(T))return v;return(await qe.highlight(w,T,{theme:e})).html}catch(A){console.error(`Error highlighting code block with language ${x}:`,A)}return v},r=c,f=c.matchAll(i);for(let v of f){let[y,x,b,w]=v,T=await g(y,x,b,w);r=r.replace(y,T)}return r}async function bt(c,e,u="",i={}){return await lr(c,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(f,v,y,x)=>{try{let b=v;if(!Ze.isAbsolute(v))b=Ze.resolve(Ze.dirname(u),v);let w={};if(y)try{try{w=JSON.parse(y)}catch{if(i.debug)console.warn("Using safer alternative for parsing JS object literal");let N=y.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let U of N){let W=U.indexOf(":");if(W>0){let L=U.substring(0,W).trim(),j=U.substring(W+1).trim(),B=j.startsWith('"')&&j.endsWith('"'),X=j.startsWith("'")&&j.endsWith("'");if(B||X)j=j.substring(1,j.length-1);w[L]=j}}}}catch(P){if(i.debug)console.error("Error parsing context in @markdown-file directive:",P)}let{content:T,data:A}=await $e(b,i),O={...e,...A,...w},M=T,I=/\{\{([^}]+)\}\}/g;return M=M.replace(I,(P,N)=>{let U=N.trim();return O[U]!==void 0?String(O[U]):P}),M}catch(b){let w=b instanceof Error?b.message:String(b);return m("Markdown File",`Error including markdown file: ${w}`,u,c,x,f)}})}async function lr(c,e,u){let i=[],g;while((g=e.exec(c))!==null){let v=g[0],y=g.index,x=g;i.push(u(...x).then((b)=>({match:v,replacement:b,index:y})))}let r=await Promise.all(i);r.sort((v,y)=>y.index-v.index);let f=c;for(let{match:v,replacement:y}of r)f=f.replace(v,()=>y);return f}var wt=new WeakMap;function xt(c=16){let e=new Uint8Array(c);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ue(c,e){if(!c)return e?.nonceGenerator?.()??xt();let u=wt.get(c);if(!u)u=e?.nonceGenerator?.()??xt(),wt.set(c,u);return u}function ur(c,e){let u=[];for(let[i,g]of Object.entries(c)){if(g===void 0||g===null)continue;if(typeof g==="boolean"){if(g)u.push(i);continue}if(Array.isArray(g)){let r=[...g];if(e&&(i==="script-src"||i==="style-src"))r=r.filter((f)=>!f.startsWith("'nonce-")),r.push(`'nonce-${e}'`);if(r.length>0)u.push(`${i} ${r.join(" ")}`)}}return u.join("; ")}function kt(c,e){return`<meta http-equiv="Content-Security-Policy" content="${ur(c,e).replace(/&/g,"&").replace(/"/g,""")}">`}function St(c,e,u){if(!e.enabled||!e.addMetaTag)return c;if(c.includes('http-equiv="Content-Security-Policy"'))return c;if(!c.includes("<head>")&&!c.includes("<head "))return c;let i=e.useNonce?Ue(u,e):void 0,g=kt(e.directives,i);return c.replace(/<head([^>]*)>/,`<head$1>
|
|
831
|
+
${g}`)}function $t(c,e){let u=c;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(i,g)=>{if(g.includes("nonce="))return i;return`<script nonce="${e}"${g}>`}),u=u.replace(/<style([^>]*)>/gi,(i,g)=>{if(g.includes("nonce="))return i;return`<style nonce="${e}"${g}>`}),u}function Et(c,e,u,i){let g=c,r=i.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let f=r.useNonce?Ue(e,r):void 0;return kt(r.directives,f)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ue(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ue(e,r);return g}import pr from"crypto";var fr=40,_t="_token",Ye=null;function gr(c=fr){let e=pr.randomBytes(Math.ceil(c/2)).toString("hex").slice(0,c);return Ye=e,e}function br(){if(!Ye)gr();return Ye}function wr(c=_t){let e=br();return`<input type="hidden" name="${c}" value="${e}">`}function Ct(c){return c.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,i)=>wr(i||_t))}async function At(c,e,u,i){if(!i.customDirectives||i.customDirectives.length===0)return c;let g=c;for(let r of i.customDirectives){if(!r.name||typeof r.handler!=="function"){if(i.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await xr(g,r,e,u,i);else g=await kr(g,r,e,u,i)}return g}async function xr(c,e,u,i,g){let{name:r,handler:f}=e,v=`@${r}`,y=`@end${r}`,x=c,b=Tt(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),w=[],T=b.exec(x);while(T!==null){let[A,O="",M=""]=T,I=T.index||0;try{let P=O?Rt(e,O):[],N=M.trim(),U=await f(N,P,u,i);w.push({original:A,processed:U,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(g.debug)console.error(`Error processing custom directive @${r}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${r}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(x)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];x=x.replace(O,M)}return x}async function kr(c,e,u,i,g){let{name:r,handler:f}=e,v=c,y=[],x=[];if(e.rawParams){for(let T of Wo(v,Tt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(T.end!==-1)x.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=Tt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)x.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of x)try{let M=Rt(e,A),I=await f("",M,u,i);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${r}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=Tt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await f("",[],u,i);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(g.debug)console.error(`Error processing custom directive @${r}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${r}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(c,e){return c.rawParams?Lt(e):Sr(e)}function Sr(c){if(!c.trim())return[];let e=[],u="",i=!1,g="";for(let r=0;r<c.length;r++){let f=c[r];if((f==='"'||f==="'")&&(r===0||c[r-1]!=="\\"))if(!i)i=!0,g=f;else if(f===g)i=!1;else u+=f;else if(f===","&&!i)e.push(u.trim()),u="";else u+=f}if(u.trim())e.push(u.trim());return e.map((r)=>{let f=r.trim();if(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))return f.substring(1,f.length-1);return f})}var Mt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dt=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function ke(c,e){if(typeof c!=="string"||c.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(c){if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap expects an options object");let e=c,{appearance:u,colorMode:i}=e;if(ke(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!i||typeof i!=="object"||Array.isArray(i))throw Error("@appearanceBootstrap colorMode must be an object");if(ke(i.key,"colorMode.key"),ke(i.attribute,"colorMode.attribute"),ke(i.default,"colorMode.default"),!Dt.test(i.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(i.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(i.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(u){if(ke(u.key,"appearance.key"),ke(u.attribute,"appearance.attribute"),ke(u.default,"appearance.default"),!Dt.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:i.key,attribute:i.attribute,default:i.default},respectExisting:e.respectExisting===!0}}function _r(c){return JSON.stringify(c).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(c){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(c)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(c,e){let u=1,i=null,g=!1;for(let r=e+1;r<c.length;r++){let f=c[r];if(g){g=!1;continue}if(i){if(f==="\\")g=!0;else if(f===i)i=null;continue}if(f==='"'||f==="'"||f==="`"){i=f;continue}if(f==="(")u++;else if(f===")"&&--u===0)return r}return-1}function It(c,e){let u=c,i=/@appearanceBootstrap\s*\(/g,g;while((g=i.exec(u))!==null){let r=g.index+g[0].length-1,f=Cr(u,r);if(f===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(r+1,f).trim(),y=l(`(${v})`,e),x=Tr(Er(y));u=u.slice(0,g.index)+x+u.slice(f+1),i.lastIndex=g.index+x.length}return u}import Ar from"crypto";function Q(c){return H(String(c??""))}var Pt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(c,e,u,i){let g=c||e;return u?`${g} ${i}`:g}function ge(c){return String(c).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ae(c,e){if(/\bid\s*=/i.test(c))return"";return` id="${Q(e)}"`}function et(c,e,u){if(!e)return"";let i="";if(!/\baria-invalid\s*=/i.test(u))i+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))i+=` aria-describedby="${Q(`${ge(c)}-error`)}"`;return i}function Rr(){return Ar.randomUUID()}function ze(c,e){let u=c;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let i=Rr();e.csrf={token:i}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(i,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Q(r)}">`;return i}),u}function jt(c,e,u=Pt){let i=c;return i=i.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,f,v,y,x="")=>{let b=r||f||"POST",w=v||y||"",T=ye(x),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Q(O)}" action="${Q(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
832
832
|
${ze("@csrf",e)}`,!["GET","POST"].includes(A))M+=`
|
|
833
|
-
${ze(`@method('${A}')`,e)}`;return M}),
|
|
833
|
+
${ze(`@method('${A}')`,e)}`;return M}),i=i.replace(/@endform/g,"</form>"),i=i.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,r,f,v,y,x="")=>{let b=r||f||"",w=v||y||"",T=ye(x),A=Le(b,e),O=A!==void 0&&A!==null?A:w||"",M=T.match(/type=['"]([^'"]+)['"]/i),I=M?M[1]:"text",P=He(b,e),N=T.match(/class=['"]([^'"]+)['"]/i),U=Ve(N?N[1]:"",u.input,P,u.inputError),W=T.replace(/class=['"][^'"]+['"]/i,"");return W=W.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Q(I)}" name="${Q(b)}"${Ae(T,ge(b))} value="${Q(O)}" class="${U}"${et(b,P,T)}${W?` ${W}`:""}>`}),i=i.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(g,r,f="",v="")=>{let y=ye(f),x=Le(r,e)||v.trim(),b=He(r,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=Ve(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Q(r)}"${Ae(y,ge(r))} class="${T}"${et(r,b,y)}${A?` ${A}`:""}>${Q(x)}</textarea>`}),i=i.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(g,r,f="",v)=>{let y=ye(f),x=Le(r,e),b=He(r,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=Ve(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,""),O=v;if(x!==void 0)O=v.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(M,I,P)=>{if((Array.isArray(x)?x.some((U)=>String(U)===P):String(x)===P)&&!I.includes("selected"))return I.replace(/(<option)/,"$1 selected");return M});return`<select name="${Q(r)}"${Ae(y,ge(r))} class="${T}"${et(r,b,y)}${A?` ${A}`:""}>${O}</select>`}),i=i.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(g,r,f,v="")=>{let y=f===void 0?"1":f,x=f===void 0?ge(r):`${ge(r)}-${ge(y)}`,b=ye(v),w=Le(r,e),T=w!==void 0&&(Array.isArray(w)?w.some((I)=>String(I)===y):w===!0||String(w)===y),A=b.match(/class=['"]([^'"]+)['"]/i),O=A?A[1]:u.checkInput,M=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Q(r)}"${Ae(b,x)} value="${Q(y)}" class="${O}"${T?" checked":""}${M?` ${M}`:""}>`}),i=i.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,f,v="")=>{let y=ye(v),x=Le(r,e),b=x!==void 0&&x===f,w=y.match(/class=['"]([^'"]+)['"]/i),T=w?w[1]:u.checkInput,A=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Q(r)}"${Ae(y,`${ge(r)}-${ge(f)}`)} value="${Q(f)}" class="${T}"${b?" checked":""}${A?` ${A}`:""}>`}),i=i.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,f="")=>{let v=ye(f),y=v.match(/accept=['"]([^'"]+)['"]/i),x=y?y[1]:"",b=v.includes("multiple"),w=He(r,e),T=v.match(/class=['"]([^'"]+)['"]/i),A=Ve(T?T[1]:"",u.input,w,u.inputError),O=v.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),M=[`<input type="file" name="${Q(r)}"${Ae(v,ge(r))}`,`class="${A}"`];if(x)M.push(`accept="${Q(x)}"`);if(b)M.push("multiple");if(O)M.push(O);return`${M.join(" ")}>`}),i=i.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(g,r,f="",v)=>{let y=ye(f),x=y.match(/class=['"]([^'"]+)['"]/i),b=x?x[1]:u.label,w=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Q(ge(r))}" class="${b}"${w?` ${w}`:""}>${v}</label>`}),i}function Ht(c,e,u=Pt){return c.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(i,g,r)=>{try{if(He(g,e)){let f=r.replace(/\{\{([^}]+)\}\}/g,(v,y,x)=>{let b=(w)=>J(r,x,String(w??""),!1,v.length);try{if(y.trim()==="$message"||y.trim()==="message")return b(Ot(g,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return b(e.errors.first(g));return b(Ot(g,e))}let w=y.trim();if(p(w)){let T=l(w,e);return T!==void 0?b(T):w}return w}catch{return y}});return`<div id="${Q(`${ge(g)}-error`)}" role="alert">${f}</div>`}return""}catch(f){return console.error("Error processing @error directive:",f),i}})}function He(c,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(c);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,c);return!1}function Ot(c,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(c);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,c)){let u=e.errors[c];return Array.isArray(u)?u[0]:String(u)}return""}function Le(c,e){let u;if(e.old&&typeof e.old==="function")return e.old(c);if(e.old&&typeof e.old==="object")return e.old[c];if(c.endsWith("[]")){let i=c.slice(0,-2);if(u=e[i],u!==void 0)return u}return e[c]}function ye(c){if(!c.trim())return"";let e=[],u=c.trim(),i=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,g;while((g=i.exec(u))!==null){let[,r,,f]=g;e.push(`${r}="${f.trim()}"`)}return e.join(" ")}import*as tt from"path";async function Bt(c,e,u=""){if(tt.basename(u)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,c.replace(/@js[\s\S]*?@endjs/g,"");return qt(c,e,u,"@js","@endjs")}async function Ft(c,e,u=""){if(tt.basename(u)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((r)=>({...r,displayName:`User ${r.id}: ${r.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return c.replace(/@ts[\s\S]*?@endts/g,"")}return qt(c,e,u,"@ts","@endts")}async function qt(c,e,u,i,g){let r=c,f=Tt(`${i}([\\s\\S]*?)${g}`,"g"),v=[],y;while((y=f.exec(c))!==null)v.push({fullMatch:y[0],content:y[1]||"",index:y.index});for(let{fullMatch:x,content:b,index:w}of v)try{let T={...e,global:e},A=Object.keys(T),O=Object.values(T),M=b.trim();if(i==="@ts")M=M.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 P=(M.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((j)=>j.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),N=P.length>0?`return { ${P.join(", ")} };`:"return {};",U=`
|
|
834
834
|
${M}
|
|
835
835
|
${N}
|
|
836
|
-
`,L=Function(...A,
|
|
836
|
+
`,L=Function(...A,U)(...O);if(L&&typeof L==="object")Object.assign(e,L);r=r.replace(x,"")}catch(T){console.error(`Error executing ${i} code block in ${u}:`,T);let A=T instanceof Error?T.message:String(T),O=m(`${i} Directive`,`Error executing code: ${A}`,u,c,w,x);console.error(O),r=r.replace(x,"")}return r}function Mr(c,e="_method"){let u=c.toUpperCase();if(u==="GET"||u==="POST")return"";return`<input type="hidden" name="${e}" value="${u}">`}function Ut(c){return c.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,u,i,g,r)=>Mr(i,r||"_method"))}async function Vt(c,e,u,i,g){if(!i.middleware||i.middleware.length===0)return c;let r=c,f=i.middleware.filter((v)=>v.timing===g);if(f.length===0)return r;for(let v of f){if(!v.name||typeof v.handler!=="function"){if(i.debug)console.warn("Invalid middleware:",v);continue}try{let y=await v.handler(r,e,u,i);if(typeof y==="string")r=y;else if(i.debug)console.warn(`Middleware ${v.name} did not return a string`)}catch(y){if(i.debug)console.error(`Error in middleware ${v.name}:`,y);if(i.debug){let x=m("Middleware",`Error in middleware '${v.name}': ${y instanceof Error?y.message:String(y)}`,u,c);r=r.replace(/<body[^>]*>/,`$&
|
|
837
837
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${d(x)}</div>
|
|
838
|
-
`)}}}return
|
|
838
|
+
`)}}}return r}async function zt(c,e,u,i){return Vt(c,e,u,i,"before")}async function Wt(c,e,u,i){return Vt(c,e,u,i,"after")}function Xt(c){return c.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,u,i,g,r)=>{try{let f=g?E(g,{}):{};return rr(i,f,r==="true")}catch(f){return console.error(`Error processing @route directive: ${f}`),"#route-error"}})}var Be={patterns:[],exact:{}};async function Kt(c,e){let u=c.split("/").pop()?.split(".")[0]||"";if(Be.exact[c])for(let i of Be.exact[c])await Promise.resolve(i(e,c));if(Be.exact[u])for(let i of Be.exact[u])await Promise.resolve(i(e,c));for(let{pattern:i,callback:g}of Be.patterns)if(i.test(c)||i.test(u))await Promise.resolve(g(e,c))}var Dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ir=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 _e(c,e){let u=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;u.lastIndex=e;let i=u.exec(c);if(!i)return null;let g=/\/\s*>$/.test(i[0])||i[1]===i[1].toLowerCase()&&Dr.has(i[1]),r=g?i[2].replace(/\/\s*$/,""):i[2];return{full:i[0],tag:i[1],attrs:r,selfClosing:g,start:i.index,end:i.index+i[0].length}}function Or(c,e,u){let i=1,g=u,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),f=new RegExp(`</${e}\\s*>`,"gi");while(i>0&&g<c.length){r.lastIndex=g,f.lastIndex=g;let v=r.exec(c),y=f.exec(c);if(!y)return-1;if(v&&v.index<y.index)i++,g=v.index+v[0].length;else{if(i--,i===0)return y.index+y[0].length;g=y.index+y[0].length}}return-1}function Ee(c,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let u=Or(c,e.tag,e.end);if(u===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:u,innerHTML:c.slice(e.end,u-`</${e.tag}>`.length)}}function Gt(c,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(c)||c.includes(` ${e}=`)||c.includes(` ${e} `)||c.trimEnd().endsWith(` ${e}`)}function Fe(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=c.match(new RegExp(`${u}="([^"]*)"`,"s"))||c.match(new RegExp(`${u}='([^']*)'`,"s"));return i?i[1]:null}function ve(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return c.replace(new RegExp(`\\s*${u}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${u}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${u}(?=\\s|$|>|/)`,"g"),"")}function Re(c,e,u){let i=e.selfClosing?" /":"",g=`<${e.tag}${u}${i}>`;return c.slice(0,e.start)+g+c.slice(e.end)}function Pr(c){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(c)}function Nr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-for");if(g===null){u=i.end;continue}let r=g.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){u=i.end;continue}let f=r[1].trim(),v=r[2].trim(),y;if(f.includes(",")){let I=f.split(",").map((U)=>U.trim()),P=I[0],N=I[1];y=`${v} as ${N} => ${P}`}else y=`${v} as ${f}`;let x=ve(i.attrs,"v-for"),b=ve(x,":key").replace(/\s*v-bind:key="[^"]*"/g,""),w=Ee(e,i),T=e.slice(w.outerStart,w.outerEnd),A=Re(T,{...i,start:0,end:i.end-i.start},b),O=`@foreach(${y})
|
|
839
839
|
`,M=`${O}${A}
|
|
840
|
-
@endforeach`;e=e.slice(0,w.outerStart)+M+e.slice(w.outerEnd),u=w.outerStart+O.length}return e}function
|
|
840
|
+
@endforeach`;e=e.slice(0,w.outerStart)+M+e.slice(w.outerEnd),u=w.outerStart+O.length}return e}function qr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-if");if(g===null){u=i.end;continue}let r=[],f=Ee(e,i),v=ve(i.attrs,"v-if"),y=Re(e.slice(f.outerStart,f.outerEnd),{...i,start:0,end:i.end-i.start},v);r.push({type:"if",expr:g,outerStart:f.outerStart,outerEnd:f.outerEnd,element:y,parsedTag:i});let x=f.outerEnd,b=!0;while(b){let M=e.slice(x).match(/^\s*/),I=M?M[0].length:0,P=_e(e,x+I);if(!P){b=!1;break}let N=Fe(P.attrs,"v-else-if"),U=Gt(P.attrs,"v-else");if(N!==null){let W=Ee(e,P),L=ve(P.attrs,"v-else-if"),j=Re(e.slice(W.outerStart,W.outerEnd),{...P,start:0,end:P.end-P.start},L);r.push({type:"else-if",expr:N,outerStart:x,outerEnd:W.outerEnd,element:j,parsedTag:P}),x=W.outerEnd}else if(U){let W=Ee(e,P),L=ve(P.attrs,"v-else"),j=Re(e.slice(W.outerStart,W.outerEnd),{...P,start:0,end:P.end-P.start},L);r.push({type:"else",outerStart:x,outerEnd:W.outerEnd,element:j,parsedTag:P}),b=!1}else b=!1}let w=[];for(let M of r)if(M.type==="if")w.push(`@if(${M.expr})
|
|
841
841
|
${M.element}`);else if(M.type==="else-if")w.push(`@elseif(${M.expr})
|
|
842
842
|
${M.element}`);else w.push(`@else
|
|
843
843
|
${M.element}`);w.push("@endif");let T=w.join(`
|
|
844
|
-
`),A=
|
|
845
|
-
${
|
|
846
|
-
@endonce`;e=e.slice(0,
|
|
847
|
-
<meta name="stx-build" content="${e}">`}function is(c){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,u=window;if(u.stxOffline)return;let
|
|
848
|
-
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw u[
|
|
844
|
+
`),A=r[0].outerStart,O=r[r.length-1].outerEnd;e=e.slice(0,A)+T+e.slice(O),u=A+T.length}return e}function zr(c){return c.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Xr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Ir.has(i.tag),r=i.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(v,y,x)=>{let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(y);if(!b||!x||!/^["']/.test(x))return v;let w=b[1]||"modelValue",T=b[2];if(g&&!b[1])return`@model${T}=${x}`;let A=x[0],O=x.slice(1,-1),M=`:${w}=${x} @update:${w}=${A}${O} = $event${A}`;if(T){let I=b[1]?`${w}Modifiers`:"modelModifiers",P=T.slice(1).split(".").map((N)=>`${N}: true`).join(", ");M+=` :${I}="{ ${P} }"`}return M});if(r===i.attrs){u=i.end;continue}let f=Re(i.full,{...i,start:0,end:i.full.length},r);e=e.slice(0,i.start)+f+e.slice(i.end),u=i.start+f.length}return e}function Kr(c){return c.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Gr(c){return c.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Jr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-html");if(g===null){u=i.end;continue}if(i.selfClosing){u=i.end;continue}let r=Ee(e,i),f=ve(i.attrs,"v-html"),v=i.selfClosing?" /":"",y=`<${i.tag}${f}${v}>{!! ${g} !!}</${i.tag}>`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function Zr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-text");if(g===null){u=i.end;continue}if(i.selfClosing){u=i.end;continue}let r=Ee(e,i),f=ve(i.attrs,"v-text"),v=i.selfClosing?" /":"",y=`<${i.tag}${f}${v}>{{ ${g} }}</${i.tag}>`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function Qr(c){return c.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 Yr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;if(!Gt(i.attrs,"v-once")){u=i.end;continue}let g=ve(i.attrs,"v-once"),r=Ee(e,i),f=e.slice(r.outerStart,r.outerEnd),y=`@once
|
|
845
|
+
${Re(f,{...i,start:0,end:i.end-i.start},g)}
|
|
846
|
+
@endonce`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function es(c){return c.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function ts(c){return c.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 Jt(c){if(!Pr(c))return c;let e=c;return e=Nr(e),e=qr(e),e=Yr(e),e=Kr(e),e=Gr(e),e=Xr(e),e=zr(e),e=ts(e),e=Jr(e),e=Zr(e),e=Qr(e),e=es(e),e}function We(c){return c.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var nt=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),ns=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Zt(c,e){let u=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(c),i=u?u[1]:c,g=l(i,e);if(g&&typeof g==="string")return g;let r=i.trim();return nt.has(r)?r:null}function Qt(c){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(c);return e?e[1]:c}function Yt(c,e,u){let i=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),g=i?`<${c} ${i}>`:`<${c}>`;if(ns.has(c))return i?`<${c} ${i}>`:`<${c}>`;return`${g}${u}</${c}>`}async function en(c,e,u,i,g){let r=c,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],slotContent:y[3],index:y.index});for(let x=v.length-1;x>=0;x--){let b=v[x];try{let w=Zt(b.expr,e);if(!w||typeof w!=="string"){let N=`<!-- dynamic component: could not resolve "${We(Qt(b.expr))}" -->`;r=r.slice(0,b.index)+N+r.slice(b.index+b.full.length);continue}if(nt.has(w)){let N=Yt(w,b.attrs,b.slotContent);r=r.slice(0,b.index)+N+r.slice(b.index+b.full.length);continue}let T=b.attrs.trim(),A={},O=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,M;while((M=O.exec(T))!==null){let N=M[1]||M[2],U=M[3];if(M[1])try{A[N]=l(U,e)}catch{A[N]=U}else A[N]=U}let I=i.componentsDir||"components",P=await je(w,A,b.slotContent,I,e,u,i,new Set,g??new Set);r=r.slice(0,b.index)+P+r.slice(b.index+b.full.length)}catch(w){let T=w instanceof Error?w.message:String(w),A=`<!-- dynamic component error: ${We(T)} -->`;r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}}return r=await rs(r,e,u,i,g),r}async function rs(c,e,u,i,g){let r=c,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],index:y.index});for(let x=v.length-1;x>=0;x--){let b=v[x];try{let w=Zt(b.expr,e);if(!w||typeof w!=="string"){let O=`<!-- dynamic component: could not resolve "${We(Qt(b.expr))}" -->`;r=r.slice(0,b.index)+O+r.slice(b.index+b.full.length);continue}if(nt.has(w)){let O=Yt(w,b.attrs,"");r=r.slice(0,b.index)+O+r.slice(b.index+b.full.length);continue}let T=i.componentsDir||"components",A=await je(w,{},"",T,e,u,i,new Set,g??new Set);r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}catch(w){let T=w instanceof Error?w.message:String(w),A=`<!-- dynamic component error: ${We(T)} -->`;r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}}return r}var ra="X-STX-Build",st=Symbol.for("stx.buildId");function eo(){let c=globalThis;if(!c[st])c[st]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return c[st]}function tn(c,e=eo()){if(c.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(c))return null;return`
|
|
847
|
+
<meta name="stx-build" content="${e}">`}function is(c){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,u=window;if(u.stxOffline)return;let i=null,g=!1,r=[],f={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>i,onUpdateReady(b){if(f.updateReady)try{b()}catch{}else r.push(b);return()=>{let w=r.indexOf(b);if(w!==-1)r.splice(w,1)}},applyUpdate(){let b=i&&i.waiting;if(!b)return!1;return g=!0,b.postMessage({type:"stx:activate-update",force:!0}),!0}};u.stxOffline=f;let v=(b)=>{if(!b.waiting||!e.controller||f.updateReady)return;f.updateReady=!0;let w=r.splice(0);for(let T of w)try{T()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(b)=>{let w=b.data||{};if(w.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:w.url,kind:w.kind,fragment:!!w.fragment}}))}catch{}if(w.type==="stx:reachability"){if(u.stxOffline.reachable=w.reachable!==!1,Number(w.at)>0)u.stxOffline.reachedAt=Number(w.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:w.reachable!==!1,at:Number(w.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(g)g=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&i&&i.waiting)i.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let y=()=>{e.register(c,{scope:"/"}).then((b)=>{i=b;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(b.waiting)v(b),b.waiting.postMessage({type:"stx:activate-update",reason:"load"});b.addEventListener("updatefound",()=>{let w=b.installing;if(!w)return;w.addEventListener("statechange",()=>{if(w.state==="installed")v(b)})})}).catch(()=>{})},x=()=>{let b=(w)=>{setTimeout(w,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>b(y));else b(y)};if(!e.controller)if(document.readyState==="complete")x();else addEventListener("load",x);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",x);else x()}function os(){let c=`(${is.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(c).trim().replace(/;$/,"")}catch{return c}}var nn=`<script data-stx-offline>${os()}</script>`;import Me from"path";function rn(c){return c.startsWith("http://")||c.startsWith("https://")||c.startsWith("//")}async function sn(c,e,u){try{let i;if(c.startsWith("/")){let g=e;for(let r=0;r<5;r++){let f=Me.join(g,c);if(await Bun.file(f).exists())return f;g=Me.dirname(g)}i=Me.join(e,c)}else if(c.startsWith("./")||c.startsWith("../"))i=Me.resolve(e,c);else i=Me.resolve(e,c);if(await Bun.file(i).exists())return i;return null}catch{return null}}var on=Symbol.for("stx.inline-assets.import-meta");function as(c,e){if(!c.includes("import.meta"))return;let u=Error(`[stx] ${e} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
848
|
+
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw u[on]=!0,u}async function an(c,e,u){let i=c,g=Me.dirname(e),r=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,f;while((f=r.exec(i))!==null){let[x,b,w,T]=f;if(rn(w))continue;let A=await sn(w,g,e);if(A)try{let O=await Bun.file(A).text();if(u.add(A),w.endsWith(".ts")||w.endsWith(".tsx")){let I=await Bun.build({entrypoints:[A],target:"browser",minify:!0,define:S()});if(I.outputs.length>0)O=await I.outputs[0].text(),as(O,w)}let M=`<script>
|
|
849
849
|
// Source: ${w}
|
|
850
850
|
${O}
|
|
851
|
-
</script>`;
|
|
851
|
+
</script>`;i=i.replace(x,M),r.lastIndex=0}catch(O){if(O?.[on])throw O}}let v=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,y;while((y=v.exec(i))!==null){let[x,b,w,T]=y,A=b+T;if(rn(w))continue;if(/rel=["']stylesheet["']/.test(A)||w.endsWith(".css")){let M=await sn(w,g,e);if(M)try{let I=await Bun.file(M).text();u.add(M);let P=`<style>
|
|
852
852
|
/* Source: ${w} */
|
|
853
853
|
${I}
|
|
854
|
-
</style>`;
|
|
855
|
-
`,
|
|
856
|
-
`){y=-1;break}y++}if(y===-1){
|
|
857
|
-
`)break;
|
|
858
|
-
`+c.slice(
|
|
859
|
-
`+
|
|
860
|
-
`+
|
|
861
|
-
`),...x.htmlAttrs&&{htmlAttrs:
|
|
862
|
-
<meta name="stx-layout" content="${
|
|
863
|
-
<meta name="stx-layout-group" content="${
|
|
864
|
-
${O}`).join("");f=
|
|
865
|
-
`+f.slice(x)}}if(
|
|
854
|
+
</style>`;i=i.replace(x,P),v.lastIndex=0}catch(I){}}}return i}import it from"path";var cs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ls=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function us(c,e){if(!e||!c.includes("/"))return c;let u=it.dirname(e);return c.replace(cs,(i,g,r,f)=>{let v=it.resolve(u,f);return`${g}${r}${v.split(it.sep).join("/")}${r}`})}function un(c,e){if(!e||!c.includes("<script"))return c;return c.replace(ls,(u,i,g,r)=>`${i}${us(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function pn(c){return c.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Sn(c,e){let u=c.length,i=e,g=!0,r=[],f=(v)=>v+9<=u&&c[v]==="<"&&c[v+1]==="/"&&(c[v+2]==="s"||c[v+2]==="S")&&(c[v+3]==="c"||c[v+3]==="C")&&(c[v+4]==="r"||c[v+4]==="R")&&(c[v+5]==="i"||c[v+5]==="I")&&(c[v+6]==="p"||c[v+6]==="P")&&(c[v+7]==="t"||c[v+7]==="T")&&(c[v+8]===">"||/\s/.test(c[v+8]));while(i<u){let v=c[i];if(f(i))return i;if(v==="/"&&c[i+1]==="/"){if(i=c.indexOf(`
|
|
855
|
+
`,i+2),i===-1)return-1;i+=1,g=!0;continue}if(v==="/"&&c[i+1]==="*"){let y=c.indexOf("*/",i+2);if(y===-1)return-1;i=y+2,g=!0;continue}if(v==="/"&&g){let y=i+1,x=!1;while(y<u){let b=c[y];if(b==="\\"){y+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){y++;break}else if(b===`
|
|
856
|
+
`){y=-1;break}y++}if(y===-1){i++,g=!1;continue}while(y<u&&/[a-z]/.test(c[y]))y++;i=y,g=!1;continue}if(v==="'"||v==='"'){let y=v;i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]===y){i++;break}if(c[i]===`
|
|
857
|
+
`)break;i++}g=!1;continue}if(v==="`"){i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++,g=!1;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;i++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!i)return null;let g=i.index+i[0].length,r=c.indexOf("</script>",g);if(r===-1)return null;let f=c.indexOf(">",r);if(f===-1)return null;return{start:i.index,end:f+1}}var ps=4096;async function fn(c,e,u){if(u.buildMode!=="serve"||e.length<ps)return null;let{registerServeModuleBundle:i}=await import("./chunk-w0vpvcj0.js");return`<script ${c} src="${i(e)}"></script>`}async function Un(c,e,u){try{let{registeredModuleIdsIn:i,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-81rdyz2n.js")),r=[],f=await g(i(...c),{minify:Xo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-w0vpvcj0.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function fs(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let i=Jn(c);if(i===-1||i===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(i<u.start)return c.slice(0,i)+c.slice(u.start,u.end)+e+`
|
|
858
|
+
`+c.slice(i,u.start)+c.slice(u.end);let g=c.slice(u.start,u.end),r=c.slice(0,u.start)+c.slice(u.end),f=Jn(r);if(f===-1)return g+e+`
|
|
859
|
+
`+r;return r.slice(0,f)+g+e+`
|
|
860
|
+
`+r.slice(f)}function ms(c){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return c.replace(e,(u,i,g)=>{let r=c.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${i}}}`:`{<!--stx-literal-->{${i}}}`})}async function o(c,e,u,i,g){if(i.ssr===!1&&!i.autoShell&&i.buildMode==="spa")return c;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(c,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of i._layerGraph?.configDependencies??[])g.add(f);if(r&&i.runtimeConfig)await hn(e,u,i.runtimeConfig);if(r)Va(e),e.__stx_scope_seq??={n:0,key:bs(String(e.__filename??u))},e.__stx_head_injections=qo(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((i.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))to(c,u);try{return await re.timeAsync("template-processing",async()=>{let f=await vs(c,e,u,i,g);if(r)f=Oo(f);if(r&&i.autoShell&&i.buildMode!=="compile"){let v=Se(i.app?.head,{known:vr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ko(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?k(A,e,u):void 0,M=x.title||w||O,I=!x.title&&(!!w||!!O),P=x.meta||[],N=new Set(P.map((X)=>rt(X)).filter(Boolean)),U={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((X)=>!N.has(rt(X))),...P],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
861
|
+
`),...x.htmlAttrs&&{htmlAttrs:oc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},W=Go(f);if(f=yr(f,U,{...I&&{titleIsHtml:!0},...i.app?.colorMode&&{colorMode:i.app.colorMode}},W),W)f=ac(f,v),f=hr(f,U.htmlAttrs);let L=f.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&f.includes("<head")){let X=L[1],K=ss(X);f=f.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
|
|
862
|
+
<meta name="stx-layout" content="${pn(X)}">
|
|
863
|
+
<meta name="stx-layout-group" content="${pn(K)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),B=j?q(f):null;if(j&&B&&!/\bdata-stx=/.test(B.tag)){f=Ke(f,(K,Y)=>`<body${Y} data-stx="${j[1]}">`);let X=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(X,"$1")}}if(r){let v=e.__stx_head_injections??qo(),y=ic(f);if(y!==null)v.beforeClose.push(y);let x=tn(f);if(x!==null)v.afterOpen.push(x);if(i.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=rc(f,v);let b=i.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-prc5dxp1.js")),M=i.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await fn("data-stx-stores",I,i)??b}catch{}y=await Un([f,b],i,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-p6g58hwg.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-s5q9ztvj.js")),M=i.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(i._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,i)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
|
|
864
|
+
${O}`).join("");f=fs(f,A)}else{let y=await Un([f],i,g);if(y){let x=f.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)f=f.slice(0,x)+y+`
|
|
865
|
+
`+f.slice(x)}}if(r)f=sc(f);if(r&&e.__stx_inject_css!==!1)f=await h(f,void 0,i.buildMode==="serve",!0);else if(r)f=ln(f);if(f=f.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),f=ms(f),r&&e.__stx_runtime_config)f=Nt(f,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let v=dr(e);if(v){let y=/<head\b[^>]*>/i.exec(f),x=y?y.index+y[0].length:0;f=f.slice(0,x)+v+f.slice(x)}}return f})}catch(f){if(f instanceof V)throw f;let v=f instanceof Error?f.message:String(f),y=new ie(`Template processing failed: ${v}`,u,void 0,void 0,c.substring(0,200)+(c.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),bn.logDetailedError(y,{filePath:u,template:c.substring(0,500)}),C()&&!i.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(i.debug)throw y;return Uo.createFallbackContent("Template Processing",y)}}async function vs(c,e,u,i,g){let r=process.cwd(),f={...i,partialsDir:i.partialsDir&&!ce.isAbsolute(i.partialsDir)?ce.resolve(r,i.partialsDir):i.partialsDir,componentsDir:i.componentsDir&&!ce.isAbsolute(i.componentsDir)?ce.resolve(r,i.componentsDir):i.componentsDir,layoutsDir:i.layoutsDir&&!ce.isAbsolute(i.layoutsDir)?ce.resolve(r,i.layoutsDir):i.layoutsDir},v=f,y=c;await ks(u,e),xs(e,v),y=await xe(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=de(y,Ie,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=x.output;let b=x.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,B)=>b[Number(B)]??""),T="\x00STX_ESCAPED_AT\x00",A="\x00STX_ESC_MUSTACHE_OPEN\x00",O="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,T),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(L,j)=>`${A}${j}${O}`),y=Jt(y),y=await an(y,u,g);let M={};y=Br(y,M);let I={...e.__sections||{}},P="",N=mt(gt(c)),U=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let W=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)P=W[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
|
|
866
866
|
${y.trim()}
|
|
867
|
-
@endsection`}if(!P&&!
|
|
867
|
+
@endsection`}if(!P&&!U&&v.defaultLayout){let L=vn(y),j=/@section\s*\(/.test(y);if(!L||j){let B="",X=ce.dirname(u),K=v.layoutsDir?ce.dirname(v.layoutsDir):process.cwd();for(let Y=0;Y<20;Y++){let ee=ce.join(X,"_layout.stx");if(await n(ee)){B=ee;break}let te=ce.dirname(X);if(te===X||te.length<K.length)break;X=te}if(B)P=B;else if(v.layoutsDir){let Y=ce.isAbsolute(v.layoutsDir)?v.layoutsDir:ce.resolve(process.cwd(),v.layoutsDir),ee=ce.join(Y,`${v.defaultLayout}.stx`);if(await n(ee))P=ee}if(P&&!j)y=`@section('content')
|
|
868
868
|
${y.trim()}
|
|
869
|
-
@endsection`}}if(P&&y.includes("<script")){let L=G(y),j=L.scripts.map((B)=>
|
|
869
|
+
@endsection`}}if(P&&y.includes("<script")){let L=G(y),j=L.scripts.map((B)=>mn(B,u)??B);y=cr(L.output,j)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,j,B)=>(I[j]=B,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,j,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return L;try{let X=l(B.trim(),e);if(X===void 0)return L;let Y=(e.__stx_inline_section_values??=[]).push(X)-1;return I[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,B)=>{if(B.includes("@parent"))I[j]=B.replace("@parent",Te);else I[j]=B.trim();return""}),e.__sections=I,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,j,B)=>I[j]||B||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||"");if(y=Fr(y,M),P){let L=[],j=G(y),B=de(j.output,cn,(X,K)=>`\x00STX_ORPHAN_STYLE_${K}\x00`);if(y=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,K,Y)=>{let ee=K==="SCRIPT"?mn(j.scripts[Number(Y)],u):B.tokens[Number(Y)];if(ee)L.push(ee);return""}),L.length>0){let X=L.join(`
|
|
870
870
|
`);I.content=I.content?`${I.content}
|
|
871
|
-
${X}`:X,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await
|
|
872
|
-
${y}`,w(y)}catch(L){if(L instanceof
|
|
873
|
-
`;if(
|
|
871
|
+
${X}`:X,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await xe(()=>gn(P,u,f,g),null,()=>{throw new ie(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ee=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return ds.readdirSync(ae).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(f.layoutsDir),...ee(f.fallbackLayoutsDir)].filter((oe,ae,le)=>le.indexOf(oe)===ae).sort(),ue=`Layout not found: ${P} (referenced from ${u})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:f.layoutsDir?`. No .stx layouts found in ${f.layoutsDir}`:"");if(D.log(Error(ue),{layoutPath:P,filePath:u,available:te},"error"),console.error(`[stx] ${ue}`),f.debug)throw new ie(ue,u);return y}let j=await xe(()=>Bun.file(L).text(),"",()=>{throw new ie(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=un(j,L);let B=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(f.debug)console.log(`Found nested layout: ${B[1]} in ${L}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,le,be)=>(ee[le]=be.trim(),""));for(let[ae,le]of Object.entries(ee))if(I[ae]&&I[ae].includes(Te)){let be=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,be)+le+I[ae].slice(be+Te.length)}else if(!I[ae])I[ae]=le;let ue={...e,__sections:I},oe=`@layout('${B[1]}')${te}`;return await o(oe,ue,L,f,g)}let X=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),K=Br(X,M),Y={};return K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(I[te]){let oe=I[te];if(oe.includes(Te)){let ae=Y[te]||"",le=oe.indexOf(Te);oe=oe.slice(0,le)+ae+oe.slice(le+Te.length)}return oe}return ue||""}),K=ws(K,I),K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),K=Fr(K,M),e.__originalFilePath=u,y=await kn(K,e,L,f,g),y=`<!-- stx-layout: ${P} -->
|
|
872
|
+
${y}`,w(y)}catch(L){if(L instanceof V)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,i,g)=>{let r=e[i];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",i={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)i[g]=r;c.$env=i}async function ks(c,e){await xe(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function mn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function yn(c){return c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(c)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function $s(c,e,u,i){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-7475sm3m.js")),r=[],f=!C()&&!wn();for(let y of g(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-1wdawkn8.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(i?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return c;let v=c;for(let y of r.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:i}=await s("stx/expressions",()=>import("./chunk-4x5dk7a4.js"));return i(c,e,{skipServer:!0})}catch(i){let g=i instanceof Error?i:Error(String(i));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),c}}async function kn(c,e,u,i,g){let r=c,f=i;if(r=await $s(r,e,u,i),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Es(r,e,u),r=await At(r,e,u,f),we(r))r=lo(r,e),r=Wr(r,e),r=Ur(r,e);r=uo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-855h3crg.js"));r=v(r,e),r=Kn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Hr(r,e,u,f,g),r=pa(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-3xx9d934.js"));r=y(r,e,u);let{processTeleportDirectives:x}=await s("stx/teleport",()=>import("./chunk-tz09earb.js"));r=x(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-ggwvnpwj.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-3wsm9g9c.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-swxznm5v.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-s8qe247r.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await s("stx/virtual-scrolling",()=>import("./chunk-nv0jjhtd.js"));r=P(r,e,u),r=N(r,e,u),r=U(r,e,u);let{processPartialHydrationDirectives:W,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-n615cbxq.js"));r=W(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:B}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=B(r,e,u);let{processFormValidationDirectives:X}=await s("stx/forms-validation",()=>import("./chunk-ammn4wbd.js"));r=X(r,e,u);let{processHeadDirective:K,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-1s2y6f4b.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=K(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
|
|
873
|
+
`;if(r=Y(r,e),r=ee(r,e,u),r=Xt(r),r=oo(r,e),r=Ct(r),r=Ut(r),r=await jr(r,e,u,f,g),r=await Hr(r,e,u,f,g),e.__stxProcessingDepth===1)r=Ua(r,e);if(r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=Oo(r),r=ne(r,e,u),r=Lr(r),r=Ba(r,e,{filePath:u,buildMode:f.buildMode}),r=io(r,e),r=ao(r,e),r=ze(r,e),r=jt(r,e),r=Ht(r,e),r=await bt(r,e,u,f),r=await ga(r,e,u),r=await ma(r,e,u,f),r=ha(r,e,u,f),r=bo(r,e,u,f),r=vo(r,e,u),r=wo(r,e,u,f),r=Et(r,e,u,f),r=hs(r,e),r=ys(r),r=Fa(r),!f.skipEventDirectives)r=$a(r,e,u);if(r=vt(r,e,u),f.debug){let F=/\bx-data\s*=/.test(r),z=Vr(c);if(F&&z)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
874
874
|
Both work on the same page, but they manage separate scopes.
|
|
875
|
-
Prefer signals (state/derived/effect) for new components.`)}
|
|
875
|
+
Prefer signals (state/derived/effect) for new components.`)}r=aa(r,e),r=await k(r,e,u),r=za(r),r=Ha(r),r=pt(r);let{processXElementDirectives:oe}=await s("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=oe(r);let ae=e.__originalFilePath||u,le=Ne(e);if(r=await po(r,f,ae,le),r=It(r,e),r=await Wt(r,e,u,f),f.media?.image?.autoSiblings){let F=f.publicDir||"public",{rewriteImagesWithSiblings:z}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gx6wxmbv.js"));r=await z(r,{publicDir:F})}if(f.seo?.enabled)r=xo(r,e,f);let be=(F,z,Z=!0)=>{if(!z)return F;let me=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),se=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=se?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(se[0]):null;if(me&&se&&fe){if(Z){let Ce=se.index+fe.index;F=F.slice(0,Ce)+me[0]+F.slice(Ce+fe[0].length)}if(z=z.replace(me[0],"").trim(),!z)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${z}
|
|
876
876
|
</head>`);if(/<head\b[^>]*>/i.test(F))return F.replace(/(<head\b[^>]*>)/i,`$1
|
|
877
|
-
${
|
|
877
|
+
${z}`);if(/<html\b[^>]*>/i.test(F))return F.replace(/(<html\b[^>]*>)/i,`$1
|
|
878
878
|
<head>
|
|
879
|
-
${
|
|
880
|
-
</head>`);return F},{renderHead:En,getHead:_n}=await
|
|
879
|
+
${z}
|
|
880
|
+
</head>`);return F},{renderHead:En,getHead:_n}=await s("stx/head",()=>import("./chunk-1s2y6f4b.js")),Oe=e.__stx_runtime_head??_n();if(Oe.title||Oe.meta?.length||Oe.link?.length){let F=En(Oe);if(F)r=be(r,F)}if(ue.headContent)r=be(r,ue.headContent,!Oe.title);if(f.csp?.enabled&&f.csp.addMetaTag)r=St(r,f.csp,e);if(f.analytics?.enabled)r=ft(r,f);if(f.heatmap?.enabled)r=fa(r,f);if(f.pwa?.enabled&&f.pwa.autoInject!==!1){let{injectPwaTags:F}=await s("stx/pwa/inject",()=>import("./chunk-xna6b7km.js"));r=F(r,f)}let Tn=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(r),Cn=/\bSTX\.\w+/.test(r),An=/window\.STX\s*=/.test(r);if(Tn&&Cn&&!An){let z=`<script data-stx-scoped data-stx-run="once">
|
|
881
881
|
${lt()}
|
|
882
|
-
</script>`;if(
|
|
883
|
-
`+Ce}else
|
|
884
|
-
</head>`)}else if(
|
|
885
|
-
${
|
|
886
|
-
`+
|
|
887
|
-
`+
|
|
888
|
-
export{gt,
|
|
882
|
+
</script>`;if(r.includes("</head>")){let Z=r.indexOf("</head>"),se=r.slice(0,Z).indexOf("<script");if(se!==-1){let fe=r.slice(0,se),Ce=r.slice(se);r=fe+z+`
|
|
883
|
+
`+Ce}else r=r.replace("</head>",`${z}
|
|
884
|
+
</head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
885
|
+
${z}`);else r=z+`
|
|
886
|
+
`+r}{let{scanScriptTags:F}=await s("stx/signal-processing",()=>import("./chunk-7475sm3m.js")),z=[];for(let Z of F(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,se=Sn(r,me);if(se===-1)continue;let fe=se+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;z.push({start:Z.start,end:fe})}if(z.length>0){let Z=Array(z.length+1),me=0;for(let se=0;se<z.length;se++){let{start:fe,end:Ce}=z[se];Z[se]=r.slice(me,fe),me=Ce}Z[z.length]=r.slice(me),r=Z.join("")}}let at=gs(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-7475sm3m.js"));for(let F of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:Z}of ct){Xe=!0;let me=Z;Pe(Z,u,i.strict,e.__originalFilePath);let se=await De(Z,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:Xo(i.buildMode),serverData:le});r=r.replace(F,()=>se)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=To(F);if(z){let Z=r.lastIndexOf("</body>");r=Z===-1?r+z:r.slice(0,Z)+z+`
|
|
887
|
+
`+r.slice(Z)}e.__stx_event_bindings=[]}}if(!he(r)&&la(r))r=await Yn(r,f);if(r=ua(r),f.csp?.enabled&&f.csp.useNonce&&typeof e.cspNonce==="string")r=$t(r,e.cspNonce);return r}
|
|
888
|
+
export{gt,$e,ra,eo,Un,o};
|