@stacksjs/stx 0.2.868 → 0.2.870
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/app-shell.js +5 -4
- package/dist/chunk-04f6r2kh.js +2 -0
- package/dist/{chunk-5kh12nvn.js → chunk-0jchm9gg.js} +1 -1
- package/dist/{chunk-g0xn80gz.js → chunk-0tyyad6q.js} +9 -9
- package/dist/{chunk-j4ec0g5g.js → chunk-12sk3dtm.js} +1 -1
- package/dist/{chunk-3wcwr2qt.js → chunk-1637r8fg.js} +1 -1
- package/dist/{chunk-67dgp45w.js → chunk-1dt8e7ew.js} +2 -2
- package/dist/{chunk-5dvkphbe.js → chunk-311mrz2n.js} +1 -1
- package/dist/chunk-3asy7ev5.js +2 -0
- package/dist/{chunk-z512gt4v.js → chunk-3f51tn2b.js} +3 -3
- package/dist/{chunk-f22sdw5q.js → chunk-3v7xht2q.js} +1 -1
- package/dist/{chunk-8s6s6nd0.js → chunk-4068rmzv.js} +2 -2
- package/dist/{chunk-tefr8tve.js → chunk-4t5t33yj.js} +3 -3
- package/dist/{chunk-8arfg8kp.js → chunk-4vtw6f0c.js} +1 -1
- package/dist/{chunk-5kkq2eqr.js → chunk-5d0csn7w.js} +1 -1
- package/dist/{chunk-vvzys1x7.js → chunk-5h9d6jew.js} +3 -3
- package/dist/{chunk-h65shwe9.js → chunk-5sbtbfj3.js} +1 -1
- package/dist/{chunk-k32q90b2.js → chunk-60yppcbb.js} +2 -2
- package/dist/{chunk-eafqxbr0.js → chunk-6ggme8xx.js} +1 -1
- package/dist/{chunk-fmzyrg2e.js → chunk-6ksyrmpp.js} +1 -1
- package/dist/{chunk-x64afx6z.js → chunk-6mjd3pqd.js} +1 -1
- package/dist/{chunk-6k4ac74t.js → chunk-6vgr5g6d.js} +2 -2
- package/dist/chunk-79sr2kxg.js +2 -0
- package/dist/{chunk-pnqap5yf.js → chunk-7d6jq5j8.js} +1 -1
- package/dist/chunk-7wae4311.js +33 -0
- package/dist/{chunk-nq4zvers.js → chunk-81n2s24z.js} +1 -1
- package/dist/chunk-8cf6995c.js +2 -0
- package/dist/chunk-8cgn4re9.js +2 -0
- package/dist/chunk-94e6kmjm.js +2 -0
- package/dist/{chunk-amkzap4f.js → chunk-9ffvh6cr.js} +1 -1
- package/dist/chunk-aa6ztwdq.js +2 -0
- package/dist/chunk-bz1jgrx8.js +2 -0
- package/dist/{chunk-egvyeet8.js → chunk-ca9x39p1.js} +1 -1
- package/dist/{chunk-qc4eca8y.js → chunk-cbpxd3qa.js} +1 -1
- package/dist/{chunk-9mvc7t63.js → chunk-cwmfxbhz.js} +2 -2
- package/dist/{chunk-9a7tds1a.js → chunk-d4zcwtna.js} +1 -1
- package/dist/{chunk-mcnwvh06.js → chunk-d9k8j44b.js} +5 -5
- package/dist/{chunk-2rz0wdft.js → chunk-dg4zxpbq.js} +3 -3
- package/dist/chunk-djdganvr.js +2 -0
- package/dist/{chunk-je3wv4qx.js → chunk-drdr0a53.js} +1 -1
- package/dist/{chunk-hw156fjb.js → chunk-dwqjrbse.js} +2 -2
- package/dist/{chunk-kh6njq2r.js → chunk-dy7vqv1x.js} +2 -2
- package/dist/{chunk-0qx649hq.js → chunk-eh1rdapx.js} +1 -1
- package/dist/{chunk-tv8107sc.js → chunk-fcvgf88g.js} +1 -1
- package/dist/{chunk-ynkbv9jq.js → chunk-gcsy3z1e.js} +2 -2
- package/dist/{chunk-ycqnq4b0.js → chunk-gesktj4m.js} +1 -1
- package/dist/{chunk-mapk8tws.js → chunk-h0nxd9xg.js} +1 -1
- package/dist/chunk-hb6r4pxp.js +2 -0
- package/dist/{chunk-jbgj2hph.js → chunk-hvx6j4a2.js} +2 -2
- package/dist/{chunk-d54r5c9e.js → chunk-hze3158c.js} +74 -74
- package/dist/chunk-jksjr12b.js +2 -0
- package/dist/{chunk-8me8hamk.js → chunk-k7m8659h.js} +2 -2
- package/dist/chunk-khe30jmk.js +3 -0
- package/dist/{chunk-d9r6xy5m.js → chunk-m1a3a32y.js} +1 -1
- package/dist/{chunk-cjy9cdm0.js → chunk-m4k6ndf5.js} +1 -1
- package/dist/{chunk-7xhwqc0c.js → chunk-mnx6njd4.js} +4 -4
- package/dist/{chunk-4hb62hcj.js → chunk-mwxehpse.js} +2 -2
- package/dist/{chunk-6jpgyb22.js → chunk-n7w8n327.js} +1 -1
- package/dist/chunk-ndrgek64.js +2 -0
- package/dist/{chunk-t76vnqff.js → chunk-nkwj7eq3.js} +1 -1
- package/dist/chunk-nxecjev1.js +2 -0
- package/dist/chunk-pdpmtmfj.js +54 -0
- package/dist/{chunk-ea3c80wv.js → chunk-pfr3cazq.js} +2 -2
- package/dist/chunk-ps6m8n9n.js +2 -0
- package/dist/{chunk-aef82ns3.js → chunk-pxce4aag.js} +1 -1
- package/dist/{chunk-cra4g128.js → chunk-q58f5wk2.js} +6 -6
- package/dist/{chunk-ypfbw069.js → chunk-qm0qn2xa.js} +4 -4
- package/dist/{chunk-p50qqwed.js → chunk-qmr5xsjj.js} +1 -1
- package/dist/chunk-qxxvaxee.js +2 -0
- package/dist/chunk-rhhq8k9f.js +2 -0
- package/dist/{chunk-bwdbj60y.js → chunk-rpep1ve3.js} +2 -2
- package/dist/{chunk-jx8nha8j.js → chunk-rt55f47q.js} +2 -2
- package/dist/chunk-s2a9vfdg.js +2 -0
- package/dist/{chunk-0kzawt78.js → chunk-sb3dx4dd.js} +2 -2
- package/dist/{chunk-83tvkw4y.js → chunk-sbvkk4cn.js} +2 -2
- package/dist/{chunk-wrvs1hh1.js → chunk-sew1z7cv.js} +7 -7
- package/dist/{chunk-f6ypmk8x.js → chunk-stdddhk9.js} +1 -1
- package/dist/{chunk-mayk025t.js → chunk-swzxhkh2.js} +26 -26
- package/dist/{chunk-krhcqf22.js → chunk-t5ekex4s.js} +2 -2
- package/dist/chunk-tg7kt56m.js +2 -0
- package/dist/{chunk-6m6y9bbx.js → chunk-tjwzy9xq.js} +1 -1
- package/dist/chunk-ttr8ay8h.js +2 -0
- package/dist/{chunk-xk555zd5.js → chunk-tv61s6fc.js} +1 -1
- package/dist/{chunk-gd56arnm.js → chunk-vrcr4b13.js} +1 -1
- package/dist/{chunk-he975510.js → chunk-w1rrfj39.js} +1 -1
- package/dist/{chunk-0v2yj490.js → chunk-w2hqjv5e.js} +1 -1
- package/dist/{chunk-3hrps6aa.js → chunk-wb7s2cnb.js} +9 -9
- package/dist/{chunk-5zvytrge.js → chunk-wk188ph7.js} +3 -3
- package/dist/chunk-xb34eyne.js +2 -0
- package/dist/{chunk-chd60py8.js → chunk-xr3x6wk6.js} +1 -1
- package/dist/chunk-y0dee635.js +2 -0
- package/dist/{chunk-sxh28q9h.js → chunk-y0msz738.js} +26 -26
- package/dist/{chunk-5n3f6mg2.js → chunk-y1cvab1b.js} +1 -1
- package/dist/{chunk-64ebysb4.js → chunk-yx3vghee.js} +1 -1
- package/dist/chunk-z8x86cr7.js +42 -0
- package/dist/{chunk-tdp2tvf3.js → chunk-zf9n3esr.js} +3 -3
- package/dist/{chunk-n3z0d58b.js → chunk-zfq2vvex.js} +39 -39
- package/dist/{chunk-2tpsbzfe.js → chunk-zpgj4asv.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-02stnjr0.js +0 -2
- package/dist/chunk-0twkeh31.js +0 -2
- package/dist/chunk-1872e8z8.js +0 -2
- package/dist/chunk-23nr1jcs.js +0 -2
- package/dist/chunk-2d8kfrs8.js +0 -2
- package/dist/chunk-3gk1e2b1.js +0 -2
- package/dist/chunk-49bx8g98.js +0 -2
- package/dist/chunk-7nvaapgm.js +0 -2
- package/dist/chunk-8qyc4nqe.js +0 -3
- package/dist/chunk-9cwag0tk.js +0 -2
- package/dist/chunk-9vq7vk10.js +0 -2
- package/dist/chunk-cm8wy2wv.js +0 -42
- package/dist/chunk-dvvp0bdw.js +0 -2
- package/dist/chunk-etjaf7f2.js +0 -2
- package/dist/chunk-f4ct7tj1.js +0 -2
- package/dist/chunk-g5hpzby1.js +0 -2
- package/dist/chunk-gy6p5xx4.js +0 -2
- package/dist/chunk-ha9qcfys.js +0 -54
- package/dist/chunk-hqgnpq8n.js +0 -33
- package/dist/chunk-kejcaqbd.js +0 -2
- package/dist/chunk-m05y60v0.js +0 -2
- package/dist/chunk-nrhahqye.js +0 -2
- package/dist/chunk-phppqwdd.js +0 -2
- package/dist/chunk-wzsr1z0z.js +0 -2
- package/dist/chunk-z1rs6b4x.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vt,
|
|
2
|
+
import{Vt,fe,E,d,m,O,t,se,Y,u,$e,Ni,W,Rn,Di,qt,Mi,bl,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,Br,Re,ji}from"./chunk-0tyyad6q.js";import{hi,Hc,o,T,je,Lt,bn,Be,ye,ee,Er,wn,qs,Zc,Qc,xn,Pr,Gs,Xs,el,ki,tl,nl,rl,sl,ze,He,Js,We,s,_n,y,g,X,re,Te,R,Ai}from"./chunk-hze3158c.js";import{Ht}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-w1rrfj39.js";import{x}from"./chunk-pfr3cazq.js";import{xr,Ls}from"./chunk-dy7vqv1x.js";import{Cc,Ec,br,st,Tc,M}from"./chunk-y0msz738.js";import{ii,ai,ci,li}from"./chunk-sbvkk4cn.js";import{vc,bs}from"./chunk-z8x86cr7.js";import{gs,ms,hs}from"./chunk-pdpmtmfj.js";import{xs,Zo,Qo,Ss,ks,ei}from"./chunk-sew1z7cv.js";import{ws,Ko}from"./chunk-wk188ph7.js";import{Vo}from"./chunk-q1wxgw5s.js";import{ue,Go,Xo,Jo}from"./chunk-hvx6j4a2.js";import{gr,ke,Sc,mr,kc}from"./chunk-q58f5wk2.js";import{V,nt}from"./chunk-4068rmzv.js";import{Rc,Ac}from"./chunk-sb3dx4dd.js";import{A,Pn,Bi}from"./chunk-rpep1ve3.js";import{D,c,f}from"./chunk-fd1bpv35.js";import Jn from"fs";import ae from"path";function mt(n){let e=Lt(n),l=e.find((S)=>S.closing&&S.name.toLowerCase()==="head");if(!l)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),h=0,r=[];for(let S=0;S<e.length;S++){let v=e[S];if(v.start<l.end)continue;let k=v.name.toLowerCase();if(a.has(k)){h=Math.max(0,h+(v.closing?-1:v.selfClosing?0:1));continue}if(k!=="style"||v.closing||h>0)continue;let C=e[S+1];if(C?.name.toLowerCase()==="style"&&C.closing){if(/@scope\s*\{/.test(n.slice(v.end,C.start)))continue;r.push({start:v.start,end:C.end}),S++}}if(!r.length)return n;let p=r.map((S)=>n.slice(S.start,S.end)).join(`
|
|
3
3
|
`),w=[n.slice(0,l.start),p,`
|
|
4
4
|
`],b=l.start;for(let S of r)w.push(n.slice(b,S.start)),b=S.end;return w.push(n.slice(b)),w.join("")}function ht(){return`
|
|
5
5
|
// STX Lifecycle Runtime
|
|
@@ -349,7 +349,7 @@ else {
|
|
|
349
349
|
|
|
350
350
|
console.log('[stx] Lifecycle runtime initialized');
|
|
351
351
|
})();
|
|
352
|
-
`}function Ye(n){return Symbol(n)}var $s=Ye("theme"),Es=Ye("router"),Cs=Ye("i18n");import*as bt from"crypto";function yt(n){let e=/\$(\w+)\./g,l=[],a;while((a=e.exec(n))!==null)if(!l.includes(a[1]))l.push(a[1]);return l}function Hr(){return`stx-${bt.randomBytes(4).toString("hex")}`}function Nr(n){return/\$\w+\./.test(n)}function Fr(n){if(!/\{\{[^}]*\$\w/.test(n)||!/\$\w+\./.test(n))return{html:n,bindings:[],stores:new Set};let e=[],l=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,h=n;return h=h.replace(a,(r,p,w,b)=>{if(["script","style","template"].includes(p.toLowerCase()))return r;if(!w.includes("{{"))return r;let S=[],v=!1,k=w,C=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...w.matchAll(C)];for(let L of _){let j=L[0],
|
|
352
|
+
`}function Ye(n){return Symbol(n)}var $s=Ye("theme"),Es=Ye("router"),Cs=Ye("i18n");import*as bt from"crypto";function yt(n){let e=/\$(\w+)\./g,l=[],a;while((a=e.exec(n))!==null)if(!l.includes(a[1]))l.push(a[1]);return l}function Hr(){return`stx-${bt.randomBytes(4).toString("hex")}`}function Nr(n){return/\$\w+\./.test(n)}function Fr(n){if(!/\{\{[^}]*\$\w/.test(n)||!/\$\w+\./.test(n))return{html:n,bindings:[],stores:new Set};let e=[],l=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,h=n;return h=h.replace(a,(r,p,w,b)=>{if(["script","style","template"].includes(p.toLowerCase()))return r;if(!w.includes("{{"))return r;let S=[],v=!1,k=w,C=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...w.matchAll(C)];for(let L of _){let j=L[0],B=L[1],F=L[2];if(Nr(F)){v=!0;let q=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(q){let H=q[1];if(S.push({attr:B,expr:H,fullMatch:j,originalAttr:B}),yt(H).forEach((U)=>l.add(U)),B==="text")k=k.replace(j,"");else if(B==="class")k=k.replace(j,'class=""');else if(B==="disabled"||B==="hidden")k=k.replace(j,"");else k=k.replace(j,`${B}=""`)}}}if(!v)return r;let P=k.match(/\bid\s*=\s*"([^"]+)"/),I;if(P)I=P[1];else I=Hr(),k=` id="${I}"${k}`;for(let L of S)e.push({elementId:I,attribute:L.attr,expression:L.expr,stores:yt(L.expr)});return`<${p}${k}${b}`}),{html:h,bindings:e,stores:l}}function Ur(n,e){if(n.length===0)return"";let l=Array.from(e),a=`
|
|
353
353
|
<script>
|
|
354
354
|
(function() {
|
|
355
355
|
'use strict';
|
|
@@ -507,10 +507,10 @@ else {
|
|
|
507
507
|
}
|
|
508
508
|
})();
|
|
509
509
|
</script>
|
|
510
|
-
`,a}function wt(n){let{html:e,bindings:l,stores:a}=Fr(n);if(l.length===0)return n;let h=Ur(l,a),r=c(e);if(r!==-1)return e.slice(0,r)+h+e.slice(r);return e+h}function qr(n){let e=n.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Vr(e);case"google-analytics":return Wr(e);case"plausible":return Xr(e);case"self-hosted":return zr(e);case"custom":return Kr(e);default:return""}}function Vr(n){let e=n.fathom;if(!e?.siteId)return"";let l=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",h=[`data-site="${
|
|
510
|
+
`,a}function wt(n){let{html:e,bindings:l,stores:a}=Fr(n);if(l.length===0)return n;let h=Ur(l,a),r=c(e);if(r!==-1)return e.slice(0,r)+h+e.slice(r);return e+h}function qr(n){let e=n.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Vr(e);case"google-analytics":return Wr(e);case"plausible":return Xr(e);case"self-hosted":return zr(e);case"custom":return Kr(e);default:return""}}function Vr(n){let e=n.fathom;if(!e?.siteId)return"";let l=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",h=[`data-site="${pe(e.siteId)}"`];if(e.honorDnt)h.push('data-honor-dnt="true"');if(e.spa)h.push('data-spa="auto"');if(e.canonical)h.push(`data-canonical="${pe(e.canonical)}"`);if(e.auto===!1)h.push('data-auto="false"');return`
|
|
511
511
|
<!-- Fathom Analytics -->
|
|
512
|
-
<script src="${
|
|
513
|
-
`}function Wr(n){let e=n.googleAnalytics;if(!e?.measurementId)return"";let l=
|
|
512
|
+
<script src="${pe(l)}" ${h.join(" ")}${a}></script>
|
|
513
|
+
`}function Wr(n){let e=n.googleAnalytics;if(!e?.measurementId)return"";let l=pe(e.measurementId),a=e.debug?`gtag('config', '${l}', { 'debug_mode': true });`:"";return`
|
|
514
514
|
<!-- Google Analytics -->
|
|
515
515
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${l}"></script>
|
|
516
516
|
<script>
|
|
@@ -520,10 +520,10 @@ else {
|
|
|
520
520
|
gtag('config', '${l}');
|
|
521
521
|
${a}
|
|
522
522
|
</script>
|
|
523
|
-
`}function Xr(n){let e=n.plausible;if(!e?.domain)return"";let l=e.scriptUrl||"https://plausible.io/js/script.js",a=[`data-domain="${
|
|
523
|
+
`}function Xr(n){let e=n.plausible;if(!e?.domain)return"";let l=e.scriptUrl||"https://plausible.io/js/script.js",a=[`data-domain="${pe(e.domain)}"`],h=l,r=[];if(e.trackLocalhost)r.push("local");if(e.hashMode)r.push("hash");if(r.length>0&&l==="https://plausible.io/js/script.js")h=`https://plausible.io/js/script.${r.join(".")}.js`;return`
|
|
524
524
|
<!-- Plausible Analytics -->
|
|
525
|
-
<script defer data-domain="${
|
|
526
|
-
`}function zr(n){let e=n.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let l=
|
|
525
|
+
<script defer data-domain="${pe(e.domain)}" src="${pe(h)}"></script>
|
|
526
|
+
`}function zr(n){let e=n.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let l=pe(e.siteId),a=pe(e.apiEndpoint),h=e.honorDnt?'if(n.doNotTrack==="1")return;':"",r=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",p=e.trackOutboundLinks?`
|
|
527
527
|
d.addEventListener('click',function(e){
|
|
528
528
|
var a=e.target.closest('a');
|
|
529
529
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -561,26 +561,26 @@ else {
|
|
|
561
561
|
<script>
|
|
562
562
|
${e.inlineScript}
|
|
563
563
|
</script>
|
|
564
|
-
`;if(!e.scriptUrl)return"";let l=[];if(e.scriptId)l.push(`id="${
|
|
564
|
+
`;if(!e.scriptUrl)return"";let l=[];if(e.scriptId)l.push(`id="${pe(e.scriptId)}"`);if(e.attributes)for(let[h,r]of Object.entries(e.attributes))l.push(`${pe(h)}="${pe(r)}"`);return`
|
|
565
565
|
<!-- Custom Analytics -->
|
|
566
|
-
<script${l.length>0?` ${l.join(" ")}`:""} src="${
|
|
567
|
-
`}function vt(n,e){let l=qr(e);if(!l)return n;if(!n.includes("</head>")){let a=c(n);if(a!==-1)return n.slice(0,a)+l+n.slice(a);return n+l}return f(n,l,"")}function
|
|
568
|
-
${h}`)}function Tt(n,e){let l=n;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function At(n,e,l,a){let h=n,r=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let p=r.useNonce?Ke(e,r):void 0;return Ct(r.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ke(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ke(e,r);return h}import en from"crypto";var tn=40,Rt="_token",rt=null;function rn(n=tn){let e=en.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return rt=e,e}function nn(){if(!rt)rn();return rt}function sn(n=Rt){let e=nn();return`<input type="hidden" name="${n}" value="${e}">`}function Mt(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>sn(a||Rt))}async function Dt(n,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let h=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)h=await on(h,r,e,l,a);else h=await an(h,r,e,l,a)}return h}async function on(n,e,l,a,h){let{name:r,handler:p}=e,w=`@${r}`,b=`@end${r}`,S=n,v=Vt(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${b}`,"g"),k=[],C=v.exec(S);while(C!==null){let[_,P="",I=""]=C,L=C.index||0;try{let j=P?It(e,P):[],F=I.trim(),q=await p(F,j,l,a);k.push({original:_,processed:q,startIndex:L})}catch(j){let F=j instanceof Error?j.message:String(j);if(h.debug)console.error(`Error processing custom directive @${r}:`,j);k.push({original:_,processed:u("CustomDirective",`Error in @${r}${P?`(${P})`:""}: ${F}`,t.EVALUATION_ERROR),startIndex:L})}C=v.exec(S)}for(let _=k.length-1;_>=0;_--){let{original:P,processed:I}=k[_];S=S.replace(P,I)}return S}async function an(n,e,l,a,h){let{name:r,handler:p}=e,w=n,b=[],S=[];if(e.rawParams){for(let C of Di(w,Vt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(C.end!==-1)S.push({fullMatch:C.call,paramString:C.args,startIndex:C.start})}else{let C=Vt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");C.lastIndex=0;let _=C.exec(w);while(_!==null)S.push({fullMatch:_[0],paramString:_[1]??"",startIndex:_.index||0}),_=C.exec(w)}for(let{fullMatch:C,paramString:_,startIndex:P}of S)try{let I=It(e,_),L=await p("",I,l,a);b.push({original:C,processed:L,startIndex:P})}catch(I){let L=I instanceof Error?I.message:String(I);if(h.debug)console.error(`Error processing custom directive @${r}:`,I);b.push({original:C,processed:u("CustomDirective",`Error in @${r}(${_}): ${L}`,t.EVALUATION_ERROR),startIndex:P})}let v=Vt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),k=v.exec(w);while(k!==null){let[C]=k,_=k.index||0;try{let P=await p("",[],l,a);b.push({original:C,processed:P,startIndex:_})}catch(P){let I=P instanceof Error?P.message:String(P);if(h.debug)console.error(`Error processing custom directive @${r}:`,P);b.push({original:C,processed:u("CustomDirective",`Error in @${r}: ${I}`,t.EVALUATION_ERROR),startIndex:_})}k=v.exec(w)}for(let C=b.length-1;C>=0;C--){let{original:_,processed:P}=b[C];w=w.replace(_,P)}return w}function It(n,e){return n.rawParams?qt(e):cn(e)}function cn(n){if(!n.trim())return[];let e=[],l="",a=!1,h="";for(let r=0;r<n.length;r++){let p=n[r];if((p==='"'||p==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((r)=>{let p=r.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Ot=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Pt=/^[A-Za-z_$][\w$]*$/,ln=new Set(["light","dark","system"]);function Ce(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function un(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:l,colorMode:a}=e;if(Ce(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))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(Ce(a.key,"colorMode.key"),Ce(a.attribute,"colorMode.attribute"),Ce(a.default,"colorMode.default"),!Pt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!ln.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ce(l.key,"appearance.key"),Ce(l.attribute,"appearance.attribute"),Ce(l.default,"appearance.default"),!Pt.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function dn(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pn(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${dn(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 fn(n,e){let l=1,a=null,h=!1;for(let r=e+1;r<n.length;r++){let p=n[r];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return r}return-1}function jt(n,e){let l=n,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let r=h.index+h[0].length-1,p=fn(l,r);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(r+1,p).trim(),b=d(`(${w})`,e),S=pn(un(b));l=l.slice(0,h.index)+S+l.slice(p+1),a.lastIndex=h.index+S.length}return l}import gn from"crypto";function te(n){return G(String(n??""))}var Bt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ge(n,e,l,a){let h=n||e;return l?`${h} ${a}`:h}function he(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ie(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${te(e)}"`}function it(n,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${te(`${he(n)}-error`)}"`;return a}function mn(){return gn.randomUUID()}function Ze(n,e){let l=n;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=mn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${te(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let r=h.toUpperCase();if(h&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${te(r)}">`;return a}),l}function Ft(n,e,l=Bt){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"POST",k=w||b||"",C=xe(S),_=v.toUpperCase(),P=["GET","POST"].includes(_)?_:"POST",I=`<form method="${te(P)}" action="${te(k)}"${C?` ${C}`:""}>`;if(I+=`
|
|
566
|
+
<script${l.length>0?` ${l.join(" ")}`:""} src="${pe(e.scriptUrl)}" defer></script>
|
|
567
|
+
`}function vt(n,e){let l=qr(e);if(!l)return n;if(!n.includes("</head>")){let a=c(n);if(a!==-1)return n.slice(0,a)+l+n.slice(a);return n+l}return f(n,l,"")}function pe(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function kt(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 xt(n){let e=n?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}import Gr from"fs";import et from"path";import{createHighlighter as Zr}from"ts-syntax-highlighter";var tt=new Map;async function Ne(n,e={}){try{if(!await s(n))throw Error(`Markdown file not found: ${n}`);let a=(await Gr.promises.stat(n)).mtime.getTime();if(e.cache&&tt.has(n)){let k=tt.get(n);if(k.updatedAt>=a)return{content:k.content,data:k.data}}let h=await Bun.file(n).text(),{data:r,content:p}=br(h),w=e.markdown||M.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},S=st(p,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)S=await Jr(S,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let v={content:S,data:r||{}};if(e.cache)tt.set(n,{...v,updatedAt:a});return v}catch(l){if(e.debug)console.error(`Error reading/parsing markdown file ${n}:`,l);let a=l instanceof Error?l.message:String(l);return{content:y("Markdown File",`Error reading/parsing markdown file: ${a}`,n,"",0,""),data:{}}}}var Xe=null;async function Jr(n,e,l){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Xe)try{Xe=await Zr({theme:e||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),n}let h=async(w,b,S,v)=>{let k=v.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),C=S||(l?"text":"");if(!C)return w;try{if(!Xe.getSupportedLanguages().includes(C))return w;return(await Xe.highlight(k,C,{theme:e})).html}catch(_){console.error(`Error highlighting code block with language ${S}:`,_)}return w},r=n,p=n.matchAll(a);for(let w of p){let[b,S,v,k]=w,C=await h(b,S,v,k);r=r.replace(b,C)}return r}async function St(n,e,l="",a={}){return await Qr(n,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(p,w,b,S)=>{try{let v=w;if(!et.isAbsolute(w))v=et.resolve(et.dirname(l),w);let k={};if(b)try{try{k=JSON.parse(b)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let B=b.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of B){let q=F.indexOf(":");if(q>0){let H=F.substring(0,q).trim(),N=F.substring(q+1).trim(),U=N.startsWith('"')&&N.endsWith('"'),G=N.startsWith("'")&&N.endsWith("'");if(U||G)N=N.substring(1,N.length-1);k[H]=N}}}}catch(j){if(a.debug)console.error("Error parsing context in @markdown-file directive:",j)}let{content:C,data:_}=await Ne(v,a),P={...e,..._,...k},I=C,L=/\{\{([^}]+)\}\}/g;return I=I.replace(L,(j,B)=>{let F=B.trim();return P[F]!==void 0?String(P[F]):j}),I}catch(v){let k=v instanceof Error?v.message:String(v);return y("Markdown File",`Error including markdown file: ${k}`,l,n,S,p)}})}async function Qr(n,e,l){let a=[],h;while((h=e.exec(n))!==null){let w=h[0],b=h.index,S=h;a.push(l(...S).then((v)=>({match:w,replacement:v,index:b})))}let r=await Promise.all(a);r.sort((w,b)=>b.index-w.index);let p=n;for(let{match:w,replacement:b}of r)p=p.replace(w,()=>b);return p}var $t=new WeakMap;function Et(n=16){let e=new Uint8Array(n);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ke(n,e){if(!n)return e?.nonceGenerator?.()??Et();let l=$t.get(n);if(!l)l=e?.nonceGenerator?.()??Et(),$t.set(n,l);return l}function Yr(n,e){let l=[];for(let[a,h]of Object.entries(n)){if(h===void 0||h===null)continue;if(typeof h==="boolean"){if(h)l.push(a);continue}if(Array.isArray(h)){let r=[...h];if(e&&(a==="script-src"||a==="style-src"))r=r.filter((p)=>!p.startsWith("'nonce-")),r.push(`'nonce-${e}'`);if(r.length>0)l.push(`${a} ${r.join(" ")}`)}}return l.join("; ")}function Ct(n,e){return`<meta http-equiv="Content-Security-Policy" content="${Yr(n,e).replace(/&/g,"&").replace(/"/g,""")}">`}function _t(n,e,l){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?Ke(l,e):void 0,h=Ct(e.directives,a);return n.replace(/<head([^>]*)>/,`<head$1>
|
|
568
|
+
${h}`)}function Tt(n,e){let l=n;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<script nonce="${e}"${h}>`}),l=l.replace(/<style([^>]*)>/gi,(a,h)=>{if(h.includes("nonce="))return a;return`<style nonce="${e}"${h}>`}),l}function At(n,e,l,a){let h=n,r=a.csp;if(h=h.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let p=r.useNonce?Ke(e,r):void 0;return Ct(r.directives,p)}),h=h.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ke(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ke(e,r);return h}import en from"crypto";var tn=40,Rt="_token",rt=null;function rn(n=tn){let e=en.randomBytes(Math.ceil(n/2)).toString("hex").slice(0,n);return rt=e,e}function nn(){if(!rt)rn();return rt}function sn(n=Rt){let e=nn();return`<input type="hidden" name="${n}" value="${e}">`}function Mt(n){return n.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>sn(a||Rt))}async function Dt(n,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return n;let h=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)h=await on(h,r,e,l,a);else h=await an(h,r,e,l,a)}return h}async function on(n,e,l,a,h){let{name:r,handler:p}=e,w=`@${r}`,b=`@end${r}`,S=n,v=Vt(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${b}`,"g"),k=[],C=v.exec(S);while(C!==null){let[_,P="",I=""]=C,L=C.index||0;try{let j=P?It(e,P):[],B=I.trim(),F=await p(B,j,l,a);k.push({original:_,processed:F,startIndex:L})}catch(j){let B=j instanceof Error?j.message:String(j);if(h.debug)console.error(`Error processing custom directive @${r}:`,j);k.push({original:_,processed:u("CustomDirective",`Error in @${r}${P?`(${P})`:""}: ${B}`,t.EVALUATION_ERROR),startIndex:L})}C=v.exec(S)}for(let _=k.length-1;_>=0;_--){let{original:P,processed:I}=k[_];S=S.replace(P,I)}return S}async function an(n,e,l,a,h){let{name:r,handler:p}=e,w=n,b=[],S=[];if(e.rawParams){for(let C of Di(w,Vt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(C.end!==-1)S.push({fullMatch:C.call,paramString:C.args,startIndex:C.start})}else{let C=Vt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");C.lastIndex=0;let _=C.exec(w);while(_!==null)S.push({fullMatch:_[0],paramString:_[1]??"",startIndex:_.index||0}),_=C.exec(w)}for(let{fullMatch:C,paramString:_,startIndex:P}of S)try{let I=It(e,_),L=await p("",I,l,a);b.push({original:C,processed:L,startIndex:P})}catch(I){let L=I instanceof Error?I.message:String(I);if(h.debug)console.error(`Error processing custom directive @${r}:`,I);b.push({original:C,processed:u("CustomDirective",`Error in @${r}(${_}): ${L}`,t.EVALUATION_ERROR),startIndex:P})}let v=Vt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),k=v.exec(w);while(k!==null){let[C]=k,_=k.index||0;try{let P=await p("",[],l,a);b.push({original:C,processed:P,startIndex:_})}catch(P){let I=P instanceof Error?P.message:String(P);if(h.debug)console.error(`Error processing custom directive @${r}:`,P);b.push({original:C,processed:u("CustomDirective",`Error in @${r}: ${I}`,t.EVALUATION_ERROR),startIndex:_})}k=v.exec(w)}for(let C=b.length-1;C>=0;C--){let{original:_,processed:P}=b[C];w=w.replace(_,P)}return w}function It(n,e){return n.rawParams?qt(e):cn(e)}function cn(n){if(!n.trim())return[];let e=[],l="",a=!1,h="";for(let r=0;r<n.length;r++){let p=n[r];if((p==='"'||p==="'")&&(r===0||n[r-1]!=="\\"))if(!a)a=!0,h=p;else if(p===h)a=!1;else l+=p;else if(p===","&&!a)e.push(l.trim()),l="";else l+=p}if(l.trim())e.push(l.trim());return e.map((r)=>{let p=r.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Ot=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Pt=/^[A-Za-z_$][\w$]*$/,ln=new Set(["light","dark","system"]);function Ce(n,e){if(typeof n!=="string"||n.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function un(n){if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap expects an options object");let e=n,{appearance:l,colorMode:a}=e;if(Ce(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))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(Ce(a.key,"colorMode.key"),Ce(a.attribute,"colorMode.attribute"),Ce(a.default,"colorMode.default"),!Pt.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!ln.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let h=null;if(l){if(Ce(l.key,"appearance.key"),Ce(l.attribute,"appearance.attribute"),Ce(l.default,"appearance.default"),!Pt.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Ot.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");h={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:h,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function dn(n){return JSON.stringify(n).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pn(n){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${dn(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 fn(n,e){let l=1,a=null,h=!1;for(let r=e+1;r<n.length;r++){let p=n[r];if(h){h=!1;continue}if(a){if(p==="\\")h=!0;else if(p===a)a=null;continue}if(p==='"'||p==="'"||p==="`"){a=p;continue}if(p==="(")l++;else if(p===")"&&--l===0)return r}return-1}function jt(n,e){let l=n,a=/@appearanceBootstrap\s*\(/g,h;while((h=a.exec(l))!==null){let r=h.index+h[0].length-1,p=fn(l,r);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=l.slice(r+1,p).trim(),b=d(`(${w})`,e),S=pn(un(b));l=l.slice(0,h.index)+S+l.slice(p+1),a.lastIndex=h.index+S.length}return l}import gn from"crypto";function te(n){return X(String(n??""))}var Bt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ge(n,e,l,a){let h=n||e;return l?`${h} ${a}`:h}function he(n){return String(n).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ie(n,e){if(/\bid\s*=/i.test(n))return"";return` id="${te(e)}"`}function it(n,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${te(`${he(n)}-error`)}"`;return a}function mn(){return gn.randomUUID()}function Ze(n,e){let l=n;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=mn();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${te(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,h)=>{let r=h.toUpperCase();if(h&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${te(r)}">`;return a}),l}function Ft(n,e,l=Bt){let a=n;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"POST",k=w||b||"",C=xe(S),_=v.toUpperCase(),P=["GET","POST"].includes(_)?_:"POST",I=`<form method="${te(P)}" action="${te(k)}"${C?` ${C}`:""}>`;if(I+=`
|
|
569
569
|
${Ze("@csrf",e)}`,!["GET","POST"].includes(_))I+=`
|
|
570
|
-
${Ze(`@method('${_}')`,e)}`;return I}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"",k=w||b||"",C=xe(S),_=Fe(v,e),P=_!==void 0&&_!==null?_:k||"",I=C.match(/type=['"]([^'"]+)['"]/i),L=I?I[1]:"text",j=Ue(v,e),
|
|
570
|
+
${Ze(`@method('${_}')`,e)}`;return I}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(h,r,p,w,b,S="")=>{let v=r||p||"",k=w||b||"",C=xe(S),_=Fe(v,e),P=_!==void 0&&_!==null?_:k||"",I=C.match(/type=['"]([^'"]+)['"]/i),L=I?I[1]:"text",j=Ue(v,e),B=C.match(/class=['"]([^'"]+)['"]/i),F=Ge(B?B[1]:"",l.input,j,l.inputError),q=C.replace(/class=['"][^'"]+['"]/i,"");return q=q.replace(/type=['"][^'"]+['"]/i,""),`<input type="${te(L)}" name="${te(v)}"${Ie(C,he(v))} value="${te(P)}" class="${F}"${it(v,j,C)}${q?` ${q}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(h,r,p="",w="")=>{let b=xe(p),S=Fe(r,e)||w.trim(),v=Ue(r,e),k=b.match(/class=['"]([^'"]+)['"]/i),C=Ge(k?k[1]:"",l.input,v,l.inputError),_=b.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${te(r)}"${Ie(b,he(r))} class="${C}"${it(r,v,b)}${_?` ${_}`:""}>${te(S)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(h,r,p="",w)=>{let b=xe(p),S=Fe(r,e),v=Ue(r,e),k=b.match(/class=['"]([^'"]+)['"]/i),C=Ge(k?k[1]:"",l.input,v,l.inputError),_=b.replace(/class=['"][^'"]+['"]/i,""),P=w;if(S!==void 0)P=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(I,L,j)=>{if((Array.isArray(S)?S.some((F)=>String(F)===j):String(S)===j)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return I});return`<select name="${te(r)}"${Ie(b,he(r))} class="${C}"${it(r,v,b)}${_?` ${_}`:""}>${P}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(h,r,p,w="")=>{let b=p===void 0?"1":p,S=p===void 0?he(r):`${he(r)}-${he(b)}`,v=xe(w),k=Fe(r,e),C=k!==void 0&&(Array.isArray(k)?k.some((L)=>String(L)===b):k===!0||String(k)===b),_=v.match(/class=['"]([^'"]+)['"]/i),P=_?_[1]:l.checkInput,I=v.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${te(r)}"${Ie(v,S)} value="${te(b)}" class="${P}"${C?" checked":""}${I?` ${I}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,r,p,w="")=>{let b=xe(w),S=Fe(r,e),v=S!==void 0&&S===p,k=b.match(/class=['"]([^'"]+)['"]/i),C=k?k[1]:l.checkInput,_=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${te(r)}"${Ie(b,`${he(r)}-${he(p)}`)} value="${te(p)}" class="${C}"${v?" checked":""}${_?` ${_}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(h,r,p="")=>{let w=xe(p),b=w.match(/accept=['"]([^'"]+)['"]/i),S=b?b[1]:"",v=w.includes("multiple"),k=Ue(r,e),C=w.match(/class=['"]([^'"]+)['"]/i),_=Ge(C?C[1]:"",l.input,k,l.inputError),P=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),I=[`<input type="file" name="${te(r)}"${Ie(w,he(r))}`,`class="${_}"`];if(S)I.push(`accept="${te(S)}"`);if(v)I.push("multiple");if(P)I.push(P);return`${I.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(h,r,p="",w)=>{let b=xe(p),S=b.match(/class=['"]([^'"]+)['"]/i),v=S?S[1]:l.label,k=b.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${te(he(r))}" class="${v}"${k?` ${k}`:""}>${w}</label>`}),a}function Ut(n,e,l=Bt){return n.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,h,r)=>{try{if(Ue(h,e)){let p=r.replace(/\{\{([^}]+)\}\}/g,(w,b,S)=>{let v=(k)=>re(r,S,String(k??""),!1,w.length);try{if(b.trim()==="$message"||b.trim()==="message")return v(Nt(h,e));if(b.trim().includes("errors.first")||b.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return v(e.errors.first(h));return v(Nt(h,e))}let k=b.trim();if(m(k)){let C=d(k,e);return C!==void 0?v(C):k}return k}catch{return b}});return`<div id="${te(`${he(h)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),a}})}function Ue(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 Nt(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 l=e.errors[n];return Array.isArray(l)?l[0]:String(l)}return""}function Fe(n,e){let l;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(l=e[a],l!==void 0)return l}return e[n]}function xe(n){if(!n.trim())return"";let e=[],l=n.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,h;while((h=a.exec(l))!==null){let[,r,,p]=h;e.push(`${r}="${p.trim()}"`)}return e.join(" ")}import*as ot from"path";async function Wt(n,e,l=""){if(ot.basename(l)==="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 zt(n,e,l,"@js","@endjs")}async function Xt(n,e,l=""){if(ot.basename(l)==="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 zt(n,e,l,"@ts","@endts")}async function zt(n,e,l,a,h){let r=n,p=Vt(`${a}([\\s\\S]*?)${h}`,"g"),w=[],b;while((b=p.exec(n))!==null)w.push({fullMatch:b[0],content:b[1]||"",index:b.index});for(let{fullMatch:S,content:v,index:k}of w)try{let C={...e,global:e},_=Object.keys(C),P=Object.values(C),I=v.trim();if(a==="@ts")I=I.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 j=(I.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),B=j.length>0?`return { ${j.join(", ")} };`:"return {};",F=`
|
|
571
571
|
${I}
|
|
572
|
-
${
|
|
573
|
-
`,
|
|
572
|
+
${B}
|
|
573
|
+
`,H=Function(..._,F)(...P);if(H&&typeof H==="object")Object.assign(e,H);r=r.replace(S,"")}catch(C){console.error(`Error executing ${a} code block in ${l}:`,C);let _=C instanceof Error?C.message:String(C),P=y(`${a} Directive`,`Error executing code: ${_}`,l,n,k,S);console.error(P),r=r.replace(S,"")}return r}function hn(n,e="_method"){let l=n.toUpperCase();if(l==="GET"||l==="POST")return"";return`<input type="hidden" name="${e}" value="${l}">`}function Kt(n){return n.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,l,a,h,r)=>hn(a,r||"_method"))}async function Gt(n,e,l,a,h){if(!a.middleware||a.middleware.length===0)return n;let r=n,p=a.middleware.filter((w)=>w.timing===h);if(p.length===0)return r;for(let w of p){if(!w.name||typeof w.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",w);continue}try{let b=await w.handler(r,e,l,a);if(typeof b==="string")r=b;else if(a.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(b){if(a.debug)console.error(`Error in middleware ${w.name}:`,b);if(a.debug){let S=y("Middleware",`Error in middleware '${w.name}': ${b instanceof Error?b.message:String(b)}`,l,n);r=r.replace(/<body[^>]*>/,`$&
|
|
574
574
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${g(S)}</div>
|
|
575
|
-
`)}}}return r}async function Zt(n,e,l,a){return Gt(n,e,l,a,"before")}async function Jt(n,e,l,a){return Gt(n,e,l,a,"after")}function Qt(n){return n.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,l,a,h,r)=>{try{let p=h?O(h,{}):{};return xr(a,p,r==="true")}catch(p){return console.error(`Error processing @route directive: ${p}`),"#route-error"}})}var qe={patterns:[],exact:{}};async function Yt(n,e){let l=n.split("/").pop()?.split(".")[0]||"";if(qe.exact[n])for(let a of qe.exact[n])await Promise.resolve(a(e,n));if(qe.exact[l])for(let a of qe.exact[l])await Promise.resolve(a(e,n));for(let{pattern:a,callback:h}of qe.patterns)if(a.test(n)||a.test(l))await Promise.resolve(h(e,n))}var yn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vn=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 Ae(n,e){let l=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;l.lastIndex=e;let a=l.exec(n);if(!a)return null;let h=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&yn.has(a[1]),r=h?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:r,selfClosing:h,start:a.index,end:a.index+a[0].length}}function kn(n,e,l){let a=1,h=l,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),p=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&h<n.length){r.lastIndex=h,p.lastIndex=h;let w=r.exec(n),b=p.exec(n);if(!b)return-1;if(w&&w.index<b.index)a++,h=w.index+w[0].length;else{if(a--,a===0)return b.index+b[0].length;h=b.index+b[0].length}}return-1}function _e(n,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let l=kn(n,e.tag,e.end);if(l===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:l,innerHTML:n.slice(e.end,l-`</${e.tag}>`.length)}}function er(n,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(n)||n.includes(` ${e}=`)||n.includes(` ${e} `)||n.trimEnd().endsWith(` ${e}`)}function Ve(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=n.match(new RegExp(`${l}="([^"]*)"`,"s"))||n.match(new RegExp(`${l}='([^']*)'`,"s"));return a?a[1]:null}function Se(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return n.replace(new RegExp(`\\s*${l}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${l}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${l}(?=\\s|$|>|/)`,"g"),"")}function Oe(n,e,l){let a=e.selfClosing?" /":"",h=`<${e.tag}${l}${a}>`;return n.slice(0,e.start)+h+n.slice(e.end)}function Sn(n){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(n)}function $n(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=Ve(a.attrs,"v-for");if(h===null){l=a.end;continue}let r=h.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){l=a.end;continue}let p=r[1].trim(),w=r[2].trim(),b;if(p.includes(",")){let L=p.split(",").map((
|
|
575
|
+
`)}}}return r}async function Zt(n,e,l,a){return Gt(n,e,l,a,"before")}async function Jt(n,e,l,a){return Gt(n,e,l,a,"after")}function Qt(n){return n.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,l,a,h,r)=>{try{let p=h?O(h,{}):{};return xr(a,p,r==="true")}catch(p){return console.error(`Error processing @route directive: ${p}`),"#route-error"}})}var qe={patterns:[],exact:{}};async function Yt(n,e){let l=n.split("/").pop()?.split(".")[0]||"";if(qe.exact[n])for(let a of qe.exact[n])await Promise.resolve(a(e,n));if(qe.exact[l])for(let a of qe.exact[l])await Promise.resolve(a(e,n));for(let{pattern:a,callback:h}of qe.patterns)if(a.test(n)||a.test(l))await Promise.resolve(h(e,n))}var yn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vn=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 Ae(n,e){let l=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;l.lastIndex=e;let a=l.exec(n);if(!a)return null;let h=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&yn.has(a[1]),r=h?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:r,selfClosing:h,start:a.index,end:a.index+a[0].length}}function kn(n,e,l){let a=1,h=l,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),p=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&h<n.length){r.lastIndex=h,p.lastIndex=h;let w=r.exec(n),b=p.exec(n);if(!b)return-1;if(w&&w.index<b.index)a++,h=w.index+w[0].length;else{if(a--,a===0)return b.index+b[0].length;h=b.index+b[0].length}}return-1}function _e(n,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let l=kn(n,e.tag,e.end);if(l===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:l,innerHTML:n.slice(e.end,l-`</${e.tag}>`.length)}}function er(n,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(n)||n.includes(` ${e}=`)||n.includes(` ${e} `)||n.trimEnd().endsWith(` ${e}`)}function Ve(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=n.match(new RegExp(`${l}="([^"]*)"`,"s"))||n.match(new RegExp(`${l}='([^']*)'`,"s"));return a?a[1]:null}function Se(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return n.replace(new RegExp(`\\s*${l}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${l}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${l}(?=\\s|$|>|/)`,"g"),"")}function Oe(n,e,l){let a=e.selfClosing?" /":"",h=`<${e.tag}${l}${a}>`;return n.slice(0,e.start)+h+n.slice(e.end)}function Sn(n){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(n)}function $n(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=Ve(a.attrs,"v-for");if(h===null){l=a.end;continue}let r=h.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){l=a.end;continue}let p=r[1].trim(),w=r[2].trim(),b;if(p.includes(",")){let L=p.split(",").map((F)=>F.trim()),j=L[0],B=L[1];b=`${w} as ${B} => ${j}`}else b=`${w} as ${p}`;let S=Se(a.attrs,"v-for"),v=Se(S,":key").replace(/\s*v-bind:key="[^"]*"/g,""),k=_e(e,a),C=e.slice(k.outerStart,k.outerEnd),_=Oe(C,{...a,start:0,end:a.end-a.start},v),P=`@foreach(${b})
|
|
576
576
|
`,I=`${P}${_}
|
|
577
|
-
@endforeach`;e=e.slice(0,k.outerStart)+I+e.slice(k.outerEnd),l=k.outerStart+P.length}return e}function En(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=Ve(a.attrs,"v-if");if(h===null){l=a.end;continue}let r=[],p=_e(e,a),w=Se(a.attrs,"v-if"),b=Oe(e.slice(p.outerStart,p.outerEnd),{...a,start:0,end:a.end-a.start},w);r.push({type:"if",expr:h,outerStart:p.outerStart,outerEnd:p.outerEnd,element:b,parsedTag:a});let S=p.outerEnd,v=!0;while(v){let I=e.slice(S).match(/^\s*/),L=I?I[0].length:0,j=Ae(e,S+L);if(!j){v=!1;break}let
|
|
577
|
+
@endforeach`;e=e.slice(0,k.outerStart)+I+e.slice(k.outerEnd),l=k.outerStart+P.length}return e}function En(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=Ve(a.attrs,"v-if");if(h===null){l=a.end;continue}let r=[],p=_e(e,a),w=Se(a.attrs,"v-if"),b=Oe(e.slice(p.outerStart,p.outerEnd),{...a,start:0,end:a.end-a.start},w);r.push({type:"if",expr:h,outerStart:p.outerStart,outerEnd:p.outerEnd,element:b,parsedTag:a});let S=p.outerEnd,v=!0;while(v){let I=e.slice(S).match(/^\s*/),L=I?I[0].length:0,j=Ae(e,S+L);if(!j){v=!1;break}let B=Ve(j.attrs,"v-else-if"),F=er(j.attrs,"v-else");if(B!==null){let q=_e(e,j),H=Se(j.attrs,"v-else-if"),N=Oe(e.slice(q.outerStart,q.outerEnd),{...j,start:0,end:j.end-j.start},H);r.push({type:"else-if",expr:B,outerStart:S,outerEnd:q.outerEnd,element:N,parsedTag:j}),S=q.outerEnd}else if(F){let q=_e(e,j),H=Se(j.attrs,"v-else"),N=Oe(e.slice(q.outerStart,q.outerEnd),{...j,start:0,end:j.end-j.start},H);r.push({type:"else",outerStart:S,outerEnd:q.outerEnd,element:N,parsedTag:j}),v=!1}else v=!1}let k=[];for(let I of r)if(I.type==="if")k.push(`@if(${I.expr})
|
|
578
578
|
${I.element}`);else if(I.type==="else-if")k.push(`@elseif(${I.expr})
|
|
579
579
|
${I.element}`);else k.push(`@else
|
|
580
580
|
${I.element}`);k.push("@endif");let C=k.join(`
|
|
581
|
-
`),_=r[0].outerStart,P=r[r.length-1].outerEnd;e=e.slice(0,_)+C+e.slice(P),l=_+C.length}return e}function Cn(n){return n.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Mn(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=vn.has(a.tag),r=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(w,b,S)=>{let v=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(b);if(!v||!S||!/^["']/.test(S))return w;let k=v[1]||"modelValue",C=v[2];if(h&&!v[1])return`@model${C}=${S}`;let _=S[0],P=S.slice(1,-1),I=`:${k}=${S} @update:${k}=${_}${P} = $event${_}`;if(C){let L=v[1]?`${k}Modifiers`:"modelModifiers",j=C.slice(1).split(".").map((
|
|
581
|
+
`),_=r[0].outerStart,P=r[r.length-1].outerEnd;e=e.slice(0,_)+C+e.slice(P),l=_+C.length}return e}function Cn(n){return n.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Mn(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=vn.has(a.tag),r=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(w,b,S)=>{let v=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(b);if(!v||!S||!/^["']/.test(S))return w;let k=v[1]||"modelValue",C=v[2];if(h&&!v[1])return`@model${C}=${S}`;let _=S[0],P=S.slice(1,-1),I=`:${k}=${S} @update:${k}=${_}${P} = $event${_}`;if(C){let L=v[1]?`${k}Modifiers`:"modelModifiers",j=C.slice(1).split(".").map((B)=>`${B}: true`).join(", ");I+=` :${L}="{ ${j} }"`}return I});if(r===a.attrs){l=a.end;continue}let p=Oe(a.full,{...a,start:0,end:a.full.length},r);e=e.slice(0,a.start)+p+e.slice(a.end),l=a.start+p.length}return e}function Dn(n){return n.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function In(n){return n.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function On(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=Ve(a.attrs,"v-html");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let r=_e(e,a),p=Se(a.attrs,"v-html"),w=a.selfClosing?" /":"",b=`<${a.tag}${p}${w}>{!! ${h} !!}</${a.tag}>`;e=e.slice(0,r.outerStart)+b+e.slice(r.outerEnd),l=r.outerStart+b.length}return e}function Ln(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;let h=Ve(a.attrs,"v-text");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let r=_e(e,a),p=Se(a.attrs,"v-text"),w=a.selfClosing?" /":"",b=`<${a.tag}${p}${w}>{{ ${h} }}</${a.tag}>`;e=e.slice(0,r.outerStart)+b+e.slice(r.outerEnd),l=r.outerStart+b.length}return e}function jn(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 Hn(n){let e=n,l=0;while(l<e.length){let a=Ae(e,l);if(!a)break;if(!er(a.attrs,"v-once")){l=a.end;continue}let h=Se(a.attrs,"v-once"),r=_e(e,a),p=e.slice(r.outerStart,r.outerEnd),b=`@once
|
|
582
582
|
${Oe(p,{...a,start:0,end:a.end-a.start},h)}
|
|
583
|
-
@endonce`;e=e.slice(0,r.outerStart)+b+e.slice(r.outerEnd),l=r.outerStart+b.length}return e}function Nn(n){return n.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Bn(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 tr(n){if(!Sn(n))return n;let e=n;return e=$n(e),e=En(e),e=Hn(e),e=Dn(e),e=In(e),e=Mn(e),e=Cn(e),e=Bn(e),e=On(e),e=Ln(e),e=jn(e),e=Nn(e),e}function Je(n){return n.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var at=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"]),Fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function rr(n,e){let l=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(n),a=l?l[1]:n,h=d(a,e);if(h&&typeof h==="string")return h;let r=a.trim();return at.has(r)?r:null}function nr(n){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(n);return e?e[1]:n}function sr(n,e,l){let a=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),h=a?`<${n} ${a}>`:`<${n}>`;if(Fn.has(n))return a?`<${n} ${a}>`:`<${n}>`;return`${h}${l}</${n}>`}async function ir(n,e,l,a,h){let r=n,p=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],b;while((b=p.exec(r))!==null)w.push({full:b[0],expr:b[1],attrs:b[2],slotContent:b[3],index:b.index});for(let S=w.length-1;S>=0;S--){let v=w[S];try{let k=rr(v.expr,e);if(!k||typeof k!=="string"){let
|
|
583
|
+
@endonce`;e=e.slice(0,r.outerStart)+b+e.slice(r.outerEnd),l=r.outerStart+b.length}return e}function Nn(n){return n.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Bn(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 tr(n){if(!Sn(n))return n;let e=n;return e=$n(e),e=En(e),e=Hn(e),e=Dn(e),e=In(e),e=Mn(e),e=Cn(e),e=Bn(e),e=On(e),e=Ln(e),e=jn(e),e=Nn(e),e}function Je(n){return n.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var at=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"]),Fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function rr(n,e){let l=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(n),a=l?l[1]:n,h=d(a,e);if(h&&typeof h==="string")return h;let r=a.trim();return at.has(r)?r:null}function nr(n){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(n);return e?e[1]:n}function sr(n,e,l){let a=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),h=a?`<${n} ${a}>`:`<${n}>`;if(Fn.has(n))return a?`<${n} ${a}>`:`<${n}>`;return`${h}${l}</${n}>`}async function ir(n,e,l,a,h){let r=n,p=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],b;while((b=p.exec(r))!==null)w.push({full:b[0],expr:b[1],attrs:b[2],slotContent:b[3],index:b.index});for(let S=w.length-1;S>=0;S--){let v=w[S];try{let k=rr(v.expr,e);if(!k||typeof k!=="string"){let B=`<!-- dynamic component: could not resolve "${Je(nr(v.expr))}" -->`;r=r.slice(0,v.index)+B+r.slice(v.index+v.full.length);continue}if(at.has(k)){let B=sr(k,v.attrs,v.slotContent);r=r.slice(0,v.index)+B+r.slice(v.index+v.full.length);continue}let C=v.attrs.trim(),_={},P=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,I;while((I=P.exec(C))!==null){let B=I[1]||I[2],F=I[3];if(I[1])try{_[B]=d(F,e)}catch{_[B]=F}else _[B]=F}let L=a.componentsDir||"components",j=await We(k,_,v.slotContent,L,e,l,a,new Set,h??new Set);r=r.slice(0,v.index)+j+r.slice(v.index+v.full.length)}catch(k){let C=k instanceof Error?k.message:String(k),_=`<!-- dynamic component error: ${Je(C)} -->`;r=r.slice(0,v.index)+_+r.slice(v.index+v.full.length)}}return r=await Un(r,e,l,a,h),r}async function Un(n,e,l,a,h){let r=n,p=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],b;while((b=p.exec(r))!==null)w.push({full:b[0],expr:b[1],attrs:b[2],index:b.index});for(let S=w.length-1;S>=0;S--){let v=w[S];try{let k=rr(v.expr,e);if(!k||typeof k!=="string"){let P=`<!-- dynamic component: could not resolve "${Je(nr(v.expr))}" -->`;r=r.slice(0,v.index)+P+r.slice(v.index+v.full.length);continue}if(at.has(k)){let P=sr(k,v.attrs,"");r=r.slice(0,v.index)+P+r.slice(v.index+v.full.length);continue}let C=a.componentsDir||"components",_=await We(k,{},"",C,e,l,a,new Set,h??new Set);r=r.slice(0,v.index)+_+r.slice(v.index+v.full.length)}catch(k){let C=k instanceof Error?k.message:String(k),_=`<!-- dynamic component error: ${Je(C)} -->`;r=r.slice(0,v.index)+_+r.slice(v.index+v.full.length)}}return r}var hc="X-STX-Build",ct=Symbol.for("stx.buildId");function ps(){let n=globalThis;if(!n[ct])n[ct]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return n[ct]}function or(n,e=ps()){if(n.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(n))return null;return`
|
|
584
584
|
<meta name="stx-build" content="${e}">`}var zo="/_stx/sw.js";function qn(n){if(typeof n!=="string"||!n.startsWith("/"))return null;let e=[],l=[],a=n.replace(/\/+$/,"").split("/").slice(1).map((h)=>{let r=/^:(\w+)$/.exec(h)||/^\[(\w+)\]$/.exec(h);if(r)return e.push(r[1]),l.push("0"),"([^/]+)";return l.push(h),h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:n,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function Vn(n){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,l=window;if(l.stxOffline)return;let a=null,h=!1,r=[],p={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>a,onUpdateReady(v){if(p.updateReady)try{v()}catch{}else r.push(v);return()=>{let k=r.indexOf(v);if(k!==-1)r.splice(k,1)}},applyUpdate(){let v=a&&a.waiting;if(!v)return!1;return h=!0,v.postMessage({type:"stx:activate-update",force:!0}),!0}};l.stxOffline=p;let w=(v)=>{if(!v.waiting||!e.controller||p.updateReady)return;p.updateReady=!0;let k=r.splice(0);for(let C of k)try{C()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(v)=>{let k=v.data||{};if(k.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:k.url,kind:k.kind,fragment:!!k.fragment}}))}catch{}if(k.type==="stx:reachability"){if(l.stxOffline.reachable=k.reachable!==!1,Number(k.at)>0)l.stxOffline.reachedAt=Number(k.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:k.reachable!==!1,at:Number(k.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(h)h=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&a&&a.waiting)a.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let b=()=>{e.register(n,{scope:"/"}).then((v)=>{a=v;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(v.waiting)w(v),v.waiting.postMessage({type:"stx:activate-update",reason:"load"});v.addEventListener("updatefound",()=>{let k=v.installing;if(!k)return;k.addEventListener("statechange",()=>{if(k.state==="installed")w(v)})})}).catch(()=>{})},S=()=>{let v=(k)=>{setTimeout(k,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>v(b));else v(b)};if(!e.controller)if(document.readyState==="complete")S();else addEventListener("load",S);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",S);else S()}function Wn(){let n=`(${Vn.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim().replace(/;$/,"")}catch{return n}}function Xn(n,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!n||!n.startsWith("/"))return null;let l=n.split(/[?#]/)[0].split("/").filter(Boolean)[0];return l?`/${l}`:"/"}var ar=`<script data-stx-offline>${Wn()}</script>`;function Ho(n,e){let l=Number(n.precacheTimeoutMs),a={build:String(e||"dev"),pages:Array.from(new Set((n.pages||[]).filter((h)=>typeof h==="string"&&h.startsWith("/")))),staticPages:(n.staticPages||[]).filter((h)=>typeof h==="string"&&((n.pages||[]).includes(h)||(n.routes||[]).includes(h))),api:n.apiPrefix||"/api/",timeout:Math.max(500,Number(n.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(l)&&l>0?Math.min(2147483647,Math.max(1,Math.floor(l))):1e4,networkFirst:(n.networkFirst||[]).filter((h)=>typeof h==="string"&&h.startsWith("/")),updateOnColdStart:n.updateOnColdStart===!0,fallback:n.fallback||n.pages&&n.pages[0]||null,fallbackScope:Xn(n.fallback||n.pages&&n.pages[0]||null,n.fallbackScope),routes:(n.routes||[]).map(qn).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} */
|
|
585
585
|
'use strict';
|
|
586
586
|
var S = ${JSON.stringify(a)};
|
|
@@ -1295,33 +1295,33 @@ ${L}
|
|
|
1295
1295
|
</style>`;a=a.replace(S,j),w.lastIndex=0}catch(L){}}}return a}import lt from"path";var Kn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Gn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Zn(n,e){if(!e||!n.includes("/"))return n;let l=lt.dirname(e);return n.replace(Kn,(a,h,r,p)=>{let w=lt.resolve(l,p);return`${h}${r}${w.split(lt.sep).join("/")}${r}`})}function fr(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Gn,(l,a,h,r)=>`${a}${Zn(h,e)}${r}`)}var Me="<!--PARENT_CONTENT_PLACEHOLDER-->";function hr(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Cr(n,e){let l=n.length,a=e,h=!0,r=[],p=(w)=>w+9<=l&&n[w]==="<"&&n[w+1]==="/"&&(n[w+2]==="s"||n[w+2]==="S")&&(n[w+3]==="c"||n[w+3]==="C")&&(n[w+4]==="r"||n[w+4]==="R")&&(n[w+5]==="i"||n[w+5]==="I")&&(n[w+6]==="p"||n[w+6]==="P")&&(n[w+7]==="t"||n[w+7]==="T")&&(n[w+8]===">"||/\s/.test(n[w+8]));while(a<l){let w=n[a];if(p(a))return a;if(w==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
|
|
1296
1296
|
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&n[a+1]==="*"){let b=n.indexOf("*/",a+2);if(b===-1)return-1;a=b+2,h=!0;continue}if(w==="/"&&h){let b=a+1,S=!1;while(b<l){let v=n[b];if(v==="\\"){b+=2;continue}if(v==="[")S=!0;else if(v==="]")S=!1;else if(v==="/"&&!S){b++;break}else if(v===`
|
|
1297
1297
|
`){b=-1;break}b++}if(b===-1){a++,h=!1;continue}while(b<l&&/[a-z]/.test(n[b]))b++;a=b,h=!1;continue}if(w==="'"||w==='"'){let b=w;a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===b){a++;break}if(n[a]===`
|
|
1298
|
-
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1298
|
+
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}if(r.length===0)h=!1;continue}if(w==="}"&&r.length>0){r.pop(),a++;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,h=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function _r(n,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let h=a.index+a[0].length,r=n.indexOf("</script>",h);if(r===-1)return null;let p=n.indexOf(">",r);if(p===-1)return null;return{start:a.index,end:p+1}}var Qn=4096;async function ut(n,e,l){if(l.buildMode!=="serve"||e.length<Qn)return null;let{registerServeModuleBundle:a}=await import("./chunk-m1a3a32y.js");return`<script ${n} src="${a(e)}"></script>`}async function cr(n,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-fcvgf88g.js")),p=[],w=await r(h(...n),{minify:Bi(e.buildMode,e.minifyClient),collectInputs:p});for(let b of p)l?.add(b);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:b}=await import("./chunk-m1a3a32y.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${b(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Yn(n,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:C}=await o("stx/framework-composables",()=>import("./chunk-cbpxd3qa.js"));h.frameworkScript=await C(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-tg7kt56m.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),b=w?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),S=[],v=[],k=null;for(let C=0;C<8;C++){let _=null,P="",I=!1;try{if(r){let F=w?await r.getStoreScript(p).then((q)=>q?{code:q,stores:["*"],functions:null}:null):await r.getStoreScriptFor(p,[b],{reads:r.storesReadInFiles([...S,...v]),runOnce:!0});if(F)_=F.code,P=F.stores.join(","),I=!!F.functions&&!w}}catch{}if(k!==null&&P===k)break;k=P;let L=I?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",j=_?`<script ${L}>${_}</script>`:null;h.storeCode=_,h.storeTag=_?await ut(L,_,e)??j:null;let B={};h.modulesTag=await cr([n,j],e,l,B),h.modulesCode=B.code??null,S=B.inputs??[],h.composableTag=null,h.composableCode=null,v=[];try{let{getComposableScript:F}=await o("stx/composable-loader",()=>import("./chunk-8cgn4re9.js")),q=e.composablesDir,H=[h.modulesCode??h.modulesTag,j,h.frameworkScript].filter((U)=>U!==null),N=await F(e._layerComposableDirs??q,n,H,v);if(N)h.composableCode=N,h.composableTag=await ut('data-stx-scoped data-stx-run="always" data-stx-composables',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${N}</script>`}catch{}if(w||!r)break}return h}async function es(n,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:r}=await import("./chunk-qmr5xsjj.js"),p=await import("./chunk-m9cperj4.js"),{messages:w,webModules:b}=e,S=null,v=null,k=r()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{S=await p.loadPageMessages(process.cwd(),w)}catch(L){ts(L)}if(b&&Object.keys(b).length&&k)try{v=await(await import("./chunk-8hhhmscy.js")).loadWebModules(process.cwd(),b)}catch(L){rs(L)}let C=new Map([...v??[],...S?.stubs??[]]),_=()=>Yn(n,e,l,a),P=C.size?await h(C,_):await _(),I=null;if(S){let L=p.messageAreasIn(P.modulesCode,P.storeCode,P.composableCode),j=p.pageMessagesScript(S,p.pageLanguages(n,S),L);if(j)I=await ut('data-stx-scoped data-stx-run="always" data-stx-messages',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${j.replace(/<\/script/gi,"<\\/script")}</script>`}return[I,P.modulesTag,P.storeTag,P.composableTag,P.frameworkScript].filter((L)=>L!==null)}var yr=!1;function ts(n){if(yr)return;yr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var wr=!1;function rs(n){if(wr)return;wr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function ns(n,e=""){let l=_r(n,"data-stx-runtime");if(!l)return n;let a=gr(n);if(a===-1||a===l.start){if(!e)return n;return n.slice(0,l.end)+e+n.slice(l.end)}if(a<l.start)return n.slice(0,a)+n.slice(l.start,l.end)+e+`
|
|
1299
1299
|
`+n.slice(a,l.start)+n.slice(l.end);let h=n.slice(l.start,l.end),r=n.slice(0,l.start)+n.slice(l.end),p=gr(r);if(p===-1)return h+e+`
|
|
1300
1300
|
`+r;return r.slice(0,p)+h+e+`
|
|
1301
|
-
`+r.slice(p)}function ss(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(l,a,h)=>{let r=n.slice(0,h);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,l,a,h){if(await E(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Te(n,l);let r=!e.__stxProcessingDepth;xn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(r&&a.runtimeConfig)await Tn(e,l,a.runtimeConfig);if(r)rl(e),e.__stx_scope_seq??={n:0,key:Js(String(e.__filename??l))},e.__stx_head_injections=Mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!A()&&!Pn())&&l&&l.endsWith(".stx"))Vo(n,l);try{return await
|
|
1302
|
-
`),...S.htmlAttrs&&{htmlAttrs:vl(w.htmlAttrs,S.htmlAttrs)},...S.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...S.bodyAttrs}}},
|
|
1303
|
-
<meta name="stx-layout" content="${hr(
|
|
1304
|
-
<meta name="stx-layout-group" content="${hr(
|
|
1301
|
+
`+r.slice(p)}function ss(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(l,a,h)=>{let r=n.slice(0,h);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,l,a,h){if(await E(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Te(n,l);let r=!e.__stxProcessingDepth;xn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(r&&a.runtimeConfig)await Tn(e,l,a.runtimeConfig);if(r)rl(e),e.__stx_scope_seq??={n:0,key:Js(String(e.__filename??l))},e.__stx_head_injections=Mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!A()&&!Pn())&&l&&l.endsWith(".stx"))Vo(n,l);try{return await fe.timeAsync("template-processing",async()=>{let p=await is(n,e,l,a,h);if(r)p=ki(p);if(r&&a.autoShell&&a.buildMode!=="compile"){let w=Re(a.app?.head,{known:Br,source:"app.head"}),S=(e.__stx_runtime_head||null)??ji(),v=(e.__stx_head_raw||"").trim(),k,C=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(C)k=C[1].trim(),v=v.replace(C[0],"").trim();let _=e.__sections?.title,P=_?R(_,e,l):void 0,I=S.title||k||P,L=!S.title&&(!!k||!!P),j=S.meta||[],B=new Set(j.map((G)=>pt(G)).filter(Boolean)),F={...w,...I&&{title:I},meta:[...(w.meta||[]).filter((G)=>!B.has(pt(G))),...j],link:[...w.link||[],...S.link||[]],script:[...w.script||[],...S.script||[]],headRaw:[w.headRaw,v].filter(Boolean).join(`
|
|
1302
|
+
`),...S.htmlAttrs&&{htmlAttrs:vl(w.htmlAttrs,S.htmlAttrs)},...S.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...S.bodyAttrs}}},q=Li(p);if(p=Lr(p,F,{...L&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},q),q)p=Sl(p,w),p=Mr(p,F.htmlAttrs);let H=p.match(/<!-- stx-layout: ([^ ]+) -->/);if(H&&p.includes("<head")){let G=H[1],le=Ls(G);p=p.replace(/<head\b[^>]*>/i,(Z)=>`${Z}
|
|
1303
|
+
<meta name="stx-layout" content="${hr(G)}">
|
|
1304
|
+
<meta name="stx-layout-group" content="${hr(le)}">`)}let N=p.match(/function (__stx_setup_\w+)\(/),U=N?V(p):null;if(N&&U&&!/\bdata-stx=/.test(U.tag)){p=nt(p,(le,Z)=>`<body${Z} data-stx="${N[1]}">`);let G=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${N[1]}"`,"i");p=p.replace(G,"$1")}}if(r){let w=e.__stx_head_injections??Mi(),b=xl(p);if(b!==null)w.beforeClose.push(b);let S=or(p);if(S!==null)w.afterOpen.push(S);if(a.offline?.enabled&&!p.includes("data-stx-offline"))w.beforeClose.push(ar);p=bl(p,w);let v=a.app?.colorMode;if(v)p=Dr(p,v)}if(r)if(_r(p,"data-stx-runtime")){let b=await es(p,a,h,e);p=ns(p,b.map((S)=>`
|
|
1305
1305
|
${S}`).join(""))}else{let b=await cr([p],a,h);if(b){let S=p.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(S!==-1)p=p.slice(0,S)+b+`
|
|
1306
|
-
`+p.slice(S)}}if(r)p=wl(p);if(r&&e.__stx_inject_css!==!1)p=await x(p,void 0,a.buildMode==="serve",!0);else if(r)p=wn(p);if(r)p=mt(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=ss(p),r&&e.__stx_runtime_config)p=Ht(p,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let w=Pr(e);if(w){let b=/<head\b[^>]*>/i.exec(p),S=b?b.index+b[0].length:0;p=p.slice(0,S)+w+p.slice(S)}}return p})}catch(p){if(p instanceof
|
|
1306
|
+
`+p.slice(S)}}if(r)p=wl(p);if(r&&e.__stx_inject_css!==!1)p=await x(p,void 0,a.buildMode==="serve",!0);else if(r)p=wn(p);if(r)p=mt(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=ss(p),r&&e.__stx_runtime_config)p=Ht(p,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let w=Pr(e);if(w){let b=/<head\b[^>]*>/i.exec(p),S=b?b.index+b[0].length:0;p=p.slice(0,S)+w+p.slice(S)}}return p})}catch(p){if(p instanceof Y)throw p;let w=p instanceof Error?p.message:String(p),b=new se(`Template processing failed: ${w}`,l,void 0,void 0,n.substring(0,200)+(n.length>200?"...":""));if(W.log(b,{filePath:l,context:e}),Rn.logDetailedError(b,{filePath:l,template:n.substring(0,500)}),A()&&!a.debug)console.error(`[stx] ${ae.relative(process.cwd(),l)||l}: ${b.message}`);if(a.debug)throw b;return Ni.createFallbackContent("Template Processing",b)}}async function is(n,e,l,a,h){let r=process.cwd(),p={...a,partialsDir:a.partialsDir&&!ae.isAbsolute(a.partialsDir)?ae.resolve(r,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ae.isAbsolute(a.componentsDir)?ae.resolve(r,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ae.isAbsolute(a.layoutsDir)?ae.resolve(r,a.layoutsDir):a.layoutsDir},w=p,b=n;await cs(l,e),as(e,w),b=await $e(()=>Zt(b,e,l,w),b,(H)=>{W.log(H,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${H.message}`)}),b=b.replace(/\{\{--[\s\S]*?--\}\}/g,"");let S=ye(b,Be,(H,N)=>`\x00STX_HTML_COMMENT_${N}\x00`);b=S.output;let v=S.tokens,k=(H)=>v.length===0?H:H.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(N,U)=>v[Number(U)]??""),C="\x00STX_ESCAPED_AT\x00",_="\x00STX_ESC_MUSTACHE_OPEN\x00",P="\x00STX_ESC_MUSTACHE_CLOSE\x00";b=b.replace(/@@/g,C),b=b.replace(/@\{\{([\s\S]*?)\}\}/g,(H,N)=>`${_}${N}${P}`),b=tr(b),b=await pr(b,l,h);let I={};b=ms(b,I);let L={...e.__sections||{}},j="",B=xt(kt(n)),F=/@nolayout\b/.test(b)||B===!1;if(/@nolayout\b/.test(b))b=b.replace(/@nolayout\b\s*/g,"");let q=b.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(q)j=q[1],b=b.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof B==="string"){if(j=B,!/@section\s*\(/.test(b))b=`@section('content')
|
|
1307
1307
|
${b.trim()}
|
|
1308
|
-
@endsection`}if(!j&&!
|
|
1308
|
+
@endsection`}if(!j&&!F&&w.defaultLayout){let H=An(b),N=/@section\s*\(/.test(b);if(!H||N){let U="",G=ae.dirname(l),le=w.layoutsDir?ae.dirname(w.layoutsDir):process.cwd();for(let Z=0;Z<20;Z++){let de=ae.join(G,"_layout.stx");if(await s(de)){U=de;break}let ce=ae.dirname(G);if(ce===G||ce.length<le.length)break;G=ce}if(U)j=U;else if(w.layoutsDir){let Z=ae.isAbsolute(w.layoutsDir)?w.layoutsDir:ae.resolve(process.cwd(),w.layoutsDir),de=ae.join(Z,`${w.defaultLayout}.stx`);if(await s(de))j=de}if(j&&!N)b=`@section('content')
|
|
1309
1309
|
${b.trim()}
|
|
1310
|
-
@endsection`}}if(j&&b.includes("<script")){let
|
|
1310
|
+
@endsection`}}if(j&&b.includes("<script")){let H=ee(b),N=H.scripts.map((U)=>vr(U,l)??U);b=Er(H.output,N)}if(b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,N,U)=>(L[N]=U,"")),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,N,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let G=d(U.trim(),e);if(G===void 0)return H;let Z=(e.__stx_inline_section_values??=[]).push(G)-1;return L[N]=`{{ __stx_inline_section_values[${Z}] }}`,""}catch{return H}}),b=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,N,U)=>{if(U.includes("@parent"))L[N]=U.replace("@parent",Me);else L[N]=U.trim();return""}),e.__sections=L,b=b.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,N,U)=>L[N]||U||""),!("slot"in e)||e.slot===void 0)b=b.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||"");if(b=hs(b,I),j){let H=[],N=ee(b),U=ye(N.output,bn,(G,le)=>`\x00STX_ORPHAN_STYLE_${le}\x00`);if(b=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(G,le,Z)=>{let de=le==="SCRIPT"?vr(N.scripts[Number(Z)],l):U.tokens[Number(Z)];if(de)H.push(de);return""}),H.length>0){let G=H.join(`
|
|
1311
1311
|
`);L.content=L.content?`${L.content}
|
|
1312
|
-
${
|
|
1313
|
-
${b}`,k(b)}catch(
|
|
1314
|
-
`;if(r=Z(r,e),r=de(r,e,l),r=Qt(r),r=Go(r,e),r=Mt(r),r=Kt(r),r=await gs(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=ki(r),r=
|
|
1312
|
+
${G}`:G,e.__sections=L}}if(j)try{let H;if(ae.isAbsolute(j))H=j,h.add(j);else H=await $e(()=>_n(j,l,p,h),null,()=>{throw new se(`Failed to resolve layout path: ${j}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ce=(J)=>{if(!J)return[];try{let ve=ae.isAbsolute(J)?J:ae.resolve(process.cwd(),J);return Jn.readdirSync(ve).filter((Ee)=>Ee.endsWith(".stx")).map((Ee)=>Ee.replace(/\.stx$/,""))}catch{return[]}},ne=[...ce(p.layoutsDir),...ce(p.fallbackLayoutsDir)].filter((J,ve,Ee)=>Ee.indexOf(J)===ve).sort(),we=[p.layoutsDir,p.fallbackLayoutsDir].filter((J)=>typeof J==="string"&&J.length>0),ge=we.length>0?` Searched: ${we.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${j} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+ge;if(W.log(Error(ie),{layoutPath:j,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),p.debug)throw new se(ie,l);return b}let N=await $e(()=>Bun.file(H).text(),"",()=>{throw new se(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});N=fr(N,H),N=N.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ce=[...U.slice(U.indexOf(H)),H];throw new se(ce.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ce.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let G=N.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(G){if(p.debug)console.log(`Found nested layout: ${G[1]} in ${H}`);let ce={},ne=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,J,ve)=>(ce[J]=ve.trim(),""));for(let[ie,J]of Object.entries(ce))if(L[ie]&&L[ie].includes(Me)){let ve=L[ie].indexOf(Me);L[ie]=L[ie].slice(0,ve)+J+L[ie].slice(ve+Me.length)}else if(!L[ie])L[ie]=J;let we={...e,__sections:L,__layoutChain:[...U,H]},ge=`@layout('${G[1]}')${ne}`;return await i(ge,we,H,p,h)}let le=N.replace(/\{\{--[\s\S]*?--\}\}/g,""),Z=ms(le,I),de={};return Z=Z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ce,ne,we)=>(de[ne]=we.trim(),`@slot('${ne}')`)),Z=Z.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ce,ne,we)=>{if(L[ne]){let ge=L[ne];if(ge.includes(Me)){let ie=de[ne]||"",J=ge.indexOf(Me);ge=ge.slice(0,J)+ie+ge.slice(J+Me.length)}return ge}return we||""}),Z=os(Z,L),Z=Z.replace(/\{\{\s*slot\s*\}\}/g,()=>L.content||""),Z=hs(Z,I),e.__originalFilePath=l,b=await $r(Z,e,H,p,h),b=`<!-- stx-layout: ${j} -->
|
|
1313
|
+
${b}`,k(b)}catch(H){if(H instanceof Y)throw H;throw new se(`Error processing layout ${j}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await $r(b,e,l,p,h))}function os(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return h||""})}function as(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,r]of Object.entries(process.env))if(h.startsWith(l)&&r!==void 0)a[h]=r;n.$env=a}async function cs(n,e){await $e(()=>Yt(n,e),void 0,(l)=>{W.log(l,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${l.message}`)})}var dt="data-stx-source";function vr(n,e){if(!n)return n;let l=/^<script\b([^>]*)>/i.exec(n);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(dt))return n;return`<script ${dt}="${encodeURIComponent(e)}"${n.slice(7)}`}function ls(n){let e=new RegExp(`${dt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function kr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Sr(n,e,l){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">${kr(n)}</span><span style="display:block;margin-top:4px">${kr(l)}</span></div>`}async function us(n,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-zpgj4asv.js")),r=[],p=!A()&&!Pn();for(let b of h(n)){let S=b.attrs;if(!/\bserver\b/.test(S))continue;let v=b.start+b.fullMatch.indexOf(">")+1,k=Cr(n,v);if(k===-1)continue;let C=n.slice(v,k);if(!C.trim())continue;let _=ls(S)??l,P={index:b.start,length:k+9-b.start};try{let{extractVariables:I}=await o("stx/variable-extractor",()=>import("./chunk-d4zcwtna.js"));await I(C,e,_,{preserveExisting:!0,onFailure:(L)=>{if(L.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:L.kind,message:L.message}),!p)return;r.push({...P,markup:Sr(_,L.kind,L.message)})}})}catch(I){let L=I instanceof Error?I:Error(String(I));if(W.log(L,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${L.message}`),p)r.push({...P,markup:Sr(_,"unknown",L.message)})}}if(r.length===0)return n;let w=n;for(let b of r.sort((S,v)=>v.index-S.index))w=w.slice(0,b.index)+b.markup+w.slice(b.index+b.length);return w}async function ds(n,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-h0nxd9xg.js"));return a(n,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return W.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),n}}async function $r(n,e,l,a,h){let r=n;await E();let p=a;if(r=await us(r,e,l,a),r=await Wt(r,e,l),r=await Xt(r,e,l),r=await ds(r,e,l),await E(),r=await Dt(r,e,l,p),Te(r))r=Zo(r,e),r=ks(r,e),r=Ss(r,e);r=Qo(r),await E();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-04f6r2kh.js"));r=w(r,e),r=await Ko(r,e,l,p,!0),await E(),r=await ir(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=Cc(r,e,l,p);let{processDeferDirectives:b}=await o("stx/defer",()=>import("./chunk-6pczzq5f.js"));r=b(r,e,l);let{processTeleportDirectives:S}=await o("stx/teleport",()=>import("./chunk-ba91r7q9.js"));r=S(r,e,l);let{processTransitionDirectives:v,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-7wqevtks.js"));r=v(r,e,l),r=k(r);let{processErrorBoundaryDirectives:C,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=C(r,e,l),r=_(r);let{processSuspenseDirectives:P}=await o("stx/suspense",()=>import("./chunk-j4zrq17p.js"));r=P(r,e,l);let{processAsyncDirectives:I}=await o("stx/async-components",()=>import("./chunk-f52b9hjv.js"));r=I(r,e,l);let{processKeepAliveDirectives:L}=await o("stx/keep-alive",()=>import("./chunk-meqsd5bt.js"));r=L(r,e,l);let{processVirtualListDirectives:j,processVirtualGridDirectives:B,processInfiniteListDirectives:F}=await o("stx/virtual-scrolling",()=>import("./chunk-2asyyky3.js"));r=j(r,e,l),r=B(r,e,l),r=F(r,e,l),await E();let{processPartialHydrationDirectives:q,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-3ryp43f3.js"));r=q(r,e,l),r=H(r);let{processComputedDirectives:N,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=N(r,e,l),r=U(r,e,l);let{processFormValidationDirectives:G}=await o("stx/forms-validation",()=>import("./chunk-eh1rdapx.js"));r=G(r,e,l);let{processHeadDirective:le,processTitleDirective:Z,processMetaDirective:de,resetHead:ce}=await o("stx/head",()=>import("./chunk-m4k6ndf5.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ce();let ne=le(r);if(r=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
|
|
1314
|
+
`;if(r=Z(r,e),r=de(r,e,l),r=Qt(r),r=Go(r,e),r=Mt(r),r=Kt(r),r=await gs(r,e,l,p,h),r=await bs(r,e,l,p,h),await E(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=ki(r),r=ue(r,e,l),r=ws(r),await E(),e.__stxProcessingDepth===1)r=sl(r,e);if(r=Zc(r,e,{filePath:l,buildMode:p.buildMode}),r=Xo(r,e),r=Jo(r,e),r=Ze(r,e),r=Ft(r,e),r=Ut(r,e),r=await St(r,e,l,p),r=await Tc(r,e,l),r=await Rc(r,e,l,p),await E(),r=Ac(r,e,l,p),r=ii(r,e,l,p),r=ai(r,e,l),r=ci(r,e,l,p),r=At(r,e,l,p),r=Gs(r,e),r=Xs(r),r=el(r),!p.skipEventDirectives)r=Hc(r,e,l);if(r=Qc(r,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await E(),p.debug){let z=/\bx-data\s*=/.test(r),K=xs(n);if(z&&K)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1315
1315
|
Both work on the same page, but they manage separate scopes.
|
|
1316
|
-
Prefer signals (state/derived/effect) for new components.`)}r=vc(r,e),r=await Ai(r,e,l),await E(),r=tl(r),r=nl(r),r=wt(r);let{processXElementDirectives:we}=await o("stx/x-element",()=>import("./chunk-b666d8m6.js"));r=we(r);let ge=e.__originalFilePath||l,ie=ze(e);if(r=await ei(r,p,ge,ie),await E(),r=jt(r,e),r=await Jt(r,e,l,p),await E(),p.media?.image?.autoSiblings){let
|
|
1317
|
-
${
|
|
1316
|
+
Prefer signals (state/derived/effect) for new components.`)}r=vc(r,e),r=await Ai(r,e,l),await E(),r=tl(r),r=nl(r),r=wt(r);let{processXElementDirectives:we}=await o("stx/x-element",()=>import("./chunk-b666d8m6.js"));r=we(r);let ge=e.__originalFilePath||l,ie=ze(e);if(r=await ei(r,p,ge,ie),await E(),r=jt(r,e),r=await Jt(r,e,l,p),await E(),p.media?.image?.autoSiblings){let z=p.publicDir||"public",{rewriteImagesWithSiblings:K}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-ytzzth34.js"));r=await K(r,{publicDir:z})}if(p.seo?.enabled)r=li(r,e,p);let J=(z,K,Q=!0)=>{if(!K)return z;let be=K.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(z),me=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&me){if(Q){let De=oe.index+me.index;z=z.slice(0,De)+be[0]+z.slice(De+me[0].length)}if(K=K.replace(be[0],"").trim(),!K)return z}if(/<\/head>/i.test(z))return f(z,K);if(/<head\b[^>]*>/i.test(z))return z.replace(/(<head\b[^>]*>)/i,`$1
|
|
1317
|
+
${K}`);if(/<html\b[^>]*>/i.test(z))return z.replace(/(<html\b[^>]*>)/i,`$1
|
|
1318
1318
|
<head>
|
|
1319
|
-
${
|
|
1320
|
-
</head>`);return
|
|
1319
|
+
${K}
|
|
1320
|
+
</head>`);return z},{renderHead:ve,getHead:Ee}=await o("stx/head",()=>import("./chunk-m4k6ndf5.js")),Pe=e.__stx_runtime_head??Ee();if(Pe.title||Pe.meta?.length||Pe.link?.length){let z=ve(Pe);if(z)r=J(r,z)}if(ne.headContent)r=J(r,ne.headContent,!Pe.title);if(p.csp?.enabled&&p.csp.addMetaTag)r=_t(r,p.csp,e);if(p.analytics?.enabled)r=vt(r,p);if(p.heatmap?.enabled)r=Ec(r,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:z}=await o("stx/pwa/inject",()=>import("./chunk-ps6m8n9n.js"));r=z(r,p)}let Tr=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(r),Ar=/\bSTX\.\w+/.test(r),Rr=/window\.STX\s*=/.test(r);if(Tr&&Ar&&!Rr){let K=`<script data-stx-scoped data-stx-run="once">
|
|
1321
1321
|
${ht()}
|
|
1322
|
-
</script>`;if(r.includes("</head>")){let
|
|
1323
|
-
`+De}else r=f(r,
|
|
1324
|
-
${
|
|
1325
|
-
`+r}{let{scanScriptTags:
|
|
1326
|
-
`+r.slice(
|
|
1322
|
+
</script>`;if(r.includes("</head>")){let Q=D(r),oe=r.slice(0,Q).indexOf("<script");if(oe!==-1){let me=r.slice(0,oe),De=r.slice(oe);r=me+K+`
|
|
1323
|
+
`+De}else r=f(r,K)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
1324
|
+
${K}`);else r=K+`
|
|
1325
|
+
`+r}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-zpgj4asv.js")),K=[];for(let Q of z(r)){if(!/\bserver\b/i.test(Q.attrs))continue;let be=Q.start+Q.fullMatch.indexOf(">")+1,oe=Cr(r,be);if(oe===-1)continue;let me=oe+9;while(me<r.length&&/\s/.test(r[me]))me++;K.push({start:Q.start,end:me})}if(K.length>0){let Q=Array(K.length+1),be=0;for(let oe=0;oe<K.length;oe++){let{start:me,end:De}=K[oe];Q[oe]=r.slice(be,me),be=De}Q[K.length]=r.slice(be),r=Q.join("")}}let ft=qs(r,l);if(ft.hasScoped)r=ft.html;let Ir=e.__stx_event_bindings||[],Qe=!1,gt=[],Or=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:jr}=await o("stx/signal-processing",()=>import("./chunk-zpgj4asv.js"));for(let z of jr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))gt.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:K,content:Q}of gt){Qe=!0;let be=Q;je(Q,l,a.strict,e.__originalFilePath);let oe=await He(Q,{eventBindings:Ir,attrs:K,hasColonDirectives:Or,templateContent:n,filePath:l,projectRoot:process.cwd(),production:Bi(a.buildMode,a.minifyClient),serverData:ie});r=r.replace(z,()=>oe)}if(Qe)e.__stx_event_bindings=[];if(!Qe&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let K=hi(z);if(K){let Q=c(r);r=Q===-1?r+K:r.slice(0,Q)+K+`
|
|
1326
|
+
`+r.slice(Q)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!ke(r)&&Sc(r))r=await mr(r,p);if(r=kc(r),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")r=Tt(r,e.cspNonce);return r}
|
|
1327
1327
|
export{kt,Ne,hc,ps,zo,Ho,cr,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zh,vs,Yo,xs,fr,Zo,Qo,Zf,Ss,ks,_s,ei,xc,Qf,Ct}from"./chunk-
|
|
2
|
+
import{Zh,vs,Yo,xs,fr,Zo,Qo,Zf,Ss,ks,_s,ei,xc,Qf,Ct}from"./chunk-sew1z7cv.js";import"./chunk-q58f5wk2.js";import"./chunk-311mrz2n.js";import"./chunk-y0msz738.js";import"./chunk-sb3dx4dd.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-sbvkk4cn.js";import"./chunk-dy7vqv1x.js";import{K}from"./chunk-hze3158c.js";import"./chunk-w1rrfj39.js";import"./chunk-60yppcbb.js";import"./chunk-0tyyad6q.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Zf as bindLoopInterpolations,Zh as clearScriptScanCache,Ss as convertServerLoopAttributesToDirectives,Zo as convertSignalDirectivesToAttributes,ks as convertSignalLoopsToAttributes,fr as extractClientSignalNames,K as extractExports,xc as findMarkupIndexOutsideScripts,xs as hasSignalsSyntax,Yo as parseLoopExpression,Qo as preEvalLiteralReactiveIfs,_s as processScriptSetup,ei as processSignals,Qf as rewriteStxImportSpecifiers,vs as scanScriptTags,Ct as stripStxRuntimeImports};
|