@stacksjs/stx 0.2.826 → 0.2.827
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-02zvytqx.js +2 -0
- package/dist/{chunk-bt0amey5.js → chunk-04z1xyrb.js} +2 -2
- package/dist/chunk-0jhq2kza.js +2 -0
- package/dist/{chunk-f0txsdpa.js → chunk-0rvntfhj.js} +3 -3
- package/dist/chunk-12m1qwzd.js +2 -0
- package/dist/chunk-17zrprh0.js +2 -0
- package/dist/chunk-1bpx9b0m.js +2 -0
- package/dist/{chunk-wy0gghvh.js → chunk-1vzncfka.js} +2 -2
- package/dist/chunk-2b1w7py1.js +2 -0
- package/dist/chunk-2mrdtxfy.js +2 -0
- package/dist/{chunk-2vqpz4qv.js → chunk-2qngyyaz.js} +2 -2
- package/dist/{chunk-7yb82rm6.js → chunk-2x9zhezb.js} +2 -2
- package/dist/{chunk-cmf6ar8v.js → chunk-3esj6tb8.js} +5 -5
- package/dist/{chunk-mfy2ayv0.js → chunk-3g7bjpj6.js} +3 -3
- package/dist/{chunk-981z8va1.js → chunk-3p7r3ajd.js} +2 -2
- package/dist/chunk-3qx7whh5.js +2 -0
- package/dist/chunk-3vsz0vrk.js +2 -0
- package/dist/{chunk-cgtpbr01.js → chunk-3x3zcfxp.js} +48 -48
- package/dist/chunk-3zfras5s.js +2 -0
- package/dist/chunk-42c92rp3.js +2 -0
- package/dist/{chunk-8ycrmsba.js → chunk-48z7tg83.js} +3 -3
- package/dist/chunk-4a3r1kh1.js +43 -0
- package/dist/{chunk-vwtejkb5.js → chunk-4d8ep00w.js} +50 -50
- package/dist/chunk-4z0jpzdq.js +3 -0
- package/dist/{chunk-6qvn1h09.js → chunk-5201w0f1.js} +3 -3
- package/dist/{chunk-bq7cfqk3.js → chunk-543yvntm.js} +2 -2
- package/dist/{chunk-d9yjpdyn.js → chunk-5phdmpa7.js} +6 -6
- package/dist/{chunk-q45xwvf6.js → chunk-5r63bv4g.js} +3 -3
- package/dist/chunk-67nq6csk.js +2 -0
- package/dist/chunk-6aak0b7c.js +2 -0
- package/dist/{chunk-7sh9fa3q.js → chunk-6k26n0sj.js} +2 -2
- package/dist/chunk-6r4teng3.js +2 -0
- package/dist/{chunk-d6d2s7n6.js → chunk-6tjm38e4.js} +2 -2
- package/dist/{chunk-06hc6rs6.js → chunk-716jrdcg.js} +1 -1
- package/dist/{chunk-y2bf32vg.js → chunk-717qsbap.js} +10 -10
- package/dist/chunk-72n804gy.js +2 -0
- package/dist/chunk-7amk61bt.js +2 -0
- package/dist/{chunk-3yh6y00f.js → chunk-7k9yahng.js} +6 -6
- package/dist/{chunk-wf0n9gpj.js → chunk-7p8m82pj.js} +4 -4
- package/dist/{chunk-h864en4b.js → chunk-7z2ygy9p.js} +7 -7
- package/dist/chunk-8n8vj099.js +2 -0
- package/dist/chunk-8ta7f5en.js +2 -0
- package/dist/{chunk-r9e0r6jx.js → chunk-8y8kgw9s.js} +3 -3
- package/dist/{chunk-b64y3yh0.js → chunk-8yy8qrcv.js} +10 -10
- package/dist/chunk-a7ewznxk.js +2 -0
- package/dist/{chunk-gjf8cjdt.js → chunk-ac9ncbfw.js} +3 -3
- package/dist/chunk-ahd8jdzx.js +2 -0
- package/dist/chunk-ay7ggc4k.js +2 -0
- package/dist/chunk-ayk94a19.js +2 -0
- package/dist/{chunk-mv3yhspn.js → chunk-b1q40vq4.js} +2 -2
- package/dist/{chunk-w45njn1r.js → chunk-b3nv89wq.js} +2 -2
- package/dist/{chunk-3axb6t08.js → chunk-b7tb00nz.js} +2 -2
- package/dist/chunk-b92vzax2.js +2 -0
- package/dist/{chunk-he5njpsd.js → chunk-bh35v908.js} +1 -1
- package/dist/chunk-bh7v78je.js +2 -0
- package/dist/{chunk-tgk2hcxv.js → chunk-bjvmmsvp.js} +6 -6
- package/dist/{chunk-8qy616yt.js → chunk-bwnwv91e.js} +8 -8
- package/dist/chunk-c7ybxv8x.js +2 -0
- package/dist/{chunk-4qhz8q0d.js → chunk-c8vza3p0.js} +22 -22
- package/dist/{chunk-8ttmzcxb.js → chunk-c9mdvpf5.js} +29 -29
- package/dist/{chunk-5emrarpf.js → chunk-car6nhfe.js} +2 -2
- package/dist/{chunk-e4jwhmpb.js → chunk-cca18z35.js} +31 -31
- package/dist/chunk-cfrgrnej.js +2 -0
- package/dist/{chunk-vzbyn4nh.js → chunk-ckg6q98b.js} +5 -5
- package/dist/{chunk-k81trehg.js → chunk-cv1zc9dg.js} +2 -2
- package/dist/chunk-cw8vpk41.js +2 -0
- package/dist/chunk-d2n2zrdg.js +2 -0
- package/dist/{chunk-0scyzg9r.js → chunk-d9s37xm5.js} +19 -19
- package/dist/chunk-db1c0c3c.js +2 -0
- package/dist/{chunk-cxz4cdcn.js → chunk-e75dntfb.js} +2 -2
- package/dist/chunk-e8a6s6xs.js +25 -0
- package/dist/{chunk-wceg59n0.js → chunk-ekh3mxyp.js} +2 -2
- package/dist/{chunk-4mj9dem1.js → chunk-em8tv6nz.js} +2 -2
- package/dist/{chunk-7qk4exw1.js → chunk-ema1c29k.js} +2 -2
- package/dist/{chunk-z23arg8m.js → chunk-f49x34sr.js} +2 -2
- package/dist/{chunk-8w9spdbn.js → chunk-f6b7av6b.js} +9 -9
- package/dist/{chunk-9gmceny5.js → chunk-f7jgda7x.js} +5 -5
- package/dist/chunk-fb90n0by.js +2 -0
- package/dist/chunk-fevyb337.js +3 -0
- package/dist/chunk-fqq5qzm0.js +2 -0
- package/dist/chunk-fr9e8kb9.js +2 -0
- package/dist/{chunk-g25rz48g.js → chunk-ftw0a5dm.js} +6 -6
- package/dist/{chunk-b4x5ndt9.js → chunk-fwktw49p.js} +4 -4
- package/dist/chunk-g4qzy5hv.js +2 -0
- package/dist/{chunk-tksjakyv.js → chunk-gcf97wgx.js} +1 -1
- package/dist/chunk-gg48cgx3.js +2 -0
- package/dist/{chunk-076fj387.js → chunk-hd378dgy.js} +1 -1
- package/dist/chunk-j9aftb7p.js +2 -0
- package/dist/chunk-jp6sbk05.js +2 -0
- package/dist/chunk-k6ye0159.js +3 -0
- package/dist/{chunk-eycaj8mk.js → chunk-kfkbqwyf.js} +2 -2
- package/dist/{chunk-p1sfwzmb.js → chunk-kh2n3zqa.js} +1 -1
- package/dist/{chunk-x6863pzd.js → chunk-kmqcvpz2.js} +5 -5
- package/dist/chunk-kshem79d.js +2 -0
- package/dist/chunk-kve27dy3.js +2 -0
- package/dist/chunk-m3tnxk01.js +2 -0
- package/dist/chunk-m716f2ga.js +2 -0
- package/dist/{chunk-sk0tmtd3.js → chunk-m973xh3a.js} +13 -13
- package/dist/chunk-m9bbhg46.js +3 -0
- package/dist/chunk-m9dj8pgb.js +2 -0
- package/dist/{chunk-8p86mpfv.js → chunk-mfebs2s2.js} +2 -2
- package/dist/{chunk-qj4r08jb.js → chunk-mxvevxb8.js} +4 -4
- package/dist/{chunk-btxnrqxf.js → chunk-myje6fhm.js} +5 -5
- package/dist/{chunk-1f7d1c0y.js → chunk-mypygxdm.js} +2 -2
- package/dist/{chunk-76eh43e9.js → chunk-nfpsaaqm.js} +2 -2
- package/dist/{chunk-rptnx3s6.js → chunk-ng5revck.js} +29 -29
- package/dist/chunk-nxnkd48v.js +2 -0
- package/dist/chunk-pe5qqem0.js +2 -0
- package/dist/chunk-pg146fc5.js +2 -0
- package/dist/{chunk-67kbsav0.js → chunk-q5pwvr98.js} +1 -1
- package/dist/{chunk-2nj9aewf.js → chunk-qadce16v.js} +1 -1
- package/dist/chunk-qg2tpvdw.js +2 -0
- package/dist/chunk-qm6epp9h.js +2 -0
- package/dist/{chunk-bwsz6sv4.js → chunk-qn06sy9j.js} +5 -5
- package/dist/{chunk-q7zwv88b.js → chunk-qnrgfm9v.js} +2 -2
- package/dist/{chunk-f05tmz4z.js → chunk-qz82cpyv.js} +9 -9
- package/dist/chunk-rbq4dn2a.js +2 -0
- package/dist/{chunk-t9vwggkw.js → chunk-ret52ds0.js} +6 -6
- package/dist/{chunk-xpy9yjyx.js → chunk-rkdsgfhd.js} +13 -13
- package/dist/{chunk-bfbh0hfn.js → chunk-rmygv0n0.js} +6 -6
- package/dist/{chunk-n7arptzc.js → chunk-s53wjw7y.js} +3 -3
- package/dist/{chunk-p1fpferp.js → chunk-s5dhvnnd.js} +6 -6
- package/dist/chunk-s5ejh2yx.js +2 -0
- package/dist/chunk-s6399qe7.js +2 -0
- package/dist/chunk-se3fqsxk.js +2 -0
- package/dist/chunk-t59bc7na.js +3 -0
- package/dist/{chunk-21syn2j5.js → chunk-t96229jm.js} +2 -2
- package/dist/{chunk-9kj5p5jq.js → chunk-tngj0fp6.js} +8 -8
- package/dist/chunk-txzap6yn.js +2 -0
- package/dist/{chunk-tjhcrj3z.js → chunk-tzhs7drk.js} +11 -11
- package/dist/chunk-v1mwhvf8.js +2 -0
- package/dist/chunk-vb4xzz5c.js +2 -0
- package/dist/{chunk-me6kgvsm.js → chunk-vpnyqf0h.js} +1 -1
- package/dist/chunk-vxhq8n8y.js +2 -0
- package/dist/{chunk-mwxbdpb1.js → chunk-vyv76w55.js} +2 -2
- package/dist/chunk-w39cfxa6.js +2 -0
- package/dist/chunk-w9gpscjf.js +2 -0
- package/dist/chunk-wb6w807m.js +2 -0
- package/dist/chunk-wpyhavjy.js +2 -0
- package/dist/{chunk-j3st59hv.js → chunk-wr7bmkne.js} +2 -2
- package/dist/chunk-wt7qhv5b.js +2 -0
- package/dist/{chunk-y8p85kcj.js → chunk-wvds0s9m.js} +2 -2
- package/dist/chunk-x742wppj.js +2 -0
- package/dist/chunk-xdwnbr9b.js +4 -0
- package/dist/{chunk-928y0wer.js → chunk-xj3my6b9.js} +105 -105
- package/dist/{chunk-qz3fdmrc.js → chunk-xn9jg1q5.js} +3 -3
- package/dist/chunk-xrspzeqx.js +2 -0
- package/dist/{chunk-x5vxkypk.js → chunk-xtn0hnmz.js} +6 -6
- package/dist/{chunk-1d67wtj4.js → chunk-y6nz6bk2.js} +3 -3
- package/dist/{chunk-cmnze7at.js → chunk-ybq56wam.js} +2 -2
- package/dist/{chunk-y9bj3566.js → chunk-yrw5ensv.js} +3 -3
- package/dist/{chunk-e648sx8w.js → chunk-yv1vw0kx.js} +2 -2
- package/dist/{chunk-pvj0bpqg.js → chunk-z25w7kmr.js} +4 -4
- package/dist/chunk-zty254tw.js +2 -0
- package/dist/{chunk-j737tnvt.js → chunk-zvvv6x8c.js} +4 -4
- package/dist/cli.js +23 -23
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.d.ts +2 -0
- package/dist/loops.js +22 -3
- package/dist/performance-utils.d.ts +2 -0
- package/dist/performance-utils.js +7 -0
- package/dist/process.js +16 -10
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +11 -11
- package/package.json +5 -5
- package/dist/chunk-09285y4b.js +0 -2
- package/dist/chunk-0jvrzpfs.js +0 -2
- package/dist/chunk-19gk9k01.js +0 -2
- package/dist/chunk-2c5bwrnh.js +0 -2
- package/dist/chunk-2fwssv2z.js +0 -2
- package/dist/chunk-2v3r330m.js +0 -3
- package/dist/chunk-2vk7dtvs.js +0 -2
- package/dist/chunk-30rpspzt.js +0 -43
- package/dist/chunk-3bf48zrh.js +0 -2
- package/dist/chunk-4amybnpc.js +0 -2
- package/dist/chunk-4zjxj8ex.js +0 -2
- package/dist/chunk-58e92xts.js +0 -2
- package/dist/chunk-6h1qa3hw.js +0 -2
- package/dist/chunk-7pz76f28.js +0 -2
- package/dist/chunk-82v1egn6.js +0 -2
- package/dist/chunk-897gqcby.js +0 -2
- package/dist/chunk-9z9c025j.js +0 -2
- package/dist/chunk-a8fy7jv8.js +0 -2
- package/dist/chunk-akj26p4b.js +0 -3
- package/dist/chunk-b22yj5j5.js +0 -2
- package/dist/chunk-brhas9mp.js +0 -3
- package/dist/chunk-c1e45rtv.js +0 -2
- package/dist/chunk-cgamtmxv.js +0 -2
- package/dist/chunk-d0jcw9h6.js +0 -2
- package/dist/chunk-erf2g5b2.js +0 -2
- package/dist/chunk-exke928x.js +0 -2
- package/dist/chunk-fwk0gjbq.js +0 -2
- package/dist/chunk-g4sdthck.js +0 -2
- package/dist/chunk-g8nqmnb7.js +0 -2
- package/dist/chunk-gnt36wgk.js +0 -25
- package/dist/chunk-h67pm636.js +0 -2
- package/dist/chunk-hb8jxg45.js +0 -2
- package/dist/chunk-hfgzqapw.js +0 -2
- package/dist/chunk-hhats9b3.js +0 -2
- package/dist/chunk-htdbm0sd.js +0 -2
- package/dist/chunk-j0hrk24j.js +0 -2
- package/dist/chunk-jjbdtj4w.js +0 -2
- package/dist/chunk-jzc3rw49.js +0 -2
- package/dist/chunk-jzgyrxye.js +0 -2
- package/dist/chunk-k0xdvegc.js +0 -2
- package/dist/chunk-kep17bvj.js +0 -2
- package/dist/chunk-kfn7g24h.js +0 -2
- package/dist/chunk-kq5k2qbz.js +0 -2
- package/dist/chunk-ksxtrmy2.js +0 -2
- package/dist/chunk-m934bzg2.js +0 -2
- package/dist/chunk-mfc5d181.js +0 -2
- package/dist/chunk-mmeck545.js +0 -2
- package/dist/chunk-mz6qjee1.js +0 -2
- package/dist/chunk-ndjmt3vg.js +0 -3
- package/dist/chunk-p9dma8k0.js +0 -2
- package/dist/chunk-pby6dxnc.js +0 -2
- package/dist/chunk-prt4ntb0.js +0 -2
- package/dist/chunk-q2ynwst2.js +0 -2
- package/dist/chunk-q5bct2ks.js +0 -2
- package/dist/chunk-qp7dajd2.js +0 -2
- package/dist/chunk-r2hjn9ds.js +0 -2
- package/dist/chunk-s2zsa16d.js +0 -2
- package/dist/chunk-s8b6re34.js +0 -2
- package/dist/chunk-sddp2398.js +0 -2
- package/dist/chunk-sv4emtcj.js +0 -2
- package/dist/chunk-tcyvwy8p.js +0 -2
- package/dist/chunk-tg18j1yf.js +0 -2
- package/dist/chunk-tj7dh2dz.js +0 -2
- package/dist/chunk-tsvnhc0c.js +0 -4
- package/dist/chunk-v2ps4gnx.js +0 -2
- package/dist/chunk-vafxrky2.js +0 -2
- package/dist/chunk-wpendr22.js +0 -3
- package/dist/chunk-x30gh7vt.js +0 -2
- package/dist/chunk-x5r1cty7.js +0 -2
- package/dist/chunk-zd3dsp6p.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{jt,ae,A,u,f,P,t,ce,K,l,_e,Ci,z,kn,Ei,zt,Ti,il,$r,al,at,cl,Rr,ll,_n,$i,ul,Ar,Ir,Ce,Ri}from"./chunk-c9mdvpf5.js";import{ci,Ac,o,C,Ne,fn,Me,fe,J,vr,gn,Bs,Fc,zc,hn,_r,zs,Hs,Hc,mi,Vc,Uc,Wc,qc,Le,je,Vs,ze,s,wn,h,p,W,Q,ke,_}from"./chunk-xj3my6b9.js";import{Lt}from"./chunk-2qngyyaz.js";import{xn}from"./chunk-yv1vw0kx.js";import{b}from"./chunk-717qsbap.js";import{gr,As}from"./chunk-mxvevxb8.js";import{gc,mc,dr,et,hc,O}from"./chunk-ng5revck.js";import{Qo,ei,ti,ni}from"./chunk-rkdsgfhd.js";import{lc,us}from"./chunk-bwnwv91e.js";import{is,as,cs}from"./chunk-tzhs7drk.js";import{gs,Wo,qo,ms,hs,Ko}from"./chunk-qz82cpyv.js";import{ds,Fo}from"./chunk-e8a6s6xs.js";import{Do}from"./chunk-c84pxd2k.js";import{oe,zo,Ho,Vo}from"./chunk-ekh3mxyp.js";import{ar,we,dc,cr,pc}from"./chunk-5phdmpa7.js";import{B,Ze}from"./chunk-ybq56wam.js";import{yc,bc}from"./chunk-y6nz6bk2.js";import{E,Cn,Ai}from"./chunk-t59bc7na.js";import Xn from"fs";import ie from"path";function dt(){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(n){return Symbol(n)}var ys=Ge("theme"),bs=Ge("router"),ws=Ge("i18n");import*as ft from"crypto";function pt(n){let e=/\$(\w+)\./g,c=[],a;while((a=e.exec(n))!==null)if(!c.includes(a[1]))c.push(a[1]);return c}function Or(){return`stx-${ft.randomBytes(4).toString("hex")}`}function Lr(n){return/\$\w+\./.test(n)}function Pr(n){if(!/\{\{[^}]*\$\w/.test(n)||!/\$\w+\./.test(n))return{html:n,bindings:[],stores:new Set};let e=[],c=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,g=n;return g=g.replace(a,(r,d,y,m)=>{if(["script","style","template"].includes(d.toLowerCase()))return r;if(!y.includes("{{"))return r;let x=[],w=!1,v=y,k=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,S=[...y.matchAll(k)];for(let R of S){let D=R[0],N=R[1],j=R[2];if(Lr(j)){w=!0;let F=j.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(F){let I=F[1];if(x.push({attr:N,expr:I,fullMatch:D,originalAttr:N}),pt(I).forEach((H)=>c.add(H)),N==="text")v=v.replace(D,"");else if(N==="class")v=v.replace(D,'class=""');else if(N==="disabled"||N==="hidden")v=v.replace(D,"");else v=v.replace(D,`${N}=""`)}}}if(!w)return r;let M=v.match(/\bid\s*=\s*"([^"]+)"/),T;if(M)T=M[1];else T=Or(),v=` id="${T}"${v}`;for(let R of x)e.push({elementId:T,attribute:R.attr,expression:R.expr,stores:pt(R.expr)});return`<${d}${v}${m}`}),{html:g,bindings:e,stores:c}}function Nr(n,e){if(n.length===0)return"";let c=Array.from(e),a=`
|
|
351
351
|
<script>
|
|
352
352
|
(function() {
|
|
353
353
|
'use strict';
|
|
@@ -505,10 +505,10 @@ else {
|
|
|
505
505
|
}
|
|
506
506
|
})();
|
|
507
507
|
</script>
|
|
508
|
-
`,a}function
|
|
508
|
+
`,a}function gt(n){let{html:e,bindings:c,stores:a}=Pr(n);if(c.length===0)return n;let g=Nr(c,a),r=e.lastIndexOf("</body>");if(r!==-1)return e.slice(0,r)+g+e.slice(r);return e+g}function jr(n){let e=n.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Hr(e);case"google-analytics":return Br(e);case"plausible":return Fr(e);case"self-hosted":return Ur(e);case"custom":return qr(e);default:return""}}function Hr(n){let e=n.fathom;if(!e?.siteId)return"";let c=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",g=[`data-site="${ue(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="${ue(e.canonical)}"`);if(e.auto===!1)g.push('data-auto="false"');return`
|
|
509
509
|
<!-- Fathom Analytics -->
|
|
510
|
-
<script src="${
|
|
511
|
-
`}function
|
|
510
|
+
<script src="${ue(c)}" ${g.join(" ")}${a}></script>
|
|
511
|
+
`}function Br(n){let e=n.googleAnalytics;if(!e?.measurementId)return"";let c=ue(e.measurementId),a=e.debug?`gtag('config', '${c}', { 'debug_mode': true });`:"";return`
|
|
512
512
|
<!-- Google Analytics -->
|
|
513
513
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${c}"></script>
|
|
514
514
|
<script>
|
|
@@ -518,10 +518,10 @@ else {
|
|
|
518
518
|
gtag('config', '${c}');
|
|
519
519
|
${a}
|
|
520
520
|
</script>
|
|
521
|
-
`}function
|
|
521
|
+
`}function Fr(n){let e=n.plausible;if(!e?.domain)return"";let c=e.scriptUrl||"https://plausible.io/js/script.js",a=[`data-domain="${ue(e.domain)}"`],g=c,r=[];if(e.trackLocalhost)r.push("local");if(e.hashMode)r.push("hash");if(r.length>0&&c==="https://plausible.io/js/script.js")g=`https://plausible.io/js/script.${r.join(".")}.js`;return`
|
|
522
522
|
<!-- Plausible Analytics -->
|
|
523
|
-
<script defer data-domain="${
|
|
524
|
-
`}function
|
|
523
|
+
<script defer data-domain="${ue(e.domain)}" src="${ue(g)}"></script>
|
|
524
|
+
`}function Ur(n){let e=n.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let c=ue(e.siteId),a=ue(e.apiEndpoint),g=e.honorDnt?'if(n.doNotTrack==="1")return;':"",r=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",d=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){
|
|
@@ -554,32 +554,32 @@ else {
|
|
|
554
554
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
555
555
|
})();
|
|
556
556
|
</script>
|
|
557
|
-
`}function
|
|
557
|
+
`}function qr(n){let e=n.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 c=[];if(e.scriptId)c.push(`id="${
|
|
562
|
+
`;if(!e.scriptUrl)return"";let c=[];if(e.scriptId)c.push(`id="${ue(e.scriptId)}"`);if(e.attributes)for(let[g,r]of Object.entries(e.attributes))c.push(`${ue(g)}="${ue(r)}"`);return`
|
|
563
563
|
<!-- Custom Analytics -->
|
|
564
|
-
<script${c.length>0?` ${c.join(" ")}`:""} src="${
|
|
565
|
-
`}function
|
|
566
|
-
${g}`)}function kt(n,e){let c=n;return c=c.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<script nonce="${e}"${g}>`}),c=c.replace(/<style([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<style nonce="${e}"${g}>`}),c}function St(n,e,c,a){let g=n,r=a.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let d=r.useNonce?qe(e,r):void 0;return vt(r.directives,d)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return qe(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=qe(e,r);return g}import Zr from"crypto";var Jr=40,$t="_token",Je=null;function Qr(n=Jr){let e=Zr.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return Je=e,e}function Yr(){if(!Je)Qr();return Je}function en(n=$t){let e=Yr();return`<input type="hidden" name="${n}" value="${e}">`}function Et(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,c,a)=>en(a||$t))}async function Tt(n,e,c,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let g=n;for(let r of a.customDirectives){if(!r.name||typeof r.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await tn(g,r,e,c,a);else g=await rn(g,r,e,c,a)}return g}async function tn(n,e,c,a,g){let{name:r,handler:d}=e,y=`@${r}`,m=`@end${r}`,x=n,w=Lt(`${y}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${m}`,"g"),v=[],k=w.exec(x);while(k!==null){let[S,M="",T=""]=k,R=k.index||0;try{let D=M?_t(e,M):[],P=T.trim(),N=await d(P,D,c,a);v.push({original:S,processed:N,startIndex:R})}catch(D){let P=D instanceof Error?D.message:String(D);if(g.debug)console.error(`Error processing custom directive @${r}:`,D);v.push({original:S,processed:l("CustomDirective",`Error in @${r}${M?`(${M})`:""}: ${P}`,t.EVALUATION_ERROR),startIndex:R})}k=w.exec(x)}for(let S=v.length-1;S>=0;S--){let{original:M,processed:T}=v[S];x=x.replace(M,T)}return x}async function rn(n,e,c,a,g){let{name:r,handler:d}=e,y=n,m=[],x=[];if(e.rawParams){for(let k of Ci(y,Lt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(k.end!==-1)x.push({fullMatch:k.call,paramString:k.args,startIndex:k.start})}else{let k=Lt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");k.lastIndex=0;let S=k.exec(y);while(S!==null)x.push({fullMatch:S[0],paramString:S[1]??"",startIndex:S.index||0}),S=k.exec(y)}for(let{fullMatch:k,paramString:S,startIndex:M}of x)try{let T=_t(e,S),R=await d("",T,c,a);m.push({original:k,processed:R,startIndex:M})}catch(T){let R=T instanceof Error?T.message:String(T);if(g.debug)console.error(`Error processing custom directive @${r}:`,T);m.push({original:k,processed:l("CustomDirective",`Error in @${r}(${S}): ${R}`,t.EVALUATION_ERROR),startIndex:M})}let w=Lt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),v=w.exec(y);while(v!==null){let[k]=v,S=v.index||0;try{let M=await d("",[],c,a);m.push({original:k,processed:M,startIndex:S})}catch(M){let T=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);m.push({original:k,processed:l("CustomDirective",`Error in @${r}: ${T}`,t.EVALUATION_ERROR),startIndex:S})}v=w.exec(y)}for(let k=m.length-1;k>=0;k--){let{original:S,processed:M}=m[k];y=y.replace(S,M)}return y}function _t(n,e){return n.rawParams?Ft(e):nn(e)}function nn(n){if(!n.trim())return[];let e=[],c="",a=!1,g="";for(let r=0;r<n.length;r++){let d=n[r];if((d==='"'||d==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,g=d;else if(d===g)a=!1;else c+=d;else if(d===","&&!a)e.push(c.trim()),c="";else c+=d}if(c.trim())e.push(c.trim());return e.map((r)=>{let d=r.trim();if(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))return d.substring(1,d.length-1);return d})}var Ct=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,At=/^[A-Za-z_$][\w$]*$/,sn=new Set(["light","dark","system"]);function ve(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function on(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:c,colorMode:a}=e;if(ve(e.storageKey,"storageKey"),c!==void 0&&(!c||typeof c!=="object"||Array.isArray(c)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(ve(a.key,"colorMode.key"),ve(a.attribute,"colorMode.attribute"),ve(a.default,"colorMode.default"),!At.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ct.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!sn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(c){if(ve(c.key,"appearance.key"),ve(c.attribute,"appearance.attribute"),ve(c.default,"appearance.default"),!At.test(c.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ct.test(c.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(c.allowed)||c.allowed.length===0||c.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!c.allowed.includes(c.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:c.key,attribute:c.attribute,allowed:[...new Set(c.allowed)],default:c.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function an(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function cn(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${an(n)};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 ln(n,e){let c=1,a=null,g=!1;for(let r=e+1;r<n.length;r++){let d=n[r];if(g){g=!1;continue}if(a){if(d==="\\")g=!0;else if(d===a)a=null;continue}if(d==='"'||d==="'"||d==="`"){a=d;continue}if(d==="(")c++;else if(d===")"&&--c===0)return r}return-1}function Rt(n,e){let c=n,a=/@appearanceBootstrap\s*\(/g,g;while((g=a.exec(c))!==null){let r=g.index+g[0].length-1,d=ln(c,r);if(d===-1)throw Error("@appearanceBootstrap has an unclosed options object");let y=c.slice(r+1,d).trim(),m=u(`(${y})`,e),x=cn(on(m));c=c.slice(0,g.index)+x+c.slice(d+1),a.lastIndex=g.index+x.length}return c}import un from"crypto";function Q(n){return U(String(n??""))}var It={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(n,e,c,a){let g=n||e;return c?`${g} ${a}`:g}function fe(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ce(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${Q(e)}"`}function et(n,e,c){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(c))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(c))a+=` aria-describedby="${Q(`${fe(n)}-error`)}"`;return a}function dn(){return un.randomUUID()}function We(n,e){let c=n;return c=c.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=dn();e.csrf={token:a}}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="">'}),c=c.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Q(r)}">`;return a}),c}function Ot(n,e,c=It){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,d,y,m,x="")=>{let w=r||d||"POST",v=y||m||"",k=he(x),S=w.toUpperCase(),M=["GET","POST"].includes(S)?S:"POST",T=`<form method="${Q(M)}" action="${Q(v)}"${k?` ${k}`:""}>`;if(T+=`
|
|
564
|
+
<script${c.length>0?` ${c.join(" ")}`:""} src="${ue(e.scriptUrl)}" defer></script>
|
|
565
|
+
`}function mt(n,e){let c=jr(e);if(!c)return n;if(!n.includes("</head>")){let a=n.lastIndexOf("</body>");if(a!==-1)return n.slice(0,a)+c+n.slice(a);return n+c}return n.replace("</head>",`${c}</head>`)}function ue(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function bt(n){let e=n.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function ht(n){let e=n?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import Vr from"fs";import Je from"path";import{createHighlighter as Wr}from"ts-syntax-highlighter";var Qe=new Map;async function Ae(n,e={}){try{if(!await s(n))throw Error(`Markdown file not found: ${n}`);let a=(await Vr.promises.stat(n)).mtime.getTime();if(e.cache&&Qe.has(n)){let v=Qe.get(n);if(v.updatedAt>=a)return{content:v.content,data:v.data}}let g=await Bun.file(n).text(),{data:r,content:d}=dr(g),y=e.markdown||O.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=et(d,{gfm:!0});if(y.syntaxHighlighting?.enabled&&y.syntaxHighlighting?.serverSide)x=await Xr(x,y.syntaxHighlighting?.defaultTheme||"github-dark",y.syntaxHighlighting?.highlightUnknownLanguages||!1);let w={content:x,data:r||{}};if(e.cache)Qe.set(n,{...w,updatedAt:a});return w}catch(c){if(e.debug)console.error(`Error reading/parsing markdown file ${n}:`,c);let a=c instanceof Error?c.message:String(c);return{content:h("Markdown File",`Error reading/parsing markdown file: ${a}`,n,"",0,""),data:{}}}}var Ue=null;async function Xr(n,e,c){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Ue)try{Ue=await Wr({theme:e||"github-dark",cache:!0})}catch(y){return console.error("Failed to initialize ts-syntax-highlighter:",y),n}let g=async(y,m,x,w)=>{let v=w.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),k=x||(c?"text":"");if(!k)return y;try{if(!Ue.getSupportedLanguages().includes(k))return y;return(await Ue.highlight(v,k,{theme:e})).html}catch(S){console.error(`Error highlighting code block with language ${x}:`,S)}return y},r=n,d=n.matchAll(a);for(let y of d){let[m,x,w,v]=y,k=await g(m,x,w,v);r=r.replace(m,k)}return r}async function yt(n,e,c="",a={}){return await zr(n,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(d,y,m,x)=>{try{let w=y;if(!Je.isAbsolute(y))w=Je.resolve(Je.dirname(c),y);let v={};if(m)try{try{v=JSON.parse(m)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let N=m.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let j of N){let F=j.indexOf(":");if(F>0){let I=j.substring(0,F).trim(),L=j.substring(F+1).trim(),H=L.startsWith('"')&&L.endsWith('"'),V=L.startsWith("'")&&L.endsWith("'");if(H||V)L=L.substring(1,L.length-1);v[I]=L}}}}catch(D){if(a.debug)console.error("Error parsing context in @markdown-file directive:",D)}let{content:k,data:S}=await Ae(w,a),M={...e,...S,...v},T=k,R=/\{\{([^}]+)\}\}/g;return T=T.replace(R,(D,N)=>{let j=N.trim();return M[j]!==void 0?String(M[j]):D}),T}catch(w){let v=w instanceof Error?w.message:String(w);return h("Markdown File",`Error including markdown file: ${v}`,c,n,x,d)}})}async function zr(n,e,c){let a=[],g;while((g=e.exec(n))!==null){let y=g[0],m=g.index,x=g;a.push(c(...x).then((w)=>({match:y,replacement:w,index:m})))}let r=await Promise.all(a);r.sort((y,m)=>m.index-y.index);let d=n;for(let{match:y,replacement:m}of r)d=d.replace(y,()=>m);return d}var wt=new WeakMap;function vt(n=16){let e=new Uint8Array(n);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function qe(n,e){if(!n)return e?.nonceGenerator?.()??vt();let c=wt.get(n);if(!c)c=e?.nonceGenerator?.()??vt(),wt.set(n,c);return c}function Kr(n,e){let c=[];for(let[a,g]of Object.entries(n)){if(g===void 0||g===null)continue;if(typeof g==="boolean"){if(g)c.push(a);continue}if(Array.isArray(g)){let r=[...g];if(e&&(a==="script-src"||a==="style-src"))r=r.filter((d)=>!d.startsWith("'nonce-")),r.push(`'nonce-${e}'`);if(r.length>0)c.push(`${a} ${r.join(" ")}`)}}return c.join("; ")}function xt(n,e){return`<meta http-equiv="Content-Security-Policy" content="${Kr(n,e).replace(/&/g,"&").replace(/"/g,""")}">`}function kt(n,e,c){if(!e.enabled||!e.addMetaTag)return n;if(n.includes('http-equiv="Content-Security-Policy"'))return n;if(!n.includes("<head>")&&!n.includes("<head "))return n;let a=e.useNonce?qe(c,e):void 0,g=xt(e.directives,a);return n.replace(/<head([^>]*)>/,`<head$1>
|
|
566
|
+
${g}`)}function St(n,e){let c=n;return c=c.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<script nonce="${e}"${g}>`}),c=c.replace(/<style([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<style nonce="${e}"${g}>`}),c}function $t(n,e,c,a){let g=n,r=a.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let d=r.useNonce?qe(e,r):void 0;return xt(r.directives,d)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return qe(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=qe(e,r);return g}import Gr from"crypto";var Zr=40,Et="_token",Ye=null;function Jr(n=Zr){let e=Gr.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return Ye=e,e}function Qr(){if(!Ye)Jr();return Ye}function Yr(n=Et){let e=Qr();return`<input type="hidden" name="${n}" value="${e}">`}function Tt(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,c,a)=>Yr(a||Et))}async function _t(n,e,c,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let g=n;for(let r of a.customDirectives){if(!r.name||typeof r.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await en(g,r,e,c,a);else g=await tn(g,r,e,c,a)}return g}async function en(n,e,c,a,g){let{name:r,handler:d}=e,y=`@${r}`,m=`@end${r}`,x=n,w=jt(`${y}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${m}`,"g"),v=[],k=w.exec(x);while(k!==null){let[S,M="",T=""]=k,R=k.index||0;try{let D=M?Ct(e,M):[],N=T.trim(),j=await d(N,D,c,a);v.push({original:S,processed:j,startIndex:R})}catch(D){let N=D instanceof Error?D.message:String(D);if(g.debug)console.error(`Error processing custom directive @${r}:`,D);v.push({original:S,processed:l("CustomDirective",`Error in @${r}${M?`(${M})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:R})}k=w.exec(x)}for(let S=v.length-1;S>=0;S--){let{original:M,processed:T}=v[S];x=x.replace(M,T)}return x}async function tn(n,e,c,a,g){let{name:r,handler:d}=e,y=n,m=[],x=[];if(e.rawParams){for(let k of Ei(y,jt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(k.end!==-1)x.push({fullMatch:k.call,paramString:k.args,startIndex:k.start})}else{let k=jt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");k.lastIndex=0;let S=k.exec(y);while(S!==null)x.push({fullMatch:S[0],paramString:S[1]??"",startIndex:S.index||0}),S=k.exec(y)}for(let{fullMatch:k,paramString:S,startIndex:M}of x)try{let T=Ct(e,S),R=await d("",T,c,a);m.push({original:k,processed:R,startIndex:M})}catch(T){let R=T instanceof Error?T.message:String(T);if(g.debug)console.error(`Error processing custom directive @${r}:`,T);m.push({original:k,processed:l("CustomDirective",`Error in @${r}(${S}): ${R}`,t.EVALUATION_ERROR),startIndex:M})}let w=jt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),v=w.exec(y);while(v!==null){let[k]=v,S=v.index||0;try{let M=await d("",[],c,a);m.push({original:k,processed:M,startIndex:S})}catch(M){let T=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);m.push({original:k,processed:l("CustomDirective",`Error in @${r}: ${T}`,t.EVALUATION_ERROR),startIndex:S})}v=w.exec(y)}for(let k=m.length-1;k>=0;k--){let{original:S,processed:M}=m[k];y=y.replace(S,M)}return y}function Ct(n,e){return n.rawParams?zt(e):rn(e)}function rn(n){if(!n.trim())return[];let e=[],c="",a=!1,g="";for(let r=0;r<n.length;r++){let d=n[r];if((d==='"'||d==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,g=d;else if(d===g)a=!1;else c+=d;else if(d===","&&!a)e.push(c.trim()),c="";else c+=d}if(c.trim())e.push(c.trim());return e.map((r)=>{let d=r.trim();if(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))return d.substring(1,d.length-1);return d})}var At=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Rt=/^[A-Za-z_$][\w$]*$/,nn=new Set(["light","dark","system"]);function xe(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function sn(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:c,colorMode:a}=e;if(xe(e.storageKey,"storageKey"),c!==void 0&&(!c||typeof c!=="object"||Array.isArray(c)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(xe(a.key,"colorMode.key"),xe(a.attribute,"colorMode.attribute"),xe(a.default,"colorMode.default"),!Rt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!At.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!nn.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(c){if(xe(c.key,"appearance.key"),xe(c.attribute,"appearance.attribute"),xe(c.default,"appearance.default"),!Rt.test(c.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!At.test(c.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(c.allowed)||c.allowed.length===0||c.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!c.allowed.includes(c.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:c.key,attribute:c.attribute,allowed:[...new Set(c.allowed)],default:c.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function on(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function an(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${on(n)};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 cn(n,e){let c=1,a=null,g=!1;for(let r=e+1;r<n.length;r++){let d=n[r];if(g){g=!1;continue}if(a){if(d==="\\")g=!0;else if(d===a)a=null;continue}if(d==='"'||d==="'"||d==="`"){a=d;continue}if(d==="(")c++;else if(d===")"&&--c===0)return r}return-1}function Mt(n,e){let c=n,a=/@appearanceBootstrap\s*\(/g,g;while((g=a.exec(c))!==null){let r=g.index+g[0].length-1,d=cn(c,r);if(d===-1)throw Error("@appearanceBootstrap has an unclosed options object");let y=c.slice(r+1,d).trim(),m=u(`(${y})`,e),x=an(sn(m));c=c.slice(0,g.index)+x+c.slice(d+1),a.lastIndex=g.index+x.length}return c}import ln from"crypto";function Y(n){return W(String(n??""))}var It={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(n,e,c,a){let g=n||e;return c?`${g} ${a}`:g}function ge(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Re(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${Y(e)}"`}function tt(n,e,c){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(c))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(c))a+=` aria-describedby="${Y(`${ge(n)}-error`)}"`;return a}function un(){return ln.randomUUID()}function We(n,e){let c=n;return c=c.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=un();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Y(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),c=c.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Y(r)}">`;return a}),c}function Ot(n,e,c=It){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,d,y,m,x="")=>{let w=r||d||"POST",v=y||m||"",k=ye(x),S=w.toUpperCase(),M=["GET","POST"].includes(S)?S:"POST",T=`<form method="${Y(M)}" action="${Y(v)}"${k?` ${k}`:""}>`;if(T+=`
|
|
567
567
|
${We("@csrf",e)}`,!["GET","POST"].includes(S))T+=`
|
|
568
|
-
${We(`@method('${S}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,r,d,y,m,x="")=>{let w=r||d||"",v=y||m||"",k=
|
|
568
|
+
${We(`@method('${S}')`,e)}`;return T}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,r,d,y,m,x="")=>{let w=r||d||"",v=y||m||"",k=ye(x),S=Pe(w,e),M=S!==void 0&&S!==null?S:v||"",T=k.match(/type=['"]([^'"]+)['"]/i),R=T?T[1]:"text",D=He(w,e),N=k.match(/class=['"]([^'"]+)['"]/i),j=Ve(N?N[1]:"",c.input,D,c.inputError),F=k.replace(/class=['"][^'"]+['"]/i,"");return F=F.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Y(R)}" name="${Y(w)}"${Re(k,ge(w))} value="${Y(M)}" class="${j}"${tt(w,D,k)}${F?` ${F}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(g,r,d="",y="")=>{let m=ye(d),x=Pe(r,e)||y.trim(),w=He(r,e),v=m.match(/class=['"]([^'"]+)['"]/i),k=Ve(v?v[1]:"",c.input,w,c.inputError),S=m.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Y(r)}"${Re(m,ge(r))} class="${k}"${tt(r,w,m)}${S?` ${S}`:""}>${Y(x)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(g,r,d="",y)=>{let m=ye(d),x=Pe(r,e),w=He(r,e),v=m.match(/class=['"]([^'"]+)['"]/i),k=Ve(v?v[1]:"",c.input,w,c.inputError),S=m.replace(/class=['"][^'"]+['"]/i,""),M=y;if(x!==void 0)M=y.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(T,R,D)=>{if((Array.isArray(x)?x.some((j)=>String(j)===D):String(x)===D)&&!R.includes("selected"))return R.replace(/(<option)/,"$1 selected");return T});return`<select name="${Y(r)}"${Re(m,ge(r))} class="${k}"${tt(r,w,m)}${S?` ${S}`:""}>${M}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(g,r,d,y="")=>{let m=d===void 0?"1":d,x=d===void 0?ge(r):`${ge(r)}-${ge(m)}`,w=ye(y),v=Pe(r,e),k=v!==void 0&&(Array.isArray(v)?v.some((R)=>String(R)===m):v===!0||String(v)===m),S=w.match(/class=['"]([^'"]+)['"]/i),M=S?S[1]:c.checkInput,T=w.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Y(r)}"${Re(w,x)} value="${Y(m)}" class="${M}"${k?" checked":""}${T?` ${T}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,d,y="")=>{let m=ye(y),x=Pe(r,e),w=x!==void 0&&x===d,v=m.match(/class=['"]([^'"]+)['"]/i),k=v?v[1]:c.checkInput,S=m.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Y(r)}"${Re(m,`${ge(r)}-${ge(d)}`)} value="${Y(d)}" class="${k}"${w?" checked":""}${S?` ${S}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,d="")=>{let y=ye(d),m=y.match(/accept=['"]([^'"]+)['"]/i),x=m?m[1]:"",w=y.includes("multiple"),v=He(r,e),k=y.match(/class=['"]([^'"]+)['"]/i),S=Ve(k?k[1]:"",c.input,v,c.inputError),M=y.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),T=[`<input type="file" name="${Y(r)}"${Re(y,ge(r))}`,`class="${S}"`];if(x)T.push(`accept="${Y(x)}"`);if(w)T.push("multiple");if(M)T.push(M);return`${T.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(g,r,d="",y)=>{let m=ye(d),x=m.match(/class=['"]([^'"]+)['"]/i),w=x?x[1]:c.label,v=m.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Y(ge(r))}" class="${w}"${v?` ${v}`:""}>${y}</label>`}),a}function Pt(n,e,c=It){return n.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,g,r)=>{try{if(He(g,e)){let d=r.replace(/\{\{([^}]+)\}\}/g,(y,m,x)=>{let w=(v)=>Q(r,x,String(v??""),!1,y.length);try{if(m.trim()==="$message"||m.trim()==="message")return w(Dt(g,e));if(m.trim().includes("errors.first")||m.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return w(e.errors.first(g));return w(Dt(g,e))}let v=m.trim();if(f(v)){let k=u(v,e);return k!==void 0?w(k):v}return v}catch{return m}});return`<div id="${Y(`${ge(g)}-error`)}" role="alert">${d}</div>`}return""}catch(d){return console.error("Error processing @error directive:",d),a}})}function He(n,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(n);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,n);return!1}function Dt(n,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(n);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,n)){let c=e.errors[n];return Array.isArray(c)?c[0]:String(c)}return""}function Pe(n,e){let c;if(e.old&&typeof e.old==="function")return e.old(n);if(e.old&&typeof e.old==="object")return e.old[n];if(n.endsWith("[]")){let a=n.slice(0,-2);if(c=e[a],c!==void 0)return c}return e[n]}function ye(n){if(!n.trim())return"";let e=[],c=n.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,g;while((g=a.exec(c))!==null){let[,r,,d]=g;e.push(`${r}="${d.trim()}"`)}return e.join(" ")}import*as rt from"path";async function Nt(n,e,c=""){if(rt.basename(c)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,n.replace(/@js[\s\S]*?@endjs/g,"");return Bt(n,e,c,"@js","@endjs")}async function Ht(n,e,c=""){if(rt.basename(c)==="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 n.replace(/@ts[\s\S]*?@endts/g,"")}return Bt(n,e,c,"@ts","@endts")}async function Bt(n,e,c,a,g){let r=n,d=jt(`${a}([\\s\\S]*?)${g}`,"g"),y=[],m;while((m=d.exec(n))!==null)y.push({fullMatch:m[0],content:m[1]||"",index:m.index});for(let{fullMatch:x,content:w,index:v}of y)try{let k={...e,global:e},S=Object.keys(k),M=Object.values(k),T=w.trim();if(a==="@ts")T=T.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 D=(T.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((L)=>L.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),N=D.length>0?`return { ${D.join(", ")} };`:"return {};",j=`
|
|
569
569
|
${T}
|
|
570
|
-
${
|
|
571
|
-
`,
|
|
570
|
+
${N}
|
|
571
|
+
`,I=Function(...S,j)(...M);if(I&&typeof I==="object")Object.assign(e,I);r=r.replace(x,"")}catch(k){console.error(`Error executing ${a} code block in ${c}:`,k);let S=k instanceof Error?k.message:String(k),M=h(`${a} Directive`,`Error executing code: ${S}`,c,n,v,x);console.error(M),r=r.replace(x,"")}return r}function dn(n,e="_method"){let c=n.toUpperCase();if(c==="GET"||c==="POST")return"";return`<input type="hidden" name="${e}" value="${c}">`}function Ft(n){return n.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,c,a,g,r)=>dn(a,r||"_method"))}async function Ut(n,e,c,a,g){if(!a.middleware||a.middleware.length===0)return n;let r=n,d=a.middleware.filter((y)=>y.timing===g);if(d.length===0)return r;for(let y of d){if(!y.name||typeof y.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",y);continue}try{let m=await y.handler(r,e,c,a);if(typeof m==="string")r=m;else if(a.debug)console.warn(`Middleware ${y.name} did not return a string`)}catch(m){if(a.debug)console.error(`Error in middleware ${y.name}:`,m);if(a.debug){let x=h("Middleware",`Error in middleware '${y.name}': ${m instanceof Error?m.message:String(m)}`,c,n);r=r.replace(/<body[^>]*>/,`$&
|
|
572
572
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${p(x)}</div>
|
|
573
|
-
`)}}}return r}async function qt(n,e,c,a){return Ut(n,e,c,a,"before")}async function Vt(n,e,c,a){return Ut(n,e,c,a,"after")}function Wt(n){return n.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,c,a,g,r)=>{try{let d=g?
|
|
573
|
+
`)}}}return r}async function qt(n,e,c,a){return Ut(n,e,c,a,"before")}async function Vt(n,e,c,a){return Ut(n,e,c,a,"after")}function Wt(n){return n.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,c,a,g,r)=>{try{let d=g?P(g,{}):{};return gr(a,d,r==="true")}catch(d){return console.error(`Error processing @route directive: ${d}`),"#route-error"}})}var Be={patterns:[],exact:{}};async function Xt(n,e){let c=n.split("/").pop()?.split(".")[0]||"";if(Be.exact[n])for(let a of Be.exact[n])await Promise.resolve(a(e,n));if(Be.exact[c])for(let a of Be.exact[c])await Promise.resolve(a(e,n));for(let{pattern:a,callback:g}of Be.patterns)if(a.test(n)||a.test(c))await Promise.resolve(g(e,n))}var pn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),mn=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(n,e){let c=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;c.lastIndex=e;let a=c.exec(n);if(!a)return null;let g=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&pn.has(a[1]),r=g?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:r,selfClosing:g,start:a.index,end:a.index+a[0].length}}function yn(n,e,c){let a=1,g=c,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),d=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&g<n.length){r.lastIndex=g,d.lastIndex=g;let y=r.exec(n),m=d.exec(n);if(!m)return-1;if(y&&y.index<m.index)a++,g=y.index+y[0].length;else{if(a--,a===0)return m.index+m[0].length;g=m.index+m[0].length}}return-1}function Se(n,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let c=yn(n,e.tag,e.end);if(c===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:c,innerHTML:n.slice(e.end,c-`</${e.tag}>`.length)}}function Kt(n,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(n)||n.includes(` ${e}=`)||n.includes(` ${e} `)||n.trimEnd().endsWith(` ${e}`)}function Fe(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=n.match(new RegExp(`${c}="([^"]*)"`,"s"))||n.match(new RegExp(`${c}='([^']*)'`,"s"));return a?a[1]:null}function be(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return n.replace(new RegExp(`\\s*${c}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${c}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${c}(?=\\s|$|>|/)`,"g"),"")}function De(n,e,c){let a=e.selfClosing?" /":"",g=`<${e.tag}${c}${a}>`;return n.slice(0,e.start)+g+n.slice(e.end)}function bn(n){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(n)}function vn(n){let e=n,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-for");if(g===null){c=a.end;continue}let r=g.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){c=a.end;continue}let d=r[1].trim(),y=r[2].trim(),m;if(d.includes(",")){let R=d.split(",").map((j)=>j.trim()),D=R[0],N=R[1];m=`${y} as ${N} => ${D}`}else m=`${y} as ${d}`;let x=be(a.attrs,"v-for"),w=be(x,":key").replace(/\s*v-bind:key="[^"]*"/g,""),v=Se(e,a),k=e.slice(v.outerStart,v.outerEnd),S=De(k,{...a,start:0,end:a.end-a.start},w),M=`@foreach(${m})
|
|
574
574
|
`,T=`${M}${S}
|
|
575
|
-
@endforeach`;e=e.slice(0,v.outerStart)+T+e.slice(v.outerEnd),c=v.outerStart+M.length}return e}function
|
|
575
|
+
@endforeach`;e=e.slice(0,v.outerStart)+T+e.slice(v.outerEnd),c=v.outerStart+M.length}return e}function Sn(n){let e=n,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-if");if(g===null){c=a.end;continue}let r=[],d=Se(e,a),y=be(a.attrs,"v-if"),m=De(e.slice(d.outerStart,d.outerEnd),{...a,start:0,end:a.end-a.start},y);r.push({type:"if",expr:g,outerStart:d.outerStart,outerEnd:d.outerEnd,element:m,parsedTag:a});let x=d.outerEnd,w=!0;while(w){let T=e.slice(x).match(/^\s*/),R=T?T[0].length:0,D=$e(e,x+R);if(!D){w=!1;break}let N=Fe(D.attrs,"v-else-if"),j=Kt(D.attrs,"v-else");if(N!==null){let F=Se(e,D),I=be(D.attrs,"v-else-if"),L=De(e.slice(F.outerStart,F.outerEnd),{...D,start:0,end:D.end-D.start},I);r.push({type:"else-if",expr:N,outerStart:x,outerEnd:F.outerEnd,element:L,parsedTag:D}),x=F.outerEnd}else if(j){let F=Se(e,D),I=be(D.attrs,"v-else"),L=De(e.slice(F.outerStart,F.outerEnd),{...D,start:0,end:D.end-D.start},I);r.push({type:"else",outerStart:x,outerEnd:F.outerEnd,element:L,parsedTag:D}),w=!1}else w=!1}let v=[];for(let T of r)if(T.type==="if")v.push(`@if(${T.expr})
|
|
576
576
|
${T.element}`);else if(T.type==="else-if")v.push(`@elseif(${T.expr})
|
|
577
577
|
${T.element}`);else v.push(`@else
|
|
578
578
|
${T.element}`);v.push("@endif");let k=v.join(`
|
|
579
|
-
`),S=r[0].outerStart,M=r[r.length-1].outerEnd;e=e.slice(0,S)+k+e.slice(M),c=S+k.length}return e}function
|
|
580
|
-
${
|
|
581
|
-
@endonce`;e=e.slice(0,r.outerStart)+m+e.slice(r.outerEnd),c=r.outerStart+m.length}return e}function
|
|
582
|
-
<meta name="stx-build" content="${e}">`}var No="/_stx/sw.js";function
|
|
579
|
+
`),S=r[0].outerStart,M=r[r.length-1].outerEnd;e=e.slice(0,S)+k+e.slice(M),c=S+k.length}return e}function $n(n){return n.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function En(n){let e=n,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=mn.has(a.tag),r=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(y,m,x)=>{let w=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(m);if(!w||!x||!/^["']/.test(x))return y;let v=w[1]||"modelValue",k=w[2];if(g&&!w[1])return`@model${k}=${x}`;let S=x[0],M=x.slice(1,-1),T=`:${v}=${x} @update:${v}=${S}${M} = $event${S}`;if(k){let R=w[1]?`${v}Modifiers`:"modelModifiers",D=k.slice(1).split(".").map((N)=>`${N}: true`).join(", ");T+=` :${R}="{ ${D} }"`}return T});if(r===a.attrs){c=a.end;continue}let d=De(a.full,{...a,start:0,end:a.full.length},r);e=e.slice(0,a.start)+d+e.slice(a.end),c=a.start+d.length}return e}function Tn(n){return n.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function An(n){return n.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Rn(n){let e=n,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-html");if(g===null){c=a.end;continue}if(a.selfClosing){c=a.end;continue}let r=Se(e,a),d=be(a.attrs,"v-html"),y=a.selfClosing?" /":"",m=`<${a.tag}${d}${y}>{!! ${g} !!}</${a.tag}>`;e=e.slice(0,r.outerStart)+m+e.slice(r.outerEnd),c=r.outerStart+m.length}return e}function Mn(n){let e=n,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;let g=Fe(a.attrs,"v-text");if(g===null){c=a.end;continue}if(a.selfClosing){c=a.end;continue}let r=Se(e,a),d=be(a.attrs,"v-text"),y=a.selfClosing?" /":"",m=`<${a.tag}${d}${y}>{{ ${g} }}</${a.tag}>`;e=e.slice(0,r.outerStart)+m+e.slice(r.outerEnd),c=r.outerStart+m.length}return e}function Dn(n){return n.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 In(n){let e=n,c=0;while(c<e.length){let a=$e(e,c);if(!a)break;if(!Kt(a.attrs,"v-once")){c=a.end;continue}let g=be(a.attrs,"v-once"),r=Se(e,a),d=e.slice(r.outerStart,r.outerEnd),m=`@once
|
|
580
|
+
${De(d,{...a,start:0,end:a.end-a.start},g)}
|
|
581
|
+
@endonce`;e=e.slice(0,r.outerStart)+m+e.slice(r.outerEnd),c=r.outerStart+m.length}return e}function On(n){return n.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ln(n){return n.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 Gt(n){if(!bn(n))return n;let e=n;return e=vn(e),e=Sn(e),e=In(e),e=Tn(e),e=An(e),e=En(e),e=$n(e),e=Ln(e),e=Rn(e),e=Mn(e),e=Dn(e),e=On(e),e}function Xe(n){return n.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"]),Pn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Zt(n,e){let c=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(n),a=c?c[1]:n,g=u(a,e);if(g&&typeof g==="string")return g;let r=a.trim();return nt.has(r)?r:null}function Jt(n){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(n);return e?e[1]:n}function Qt(n,e,c){let a=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),g=a?`<${n} ${a}>`:`<${n}>`;if(Pn.has(n))return a?`<${n} ${a}>`:`<${n}>`;return`${g}${c}</${n}>`}async function Yt(n,e,c,a,g){let r=n,d=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,y=[],m;while((m=d.exec(r))!==null)y.push({full:m[0],expr:m[1],attrs:m[2],slotContent:m[3],index:m.index});for(let x=y.length-1;x>=0;x--){let w=y[x];try{let v=Zt(w.expr,e);if(!v||typeof v!=="string"){let N=`<!-- dynamic component: could not resolve "${Xe(Jt(w.expr))}" -->`;r=r.slice(0,w.index)+N+r.slice(w.index+w.full.length);continue}if(nt.has(v)){let N=Qt(v,w.attrs,w.slotContent);r=r.slice(0,w.index)+N+r.slice(w.index+w.full.length);continue}let k=w.attrs.trim(),S={},M=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,T;while((T=M.exec(k))!==null){let N=T[1]||T[2],j=T[3];if(T[1])try{S[N]=u(j,e)}catch{S[N]=j}else S[N]=j}let R=a.componentsDir||"components",D=await ze(v,S,w.slotContent,R,e,c,a,new Set,g??new Set);r=r.slice(0,w.index)+D+r.slice(w.index+w.full.length)}catch(v){let k=v instanceof Error?v.message:String(v),S=`<!-- dynamic component error: ${Xe(k)} -->`;r=r.slice(0,w.index)+S+r.slice(w.index+w.full.length)}}return r=await Nn(r,e,c,a,g),r}async function Nn(n,e,c,a,g){let r=n,d=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,y=[],m;while((m=d.exec(r))!==null)y.push({full:m[0],expr:m[1],attrs:m[2],index:m.index});for(let x=y.length-1;x>=0;x--){let w=y[x];try{let v=Zt(w.expr,e);if(!v||typeof v!=="string"){let M=`<!-- dynamic component: could not resolve "${Xe(Jt(w.expr))}" -->`;r=r.slice(0,w.index)+M+r.slice(w.index+w.full.length);continue}if(nt.has(v)){let M=Qt(v,w.attrs,"");r=r.slice(0,w.index)+M+r.slice(w.index+w.full.length);continue}let k=a.componentsDir||"components",S=await ze(v,{},"",k,e,c,a,new Set,g??new Set);r=r.slice(0,w.index)+S+r.slice(w.index+w.full.length)}catch(v){let k=v instanceof Error?v.message:String(v),S=`<!-- dynamic component error: ${Xe(k)} -->`;r=r.slice(0,w.index)+S+r.slice(w.index+w.full.length)}}return r}var oc="X-STX-Build",st=Symbol.for("stx.buildId");function os(){let n=globalThis;if(!n[st])n[st]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return n[st]}function er(n,e=os()){if(n.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(n))return null;return`
|
|
582
|
+
<meta name="stx-build" content="${e}">`}var No="/_stx/sw.js";function jn(n){if(typeof n!=="string"||!n.startsWith("/"))return null;let e=[],c=[],a=n.replace(/\/+$/,"").split("/").slice(1).map((g)=>{let r=/^:(\w+)$/.exec(g)||/^\[(\w+)\]$/.exec(g);if(r)return e.push(r[1]),c.push("0"),"([^/]+)";return c.push(g),g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:n,re:`^/${a.join("/")}/?$`,names:e,sample:`/${c.join("/")}`}}function Hn(n){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,c=window;if(c.stxOffline)return;let a=null,g=!1,r=[],d={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>a,onUpdateReady(w){if(d.updateReady)try{w()}catch{}else r.push(w);return()=>{let v=r.indexOf(w);if(v!==-1)r.splice(v,1)}},applyUpdate(){let w=a&&a.waiting;if(!w)return!1;return g=!0,w.postMessage({type:"stx:activate-update",force:!0}),!0}};c.stxOffline=d;let y=(w)=>{if(!w.waiting||!e.controller||d.updateReady)return;d.updateReady=!0;let v=r.splice(0);for(let k of v)try{k()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(w)=>{let v=w.data||{};if(v.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:v.url,kind:v.kind,fragment:!!v.fragment}}))}catch{}if(v.type==="stx:reachability"){if(c.stxOffline.reachable=v.reachable!==!1,Number(v.at)>0)c.stxOffline.reachedAt=Number(v.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:v.reachable!==!1,at:Number(v.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(g)g=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&a&&a.waiting)a.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let m=()=>{e.register(n,{scope:"/"}).then((w)=>{a=w;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(w.waiting)y(w),w.waiting.postMessage({type:"stx:activate-update",reason:"load"});w.addEventListener("updatefound",()=>{let v=w.installing;if(!v)return;v.addEventListener("statechange",()=>{if(v.state==="installed")y(w)})})}).catch(()=>{})},x=()=>{let w=(v)=>{setTimeout(v,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>w(m));else w(m)};if(!e.controller)if(document.readyState==="complete")x();else addEventListener("load",x);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",x);else x()}function Bn(){let n=`(${Hn.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim().replace(/;$/,"")}catch{return n}}function Fn(n,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!n||!n.startsWith("/"))return null;let c=n.split(/[?#]/)[0].split("/").filter(Boolean)[0];return c?`/${c}`:"/"}var tr=`<script data-stx-offline>${Bn()}</script>`;function Mo(n,e){let c=Number(n.precacheTimeoutMs),a={build:String(e||"dev"),pages:Array.from(new Set((n.pages||[]).filter((g)=>typeof g==="string"&&g.startsWith("/")))),staticPages:(n.staticPages||[]).filter((g)=>typeof g==="string"&&((n.pages||[]).includes(g)||(n.routes||[]).includes(g))),api:n.apiPrefix||"/api/",timeout:Math.max(500,Number(n.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(c)&&c>0?Math.min(2147483647,Math.max(1,Math.floor(c))):1e4,networkFirst:(n.networkFirst||[]).filter((g)=>typeof g==="string"&&g.startsWith("/")),updateOnColdStart:n.updateOnColdStart===!0,fallback:n.fallback||n.pages&&n.pages[0]||null,fallbackScope:Fn(n.fallback||n.pages&&n.pages[0]||null,n.fallbackScope),routes:(n.routes||[]).map(jn).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...n.exclude||[]],mediaMax:Math.max(10485760,Number(n.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(n.assetsMaxEntries)||500)};return`/* stx offline worker, build ${a.build} */
|
|
583
583
|
'use strict';
|
|
584
584
|
var S = ${JSON.stringify(a)};
|
|
585
585
|
var SHELL = 'stx-shell-' + S.build;
|
|
@@ -1283,45 +1283,45 @@ self.addEventListener('fetch', function (event) {
|
|
|
1283
1283
|
event.respondWith(pageResponse(request, event));
|
|
1284
1284
|
}
|
|
1285
1285
|
});
|
|
1286
|
-
`}import
|
|
1287
|
-
`+" `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 c[
|
|
1286
|
+
`}import Ie from"path";function rr(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("//")}async function sr(n,e,c){try{let a;if(n.startsWith("/")){let g=e;for(let r=0;r<5;r++){let d=Ie.join(g,n);if(await Bun.file(d).exists())return d;g=Ie.dirname(g)}a=Ie.join(e,n)}else if(n.startsWith("./")||n.startsWith("../"))a=Ie.resolve(e,n);else a=Ie.resolve(e,n);if(await Bun.file(a).exists())return a;return null}catch{return null}}var ir=Symbol.for("stx.inline-assets.import-meta");function Un(n,e){if(!n.includes("import.meta"))return;let c=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.
|
|
1287
|
+
`+" `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 c[ir]=!0,c}async function or(n,e,c){let a=n,g=Ie.dirname(e),r=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,d;while((d=r.exec(a))!==null){let[x,w,v,k]=d;if(rr(v))continue;let S=await sr(v,g,e);if(S)try{let M=await Bun.file(S).text();if(c.add(S),v.endsWith(".ts")||v.endsWith(".tsx")){let R=await Bun.build({entrypoints:[S],target:"browser",minify:!0,define:C()});if(R.outputs.length>0)M=await R.outputs[0].text(),Un(M,v)}let T=`<script>
|
|
1288
1288
|
// Source: ${v}
|
|
1289
1289
|
${M}
|
|
1290
|
-
</script>`;a=a.replace(x,T),r.lastIndex=0}catch(M){if(M?.[
|
|
1290
|
+
</script>`;a=a.replace(x,T),r.lastIndex=0}catch(M){if(M?.[ir])throw M}}let y=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,m;while((m=y.exec(a))!==null){let[x,w,v,k]=m,S=w+k;if(rr(v))continue;if(/rel=["']stylesheet["']/.test(S)||v.endsWith(".css")){let T=await sr(v,g,e);if(T)try{let R=await Bun.file(T).text();c.add(T);let D=`<style>
|
|
1291
1291
|
/* Source: ${v} */
|
|
1292
1292
|
${R}
|
|
1293
|
-
</style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import
|
|
1293
|
+
</style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import it from"path";var qn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Vn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Wn(n,e){if(!e||!n.includes("/"))return n;let c=it.dirname(e);return n.replace(qn,(a,g,r,d)=>{let y=it.resolve(c,d);return`${g}${r}${y.split(it.sep).join("/")}${r}`})}function lr(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Vn,(c,a,g,r)=>`${a}${Wn(g,e)}${r}`)}var Ee="<!--PARENT_CONTENT_PLACEHOLDER-->";function ur(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wr(n,e){let c=n.length,a=e,g=!0,r=[],d=(y)=>y+9<=c&&n[y]==="<"&&n[y+1]==="/"&&(n[y+2]==="s"||n[y+2]==="S")&&(n[y+3]==="c"||n[y+3]==="C")&&(n[y+4]==="r"||n[y+4]==="R")&&(n[y+5]==="i"||n[y+5]==="I")&&(n[y+6]==="p"||n[y+6]==="P")&&(n[y+7]==="t"||n[y+7]==="T")&&(n[y+8]===">"||/\s/.test(n[y+8]));while(a<c){let y=n[a];if(d(a))return a;if(y==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
|
|
1294
1294
|
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&n[a+1]==="*"){let m=n.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(y==="/"&&g){let m=a+1,x=!1;while(m<c){let w=n[m];if(w==="\\"){m+=2;continue}if(w==="[")x=!0;else if(w==="]")x=!1;else if(w==="/"&&!x){m++;break}else if(w===`
|
|
1295
1295
|
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<c&&/[a-z]/.test(n[m]))m++;a=m,g=!1;continue}if(y==="'"||y==='"'){let m=y;a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]===m){a++;break}if(n[a]===`
|
|
1296
|
-
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}if(r.length===0)g=!1;continue}if(y==="}"&&r.length>0){r.pop(),a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,g=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function
|
|
1296
|
+
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}if(r.length===0)g=!1;continue}if(y==="}"&&r.length>0){r.pop(),a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,g=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function xr(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let g=a.index+a[0].length,r=n.indexOf("</script>",g);if(r===-1)return null;let d=n.indexOf(">",r);if(d===-1)return null;return{start:a.index,end:d+1}}var zn=4096;async function ot(n,e,c){if(c.buildMode!=="serve"||e.length<zn)return null;let{registerServeModuleBundle:a}=await import("./chunk-m716f2ga.js");return`<script ${n} src="${a(e)}"></script>`}async function nr(n,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-8ta7f5en.js")),d=[],y=await r(g(...n),{minify:Ai(e.buildMode,e.minifyClient),collectInputs:d});for(let m of d)c?.add(m);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-m716f2ga.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Kn(n,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-kh2n3zqa.js"));g.frameworkScript=await k(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-pg146fc5.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),m=y?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",T=!1;try{if(r){let j=y?await r.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await r.getStoreScriptFor(d,[m],{reads:r.storesReadInFiles([...x,...w]),runOnce:!0});if(j)S=j.code,M=j.stores.join(","),T=!!j.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await ot(R,S,e)??D:null;let N={};g.modulesTag=await nr([n,D],e,c,N),g.modulesCode=N.code??null,x=N.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:j}=await o("stx/composable-loader",()=>import("./chunk-0jhq2kza.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await j(e._layerComposableDirs??F,n,I,w);if(L)g.composableCode=L,g.composableTag=await ot('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!r)break}return g}async function Gn(n,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:r}=await import("./chunk-a7ewznxk.js"),d=await import("./chunk-jp6sbk05.js"),{messages:y,webModules:m}=e,x=null,w=null,v=r()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Zn(R)}if(m&&Object.keys(m).length&&v)try{w=await(await import("./chunk-hd378dgy.js")).loadWebModules(process.cwd(),m)}catch(R){Jn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Kn(n,e,c,a),M=k.size?await g(k,S):await S(),T=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(n,x),R);if(D)T=await ot('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var pr=!1;function Zn(n){if(pr)return;pr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var fr=!1;function Jn(n){if(fr)return;fr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function Qn(n,e=""){let c=xr(n,"data-stx-runtime");if(!c)return n;let a=ar(n);if(a===-1||a===c.start){if(!e)return n;return n.slice(0,c.end)+e+n.slice(c.end)}if(a<c.start)return n.slice(0,a)+n.slice(c.start,c.end)+e+`
|
|
1297
1297
|
`+n.slice(a,c.start)+n.slice(c.end);let g=n.slice(c.start,c.end),r=n.slice(0,c.start)+n.slice(c.end),d=ar(r);if(d===-1)return g+e+`
|
|
1298
1298
|
`+r;return r.slice(0,d)+g+e+`
|
|
1299
|
-
`+r.slice(d)}function
|
|
1300
|
-
`),...x.htmlAttrs&&{htmlAttrs:
|
|
1301
|
-
<meta name="stx-layout" content="${ur(
|
|
1302
|
-
<meta name="stx-layout-group" content="${ur(
|
|
1303
|
-
${x}`).join(""))}else{let m=await
|
|
1304
|
-
`+d.slice(x)}}if(r)d=
|
|
1299
|
+
`+r.slice(d)}function Yn(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(c,a,g)=>{let r=n.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,c,a,g){if(await A(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=ke(n,c);let r=!e.__stxProcessingDepth;hn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(r&&a.runtimeConfig)await xn(e,c,a.runtimeConfig);if(r)Wc(e),e.__stx_scope_seq??={n:0,key:Vs(String(e.__filename??c))},e.__stx_head_injections=Ti(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!Cn())&&c&&c.endsWith(".stx"))Do(n,c);try{return await ae.timeAsync("template-processing",async()=>{let d=await es(n,e,c,a,g);if(r)d=mi(d);if(r&&a.autoShell&&a.buildMode!=="compile"){let y=Ce(a.app?.head,{known:Ir,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ri(),w=(e.__stx_head_raw||"").trim(),v,k=w.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)v=k[1].trim(),w=w.replace(k[0],"").trim();let S=e.__sections?.title,M=S?_(S,e,c):void 0,T=x.title||v||M,R=!x.title&&(!!v||!!M),D=x.meta||[],N=new Set(D.map((V)=>at(V)).filter(Boolean)),j={...y,...T&&{title:T},meta:[...(y.meta||[]).filter((V)=>!N.has(at(V))),...D],link:[...y.link||[],...x.link||[]],script:[...y.script||[],...x.script||[]],headRaw:[y.headRaw,w].filter(Boolean).join(`
|
|
1300
|
+
`),...x.htmlAttrs&&{htmlAttrs:cl(y.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...y.bodyAttrs||{},...x.bodyAttrs}}},F=$i(d);if(d=Ar(d,j,{...R&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},F),F)d=ul(d,y),d=Rr(d,j.htmlAttrs);let I=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(I&&d.includes("<head")){let V=I[1],X=As(V);d=d.replace(/<head\b[^>]*>/i,(ee)=>`${ee}
|
|
1301
|
+
<meta name="stx-layout" content="${ur(V)}">
|
|
1302
|
+
<meta name="stx-layout-group" content="${ur(X)}">`)}let L=d.match(/function (__stx_setup_\w+)\(/),H=L?B(d):null;if(L&&H&&!/\bdata-stx=/.test(H.tag)){d=Ze(d,(X,ee)=>`<body${ee} data-stx="${L[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");d=d.replace(V,"$1")}}if(r){let y=e.__stx_head_injections??Ti(),m=ll(d);if(m!==null)y.beforeClose.push(m);let x=er(d);if(x!==null)y.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))y.beforeClose.push(tr);d=il(d,y);let w=a.app?.colorMode;if(w)d=$r(d,w)}if(r)if(xr(d,"data-stx-runtime")){let m=await Gn(d,a,g,e);d=Qn(d,m.map((x)=>`
|
|
1303
|
+
${x}`).join(""))}else{let m=await nr([d],a,g);if(m){let x=d.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)d=d.slice(0,x)+m+`
|
|
1304
|
+
`+d.slice(x)}}if(r)d=al(d);if(r&&e.__stx_inject_css!==!1)d=await b(d,void 0,a.buildMode==="serve",!0);else if(r)d=gn(d);if(d=d.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),d=Yn(d),r&&e.__stx_runtime_config)d=Lt(d,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let y=_r(e);if(y){let m=/<head\b[^>]*>/i.exec(d),x=m?m.index+m[0].length:0;d=d.slice(0,x)+y+d.slice(x)}}return d})}catch(d){if(d instanceof K)throw d;let y=d instanceof Error?d.message:String(d),m=new ce(`Template processing failed: ${y}`,c,void 0,void 0,n.substring(0,200)+(n.length>200?"...":""));if(z.log(m,{filePath:c,context:e}),kn.logDetailedError(m,{filePath:c,template:n.substring(0,500)}),E()&&!a.debug)console.error(`[stx] ${ie.relative(process.cwd(),c)||c}: ${m.message}`);if(a.debug)throw m;return Ci.createFallbackContent("Template Processing",m)}}async function es(n,e,c,a,g){let r=process.cwd(),d={...a,partialsDir:a.partialsDir&&!ie.isAbsolute(a.partialsDir)?ie.resolve(r,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ie.isAbsolute(a.componentsDir)?ie.resolve(r,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ie.isAbsolute(a.layoutsDir)?ie.resolve(r,a.layoutsDir):a.layoutsDir},y=d,m=n;await ns(c,e),rs(e,y),m=await _e(()=>qt(m,e,c,y),m,(I)=>{z.log(I,{filePath:c,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${c}: ${I.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=fe(m,Me,(I,L)=>`\x00STX_HTML_COMMENT_${L}\x00`);m=x.output;let w=x.tokens,v=(I)=>w.length===0?I:I.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(L,H)=>w[Number(H)]??""),k="\x00STX_ESCAPED_AT\x00",S="\x00STX_ESC_MUSTACHE_OPEN\x00",M="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,k),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(I,L)=>`${S}${L}${M}`),m=Gt(m),m=await or(m,c,g);let T={};m=as(m,T);let R={...e.__sections||{}},D="",N=ht(bt(n)),j=/@nolayout\b/.test(m)||N===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let F=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)D=F[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(D=N,!/@section\s*\(/.test(m))m=`@section('content')
|
|
1305
1305
|
${m.trim()}
|
|
1306
|
-
@endsection`}if(!D&&!
|
|
1306
|
+
@endsection`}if(!D&&!j&&y.defaultLayout){let I=_n(m),L=/@section\s*\(/.test(m);if(!I||L){let H="",V=ie.dirname(c),X=y.layoutsDir?ie.dirname(y.layoutsDir):process.cwd();for(let ee=0;ee<20;ee++){let te=ie.join(V,"_layout.stx");if(await s(te)){H=te;break}let re=ie.dirname(V);if(re===V||re.length<X.length)break;V=re}if(H)D=H;else if(y.layoutsDir){let ee=ie.isAbsolute(y.layoutsDir)?y.layoutsDir:ie.resolve(process.cwd(),y.layoutsDir),te=ie.join(ee,`${y.defaultLayout}.stx`);if(await s(te))D=te}if(D&&!L)m=`@section('content')
|
|
1307
1307
|
${m.trim()}
|
|
1308
|
-
@endsection`}}if(D&&m.includes("<script")){let
|
|
1308
|
+
@endsection`}}if(D&&m.includes("<script")){let I=J(m),L=I.scripts.map((H)=>mr(H,c)??H);m=vr(I.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(I,L,H)=>(R[L]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(I,L,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return I;try{let V=u(H.trim(),e);if(V===void 0)return I;let ee=(e.__stx_inline_section_values??=[]).push(V)-1;return R[L]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return I}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(I,L,H)=>{if(H.includes("@parent"))R[L]=H.replace("@parent",Ee);else R[L]=H.trim();return""}),e.__sections=R,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(I,L,H)=>R[L]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||"");if(m=cs(m,T),D){let I=[],L=J(m),H=fe(L.output,fn,(V,X)=>`\x00STX_ORPHAN_STYLE_${X}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(V,X,ee)=>{let te=X==="SCRIPT"?mr(L.scripts[Number(ee)],c):H.tokens[Number(ee)];if(te)I.push(te);return""}),I.length>0){let V=I.join(`
|
|
1309
1309
|
`);R.content=R.content?`${R.content}
|
|
1310
|
-
${
|
|
1311
|
-
${m}`,v(m)}catch(
|
|
1312
|
-
`;if(r=
|
|
1310
|
+
${V}`:V,e.__sections=R}}if(D)try{let I;if(ie.isAbsolute(D))I=D,g.add(D);else I=await _e(()=>wn(D,c,d,g),null,()=>{throw new ce(`Failed to resolve layout path: ${D}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!I){let te=(G)=>{if(!G)return[];try{let me=ie.isAbsolute(G)?G:ie.resolve(process.cwd(),G);return Xn.readdirSync(me).filter((ve)=>ve.endsWith(".stx")).map((ve)=>ve.replace(/\.stx$/,""))}catch{return[]}},re=[...te(d.layoutsDir),...te(d.fallbackLayoutsDir)].filter((G,me,ve)=>ve.indexOf(G)===me).sort(),le=[d.layoutsDir,d.fallbackLayoutsDir].filter((G)=>typeof G==="string"&&G.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",se=`Layout not found: ${D} (referenced from ${c})`+(re.length>0?`. Available layouts: ${re.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"")+de;if(z.log(Error(se),{layoutPath:D,filePath:c,available:re},"error"),console.error(`[stx] ${se}`),d.debug)throw new ce(se,c);return m}let L=await _e(()=>Bun.file(I).text(),"",()=>{throw new ce(`Failed to read layout file: ${I}`,c,void 0,void 0,"Layout content could not be loaded")});L=lr(L,I);let H=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${I}`);let te={},re=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(se,G,me)=>(te[G]=me.trim(),""));for(let[se,G]of Object.entries(te))if(R[se]&&R[se].includes(Ee)){let me=R[se].indexOf(Ee);R[se]=R[se].slice(0,me)+G+R[se].slice(me+Ee.length)}else if(!R[se])R[se]=G;let le={...e,__sections:R},de=`@layout('${H[1]}')${re}`;return await i(de,le,I,d,g)}let V=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=as(V,T),ee={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,re,le)=>(ee[re]=le.trim(),`@slot('${re}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,re,le)=>{if(R[re]){let de=R[re];if(de.includes(Ee)){let se=ee[re]||"",G=de.indexOf(Ee);de=de.slice(0,G)+se+de.slice(G+Ee.length)}return de}return le||""}),X=ts(X,R),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||""),X=cs(X,T),e.__originalFilePath=c,m=await br(X,e,I,d,g),m=`<!-- stx-layout: ${D} -->
|
|
1311
|
+
${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await br(m,e,c,d,g))}function ts(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function rs(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(c)&&r!==void 0)a[g]=r;n.$env=a}async function ns(n,e){await _e(()=>Xt(n,e),void 0,(c)=>{z.log(c,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${c.message}`)})}var ct="data-stx-source";function mr(n,e){if(!n)return n;let c=/^<script\b([^>]*)>/i.exec(n);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return n;return`<script ${ct}="${encodeURIComponent(e)}"${n.slice(7)}`}function ss(n){let e=new RegExp(`${ct}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function hr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yr(n,e,c){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">${hr(n)}</span><span style="display:block;margin-top:4px">${hr(c)}</span></div>`}async function ls(n,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-w9gpscjf.js")),r=[],d=!E()&&!Cn();for(let m of g(n)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let w=m.start+m.fullMatch.indexOf(">")+1,v=wr(n,w);if(v===-1)continue;let k=n.slice(w,v);if(!k.trim())continue;let S=ss(x)??c,M={index:m.start,length:v+9-m.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-bh7v78je.js"));await T(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;r.push({...M,markup:yr(S,R.kind,R.message)})}})}catch(T){let R=T instanceof Error?T:Error(String(T));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)r.push({...M,markup:yr(S,"unknown",R.message)})}}if(r.length===0)return n;let y=n;for(let m of r.sort((x,w)=>w.index-x.index))y=y.slice(0,m.index)+m.markup+y.slice(m.index+m.length);return y}async function ps(n,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-7amk61bt.js"));return a(n,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),n}}async function br(n,e,c,a,g){let r=n;await A();let d=a;if(r=await ls(r,e,c,a),r=await Nt(r,e,c),r=await Ht(r,e,c),r=await ps(r,e,c),await A(),r=await _t(r,e,c,d),ke(r))r=Wo(r,e),r=hs(r,e),r=ms(r,e);r=qo(r),await A();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-3zfras5s.js"));r=y(r,e),r=await Fo(r,e,c,d,!0),await A(),r=await Yt(r,e,c,d,g),r=await us(r,e,c,d,g),await A(),r=gc(r,e,c,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-ay7ggc4k.js"));r=m(r,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-1bpx9b0m.js"));r=x(r,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-72n804gy.js"));r=w(r,e,c),r=v(r);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=k(r,e,c),r=S(r);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-txzap6yn.js"));r=M(r,e,c);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-m3tnxk01.js"));r=T(r,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-6aak0b7c.js"));r=R(r,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:N,processInfiniteListDirectives:j}=await o("stx/virtual-scrolling",()=>import("./chunk-cw8vpk41.js"));r=D(r,e,c),r=N(r,e,c),r=j(r,e,c),await A();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-pe5qqem0.js"));r=F(r,e,c),r=I(r);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=L(r,e,c),r=H(r,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-s5ejh2yx.js"));r=V(r,e,c);let{processHeadDirective:X,processTitleDirective:ee,processMetaDirective:te,resetHead:re}=await o("stx/head",()=>import("./chunk-67nq6csk.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)re();let le=X(r);if(r=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
|
|
1312
|
+
`;if(r=ee(r,e),r=te(r,e,c),r=Wt(r),r=zo(r,e),r=Tt(r),r=Ft(r),r=await is(r,e,c,d,g),r=await us(r,e,c,d,g),await A(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=mi(r),r=oe(r,e,c),r=ds(r),await A(),e.__stxProcessingDepth===1)r=qc(r,e);if(r=Fc(r,e,{filePath:c,buildMode:d.buildMode}),r=Ho(r,e),r=Vo(r,e),r=We(r,e),r=Ot(r,e),r=Pt(r,e),r=await yt(r,e,c,d),r=await hc(r,e,c),r=await yc(r,e,c,d),await A(),r=bc(r,e,c,d),r=Qo(r,e,c,d),r=ei(r,e,c),r=ti(r,e,c,d),r=$t(r,e,c,d),r=zs(r,e),r=Hs(r),r=Hc(r),!d.skipEventDirectives)r=Ac(r,e,c);if(r=zc(r,e,c,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await A(),d.debug){let U=/\bx-data\s*=/.test(r),q=gs(n);if(U&&q)console.warn(`[stx] ${c}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1313
1313
|
Both work on the same page, but they manage separate scopes.
|
|
1314
|
-
Prefer signals (state/derived/effect) for new components.`)}r=
|
|
1315
|
-
</head>`);if(/<head\b[^>]*>/i.test(
|
|
1316
|
-
${
|
|
1314
|
+
Prefer signals (state/derived/effect) for new components.`)}r=lc(r,e),r=await _(r,e,c),await A(),r=Vc(r),r=Uc(r),r=gt(r);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=de(r);let se=e.__originalFilePath||c,G=Le(e);if(r=await Ko(r,d,se,G),await A(),r=Mt(r,e),r=await Vt(r,e,c,d),await A(),d.media?.image?.autoSiblings){let U=d.publicDir||"public",{rewriteImagesWithSiblings:q}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-xrspzeqx.js"));r=await q(r,{publicDir:U})}if(d.seo?.enabled)r=ni(r,e,d);let me=(U,q,Z=!0)=>{if(!q)return U;let he=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(U),pe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(he&&ne&&pe){if(Z){let Te=ne.index+pe.index;U=U.slice(0,Te)+he[0]+U.slice(Te+pe[0].length)}if(q=q.replace(he[0],"").trim(),!q)return U}if(/<\/head>/i.test(U))return U.replace(/<\/head>/i,`${q}
|
|
1315
|
+
</head>`);if(/<head\b[^>]*>/i.test(U))return U.replace(/(<head\b[^>]*>)/i,`$1
|
|
1316
|
+
${q}`);if(/<html\b[^>]*>/i.test(U))return U.replace(/(<html\b[^>]*>)/i,`$1
|
|
1317
1317
|
<head>
|
|
1318
|
-
${
|
|
1319
|
-
</head>`);return
|
|
1320
|
-
${
|
|
1321
|
-
</script>`;if(r.includes("</head>")){let
|
|
1322
|
-
`+Te}else r=r.replace("</head>",`${
|
|
1318
|
+
${q}
|
|
1319
|
+
</head>`);return U},{renderHead:ve,getHead:kr}=await o("stx/head",()=>import("./chunk-67nq6csk.js")),Oe=e.__stx_runtime_head??kr();if(Oe.title||Oe.meta?.length||Oe.link?.length){let U=ve(Oe);if(U)r=me(r,U)}if(le.headContent)r=me(r,le.headContent,!Oe.title);if(d.csp?.enabled&&d.csp.addMetaTag)r=kt(r,d.csp,e);if(d.analytics?.enabled)r=mt(r,d);if(d.heatmap?.enabled)r=mc(r,d);if(d.pwa?.enabled&&d.pwa.autoInject!==!1){let{injectPwaTags:U}=await o("stx/pwa/inject",()=>import("./chunk-6r4teng3.js"));r=U(r,d)}let Sr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(r),Er=/\bSTX\.\w+/.test(r),Tr=/window\.STX\s*=/.test(r);if(Sr&&Er&&!Tr){let q=`<script data-stx-scoped data-stx-run="once">
|
|
1320
|
+
${dt()}
|
|
1321
|
+
</script>`;if(r.includes("</head>")){let Z=r.indexOf("</head>"),ne=r.slice(0,Z).indexOf("<script");if(ne!==-1){let pe=r.slice(0,ne),Te=r.slice(ne);r=pe+q+`
|
|
1322
|
+
`+Te}else r=r.replace("</head>",`${q}
|
|
1323
1323
|
</head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
1324
|
-
${
|
|
1325
|
-
`+r}{let{scanScriptTags:
|
|
1326
|
-
`+r.slice(
|
|
1327
|
-
export{
|
|
1324
|
+
${q}`);else r=q+`
|
|
1325
|
+
`+r}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-w9gpscjf.js")),q=[];for(let Z of U(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let he=Z.start+Z.fullMatch.indexOf(">")+1,ne=wr(r,he);if(ne===-1)continue;let pe=ne+9;while(pe<r.length&&/\s/.test(r[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),he=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Te}=q[ne];Z[ne]=r.slice(he,pe),he=Te}Z[q.length]=r.slice(he),r=Z.join("")}}let lt=Bs(r,c);if(lt.hasScoped)r=lt.html;let Cr=e.__stx_event_bindings||[],Ke=!1,ut=[],Mr=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dr}=await o("stx/signal-processing",()=>import("./chunk-w9gpscjf.js"));for(let U of Dr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of ut){Ke=!0;let he=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Cr,attrs:q,hasColonDirectives:Mr,templateContent:n,filePath:c,projectRoot:process.cwd(),production:Ai(a.buildMode,a.minifyClient),serverData:G});r=r.replace(U,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=ci(U);if(q){let Z=r.lastIndexOf("</body>");r=Z===-1?r+q:r.slice(0,Z)+q+`
|
|
1326
|
+
`+r.slice(Z)}e.__stx_event_bindings=[]}}if(!d.skipSignalsRuntime&&!we(r)&&dc(r))r=await cr(r,d);if(r=pc(r),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")r=St(r,e.cspNonce);return r}
|
|
1327
|
+
export{bt,Ae,oc,os,No,Mo,nr,i};
|