@stacksjs/stx 0.2.681 → 0.2.683
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-19kc8xnw.js → chunk-0h22d9cb.js} +1 -1
- package/dist/{chunk-6xtzsw17.js → chunk-0t65m9nw.js} +1 -1
- package/dist/{chunk-9fnt6q57.js → chunk-1dbw2j4q.js} +1 -1
- package/dist/{chunk-rxmmrafq.js → chunk-246k73ga.js} +1 -1
- package/dist/chunk-29c177cz.js +2 -0
- package/dist/{chunk-haqbkrdk.js → chunk-2rvprm39.js} +1 -1
- package/dist/{chunk-j3qcxtvc.js → chunk-3353tc28.js} +4 -4
- package/dist/{chunk-g2h12kza.js → chunk-3vgfwsft.js} +2 -2
- package/dist/{chunk-hy4j4r8a.js → chunk-3waphqhe.js} +1 -1
- package/dist/{chunk-0kk86z2m.js → chunk-551vqymy.js} +1 -1
- package/dist/{chunk-pfvjqvzd.js → chunk-56w1njc8.js} +6 -6
- package/dist/{chunk-2efy5ftv.js → chunk-5wpny9k3.js} +5 -5
- package/dist/chunk-6rrr362d.js +2 -0
- package/dist/{chunk-d2z2kvyj.js → chunk-70fdw728.js} +1 -1
- package/dist/{chunk-7afqwh0m.js → chunk-7fgsqs43.js} +2 -2
- package/dist/{chunk-8fetb3cr.js → chunk-840aejkc.js} +27 -27
- package/dist/chunk-8s10jjf1.js +2 -0
- package/dist/chunk-979g7g0r.js +2 -0
- package/dist/{chunk-9nzx4fv4.js → chunk-aenajaxk.js} +1 -1
- package/dist/{chunk-zcht5y0v.js → chunk-bsvwzma0.js} +1 -1
- package/dist/chunk-c3dqsjv0.js +2 -0
- package/dist/{chunk-0w1132a5.js → chunk-cd6s5k6e.js} +1 -1
- package/dist/{chunk-gvpwc9hr.js → chunk-cfbev664.js} +1 -1
- package/dist/{chunk-3cr308sm.js → chunk-d2nkm1jt.js} +1 -1
- package/dist/{chunk-5s9pjs20.js → chunk-d4f6dkrt.js} +1 -1
- package/dist/{chunk-avthzrdg.js → chunk-drd4t5v4.js} +2 -2
- package/dist/chunk-e1fgpb46.js +2 -0
- package/dist/{chunk-6aahems6.js → chunk-ff3d0eh9.js} +1 -1
- package/dist/{chunk-ar4yk1rk.js → chunk-g93jkztp.js} +1 -1
- package/dist/{chunk-5cvdc2a0.js → chunk-gny4j06b.js} +1 -1
- package/dist/{chunk-0c6ag7mk.js → chunk-gtktv6nn.js} +2 -2
- package/dist/chunk-hfk17t81.js +2 -0
- package/dist/{chunk-y5ase5av.js → chunk-j87n6mh0.js} +2 -2
- package/dist/chunk-jf717wps.js +2 -0
- package/dist/{chunk-gfa0dxjd.js → chunk-jg4932ma.js} +1 -1
- package/dist/{chunk-esz22r0a.js → chunk-js8ytnrn.js} +1 -1
- package/dist/{chunk-144wmtba.js → chunk-kbagpk8a.js} +1 -1
- package/dist/{chunk-a358zpqd.js → chunk-kbt9r41q.js} +1 -1
- package/dist/{chunk-wqn17d09.js → chunk-kq8t4xn9.js} +2 -2
- package/dist/chunk-mjqf15e7.js +2 -0
- package/dist/chunk-p1a6y65v.js +2 -0
- package/dist/{chunk-5yc7btc2.js → chunk-p21prjzh.js} +1 -1
- package/dist/{chunk-aezxgrd2.js → chunk-pqg3ghvh.js} +1 -1
- package/dist/{chunk-5ha6gkfr.js → chunk-px9p7q26.js} +4 -4
- package/dist/{chunk-3h7k7cnr.js → chunk-q7z1ybcn.js} +1 -1
- package/dist/{chunk-a2fa9aj4.js → chunk-qjccq0yd.js} +7 -7
- package/dist/{chunk-x65g450d.js → chunk-qpvasda5.js} +1 -1
- package/dist/{chunk-4nst5nj4.js → chunk-qq40hxg9.js} +60 -60
- package/dist/chunk-sk2ae1qj.js +2 -0
- package/dist/chunk-smdxvjhn.js +25 -0
- package/dist/{chunk-793qv470.js → chunk-sme7phry.js} +3 -3
- package/dist/{chunk-1x0jwz8m.js → chunk-t0644y3k.js} +2 -2
- package/dist/{chunk-ms9v5tc9.js → chunk-t257ye4c.js} +1 -1
- package/dist/chunk-thkw9ez9.js +54 -0
- package/dist/{chunk-km92eh3c.js → chunk-tkypg1xx.js} +1 -1
- package/dist/{chunk-q7v05zcy.js → chunk-w1wzydvp.js} +1 -1
- package/dist/chunk-wbn3x66p.js +2 -0
- package/dist/{chunk-a6h6ansh.js → chunk-xv8yy1cz.js} +5 -5
- package/dist/{chunk-yzf8g9h1.js → chunk-yfr4tsn1.js} +2 -2
- package/dist/chunk-yq9dtdkn.js +2 -0
- package/dist/{chunk-r8xzqz8z.js → chunk-yrq24gyy.js} +3 -3
- package/dist/chunk-yxy3brpr.js +2 -0
- package/dist/chunk-z9xhpkn6.js +2 -0
- package/dist/{chunk-ekztn3f5.js → chunk-zj5x4yk2.js} +2 -2
- package/dist/{chunk-ab5fc7cj.js → chunk-zx468wjw.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/dist/utils.js +13 -1
- package/package.json +5 -5
- package/dist/chunk-1h995e54.js +0 -2
- package/dist/chunk-4vxe0605.js +0 -54
- package/dist/chunk-540jj8a7.js +0 -2
- package/dist/chunk-5b1q41vy.js +0 -2
- package/dist/chunk-877tm3sp.js +0 -2
- package/dist/chunk-8q3j4jxr.js +0 -2
- package/dist/chunk-9cmmdbzc.js +0 -25
- package/dist/chunk-d3qxmety.js +0 -2
- package/dist/chunk-ehe5f2yn.js +0 -2
- package/dist/chunk-gjaqez01.js +0 -2
- package/dist/chunk-gr1331xc.js +0 -2
- package/dist/chunk-hsgbsj0g.js +0 -2
- package/dist/chunk-j7rzh56k.js +0 -2
- package/dist/chunk-me4f7ekt.js +0 -2
- package/dist/chunk-mndxjbmy.js +0 -2
- package/dist/chunk-ythdsen4.js +0 -2
- package/dist/chunk-zc6bkctv.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ro,Aa,s,Tt,se,
|
|
2
|
+
import{Ro,Aa,s,Tt,se,k,Pe,cn,Ie,de,K,cr,ln,ms,za,dn,dr,ys,bs,Ha,Do,Va,Ua,Wa,qa,Ne,De,vs,je,n,gn,m,d,V,Y,we,x,_}from"./chunk-qq40hxg9.js";import{l,p,E,t,ie,U,a,xe,qo,D,bn,Go,Lt,Ko,oc,mr,ic,rt,ac,hr,cc,vn,Xo,lc,yr,vr,Se,Jo}from"./chunk-w28wc7mv.js";import{Nt}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-gny4j06b.js";import{h}from"./chunk-t0644y3k.js";import{rr,os}from"./chunk-gymmbbzc.js";import{ga,ma,er,Je,ha,R}from"./chunk-zj5x4yk2.js";import{wo,xo,So,ko}from"./chunk-nbjyed3q.js";import{la,Vr}from"./chunk-kbt9r41q.js";import{Br,Fr,zr}from"./chunk-thkw9ez9.js";import{Ur,po,fo,Wr,qr,go}from"./chunk-drd4t5v4.js";import{jr,Kn}from"./chunk-smdxvjhn.js";import{ro}from"./chunk-9bgb9n12.js";import{re,ao,co,lo}from"./chunk-2a1eeywj.js";import{Jn,he,da,Yn,pa}from"./chunk-px9p7q26.js";import{G,Ke}from"./chunk-jkywbfb0.js";import{ya,ba}from"./chunk-cfbev664.js";import{C,wn,Yo}from"./chunk-2ajbhefk.js";import gs from"fs";import ce from"path";function lt(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -347,7 +347,7 @@ else {
|
|
|
347
347
|
|
|
348
348
|
console.log('[stx] Lifecycle runtime initialized');
|
|
349
349
|
})();
|
|
350
|
-
`}function Ge(i){return Symbol(i)}var Rs=Ge("theme"),Ms=Ge("router"),Ds=Ge("i18n");import*as dt from"crypto";function ut(i){let e=/\$(\w+)\./g,u=[],c;while((c=e.exec(i))!==null)if(!u.includes(c[1]))u.push(c[1]);return u}function In(){return`stx-${dt.randomBytes(4).toString("hex")}`}function On(i){return/\$\w+\./.test(i)}function Pn(i){if(!/\{\{[^}]*\$\w/.test(i)||!/\$\w+\./.test(i))return{html:i,bindings:[],stores:new Set};let e=[],u=new Set,c=/<(\w+)([^>]*?)(\s*\/?>)/g,g=i;return g=g.replace(c,(r,f,v,y)=>{if(["script","style","template"].includes(f.toLowerCase()))return r;if(!v.includes("{{"))return r;let
|
|
350
|
+
`}function Ge(i){return Symbol(i)}var Rs=Ge("theme"),Ms=Ge("router"),Ds=Ge("i18n");import*as dt from"crypto";function ut(i){let e=/\$(\w+)\./g,u=[],c;while((c=e.exec(i))!==null)if(!u.includes(c[1]))u.push(c[1]);return u}function In(){return`stx-${dt.randomBytes(4).toString("hex")}`}function On(i){return/\$\w+\./.test(i)}function Pn(i){if(!/\{\{[^}]*\$\w/.test(i)||!/\$\w+\./.test(i))return{html:i,bindings:[],stores:new Set};let e=[],u=new Set,c=/<(\w+)([^>]*?)(\s*\/?>)/g,g=i;return g=g.replace(c,(r,f,v,y)=>{if(["script","style","template"].includes(f.toLowerCase()))return r;if(!v.includes("{{"))return r;let S=[],b=!1,w=v,T=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,A=[...v.matchAll(T)];for(let I of A){let P=I[0],N=I[1],F=I[2];if(On(F)){b=!0;let z=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(z){let L=z[1];if(S.push({attr:N,expr:L,fullMatch:P,originalAttr:N}),ut(L).forEach((H)=>u.add(H)),N==="text")w=w.replace(P,"");else if(N==="class")w=w.replace(P,'class=""');else if(N==="disabled"||N==="hidden")w=w.replace(P,"");else w=w.replace(P,`${N}=""`)}}}if(!b)return r;let O=w.match(/\bid\s*=\s*"([^"]+)"/),M;if(O)M=O[1];else M=In(),w=` id="${M}"${w}`;for(let I of S)e.push({elementId:M,attribute:I.attr,expression:I.expr,stores:ut(I.expr)});return`<${f}${w}${y}`}),{html:g,bindings:e,stores:u}}function Ln(i,e){if(i.length===0)return"";let u=Array.from(e),c=`
|
|
351
351
|
<script>
|
|
352
352
|
(function() {
|
|
353
353
|
'use strict';
|
|
@@ -562,7 +562,7 @@ ${e.inlineScript}
|
|
|
562
562
|
`;if(!e.scriptUrl)return"";let u=[];if(e.scriptId)u.push(`id="${pe(e.scriptId)}"`);if(e.attributes)for(let[g,r]of Object.entries(e.attributes))u.push(`${pe(g)}="${pe(r)}"`);return`
|
|
563
563
|
<!-- Custom Analytics -->
|
|
564
564
|
<script${u.length>0?` ${u.join(" ")}`:""} src="${pe(e.scriptUrl)}" defer></script>
|
|
565
|
-
`}function ft(i,e){let u=jn(e);if(!u)return i;if(!i.includes("</head>")){let c=i.lastIndexOf("</body>");if(c!==-1)return i.slice(0,c)+u+i.slice(c);return i+u}return i.replace("</head>",`${u}</head>`)}function pe(i){return i.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function gt(i){let e=i.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function mt(i){let e=i?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}var Vn=0,zn=0;function ht(i,e){let u=i.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));if(u)return u[1];let c=i.match(new RegExp(`${e}\\s*=\\s*'([^']*)'`,"i"));if(c)return c[1];return null}function Wn(i){let e=[],u=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,c;while((c=u.exec(i))!==null){let[g,r,f]=c,v=c.index,y=ht(f,"x-data");if(!y)continue;let
|
|
565
|
+
`}function ft(i,e){let u=jn(e);if(!u)return i;if(!i.includes("</head>")){let c=i.lastIndexOf("</body>");if(c!==-1)return i.slice(0,c)+u+i.slice(c);return i+u}return i.replace("</head>",`${u}</head>`)}function pe(i){return i.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function gt(i){let e=i.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function mt(i){let e=i?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}var Vn=0,zn=0;function ht(i,e){let u=i.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));if(u)return u[1];let c=i.match(new RegExp(`${e}\\s*=\\s*'([^']*)'`,"i"));if(c)return c[1];return null}function Wn(i){let e=[],u=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,c;while((c=u.exec(i))!==null){let[g,r,f]=c,v=c.index,y=ht(f,"x-data");if(!y)continue;let S=`__stx_scope_${Vn++}`,b=ht(f,"x-init"),w=Xn(i,r,v+g.length),T=i.slice(v,w.endIndex),A=Gn(T);e.push({id:S,selector:`[data-stx-scope="${S}"]`,stateExpr:y,initExpr:b,bindings:[],refs:A})}return e}function Xn(i,e,u){let c=1,g=u,r=new RegExp(`<${e}(?:\\s|>)`,"gi"),f=new RegExp(`</${e}>`,"gi"),v=new RegExp(`<${e}[^>]*/\\s*>`,"gi");while(c>0&&g<i.length){r.lastIndex=g,f.lastIndex=g,v.lastIndex=g;let y=r.exec(i),S=f.exec(i),b=v.exec(i);if(b&&b.index<(y?.index??1/0)){g=b.index+b[0].length;continue}if(!S)return{endIndex:i.length};if(y&&y.index<S.index)c++,g=y.index+y[0].length;else{if(c--,c===0)return{endIndex:S.index+S[0].length};g=S.index+S[0].length}}return{endIndex:i.length}}function Gn(i){let e=new Map,u=i.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),c=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,g;while((g=c.exec(u))!==null){let[,r,f]=g,v=Zn(r);e.set(f,v)}return e}function Zn(i){let e=i.match(/\bid\s*=\s*["']([^"']*)["']/);if(e)return e[1];return`__stx_el_${zn++}`}function Qn(){return`
|
|
566
566
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
567
567
|
(function() {
|
|
568
568
|
var style = document.createElement('style');
|
|
@@ -815,7 +815,7 @@ window.__stx_reactive = (function() {
|
|
|
815
815
|
|
|
816
816
|
return { initScope: initScope, reactive: reactive };
|
|
817
817
|
})();
|
|
818
|
-
`}function yt(i,e){let u=i.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let
|
|
818
|
+
`}function yt(i,e){let u=i.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let S=_(y,e,!0);if(S===void 0)return v;return String(S)}catch{return v}}),c="",g=0,r=null;while(g<u.length){let v=u[g];if(r&&v==="\\"){c+=v+(u[g+1]??""),g+=2;continue}if(v==="{"&&u[g+1]==="{"){let y=u.indexOf("}}",g+2);if(y!==-1){let S=u.slice(g,y+2);c+=f(u.slice(g+2,y),S,r),g=y+2;continue}}if(r){if(v===r)r=null}else if(v==="'"||v==='"'||v==="`")r=v;c+=v,g++}return c;function f(v,y,S){let b;try{b=_(v,e,!0)}catch{return y}if(b===void 0)return y;if(S){let w=String(b).replace(/\\/g,"\\\\").replace(new RegExp(S==="`"?"`":S,"g"),`\\${S}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return S==="`"?w.replace(/\$\{/g,"\\${"):w}if(typeof b==="string"){let w=b.trim();if(w.startsWith("{")&&w.endsWith("}")||w.startsWith("[")&&w.endsWith("]"))try{return JSON.parse(w),w}catch{}}return JSON.stringify(b)}}function tr(i,e){if(i.length===0)return"";let u=i.map((c)=>{let g=JSON.stringify(Object.fromEntries(c.refs)),r=yt(c.stateExpr,e),f=c.initExpr?yt(c.initExpr,e):null,v=JSON.stringify(r),y=f?JSON.stringify(f):"null";return`
|
|
819
819
|
(function() {
|
|
820
820
|
var scopeEl = document.querySelector('${c.selector}');
|
|
821
821
|
if (!scopeEl) return;
|
|
@@ -827,24 +827,24 @@ window.__stx_reactive = (function() {
|
|
|
827
827
|
${Qn()}
|
|
828
828
|
${u}
|
|
829
829
|
</script>`}function vt(i,e,u){if(!sr(i))return i;let c=Wn(i);if(c.length===0)return i;let g=nr(i,c),r=tr(c,e),f=g.lastIndexOf("</body>");if(f!==-1)g=g.slice(0,f)+r+`
|
|
830
|
-
`+g.slice(f);else g+=r;return g}function nr(i,e){let u=0,c=i.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(g,r,f)=>{let v=e[u++];if(!v)return g;let y=/data-stx-scope="([^"]*)"/.exec(f);if(y)return v.id=y[1],v.selector=`[data-stx-scope="${v.id}"]`,g;return`<${r} data-stx-scope="${v.id}"${f}>`});return c=c.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),c=c.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),c=c.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),c=c.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),c}function sr(i){return/x-data\s*=\s*["']/.test(i)}import ir from"fs";import Ze from"path";import{createHighlighter as or}from"ts-syntax-highlighter";var Qe=new Map;async function $e(i,e={}){try{if(!await n(i))throw Error(`Markdown file not found: ${i}`);let c=(await ir.promises.stat(i)).mtime.getTime();if(e.cache&&Qe.has(i)){let w=Qe.get(i);if(w.updatedAt>=c)return{content:w.content,data:w.data}}let g=await Bun.file(i).text(),{data:r,content:f}=er(g),v=e.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},
|
|
831
|
-
${g}`)}function $t(i,e){let u=i;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(c,g)=>{if(g.includes("nonce="))return c;return`<script nonce="${e}"${g}>`}),u=u.replace(/<style([^>]*)>/gi,(c,g)=>{if(g.includes("nonce="))return c;return`<style nonce="${e}"${g}>`}),u}function Et(i,e,u,c){let g=i,r=c.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let f=r.useNonce?Ue(e,r):void 0;return kt(r.directives,f)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ue(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ue(e,r);return g}import pr from"crypto";var fr=40,_t="_token",Ye=null;function gr(i=fr){let e=pr.randomBytes(Math.ceil(i/2)).toString("hex").slice(0,i);return Ye=e,e}function br(){if(!Ye)gr();return Ye}function wr(i=_t){let e=br();return`<input type="hidden" name="${i}" value="${e}">`}function Ct(i){return i.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,c)=>wr(c||_t))}async function At(i,e,u,c){if(!c.customDirectives||c.customDirectives.length===0)return i;let g=i;for(let r of c.customDirectives){if(!r.name||typeof r.handler!=="function"){if(c.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await xr(g,r,e,u,c);else g=await kr(g,r,e,u,c)}return g}async function xr(i,e,u,c,g){let{name:r,handler:f}=e,v=`@${r}`,y=`@end${r}`,x=i,b=Tt(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),w=[],T=b.exec(x);while(T!==null){let[A,O="",M=""]=T,I=T.index||0;try{let P=O?Rt(e,O):[],N=M.trim(),F=await f(N,P,u,c);w.push({original:A,processed:F,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(g.debug)console.error(`Error processing custom directive @${r}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${r}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(x)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];x=x.replace(O,M)}return x}async function kr(i,e,u,c,g){let{name:r,handler:f}=e,v=i,y=[],x=[];if(e.rawParams){for(let T of Go(v,Tt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(T.end!==-1)x.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=Tt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)x.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of x)try{let M=Rt(e,A),I=await f("",M,u,c);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${r}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=Tt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await f("",[],u,c);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(g.debug)console.error(`Error processing custom directive @${r}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${r}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(i,e){return i.rawParams?Lt(e):Sr(e)}function Sr(i){if(!i.trim())return[];let e=[],u="",c=!1,g="";for(let r=0;r<i.length;r++){let f=i[r];if((f==='"'||f==="'")&&(r===0||i[r-1]!=="\\"))if(!c)c=!0,g=f;else if(f===g)c=!1;else u+=f;else if(f===","&&!c)e.push(u.trim()),u="";else u+=f}if(u.trim())e.push(u.trim());return e.map((r)=>{let f=r.trim();if(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))return f.substring(1,f.length-1);return f})}var Mt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dt=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function ke(i,e){if(typeof i!=="string"||i.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(i){if(!i||typeof i!=="object"||Array.isArray(i))throw Error("@appearanceBootstrap expects an options object");let e=i,{appearance:u,colorMode:c}=e;if(ke(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap colorMode must be an object");if(ke(c.key,"colorMode.key"),ke(c.attribute,"colorMode.attribute"),ke(c.default,"colorMode.default"),!Dt.test(c.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(c.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(c.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(u){if(ke(u.key,"appearance.key"),ke(u.attribute,"appearance.attribute"),ke(u.default,"appearance.default"),!Dt.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:c.key,attribute:c.attribute,default:c.default},respectExisting:e.respectExisting===!0}}function _r(i){return JSON.stringify(i).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(i){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(i)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(i,e){let u=1,c=null,g=!1;for(let r=e+1;r<i.length;r++){let f=i[r];if(g){g=!1;continue}if(c){if(f==="\\")g=!0;else if(f===c)c=null;continue}if(f==='"'||f==="'"||f==="`"){c=f;continue}if(f==="(")u++;else if(f===")"&&--u===0)return r}return-1}function It(i,e){let u=i,c=/@appearanceBootstrap\s*\(/g,g;while((g=c.exec(u))!==null){let r=g.index+g[0].length-1,f=Cr(u,r);if(f===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(r+1,f).trim(),y=l(`(${v})`,e),x=Tr(Er(y));u=u.slice(0,g.index)+x+u.slice(f+1),c.lastIndex=g.index+x.length}return u}import Ar from"crypto";function Z(i){return V(String(i??""))}var Pt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(i,e,u,c){let g=i||e;return u?`${g} ${c}`:g}function ge(i){return String(i).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ae(i,e){if(/\bid\s*=/i.test(i))return"";return` id="${Z(e)}"`}function et(i,e,u){if(!e)return"";let c="";if(!/\baria-invalid\s*=/i.test(u))c+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))c+=` aria-describedby="${Z(`${ge(i)}-error`)}"`;return c}function Rr(){return Ar.randomUUID()}function ze(i,e){let u=i;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let c=Rr();e.csrf={token:c}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Z(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(c,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Z(r)}">`;return c}),u}function jt(i,e,u=Pt){let c=i;return c=c.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,f,v,y,x="")=>{let b=r||f||"POST",w=v||y||"",T=ye(x),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Z(O)}" action="${Z(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
830
|
+
`+g.slice(f);else g+=r;return g}function nr(i,e){let u=0,c=i.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(g,r,f)=>{let v=e[u++];if(!v)return g;let y=/data-stx-scope="([^"]*)"/.exec(f);if(y)return v.id=y[1],v.selector=`[data-stx-scope="${v.id}"]`,g;return`<${r} data-stx-scope="${v.id}"${f}>`});return c=c.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),c=c.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),c=c.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),c=c.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),c}function sr(i){return/x-data\s*=\s*["']/.test(i)}import ir from"fs";import Ze from"path";import{createHighlighter as or}from"ts-syntax-highlighter";var Qe=new Map;async function $e(i,e={}){try{if(!await n(i))throw Error(`Markdown file not found: ${i}`);let c=(await ir.promises.stat(i)).mtime.getTime();if(e.cache&&Qe.has(i)){let w=Qe.get(i);if(w.updatedAt>=c)return{content:w.content,data:w.data}}let g=await Bun.file(i).text(),{data:r,content:f}=er(g),v=e.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},S=Je(f,{gfm:!0});if(v.syntaxHighlighting?.enabled&&v.syntaxHighlighting?.serverSide)S=await ar(S,v.syntaxHighlighting?.defaultTheme||"github-dark",v.syntaxHighlighting?.highlightUnknownLanguages||!1);let b={content:S,data:r||{}};if(e.cache)Qe.set(i,{...b,updatedAt:c});return b}catch(u){if(e.debug)console.error(`Error reading/parsing markdown file ${i}:`,u);let c=u instanceof Error?u.message:String(u);return{content:m("Markdown File",`Error reading/parsing markdown file: ${c}`,i,"",0,""),data:{}}}}var qe=null;async function ar(i,e,u){let c=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!qe)try{qe=await or({theme:e||"github-dark",cache:!0})}catch(v){return console.error("Failed to initialize ts-syntax-highlighter:",v),i}let g=async(v,y,S,b)=>{let w=b.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),T=S||(u?"text":"");if(!T)return v;try{if(!qe.getSupportedLanguages().includes(T))return v;return(await qe.highlight(w,T,{theme:e})).html}catch(A){console.error(`Error highlighting code block with language ${S}:`,A)}return v},r=i,f=i.matchAll(c);for(let v of f){let[y,S,b,w]=v,T=await g(y,S,b,w);r=r.replace(y,T)}return r}async function bt(i,e,u="",c={}){return await lr(i,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(f,v,y,S)=>{try{let b=v;if(!Ze.isAbsolute(v))b=Ze.resolve(Ze.dirname(u),v);let w={};if(y)try{try{w=JSON.parse(y)}catch{if(c.debug)console.warn("Using safer alternative for parsing JS object literal");let N=y.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of N){let z=F.indexOf(":");if(z>0){let L=F.substring(0,z).trim(),j=F.substring(z+1).trim(),H=j.startsWith('"')&&j.endsWith('"'),W=j.startsWith("'")&&j.endsWith("'");if(H||W)j=j.substring(1,j.length-1);w[L]=j}}}}catch(P){if(c.debug)console.error("Error parsing context in @markdown-file directive:",P)}let{content:T,data:A}=await $e(b,c),O={...e,...A,...w},M=T,I=/\{\{([^}]+)\}\}/g;return M=M.replace(I,(P,N)=>{let F=N.trim();return O[F]!==void 0?String(O[F]):P}),M}catch(b){let w=b instanceof Error?b.message:String(b);return m("Markdown File",`Error including markdown file: ${w}`,u,i,S,f)}})}async function lr(i,e,u){let c=[],g;while((g=e.exec(i))!==null){let v=g[0],y=g.index,S=g;c.push(u(...S).then((b)=>({match:v,replacement:b,index:y})))}let r=await Promise.all(c);r.sort((v,y)=>y.index-v.index);let f=i;for(let{match:v,replacement:y}of r)f=f.replace(v,()=>y);return f}var wt=new WeakMap;function xt(i=16){let e=new Uint8Array(i);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ue(i,e){if(!i)return e?.nonceGenerator?.()??xt();let u=wt.get(i);if(!u)u=e?.nonceGenerator?.()??xt(),wt.set(i,u);return u}function ur(i,e){let u=[];for(let[c,g]of Object.entries(i)){if(g===void 0||g===null)continue;if(typeof g==="boolean"){if(g)u.push(c);continue}if(Array.isArray(g)){let r=[...g];if(e&&(c==="script-src"||c==="style-src"))r=r.filter((f)=>!f.startsWith("'nonce-")),r.push(`'nonce-${e}'`);if(r.length>0)u.push(`${c} ${r.join(" ")}`)}}return u.join("; ")}function kt(i,e){return`<meta http-equiv="Content-Security-Policy" content="${ur(i,e).replace(/&/g,"&").replace(/"/g,""")}">`}function St(i,e,u){if(!e.enabled||!e.addMetaTag)return i;if(i.includes('http-equiv="Content-Security-Policy"'))return i;if(!i.includes("<head>")&&!i.includes("<head "))return i;let c=e.useNonce?Ue(u,e):void 0,g=kt(e.directives,c);return i.replace(/<head([^>]*)>/,`<head$1>
|
|
831
|
+
${g}`)}function $t(i,e){let u=i;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(c,g)=>{if(g.includes("nonce="))return c;return`<script nonce="${e}"${g}>`}),u=u.replace(/<style([^>]*)>/gi,(c,g)=>{if(g.includes("nonce="))return c;return`<style nonce="${e}"${g}>`}),u}function Et(i,e,u,c){let g=i,r=c.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let f=r.useNonce?Ue(e,r):void 0;return kt(r.directives,f)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ue(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ue(e,r);return g}import pr from"crypto";var fr=40,_t="_token",Ye=null;function gr(i=fr){let e=pr.randomBytes(Math.ceil(i/2)).toString("hex").slice(0,i);return Ye=e,e}function br(){if(!Ye)gr();return Ye}function wr(i=_t){let e=br();return`<input type="hidden" name="${i}" value="${e}">`}function Ct(i){return i.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,c)=>wr(c||_t))}async function At(i,e,u,c){if(!c.customDirectives||c.customDirectives.length===0)return i;let g=i;for(let r of c.customDirectives){if(!r.name||typeof r.handler!=="function"){if(c.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await xr(g,r,e,u,c);else g=await kr(g,r,e,u,c)}return g}async function xr(i,e,u,c,g){let{name:r,handler:f}=e,v=`@${r}`,y=`@end${r}`,S=i,b=Tt(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),w=[],T=b.exec(S);while(T!==null){let[A,O="",M=""]=T,I=T.index||0;try{let P=O?Rt(e,O):[],N=M.trim(),F=await f(N,P,u,c);w.push({original:A,processed:F,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(g.debug)console.error(`Error processing custom directive @${r}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${r}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(S)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];S=S.replace(O,M)}return S}async function kr(i,e,u,c,g){let{name:r,handler:f}=e,v=i,y=[],S=[];if(e.rawParams){for(let T of Go(v,Tt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(T.end!==-1)S.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=Tt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)S.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of S)try{let M=Rt(e,A),I=await f("",M,u,c);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${r}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=Tt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await f("",[],u,c);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(g.debug)console.error(`Error processing custom directive @${r}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${r}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(i,e){return i.rawParams?Lt(e):Sr(e)}function Sr(i){if(!i.trim())return[];let e=[],u="",c=!1,g="";for(let r=0;r<i.length;r++){let f=i[r];if((f==='"'||f==="'")&&(r===0||i[r-1]!=="\\"))if(!c)c=!0,g=f;else if(f===g)c=!1;else u+=f;else if(f===","&&!c)e.push(u.trim()),u="";else u+=f}if(u.trim())e.push(u.trim());return e.map((r)=>{let f=r.trim();if(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))return f.substring(1,f.length-1);return f})}var Mt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dt=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function ke(i,e){if(typeof i!=="string"||i.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(i){if(!i||typeof i!=="object"||Array.isArray(i))throw Error("@appearanceBootstrap expects an options object");let e=i,{appearance:u,colorMode:c}=e;if(ke(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap colorMode must be an object");if(ke(c.key,"colorMode.key"),ke(c.attribute,"colorMode.attribute"),ke(c.default,"colorMode.default"),!Dt.test(c.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(c.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(c.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(u){if(ke(u.key,"appearance.key"),ke(u.attribute,"appearance.attribute"),ke(u.default,"appearance.default"),!Dt.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:c.key,attribute:c.attribute,default:c.default},respectExisting:e.respectExisting===!0}}function _r(i){return JSON.stringify(i).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(i){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(i)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(i,e){let u=1,c=null,g=!1;for(let r=e+1;r<i.length;r++){let f=i[r];if(g){g=!1;continue}if(c){if(f==="\\")g=!0;else if(f===c)c=null;continue}if(f==='"'||f==="'"||f==="`"){c=f;continue}if(f==="(")u++;else if(f===")"&&--u===0)return r}return-1}function It(i,e){let u=i,c=/@appearanceBootstrap\s*\(/g,g;while((g=c.exec(u))!==null){let r=g.index+g[0].length-1,f=Cr(u,r);if(f===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(r+1,f).trim(),y=l(`(${v})`,e),S=Tr(Er(y));u=u.slice(0,g.index)+S+u.slice(f+1),c.lastIndex=g.index+S.length}return u}import Ar from"crypto";function Z(i){return V(String(i??""))}var Pt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(i,e,u,c){let g=i||e;return u?`${g} ${c}`:g}function ge(i){return String(i).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ae(i,e){if(/\bid\s*=/i.test(i))return"";return` id="${Z(e)}"`}function et(i,e,u){if(!e)return"";let c="";if(!/\baria-invalid\s*=/i.test(u))c+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))c+=` aria-describedby="${Z(`${ge(i)}-error`)}"`;return c}function Rr(){return Ar.randomUUID()}function ze(i,e){let u=i;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let c=Rr();e.csrf={token:c}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Z(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(c,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Z(r)}">`;return c}),u}function jt(i,e,u=Pt){let c=i;return c=c.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,f,v,y,S="")=>{let b=r||f||"POST",w=v||y||"",T=ye(S),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Z(O)}" action="${Z(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
832
832
|
${ze("@csrf",e)}`,!["GET","POST"].includes(A))M+=`
|
|
833
|
-
${ze(`@method('${A}')`,e)}`;return M}),c=c.replace(/@endform/g,"</form>"),c=c.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,r,f,v,y,
|
|
833
|
+
${ze(`@method('${A}')`,e)}`;return M}),c=c.replace(/@endform/g,"</form>"),c=c.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,r,f,v,y,S="")=>{let b=r||f||"",w=v||y||"",T=ye(S),A=Le(b,e),O=A!==void 0&&A!==null?A:w||"",M=T.match(/type=['"]([^'"]+)['"]/i),I=M?M[1]:"text",P=He(b,e),N=T.match(/class=['"]([^'"]+)['"]/i),F=Ve(N?N[1]:"",u.input,P,u.inputError),z=T.replace(/class=['"][^'"]+['"]/i,"");return z=z.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Z(I)}" name="${Z(b)}"${Ae(T,ge(b))} value="${Z(O)}" class="${F}"${et(b,P,T)}${z?` ${z}`:""}>`}),c=c.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(g,r,f="",v="")=>{let y=ye(f),S=Le(r,e)||v.trim(),b=He(r,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=Ve(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Z(r)}"${Ae(y,ge(r))} class="${T}"${et(r,b,y)}${A?` ${A}`:""}>${Z(S)}</textarea>`}),c=c.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(g,r,f="",v)=>{let y=ye(f),S=Le(r,e),b=He(r,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=Ve(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,""),O=v;if(S!==void 0)O=v.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(M,I,P)=>{if((Array.isArray(S)?S.some((F)=>String(F)===P):String(S)===P)&&!I.includes("selected"))return I.replace(/(<option)/,"$1 selected");return M});return`<select name="${Z(r)}"${Ae(y,ge(r))} class="${T}"${et(r,b,y)}${A?` ${A}`:""}>${O}</select>`}),c=c.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(g,r,f,v="")=>{let y=f===void 0?"1":f,S=f===void 0?ge(r):`${ge(r)}-${ge(y)}`,b=ye(v),w=Le(r,e),T=w!==void 0&&(Array.isArray(w)?w.some((I)=>String(I)===y):w===!0||String(w)===y),A=b.match(/class=['"]([^'"]+)['"]/i),O=A?A[1]:u.checkInput,M=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Z(r)}"${Ae(b,S)} value="${Z(y)}" class="${O}"${T?" checked":""}${M?` ${M}`:""}>`}),c=c.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,f,v="")=>{let y=ye(v),S=Le(r,e),b=S!==void 0&&S===f,w=y.match(/class=['"]([^'"]+)['"]/i),T=w?w[1]:u.checkInput,A=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Z(r)}"${Ae(y,`${ge(r)}-${ge(f)}`)} value="${Z(f)}" class="${T}"${b?" checked":""}${A?` ${A}`:""}>`}),c=c.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,f="")=>{let v=ye(f),y=v.match(/accept=['"]([^'"]+)['"]/i),S=y?y[1]:"",b=v.includes("multiple"),w=He(r,e),T=v.match(/class=['"]([^'"]+)['"]/i),A=Ve(T?T[1]:"",u.input,w,u.inputError),O=v.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),M=[`<input type="file" name="${Z(r)}"${Ae(v,ge(r))}`,`class="${A}"`];if(S)M.push(`accept="${Z(S)}"`);if(b)M.push("multiple");if(O)M.push(O);return`${M.join(" ")}>`}),c=c.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(g,r,f="",v)=>{let y=ye(f),S=y.match(/class=['"]([^'"]+)['"]/i),b=S?S[1]:u.label,w=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Z(ge(r))}" class="${b}"${w?` ${w}`:""}>${v}</label>`}),c}function Ht(i,e,u=Pt){return i.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(c,g,r)=>{try{if(He(g,e)){let f=r.replace(/\{\{([^}]+)\}\}/g,(v,y,S)=>{let b=(w)=>Y(r,S,String(w??""),!1,v.length);try{if(y.trim()==="$message"||y.trim()==="message")return b(Ot(g,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return b(e.errors.first(g));return b(Ot(g,e))}let w=y.trim();if(p(w)){let T=l(w,e);return T!==void 0?b(T):w}return w}catch{return y}});return`<div id="${Z(`${ge(g)}-error`)}" role="alert">${f}</div>`}return""}catch(f){return console.error("Error processing @error directive:",f),c}})}function He(i,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(i);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,i);return!1}function Ot(i,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(i);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,i)){let u=e.errors[i];return Array.isArray(u)?u[0]:String(u)}return""}function Le(i,e){let u;if(e.old&&typeof e.old==="function")return e.old(i);if(e.old&&typeof e.old==="object")return e.old[i];if(i.endsWith("[]")){let c=i.slice(0,-2);if(u=e[c],u!==void 0)return u}return e[i]}function ye(i){if(!i.trim())return"";let e=[],u=i.trim(),c=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,g;while((g=c.exec(u))!==null){let[,r,,f]=g;e.push(`${r}="${f.trim()}"`)}return e.join(" ")}import*as tt from"path";async function Bt(i,e,u=""){if(tt.basename(u)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,i.replace(/@js[\s\S]*?@endjs/g,"");return qt(i,e,u,"@js","@endjs")}async function Ft(i,e,u=""){if(tt.basename(u)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((r)=>({...r,displayName:`User ${r.id}: ${r.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return i.replace(/@ts[\s\S]*?@endts/g,"")}return qt(i,e,u,"@ts","@endts")}async function qt(i,e,u,c,g){let r=i,f=Tt(`${c}([\\s\\S]*?)${g}`,"g"),v=[],y;while((y=f.exec(i))!==null)v.push({fullMatch:y[0],content:y[1]||"",index:y.index});for(let{fullMatch:S,content:b,index:w}of v)try{let T={...e,global:e},A=Object.keys(T),O=Object.values(T),M=b.trim();if(c==="@ts")M=M.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let P=(M.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((j)=>j.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),N=P.length>0?`return { ${P.join(", ")} };`:"return {};",F=`
|
|
834
834
|
${M}
|
|
835
835
|
${N}
|
|
836
|
-
`,L=Function(...A,F)(...O);if(L&&typeof L==="object")Object.assign(e,L);r=r.replace(
|
|
837
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${d(
|
|
838
|
-
`)}}}return r}async function zt(i,e,u,c){return Vt(i,e,u,c,"before")}async function Wt(i,e,u,c){return Vt(i,e,u,c,"after")}function Xt(i){return i.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,u,c,g,r)=>{try{let f=g?E(g,{}):{};return rr(c,f,r==="true")}catch(f){return console.error(`Error processing @route directive: ${f}`),"#route-error"}})}var Be={patterns:[],exact:{}};async function Kt(i,e){let u=i.split("/").pop()?.split(".")[0]||"";if(Be.exact[i])for(let c of Be.exact[i])await Promise.resolve(c(e,i));if(Be.exact[u])for(let c of Be.exact[u])await Promise.resolve(c(e,i));for(let{pattern:c,callback:g}of Be.patterns)if(c.test(i)||c.test(u))await Promise.resolve(g(e,i))}var Dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ir=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function _e(i,e){let u=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;u.lastIndex=e;let c=u.exec(i);if(!c)return null;let g=/\/\s*>$/.test(c[0])||c[1]===c[1].toLowerCase()&&Dr.has(c[1]),r=g?c[2].replace(/\/\s*$/,""):c[2];return{full:c[0],tag:c[1],attrs:r,selfClosing:g,start:c.index,end:c.index+c[0].length}}function Or(i,e,u){let c=1,g=u,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),f=new RegExp(`</${e}\\s*>`,"gi");while(c>0&&g<i.length){r.lastIndex=g,f.lastIndex=g;let v=r.exec(i),y=f.exec(i);if(!y)return-1;if(v&&v.index<y.index)c++,g=v.index+v[0].length;else{if(c--,c===0)return y.index+y[0].length;g=y.index+y[0].length}}return-1}function Ee(i,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let u=Or(i,e.tag,e.end);if(u===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:u,innerHTML:i.slice(e.end,u-`</${e.tag}>`.length)}}function Gt(i,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(i)||i.includes(` ${e}=`)||i.includes(` ${e} `)||i.trimEnd().endsWith(` ${e}`)}function Fe(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=i.match(new RegExp(`${u}="([^"]*)"`,"s"))||i.match(new RegExp(`${u}='([^']*)'`,"s"));return c?c[1]:null}function ve(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return i.replace(new RegExp(`\\s*${u}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${u}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${u}(?=\\s|$|>|/)`,"g"),"")}function Re(i,e,u){let c=e.selfClosing?" /":"",g=`<${e.tag}${u}${c}>`;return i.slice(0,e.start)+g+i.slice(e.end)}function Pr(i){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(i)}function Nr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Fe(c.attrs,"v-for");if(g===null){u=c.end;continue}let r=g.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){u=c.end;continue}let f=r[1].trim(),v=r[2].trim(),y;if(f.includes(",")){let I=f.split(",").map((F)=>F.trim()),P=I[0],N=I[1];y=`${v} as ${N} => ${P}`}else y=`${v} as ${f}`;let
|
|
836
|
+
`,L=Function(...A,F)(...O);if(L&&typeof L==="object")Object.assign(e,L);r=r.replace(S,"")}catch(T){console.error(`Error executing ${c} code block in ${u}:`,T);let A=T instanceof Error?T.message:String(T),O=m(`${c} Directive`,`Error executing code: ${A}`,u,i,w,S);console.error(O),r=r.replace(S,"")}return r}function Mr(i,e="_method"){let u=i.toUpperCase();if(u==="GET"||u==="POST")return"";return`<input type="hidden" name="${e}" value="${u}">`}function Ut(i){return i.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,u,c,g,r)=>Mr(c,r||"_method"))}async function Vt(i,e,u,c,g){if(!c.middleware||c.middleware.length===0)return i;let r=i,f=c.middleware.filter((v)=>v.timing===g);if(f.length===0)return r;for(let v of f){if(!v.name||typeof v.handler!=="function"){if(c.debug)console.warn("Invalid middleware:",v);continue}try{let y=await v.handler(r,e,u,c);if(typeof y==="string")r=y;else if(c.debug)console.warn(`Middleware ${v.name} did not return a string`)}catch(y){if(c.debug)console.error(`Error in middleware ${v.name}:`,y);if(c.debug){let S=m("Middleware",`Error in middleware '${v.name}': ${y instanceof Error?y.message:String(y)}`,u,i);r=r.replace(/<body[^>]*>/,`$&
|
|
837
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${d(S)}</div>
|
|
838
|
+
`)}}}return r}async function zt(i,e,u,c){return Vt(i,e,u,c,"before")}async function Wt(i,e,u,c){return Vt(i,e,u,c,"after")}function Xt(i){return i.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,u,c,g,r)=>{try{let f=g?E(g,{}):{};return rr(c,f,r==="true")}catch(f){return console.error(`Error processing @route directive: ${f}`),"#route-error"}})}var Be={patterns:[],exact:{}};async function Kt(i,e){let u=i.split("/").pop()?.split(".")[0]||"";if(Be.exact[i])for(let c of Be.exact[i])await Promise.resolve(c(e,i));if(Be.exact[u])for(let c of Be.exact[u])await Promise.resolve(c(e,i));for(let{pattern:c,callback:g}of Be.patterns)if(c.test(i)||c.test(u))await Promise.resolve(g(e,i))}var Dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ir=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function _e(i,e){let u=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;u.lastIndex=e;let c=u.exec(i);if(!c)return null;let g=/\/\s*>$/.test(c[0])||c[1]===c[1].toLowerCase()&&Dr.has(c[1]),r=g?c[2].replace(/\/\s*$/,""):c[2];return{full:c[0],tag:c[1],attrs:r,selfClosing:g,start:c.index,end:c.index+c[0].length}}function Or(i,e,u){let c=1,g=u,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),f=new RegExp(`</${e}\\s*>`,"gi");while(c>0&&g<i.length){r.lastIndex=g,f.lastIndex=g;let v=r.exec(i),y=f.exec(i);if(!y)return-1;if(v&&v.index<y.index)c++,g=v.index+v[0].length;else{if(c--,c===0)return y.index+y[0].length;g=y.index+y[0].length}}return-1}function Ee(i,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let u=Or(i,e.tag,e.end);if(u===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:u,innerHTML:i.slice(e.end,u-`</${e.tag}>`.length)}}function Gt(i,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(i)||i.includes(` ${e}=`)||i.includes(` ${e} `)||i.trimEnd().endsWith(` ${e}`)}function Fe(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=i.match(new RegExp(`${u}="([^"]*)"`,"s"))||i.match(new RegExp(`${u}='([^']*)'`,"s"));return c?c[1]:null}function ve(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return i.replace(new RegExp(`\\s*${u}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${u}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${u}(?=\\s|$|>|/)`,"g"),"")}function Re(i,e,u){let c=e.selfClosing?" /":"",g=`<${e.tag}${u}${c}>`;return i.slice(0,e.start)+g+i.slice(e.end)}function Pr(i){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(i)}function Nr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Fe(c.attrs,"v-for");if(g===null){u=c.end;continue}let r=g.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){u=c.end;continue}let f=r[1].trim(),v=r[2].trim(),y;if(f.includes(",")){let I=f.split(",").map((F)=>F.trim()),P=I[0],N=I[1];y=`${v} as ${N} => ${P}`}else y=`${v} as ${f}`;let S=ve(c.attrs,"v-for"),b=ve(S,":key").replace(/\s*v-bind:key="[^"]*"/g,""),w=Ee(e,c),T=e.slice(w.outerStart,w.outerEnd),A=Re(T,{...c,start:0,end:c.end-c.start},b),O=`@foreach(${y})
|
|
839
839
|
`,M=`${O}${A}
|
|
840
|
-
@endforeach`;e=e.slice(0,w.outerStart)+M+e.slice(w.outerEnd),u=w.outerStart+O.length}return e}function Hr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Fe(c.attrs,"v-if");if(g===null){u=c.end;continue}let r=[],f=Ee(e,c),v=ve(c.attrs,"v-if"),y=Re(e.slice(f.outerStart,f.outerEnd),{...c,start:0,end:c.end-c.start},v);r.push({type:"if",expr:g,outerStart:f.outerStart,outerEnd:f.outerEnd,element:y,parsedTag:c});let
|
|
840
|
+
@endforeach`;e=e.slice(0,w.outerStart)+M+e.slice(w.outerEnd),u=w.outerStart+O.length}return e}function Hr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Fe(c.attrs,"v-if");if(g===null){u=c.end;continue}let r=[],f=Ee(e,c),v=ve(c.attrs,"v-if"),y=Re(e.slice(f.outerStart,f.outerEnd),{...c,start:0,end:c.end-c.start},v);r.push({type:"if",expr:g,outerStart:f.outerStart,outerEnd:f.outerEnd,element:y,parsedTag:c});let S=f.outerEnd,b=!0;while(b){let M=e.slice(S).match(/^\s*/),I=M?M[0].length:0,P=_e(e,S+I);if(!P){b=!1;break}let N=Fe(P.attrs,"v-else-if"),F=Gt(P.attrs,"v-else");if(N!==null){let z=Ee(e,P),L=ve(P.attrs,"v-else-if"),j=Re(e.slice(z.outerStart,z.outerEnd),{...P,start:0,end:P.end-P.start},L);r.push({type:"else-if",expr:N,outerStart:S,outerEnd:z.outerEnd,element:j,parsedTag:P}),S=z.outerEnd}else if(F){let z=Ee(e,P),L=ve(P.attrs,"v-else"),j=Re(e.slice(z.outerStart,z.outerEnd),{...P,start:0,end:P.end-P.start},L);r.push({type:"else",outerStart:S,outerEnd:z.outerEnd,element:j,parsedTag:P}),b=!1}else b=!1}let w=[];for(let M of r)if(M.type==="if")w.push(`@if(${M.expr})
|
|
841
841
|
${M.element}`);else if(M.type==="else-if")w.push(`@elseif(${M.expr})
|
|
842
842
|
${M.element}`);else w.push(`@else
|
|
843
843
|
${M.element}`);w.push("@endif");let T=w.join(`
|
|
844
|
-
`),A=r[0].outerStart,O=r[r.length-1].outerEnd;e=e.slice(0,A)+T+e.slice(O),u=A+T.length}return e}function Xr(i){return i.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Kr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Ir.has(c.tag),r=c.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(v,y,
|
|
844
|
+
`),A=r[0].outerStart,O=r[r.length-1].outerEnd;e=e.slice(0,A)+T+e.slice(O),u=A+T.length}return e}function Xr(i){return i.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Kr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Ir.has(c.tag),r=c.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(v,y,S)=>{let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(y);if(!b||!S||!/^["']/.test(S))return v;let w=b[1]||"modelValue",T=b[2];if(g&&!b[1])return`@model${T}=${S}`;let A=S[0],O=S.slice(1,-1),M=`:${w}=${S} @update:${w}=${A}${O} = $event${A}`;if(T){let I=b[1]?`${w}Modifiers`:"modelModifiers",P=T.slice(1).split(".").map((N)=>`${N}: true`).join(", ");M+=` :${I}="{ ${P} }"`}return M});if(r===c.attrs){u=c.end;continue}let f=Re(c.full,{...c,start:0,end:c.full.length},r);e=e.slice(0,c.start)+f+e.slice(c.end),u=c.start+f.length}return e}function Gr(i){return i.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Jr(i){return i.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Zr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Fe(c.attrs,"v-html");if(g===null){u=c.end;continue}if(c.selfClosing){u=c.end;continue}let r=Ee(e,c),f=ve(c.attrs,"v-html"),v=c.selfClosing?" /":"",y=`<${c.tag}${f}${v}>{!! ${g} !!}</${c.tag}>`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function Qr(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;let g=Fe(c.attrs,"v-text");if(g===null){u=c.end;continue}if(c.selfClosing){u=c.end;continue}let r=Ee(e,c),f=ve(c.attrs,"v-text"),v=c.selfClosing?" /":"",y=`<${c.tag}${f}${v}>{{ ${g} }}</${c.tag}>`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function Yr(i){return i.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 es(i){let e=i,u=0;while(u<e.length){let c=_e(e,u);if(!c)break;if(!Gt(c.attrs,"v-once")){u=c.end;continue}let g=ve(c.attrs,"v-once"),r=Ee(e,c),f=e.slice(r.outerStart,r.outerEnd),y=`@once
|
|
845
845
|
${Re(f,{...c,start:0,end:c.end-c.start},g)}
|
|
846
|
-
@endonce`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function ts(i){return i.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function ns(i){return i.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Jt(i){if(!Pr(i))return i;let e=i;return e=Nr(e),e=Hr(e),e=es(e),e=Gr(e),e=Jr(e),e=Kr(e),e=Xr(e),e=ns(e),e=Zr(e),e=Qr(e),e=Yr(e),e=ts(e),e}function We(i){return i.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var nt=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),rs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Zt(i,e){let u=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(i),c=u?u[1]:i,g=l(c,e);if(g&&typeof g==="string")return g;let r=c.trim();return nt.has(r)?r:null}function Qt(i){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(i);return e?e[1]:i}function Yt(i,e,u){let c=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),g=c?`<${i} ${c}>`:`<${i}>`;if(rs.has(i))return c?`<${i} ${c}>`:`<${i}>`;return`${g}${u}</${i}>`}async function en(i,e,u,c,g){let r=i,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],slotContent:y[3],index:y.index});for(let
|
|
847
|
-
<meta name="stx-build" content="${e}">`}var to="/_stx/sw.js";function is(i){if(typeof i!=="string"||!i.startsWith("/"))return null;let e=[],u=[],c=i.replace(/\/+$/,"").split("/").slice(1).map((g)=>{let r=/^:(\w+)$/.exec(g)||/^\[(\w+)\]$/.exec(g);if(r)return e.push(r[1]),u.push("0"),"([^/]+)";return u.push(g),g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:i,re:`^/${c.join("/")}/?$`,names:e,sample:`/${u.join("/")}`}}function as(i){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,u=window;if(u.stxOffline)return;let c=null,g=!1,r=[],f={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>c,onUpdateReady(b){if(f.updateReady)try{b()}catch{}else r.push(b);return()=>{let w=r.indexOf(b);if(w!==-1)r.splice(w,1)}},applyUpdate(){let b=c&&c.waiting;if(!b)return!1;return g=!0,b.postMessage({type:"stx:activate-update",force:!0}),!0}};u.stxOffline=f;let v=(b)=>{if(!b.waiting||!e.controller||f.updateReady)return;f.updateReady=!0;let w=r.splice(0);for(let T of w)try{T()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(b)=>{let w=b.data||{};if(w.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:w.url,kind:w.kind,fragment:!!w.fragment}}))}catch{}if(w.type==="stx:reachability"){if(u.stxOffline.reachable=w.reachable!==!1,Number(w.at)>0)u.stxOffline.reachedAt=Number(w.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:w.reachable!==!1,at:Number(w.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(g)g=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&c&&c.waiting)c.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let y=()=>{e.register(i,{scope:"/"}).then((b)=>{c=b;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(b.waiting)v(b),b.waiting.postMessage({type:"stx:activate-update",reason:"load"});b.addEventListener("updatefound",()=>{let w=b.installing;if(!w)return;w.addEventListener("statechange",()=>{if(w.state==="installed")v(b)})})}).catch(()=>{})},
|
|
846
|
+
@endonce`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function ts(i){return i.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function ns(i){return i.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Jt(i){if(!Pr(i))return i;let e=i;return e=Nr(e),e=Hr(e),e=es(e),e=Gr(e),e=Jr(e),e=Kr(e),e=Xr(e),e=ns(e),e=Zr(e),e=Qr(e),e=Yr(e),e=ts(e),e}function We(i){return i.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var nt=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),rs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Zt(i,e){let u=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(i),c=u?u[1]:i,g=l(c,e);if(g&&typeof g==="string")return g;let r=c.trim();return nt.has(r)?r:null}function Qt(i){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(i);return e?e[1]:i}function Yt(i,e,u){let c=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),g=c?`<${i} ${c}>`:`<${i}>`;if(rs.has(i))return c?`<${i} ${c}>`:`<${i}>`;return`${g}${u}</${i}>`}async function en(i,e,u,c,g){let r=i,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],slotContent:y[3],index:y.index});for(let S=v.length-1;S>=0;S--){let b=v[S];try{let w=Zt(b.expr,e);if(!w||typeof w!=="string"){let N=`<!-- dynamic component: could not resolve "${We(Qt(b.expr))}" -->`;r=r.slice(0,b.index)+N+r.slice(b.index+b.full.length);continue}if(nt.has(w)){let N=Yt(w,b.attrs,b.slotContent);r=r.slice(0,b.index)+N+r.slice(b.index+b.full.length);continue}let T=b.attrs.trim(),A={},O=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,M;while((M=O.exec(T))!==null){let N=M[1]||M[2],F=M[3];if(M[1])try{A[N]=l(F,e)}catch{A[N]=F}else A[N]=F}let I=c.componentsDir||"components",P=await je(w,A,b.slotContent,I,e,u,c,new Set,g??new Set);r=r.slice(0,b.index)+P+r.slice(b.index+b.full.length)}catch(w){let T=w instanceof Error?w.message:String(w),A=`<!-- dynamic component error: ${We(T)} -->`;r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}}return r=await ss(r,e,u,c,g),r}async function ss(i,e,u,c,g){let r=i,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],index:y.index});for(let S=v.length-1;S>=0;S--){let b=v[S];try{let w=Zt(b.expr,e);if(!w||typeof w!=="string"){let O=`<!-- dynamic component: could not resolve "${We(Qt(b.expr))}" -->`;r=r.slice(0,b.index)+O+r.slice(b.index+b.full.length);continue}if(nt.has(w)){let O=Yt(w,b.attrs,"");r=r.slice(0,b.index)+O+r.slice(b.index+b.full.length);continue}let T=c.componentsDir||"components",A=await je(w,{},"",T,e,u,c,new Set,g??new Set);r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}catch(w){let T=w instanceof Error?w.message:String(w),A=`<!-- dynamic component error: ${We(T)} -->`;r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}}return r}var oa="X-STX-Build",st=Symbol.for("stx.buildId");function Lr(){let i=globalThis;if(!i[st])i[st]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return i[st]}function tn(i,e=Lr()){if(i.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(i))return null;return`
|
|
847
|
+
<meta name="stx-build" content="${e}">`}var to="/_stx/sw.js";function is(i){if(typeof i!=="string"||!i.startsWith("/"))return null;let e=[],u=[],c=i.replace(/\/+$/,"").split("/").slice(1).map((g)=>{let r=/^:(\w+)$/.exec(g)||/^\[(\w+)\]$/.exec(g);if(r)return e.push(r[1]),u.push("0"),"([^/]+)";return u.push(g),g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:i,re:`^/${c.join("/")}/?$`,names:e,sample:`/${u.join("/")}`}}function as(i){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,u=window;if(u.stxOffline)return;let c=null,g=!1,r=[],f={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>c,onUpdateReady(b){if(f.updateReady)try{b()}catch{}else r.push(b);return()=>{let w=r.indexOf(b);if(w!==-1)r.splice(w,1)}},applyUpdate(){let b=c&&c.waiting;if(!b)return!1;return g=!0,b.postMessage({type:"stx:activate-update",force:!0}),!0}};u.stxOffline=f;let v=(b)=>{if(!b.waiting||!e.controller||f.updateReady)return;f.updateReady=!0;let w=r.splice(0);for(let T of w)try{T()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(b)=>{let w=b.data||{};if(w.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:w.url,kind:w.kind,fragment:!!w.fragment}}))}catch{}if(w.type==="stx:reachability"){if(u.stxOffline.reachable=w.reachable!==!1,Number(w.at)>0)u.stxOffline.reachedAt=Number(w.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:w.reachable!==!1,at:Number(w.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(g)g=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&c&&c.waiting)c.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let y=()=>{e.register(i,{scope:"/"}).then((b)=>{c=b;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(b.waiting)v(b),b.waiting.postMessage({type:"stx:activate-update",reason:"load"});b.addEventListener("updatefound",()=>{let w=b.installing;if(!w)return;w.addEventListener("statechange",()=>{if(w.state==="installed")v(b)})})}).catch(()=>{})},S=()=>{let b=(w)=>{setTimeout(w,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>b(y));else b(y)};if(!e.controller)if(document.readyState==="complete")S();else addEventListener("load",S);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",S);else S()}function cs(){let i=`(${as.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(i).trim().replace(/;$/,"")}catch{return i}}function ls(i,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!i||!i.startsWith("/"))return null;let u=i.split(/[?#]/)[0].split("/").filter(Boolean)[0];return u?`/${u}`:"/"}var nn=`<script data-stx-offline>${cs()}</script>`;function no(i,e){let u=Number(i.precacheTimeoutMs),c={build:String(e||"dev"),pages:Array.from(new Set((i.pages||[]).filter((g)=>typeof g==="string"&&g.startsWith("/")))),staticPages:(i.staticPages||[]).filter((g)=>typeof g==="string"&&((i.pages||[]).includes(g)||(i.routes||[]).includes(g))),api:i.apiPrefix||"/api/",timeout:Math.max(500,Number(i.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(u)&&u>0?Math.min(2147483647,Math.max(1,Math.floor(u))):1e4,networkFirst:(i.networkFirst||[]).filter((g)=>typeof g==="string"&&g.startsWith("/")),updateOnColdStart:i.updateOnColdStart===!0,fallback:i.fallback||i.pages&&i.pages[0]||null,fallbackScope:ls(i.fallback||i.pages&&i.pages[0]||null,i.fallbackScope),routes:(i.routes||[]).map(is).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...i.exclude||[]],mediaMax:Math.max(10485760,Number(i.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(i.assetsMaxEntries)||500)};return`/* stx offline worker, build ${c.build} */
|
|
848
848
|
'use strict';
|
|
849
849
|
var S = ${JSON.stringify(c)};
|
|
850
850
|
var SHELL = 'stx-shell-' + S.build;
|
|
@@ -1549,34 +1549,34 @@ self.addEventListener('fetch', function (event) {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
});
|
|
1551
1551
|
`}import Me from"path";function rn(i){return i.startsWith("http://")||i.startsWith("https://")||i.startsWith("//")}async function sn(i,e,u){try{let c;if(i.startsWith("/")){let g=e;for(let r=0;r<5;r++){let f=Me.join(g,i);if(await Bun.file(f).exists())return f;g=Me.dirname(g)}c=Me.join(e,i)}else if(i.startsWith("./")||i.startsWith("../"))c=Me.resolve(e,i);else c=Me.resolve(e,i);if(await Bun.file(c).exists())return c;return null}catch{return null}}var on=Symbol.for("stx.inline-assets.import-meta");function us(i,e){if(!i.includes("import.meta"))return;let u=Error(`[stx] ${e} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
1552
|
-
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw u[on]=!0,u}async function an(i,e,u){let c=i,g=Me.dirname(e),r=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,f;while((f=r.exec(c))!==null){let[
|
|
1552
|
+
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw u[on]=!0,u}async function an(i,e,u){let c=i,g=Me.dirname(e),r=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,f;while((f=r.exec(c))!==null){let[S,b,w,T]=f;if(rn(w))continue;let A=await sn(w,g,e);if(A)try{let O=await Bun.file(A).text();if(u.add(A),w.endsWith(".ts")||w.endsWith(".tsx")){let I=await Bun.build({entrypoints:[A],target:"browser",minify:!0,define:k()});if(I.outputs.length>0)O=await I.outputs[0].text(),us(O,w)}let M=`<script>
|
|
1553
1553
|
// Source: ${w}
|
|
1554
1554
|
${O}
|
|
1555
|
-
</script>`;c=c.replace(
|
|
1555
|
+
</script>`;c=c.replace(S,M),r.lastIndex=0}catch(O){if(O?.[on])throw O}}let v=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,y;while((y=v.exec(c))!==null){let[S,b,w,T]=y,A=b+T;if(rn(w))continue;if(/rel=["']stylesheet["']/.test(A)||w.endsWith(".css")){let M=await sn(w,g,e);if(M)try{let I=await Bun.file(M).text();u.add(M);let P=`<style>
|
|
1556
1556
|
/* Source: ${w} */
|
|
1557
1557
|
${I}
|
|
1558
|
-
</style>`;c=c.replace(
|
|
1559
|
-
`,c+2),c===-1)return-1;c+=1,g=!0;continue}if(v==="/"&&i[c+1]==="*"){let y=i.indexOf("*/",c+2);if(y===-1)return-1;c=y+2,g=!0;continue}if(v==="/"&&g){let y=c+1,
|
|
1558
|
+
</style>`;c=c.replace(S,P),v.lastIndex=0}catch(I){}}}return c}import it from"path";var ds=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ps=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function fs(i,e){if(!e||!i.includes("/"))return i;let u=it.dirname(e);return i.replace(ds,(c,g,r,f)=>{let v=it.resolve(u,f);return`${g}${r}${v.split(it.sep).join("/")}${r}`})}function un(i,e){if(!e||!i.includes("<script"))return i;return i.replace(ps,(u,c,g,r)=>`${c}${fs(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function pn(i){return i.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Sn(i,e){let u=i.length,c=e,g=!0,r=[],f=(v)=>v+9<=u&&i[v]==="<"&&i[v+1]==="/"&&(i[v+2]==="s"||i[v+2]==="S")&&(i[v+3]==="c"||i[v+3]==="C")&&(i[v+4]==="r"||i[v+4]==="R")&&(i[v+5]==="i"||i[v+5]==="I")&&(i[v+6]==="p"||i[v+6]==="P")&&(i[v+7]==="t"||i[v+7]==="T")&&(i[v+8]===">"||/\s/.test(i[v+8]));while(c<u){let v=i[c];if(f(c))return c;if(v==="/"&&i[c+1]==="/"){if(c=i.indexOf(`
|
|
1559
|
+
`,c+2),c===-1)return-1;c+=1,g=!0;continue}if(v==="/"&&i[c+1]==="*"){let y=i.indexOf("*/",c+2);if(y===-1)return-1;c=y+2,g=!0;continue}if(v==="/"&&g){let y=c+1,S=!1;while(y<u){let b=i[y];if(b==="\\"){y+=2;continue}if(b==="[")S=!0;else if(b==="]")S=!1;else if(b==="/"&&!S){y++;break}else if(b===`
|
|
1560
1560
|
`){y=-1;break}y++}if(y===-1){c++,g=!1;continue}while(y<u&&/[a-z]/.test(i[y]))y++;c=y,g=!1;continue}if(v==="'"||v==='"'){let y=v;c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]===y){c++;break}if(i[c]===`
|
|
1561
|
-
`)break;c++}g=!1;continue}if(v==="`"){c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++,g=!1;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;c++}return-1}function $n(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(i);if(!c)return null;let g=c.index+c[0].length,r=i.indexOf("</script>",g);if(r===-1)return null;let f=i.indexOf(">",r);if(f===-1)return null;return{start:c.index,end:f+1}}var hs=4096;async function fn(i,e,u){if(u.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:c}=await import("./chunk-
|
|
1561
|
+
`)break;c++}g=!1;continue}if(v==="`"){c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),c++;while(c<u){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"){c++,g=!1;break}if(i[c]==="$"&&i[c+1]==="{"){r.push(!0),c+=2,g=!0;break}c++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;c++}return-1}function $n(i,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(i);if(!c)return null;let g=c.index+c[0].length,r=i.indexOf("</script>",g);if(r===-1)return null;let f=i.indexOf(">",r);if(f===-1)return null;return{start:c.index,end:f+1}}var hs=4096;async function fn(i,e,u){if(u.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:c}=await import("./chunk-jg4932ma.js");return`<script ${i} src="${c(e)}"></script>`}async function Un(i,e,u){try{let{registeredModuleIdsIn:c,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-2rvprm39.js")),r=[],f=await g(c(...i),{minify:Yo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-jg4932ma.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ws(i,e=""){let u=$n(i,"data-stx-runtime");if(!u)return i;let c=Jn(i);if(c===-1||c===u.start){if(!e)return i;return i.slice(0,u.end)+e+i.slice(u.end)}if(c<u.start)return i.slice(0,c)+i.slice(u.start,u.end)+e+`
|
|
1562
1562
|
`+i.slice(c,u.start)+i.slice(u.end);let g=i.slice(u.start,u.end),r=i.slice(0,u.start)+i.slice(u.end),f=Jn(r);if(f===-1)return g+e+`
|
|
1563
1563
|
`+r;return r.slice(0,f)+g+e+`
|
|
1564
|
-
`+r.slice(f)}function xs(i){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return i.replace(e,(u,c,g)=>{let r=i.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${c}}}`:`{<!--stx-literal-->{${c}}}`})}async function o(i,e,u,c,g){if(c.ssr===!1&&!c.autoShell&&c.buildMode==="spa")return i;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(i,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of c._layerGraph?.configDependencies??[])g.add(f);if(r&&c.runtimeConfig)await hn(e,u,c.runtimeConfig);if(r)Wa(e),e.__stx_scope_seq??={n:0,key:vs(String(e.__filename??u))},e.__stx_head_injections=Ko(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((c.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))ro(i,u);try{return await se.timeAsync("template-processing",async()=>{let f=await ks(i,e,u,c,g);if(r)f=Do(f);if(r&&c.autoShell&&c.buildMode!=="compile"){let v=Se(c.app?.head,{known:vr,source:"app.head"}),
|
|
1565
|
-
`),...
|
|
1564
|
+
`+r.slice(f)}function xs(i){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return i.replace(e,(u,c,g)=>{let r=i.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${c}}}`:`{<!--stx-literal-->{${c}}}`})}async function o(i,e,u,c,g){if(c.ssr===!1&&!c.autoShell&&c.buildMode==="spa")return i;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(i,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of c._layerGraph?.configDependencies??[])g.add(f);if(r&&c.runtimeConfig)await hn(e,u,c.runtimeConfig);if(r)Wa(e),e.__stx_scope_seq??={n:0,key:vs(String(e.__filename??u))},e.__stx_head_injections=Ko(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((c.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))ro(i,u);try{return await se.timeAsync("template-processing",async()=>{let f=await ks(i,e,u,c,g);if(r)f=Do(f);if(r&&c.autoShell&&c.buildMode!=="compile"){let v=Se(c.app?.head,{known:vr,source:"app.head"}),S=(e.__stx_runtime_head||null)??Jo(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?x(A,e,u):void 0,M=S.title||w||O,I=!S.title&&(!!w||!!O),P=S.meta||[],N=new Set(P.map((W)=>rt(W)).filter(Boolean)),F={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((W)=>!N.has(rt(W))),...P],link:[...v.link||[],...S.link||[]],script:[...v.script||[],...S.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
1565
|
+
`),...S.htmlAttrs&&{htmlAttrs:ac(v.htmlAttrs,S.htmlAttrs)},...S.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...S.bodyAttrs}}},z=Xo(f);if(f=yr(f,F,{...I&&{titleIsHtml:!0},...c.app?.colorMode&&{colorMode:c.app.colorMode}},z),z)f=lc(f,v),f=hr(f,F.htmlAttrs);let L=f.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&f.includes("<head")){let W=L[1],X=os(W);f=f.replace(/<head\b[^>]*>/i,(Q)=>`${Q}
|
|
1566
1566
|
<meta name="stx-layout" content="${pn(W)}">
|
|
1567
|
-
<meta name="stx-layout-group" content="${pn(X)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),H=j?G(f):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){f=Ke(f,(X,Q)=>`<body${Q} data-stx="${j[1]}">`);let W=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(W,"$1")}}if(r){let v=e.__stx_head_injections??Ko(),y=cc(f);if(y!==null)v.beforeClose.push(y);let
|
|
1568
|
-
${O}`).join("");f=ws(f,A)}else{let y=await Un([f],c,g);if(y){let
|
|
1569
|
-
`+f.slice(
|
|
1567
|
+
<meta name="stx-layout-group" content="${pn(X)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),H=j?G(f):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){f=Ke(f,(X,Q)=>`<body${Q} data-stx="${j[1]}">`);let W=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(W,"$1")}}if(r){let v=e.__stx_head_injections??Ko(),y=cc(f);if(y!==null)v.beforeClose.push(y);let S=tn(f);if(S!==null)v.afterOpen.push(S);if(c.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=oc(f,v);let b=c.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,S=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-yq9dtdkn.js")),M=c.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,S=await fn("data-stx-stores",I,c)??b}catch{}y=await Un([f,b],c,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-3353tc28.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-hfk17t81.js")),M=c.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(c._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,c)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,S,w,T].filter((O)=>O!==null).map((O)=>`
|
|
1568
|
+
${O}`).join("");f=ws(f,A)}else{let y=await Un([f],c,g);if(y){let S=f.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(S!==-1)f=f.slice(0,S)+y+`
|
|
1569
|
+
`+f.slice(S)}}if(r)f=ic(f);if(r&&e.__stx_inject_css!==!1)f=await h(f,void 0,c.buildMode==="serve",!0);else if(r)f=ln(f);if(f=f.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),f=xs(f),r&&e.__stx_runtime_config)f=Nt(f,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let v=dr(e);if(v){let y=/<head\b[^>]*>/i.exec(f),S=y?y.index+y[0].length:0;f=f.slice(0,S)+v+f.slice(S)}}return f})}catch(f){if(f instanceof U)throw f;let v=f instanceof Error?f.message:String(f),y=new ie(`Template processing failed: ${v}`,u,void 0,void 0,i.substring(0,200)+(i.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),bn.logDetailedError(y,{filePath:u,template:i.substring(0,500)}),C()&&!c.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(c.debug)throw y;return qo.createFallbackContent("Template Processing",y)}}async function ks(i,e,u,c,g){let r=process.cwd(),f={...c,partialsDir:c.partialsDir&&!ce.isAbsolute(c.partialsDir)?ce.resolve(r,c.partialsDir):c.partialsDir,componentsDir:c.componentsDir&&!ce.isAbsolute(c.componentsDir)?ce.resolve(r,c.componentsDir):c.componentsDir,layoutsDir:c.layoutsDir&&!ce.isAbsolute(c.layoutsDir)?ce.resolve(r,c.layoutsDir):c.layoutsDir},v=f,y=i;await Es(u,e),$s(e,v),y=await xe(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let S=de(y,Ie,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=S.output;let b=S.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,H)=>b[Number(H)]??""),T="\x00STX_ESCAPED_AT\x00",A="\x00STX_ESC_MUSTACHE_OPEN\x00",O="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,T),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(L,j)=>`${A}${j}${O}`),y=Jt(y),y=await an(y,u,g);let M={};y=Fr(y,M);let I={...e.__sections||{}},P="",N=mt(gt(i)),F=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let z=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(z)P=z[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
|
|
1570
1570
|
${y.trim()}
|
|
1571
1571
|
@endsection`}if(!P&&!F&&v.defaultLayout){let L=vn(y),j=/@section\s*\(/.test(y);if(!L||j){let H="",W=ce.dirname(u),X=v.layoutsDir?ce.dirname(v.layoutsDir):process.cwd();for(let Q=0;Q<20;Q++){let ee=ce.join(W,"_layout.stx");if(await n(ee)){H=ee;break}let te=ce.dirname(W);if(te===W||te.length<X.length)break;W=te}if(H)P=H;else if(v.layoutsDir){let Q=ce.isAbsolute(v.layoutsDir)?v.layoutsDir:ce.resolve(process.cwd(),v.layoutsDir),ee=ce.join(Q,`${v.defaultLayout}.stx`);if(await n(ee))P=ee}if(P&&!j)y=`@section('content')
|
|
1572
1572
|
${y.trim()}
|
|
1573
1573
|
@endsection`}}if(P&&y.includes("<script")){let L=K(y),j=L.scripts.map((H)=>mn(H,u)??H);y=cr(L.output,j)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,j,H)=>(I[j]=H,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,j,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return L;try{let W=l(H.trim(),e);if(W===void 0)return L;let Q=(e.__stx_inline_section_values??=[]).push(W)-1;return I[j]=`{{ __stx_inline_section_values[${Q}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,H)=>{if(H.includes("@parent"))I[j]=H.replace("@parent",Te);else I[j]=H.trim();return""}),e.__sections=I,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,j,H)=>I[j]||H||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||"");if(y=zr(y,M),P){let L=[],j=K(y),H=de(j.output,cn,(W,X)=>`\x00STX_ORPHAN_STYLE_${X}\x00`);if(y=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(W,X,Q)=>{let ee=X==="SCRIPT"?mn(j.scripts[Number(Q)],u):H.tokens[Number(Q)];if(ee)L.push(ee);return""}),L.length>0){let W=L.join(`
|
|
1574
1574
|
`);I.content=I.content?`${I.content}
|
|
1575
1575
|
${W}`:W,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await xe(()=>gn(P,u,f,g),null,()=>{throw new ie(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ee=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return gs.readdirSync(ae).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(f.layoutsDir),...ee(f.fallbackLayoutsDir)].filter((oe,ae,le)=>le.indexOf(oe)===ae).sort(),ue=`Layout not found: ${P} (referenced from ${u})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:f.layoutsDir?`. No .stx layouts found in ${f.layoutsDir}`:"");if(D.log(Error(ue),{layoutPath:P,filePath:u,available:te},"error"),console.error(`[stx] ${ue}`),f.debug)throw new ie(ue,u);return y}let j=await xe(()=>Bun.file(L).text(),"",()=>{throw new ie(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=un(j,L);let H=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(f.debug)console.log(`Found nested layout: ${H[1]} in ${L}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,le,be)=>(ee[le]=be.trim(),""));for(let[ae,le]of Object.entries(ee))if(I[ae]&&I[ae].includes(Te)){let be=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,be)+le+I[ae].slice(be+Te.length)}else if(!I[ae])I[ae]=le;let ue={...e,__sections:I},oe=`@layout('${H[1]}')${te}`;return await o(oe,ue,L,f,g)}let W=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=Fr(W,M),Q={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Q[te]=ue.trim(),`@slot('${te}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(I[te]){let oe=I[te];if(oe.includes(Te)){let ae=Q[te]||"",le=oe.indexOf(Te);oe=oe.slice(0,le)+ae+oe.slice(le+Te.length)}return oe}return ue||""}),X=Ss(X,I),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),X=zr(X,M),e.__originalFilePath=u,y=await kn(X,e,L,f,g),y=`<!-- stx-layout: ${P} -->
|
|
1576
|
-
${y}`,w(y)}catch(L){if(L instanceof U)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function Ss(i,e){return i.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,c,g)=>{let r=e[c];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function $s(i,e){if(i.__stx_sfc_mode=!0,i.__stx_options=e,e.buildMode)i.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",c={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)c[g]=r;i.$env=c}async function Es(i,e){await xe(()=>Kt(i,e),void 0,(u)=>{D.log(u,{filePath:i,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${i}: ${u.message}`)})}var ot="data-stx-source";function mn(i,e){if(!i)return i;let u=/^<script\b([^>]*)>/i.exec(i);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return i;return`<script ${ot}="${encodeURIComponent(e)}"${i.slice(7)}`}function _s(i){let e=new RegExp(`${ot}="([^"]*)"`).exec(i);return e?decodeURIComponent(e[1]):void 0}function yn(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(i,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(i)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function Ts(i,e,u,c){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-
|
|
1576
|
+
${y}`,w(y)}catch(L){if(L instanceof U)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function Ss(i,e){return i.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,c,g)=>{let r=e[c];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function $s(i,e){if(i.__stx_sfc_mode=!0,i.__stx_options=e,e.buildMode)i.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",c={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)c[g]=r;i.$env=c}async function Es(i,e){await xe(()=>Kt(i,e),void 0,(u)=>{D.log(u,{filePath:i,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${i}: ${u.message}`)})}var ot="data-stx-source";function mn(i,e){if(!i)return i;let u=/^<script\b([^>]*)>/i.exec(i);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return i;return`<script ${ot}="${encodeURIComponent(e)}"${i.slice(7)}`}function _s(i){let e=new RegExp(`${ot}="([^"]*)"`).exec(i);return e?decodeURIComponent(e[1]):void 0}function yn(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(i,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(i)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function Ts(i,e,u,c){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-1dbw2j4q.js")),r=[],f=!C()&&!wn();for(let y of g(i)){let S=y.attrs;if(!/\bserver\b/.test(S))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(i,b);if(w===-1)continue;let T=i.slice(b,w);if(!T.trim())continue;let A=_s(S)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-g93jkztp.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(c?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return i;let v=i;for(let y of r.sort((S,b)=>b.index-S.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Cs(i,e,u){try{let{interpolateScriptsInTemplate:c}=await s("stx/expressions",()=>import("./chunk-551vqymy.js"));return c(i,e,{skipServer:!0})}catch(c){let g=c instanceof Error?c:Error(String(c));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),i}}async function kn(i,e,u,c,g){let r=i,f=c;if(r=await Ts(r,e,u,c),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Cs(r,e,u),r=await At(r,e,u,f),we(r))r=po(r,e),r=qr(r,e),r=Wr(r,e);r=fo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-jf717wps.js"));r=v(r,e),r=Kn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Vr(r,e,u,f,g),r=ga(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-c9jnkbdb.js"));r=y(r,e,u);let{processTeleportDirectives:S}=await s("stx/teleport",()=>import("./chunk-kerxevf9.js"));r=S(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-sqvdrk81.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-8j0zcyd7.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-sncp7jhv.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-myc60z74.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:F}=await s("stx/virtual-scrolling",()=>import("./chunk-8bwa63m3.js"));r=P(r,e,u),r=N(r,e,u),r=F(r,e,u);let{processPartialHydrationDirectives:z,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-7jxj6cv1.js"));r=z(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:H}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=H(r,e,u);let{processFormValidationDirectives:W}=await s("stx/forms-validation",()=>import("./chunk-zx468wjw.js"));r=W(r,e,u);let{processHeadDirective:X,processTitleDirective:Q,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-xjx1xbey.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=X(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
|
|
1577
1577
|
`;if(r=Q(r,e),r=ee(r,e,u),r=Xt(r),r=ao(r,e),r=Ct(r),r=Ut(r),r=await Br(r,e,u,f,g),r=await Vr(r,e,u,f,g),e.__stxProcessingDepth===1)r=qa(r,e);if(r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=Do(r),r=re(r,e,u),r=jr(r),r=za(r,e,{filePath:u,buildMode:f.buildMode}),r=co(r,e),r=lo(r,e),r=ze(r,e),r=jt(r,e),r=Ht(r,e),r=await bt(r,e,u,f),r=await ha(r,e,u),r=await ya(r,e,u,f),r=ba(r,e,u,f),r=wo(r,e,u,f),r=xo(r,e,u),r=So(r,e,u,f),r=Et(r,e,u,f),r=ys(r,e),r=bs(r),r=Ha(r),!f.skipEventDirectives)r=Aa(r,e,u);if(r=vt(r,e,u),f.debug){let B=/\bx-data\s*=/.test(r),q=Ur(i);if(B&&q)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1578
1578
|
Both work on the same page, but they manage separate scopes.
|
|
1579
|
-
Prefer signals (state/derived/effect) for new components.`)}r=la(r,e),r=await
|
|
1579
|
+
Prefer signals (state/derived/effect) for new components.`)}r=la(r,e),r=await x(r,e,u),r=Va(r),r=Ua(r),r=pt(r);let{processXElementDirectives:oe}=await s("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=oe(r);let ae=e.__originalFilePath||u,le=Ne(e);if(r=await go(r,f,ae,le),r=It(r,e),r=await Wt(r,e,u,f),f.media?.image?.autoSiblings){let B=f.publicDir||"public",{rewriteImagesWithSiblings:q}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-01ks1244.js"));r=await q(r,{publicDir:B})}if(f.seo?.enabled)r=ko(r,e,f);let be=(B,q,J=!0)=>{if(!q)return B;let me=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(B),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Ce=ne.index+fe.index;B=B.slice(0,Ce)+me[0]+B.slice(Ce+fe[0].length)}if(q=q.replace(me[0],"").trim(),!q)return B}if(/<\/head>/i.test(B))return B.replace(/<\/head>/i,`${q}
|
|
1580
1580
|
</head>`);if(/<head\b[^>]*>/i.test(B))return B.replace(/(<head\b[^>]*>)/i,`$1
|
|
1581
1581
|
${q}`);if(/<html\b[^>]*>/i.test(B))return B.replace(/(<html\b[^>]*>)/i,`$1
|
|
1582
1582
|
<head>
|
|
@@ -1587,6 +1587,6 @@ ${lt()}
|
|
|
1587
1587
|
`+Ce}else r=r.replace("</head>",`${q}
|
|
1588
1588
|
</head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
1589
1589
|
${q}`);else r=q+`
|
|
1590
|
-
`+r}{let{scanScriptTags:B}=await s("stx/signal-processing",()=>import("./chunk-
|
|
1590
|
+
`+r}{let{scanScriptTags:B}=await s("stx/signal-processing",()=>import("./chunk-1dbw2j4q.js")),q=[];for(let J of B(r)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=Sn(r,me);if(ne===-1)continue;let fe=ne+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;q.push({start:J.start,end:fe})}if(q.length>0){let J=Array(q.length+1),me=0;for(let ne=0;ne<q.length;ne++){let{start:fe,end:Ce}=q[ne];J[ne]=r.slice(me,fe),me=Ce}J[q.length]=r.slice(me),r=J.join("")}}let at=ms(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-1dbw2j4q.js"));for(let B of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:B.fullMatch,attrs:B.attrs,content:B.body});for(let{match:B,attrs:q,content:J}of ct){Xe=!0;let me=J;Pe(J,u,c.strict,e.__originalFilePath);let ne=await De(J,{eventBindings:Rn,attrs:q,hasColonDirectives:Mn,templateContent:i,filePath:u,projectRoot:process.cwd(),production:Yo(c.buildMode),serverData:le});r=r.replace(B,()=>ne)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let B=e.__stx_event_bindings||[];if(B.length>0){let q=Ro(B);if(q){let J=r.lastIndexOf("</body>");r=J===-1?r+q:r.slice(0,J)+q+`
|
|
1591
1591
|
`+r.slice(J)}e.__stx_event_bindings=[]}}if(!he(r)&&da(r))r=await Yn(r,f);if(r=pa(r),f.csp?.enabled&&f.csp.useNonce&&typeof e.cspNonce==="string")r=$t(r,e.cspNonce);return r}
|
|
1592
1592
|
export{gt,$e,oa,Lr,to,no,Un,o};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Un,o}from"./chunk-840aejkc.js";import"./chunk-t0644y3k.js";import"./chunk-9bgb9n12.js";import"./chunk-smdxvjhn.js";import"./chunk-thkw9ez9.js";import"./chunk-kbt9r41q.js";import"./chunk-2a1eeywj.js";import"./chunk-drd4t5v4.js";import{ye}from"./chunk-px9p7q26.js";import"./chunk-zt5hp5w5.js";import"./chunk-246k73ga.js";import"./chunk-zj5x4yk2.js";import"./chunk-cfbev664.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import{Pe,ys,bs}from"./chunk-qq40hxg9.js";import"./chunk-gny4j06b.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Un as buildModulesTag,ye as injectRouterScript,o as processDirectives,ys as processJsonDirective,bs as processOnceDirective,Pe as validateClientScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{up,ia,dp,aa,Sl,kl,nn,Gn,pp,_l,Cl,fp,h}from"./chunk-t0644y3k.js";import"./chunk-246k73ga.js";import"./chunk-qq40hxg9.js";import"./chunk-gny4j06b.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{nn as buildCss,_l as extractClassNames,kl as fingerprintConfig,Cl as generateCss,pp as getCachedCSS,up as getCssServeAsset,h as injectCss,ia as loadCssEngine,aa as loadCssEngineConfig,Gn as rebuildCss,dp as resetCssCache,Sl as resolveUserCssConfig,fp as withLinkedModuleBundles};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-w28wc7mv.js";import"./chunk-
|
|
2
|
+
import"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-qq40hxg9.js";import"./chunk-t6m5d64b.js";import"./chunk-gny4j06b.js";import"./chunk-tenbwcts.js";import"./chunk-cfbev664.js";import{c}from"./chunk-xvs84gas.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ze}from"./chunk-gymmbbzc.js";import{ft,Dn}from"./chunk-
|
|
2
|
+
import{Ze}from"./chunk-gymmbbzc.js";import{ft,Dn}from"./chunk-w1wzydvp.js";import{Oe,un,Qa,ec}from"./chunk-qq40hxg9.js";import{mr,hr,yr,vr,Se}from"./chunk-w28wc7mv.js";import{A}from"./chunk-t6m5d64b.js";import{Vo}from"./chunk-gny4j06b.js";import{h}from"./chunk-t0644y3k.js";import{o}from"./chunk-840aejkc.js";import{N,i}from"./chunk-zj5x4yk2.js";import{_a}from"./chunk-912r15hr.js";import{Ve,_e,Ii,Oi,Cn}from"./chunk-kq8t4xn9.js";import{en,Zs}from"./chunk-d4f6dkrt.js";import{En}from"./chunk-pfn70zdr.js";import{Gt,Fn,zn}from"./chunk-bpf3xxng.js";import{q}from"./chunk-px9p7q26.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?Dn():ft(),a=W(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function U(){let n=Ze(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,a={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Qa();let _={};try{_=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Oe(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await o(e,D,r,j,w),C=Ve(b),P=ec();return{route:l,sourceFile:n,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:un(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let a=0,r=0;if(!m.existsSync(n))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(n,l),{copied:a,bytes:r}}async function zu(n={}){let l=Date.now(),a=c.resolve(n.root||process.cwd()),r=c.resolve(a,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,n.componentsDir??e.componentsDir??"components"),_=c.resolve(a,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",f=Se(e.app?.head,{known:vr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=En(w),b=n.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)en(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=q(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((g)=>s.pattern.startsWith(`/${g}/`)||s.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let g=j(s.pattern),O=g.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=yr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=mr(t.html,u);if(f.htmlAttrs)t.html=hr(t.html,f.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await Cn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=_e(t.html,D);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:s,bytes:g}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=zn(a);if(H){let{copied:s,bytes:g}=Z(H,c.join(r,"public",Fn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${Gt}/`)}let F={runtime:v.filename,router:x.filename},T=Ii(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Zs(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Vo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(_a(e._layerGraph),null,2));Oi(T,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
|
|
4
4
|
export{zu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qi,Gi,Ki,Xi,ip}from"./chunk-q7z1ybcn.js";import"./chunk-7fgsqs43.js";import"./chunk-03xn8244.js";import"./chunk-840aejkc.js";import"./chunk-t0644y3k.js";import"./chunk-9bgb9n12.js";import"./chunk-smdxvjhn.js";import"./chunk-thkw9ez9.js";import"./chunk-kbt9r41q.js";import"./chunk-2a1eeywj.js";import"./chunk-drd4t5v4.js";import"./chunk-px9p7q26.js";import"./chunk-zt5hp5w5.js";import"./chunk-246k73ga.js";import"./chunk-zj5x4yk2.js";import"./chunk-cfbev664.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import"./chunk-qq40hxg9.js";import"./chunk-gny4j06b.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{qi as buildNative,ip as default,Gi as findCraftBinary,Xi as getAvailableFormats,Ki as getAvailableTargets};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{so,oo,io,hp,Hr,yp}from"./chunk-
|
|
2
|
+
import{so,oo,io,hp,Hr,yp}from"./chunk-kbt9r41q.js";export{Hr as clearImageDeliveryCatalog,hp as deliveredImage,io as efficientDeliverySources,so as getImageDelivery,oo as isTransparentImage,yp as prepareImageDelivery};
|