@stacksjs/stx 0.2.654 → 0.2.656
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-ff1cb7k4.js → chunk-0gqmp9sa.js} +2 -2
- package/dist/{chunk-48acjmeg.js → chunk-0jhdrgpr.js} +2 -2
- package/dist/{chunk-q1x7ckfw.js → chunk-1z1fmda6.js} +1 -1
- package/dist/chunk-26qc9v36.js +2 -0
- package/dist/{chunk-y8881za3.js → chunk-27v1ehy0.js} +1 -1
- package/dist/{chunk-3v8yejzc.js → chunk-2h92dm3t.js} +3 -3
- package/dist/{chunk-46w53nj5.js → chunk-2jh21f1n.js} +1 -1
- package/dist/chunk-2qf9vt7y.js +2 -0
- package/dist/{chunk-k7nan28e.js → chunk-31yb0253.js} +4 -4
- package/dist/chunk-3p7xp7de.js +2 -0
- package/dist/{chunk-6rparhvs.js → chunk-5cyznacz.js} +1 -1
- package/dist/{chunk-j2bkjtp3.js → chunk-5w2jy5r9.js} +4 -4
- package/dist/chunk-67rvd6qy.js +2 -0
- package/dist/{chunk-h4vg78mw.js → chunk-6c2pvrw8.js} +1 -1
- package/dist/{chunk-4qwvqbzf.js → chunk-7rta163c.js} +2 -2
- package/dist/{chunk-s4cs2n2c.js → chunk-80fkh83p.js} +1 -1
- package/dist/{chunk-g7j3mwzd.js → chunk-889evdcy.js} +12 -12
- package/dist/{chunk-znnfjxph.js → chunk-8d2f2e42.js} +1 -1
- package/dist/{chunk-wh838rdh.js → chunk-8nryyqb5.js} +1 -1
- package/dist/chunk-9c3cq8ks.js +2 -0
- package/dist/chunk-9q23eed0.js +2 -0
- package/dist/chunk-a2bw46t9.js +2 -0
- package/dist/{chunk-phws2c9s.js → chunk-a2dnv6n9.js} +1 -1
- package/dist/{chunk-t7j4h3nf.js → chunk-ajjcp56c.js} +3 -3
- package/dist/{chunk-vngnface.js → chunk-aprhqxky.js} +3 -3
- package/dist/chunk-b4fd2dtk.js +2 -0
- package/dist/chunk-bpm8tyvc.js +2 -0
- package/dist/{chunk-a2a74f6c.js → chunk-c9k40352.js} +1 -1
- package/dist/{chunk-5yxd4ryz.js → chunk-cjj9b9wf.js} +2 -2
- package/dist/chunk-da6qbwqs.js +2 -0
- package/dist/chunk-dknd9nhz.js +2 -0
- package/dist/{chunk-v9bmw06j.js → chunk-ds3qn1ty.js} +1 -1
- package/dist/{chunk-x9d4bpmh.js → chunk-dv7dm5z1.js} +20 -20
- package/dist/{chunk-26whq1rg.js → chunk-e7z85137.js} +1 -1
- package/dist/{chunk-c9b0cme2.js → chunk-eecgcj41.js} +1 -1
- package/dist/chunk-fbtv2k1p.js +3 -0
- package/dist/chunk-fjqphdvp.js +2 -0
- package/dist/{chunk-xq410rsc.js → chunk-g96m1a69.js} +1 -1
- package/dist/{chunk-hjmnsa6a.js → chunk-gf3bxnpq.js} +1 -1
- package/dist/{chunk-vmn2b6p6.js → chunk-gz90fqn8.js} +1 -1
- package/dist/{chunk-50pkybyn.js → chunk-gzd7bmp5.js} +1 -1
- package/dist/{chunk-4e0z858k.js → chunk-hb08vrbb.js} +1 -1
- package/dist/{chunk-2yg9y1na.js → chunk-hzjvpcmj.js} +109 -94
- package/dist/chunk-j2hkxwjy.js +2 -0
- package/dist/{chunk-35zjpdcb.js → chunk-jf17b7y9.js} +1 -1
- package/dist/{chunk-m47spkxr.js → chunk-jfmjw734.js} +2 -2
- package/dist/{chunk-xdgvb5a5.js → chunk-jrf01hfv.js} +1 -1
- package/dist/{chunk-71mthavp.js → chunk-jvv9p6v6.js} +1 -1
- package/dist/{chunk-kcrtqyek.js → chunk-k9amsnfj.js} +4 -4
- package/dist/chunk-kg54zsda.js +2 -0
- package/dist/chunk-kpycf9tz.js +2 -0
- package/dist/{chunk-ra56jh7e.js → chunk-mz1npbyk.js} +1 -1
- package/dist/chunk-ne72vxmc.js +2 -0
- package/dist/{chunk-cvw7gknw.js → chunk-nn138y2w.js} +3 -3
- package/dist/{chunk-cq40n7ak.js → chunk-np1k9vsr.js} +1 -1
- package/dist/{chunk-sd4jwn3y.js → chunk-p314pg80.js} +1 -1
- package/dist/chunk-p7096wfv.js +2 -0
- package/dist/{chunk-vs8kg85h.js → chunk-p7bqzhe1.js} +1 -1
- package/dist/{chunk-en8jgavy.js → chunk-pxqh758g.js} +81 -19
- package/dist/chunk-qc5wyxvc.js +2 -0
- package/dist/{chunk-ht3dxx5m.js → chunk-qkasqamj.js} +1 -1
- package/dist/{chunk-7wnd2psp.js → chunk-qkq8at1r.js} +1 -1
- package/dist/{chunk-8gewq710.js → chunk-r7kmsq3n.js} +1 -1
- package/dist/{chunk-929zbzh7.js → chunk-rccpf74y.js} +1 -1
- package/dist/{chunk-d4tf0tfn.js → chunk-rjh2jwxx.js} +4 -4
- package/dist/chunk-s2qv0y4x.js +2 -0
- package/dist/{chunk-36649w15.js → chunk-sdknbvh8.js} +1 -1
- package/dist/{chunk-khvc43pq.js → chunk-t2pzy3x1.js} +2 -2
- package/dist/{chunk-h09a03ay.js → chunk-t9mfztcs.js} +4 -4
- package/dist/{chunk-n7xbhzzt.js → chunk-teahew39.js} +4 -4
- package/dist/{chunk-9y2ncrnq.js → chunk-v2x9vzgw.js} +2 -2
- package/dist/{chunk-xhmpfq9d.js → chunk-v3kc2anv.js} +1 -1
- package/dist/{chunk-hw7sv4ac.js → chunk-v5r6abrq.js} +1 -1
- package/dist/{chunk-bgt1dx8c.js → chunk-vm26nak1.js} +1 -1
- package/dist/chunk-vmzkbdmp.js +2 -0
- package/dist/{chunk-6598d3m6.js → chunk-vqc4h16r.js} +2 -2
- package/dist/{chunk-qygynhzc.js → chunk-w2zceynt.js} +1 -1
- package/dist/chunk-weqc0ssb.js +2 -0
- package/dist/chunk-wp0jtntj.js +54 -0
- package/dist/{chunk-gmrc24cb.js → chunk-x2wgczak.js} +1 -1
- package/dist/{chunk-ktvr9ta8.js → chunk-x5777qkq.js} +2 -2
- package/dist/chunk-xesyd9nx.js +2 -0
- package/dist/{chunk-nttspz8c.js → chunk-xv43szx0.js} +4 -4
- package/dist/{chunk-ex1kd5gs.js → chunk-y4waj1p4.js} +2 -2
- package/dist/chunk-yb89cj9s.js +2 -0
- package/dist/{chunk-mgj34bbg.js → chunk-yh0wb4n1.js} +1 -1
- package/dist/chunk-ypsym37h.js +2 -0
- package/dist/{chunk-4nbq7mnp.js → chunk-yq021b3r.js} +4 -4
- package/dist/{chunk-6raq8r7w.js → chunk-yr34z9ey.js} +1 -1
- package/dist/{chunk-qrt8b179.js → chunk-zaaeneq6.js} +2 -2
- package/dist/{chunk-1zb7ar32.js → chunk-zaj65qc1.js} +2 -2
- package/dist/{chunk-k49fg322.js → chunk-zfeq5h13.js} +2 -2
- package/dist/{chunk-dxk5sqtv.js → chunk-zhf01af3.js} +2 -2
- package/dist/{chunk-2zqg980j.js → chunk-zyv28182.js} +1 -1
- package/dist/cli.js +11 -11
- package/dist/client/signals-dom-ready-runtime.js +2 -2
- package/dist/client/signals-effect-runtime.js +22 -9
- package/dist/client/signals-lifecycle-runtime.js +15 -0
- package/dist/client/signals-manifest-hydration-runtime.js +8 -1
- package/dist/client/signals-mount-runtime.js +16 -4
- package/dist/client/signals-public-api-runtime.js +1 -0
- package/dist/client/signals-scope-disposal-runtime.js +14 -0
- package/dist/client/signals-spa-load-runtime.js +2 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/includes.js +9 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +12 -12
- package/dist/utils.js +15 -0
- package/package.json +5 -5
- package/dist/chunk-17srvghf.js +0 -2
- package/dist/chunk-3634ds4n.js +0 -2
- package/dist/chunk-3msbc4zj.js +0 -2
- package/dist/chunk-3q3gsr7m.js +0 -2
- package/dist/chunk-42v0vegr.js +0 -2
- package/dist/chunk-73swyb5p.js +0 -2
- package/dist/chunk-d0xcykw6.js +0 -2
- package/dist/chunk-dxjc11hx.js +0 -2
- package/dist/chunk-edz1h5f9.js +0 -2
- package/dist/chunk-etw04j02.js +0 -2
- package/dist/chunk-ewng6v6g.js +0 -49
- package/dist/chunk-fbd9w4ys.js +0 -2
- package/dist/chunk-fnj3gja0.js +0 -2
- package/dist/chunk-fsnby15p.js +0 -2
- package/dist/chunk-h0bg2h0j.js +0 -2
- package/dist/chunk-j3472s37.js +0 -3
- package/dist/chunk-jmx4q1yr.js +0 -2
- package/dist/chunk-m947aq9a.js +0 -2
- package/dist/chunk-ndtxkps4.js +0 -2
- package/dist/chunk-pge3bzqx.js +0 -2
- package/dist/chunk-q79ksfcd.js +0 -2
- package/dist/chunk-qjf1c8fa.js +0 -2
- package/dist/chunk-rmdw6s65.js +0 -2
- package/dist/chunk-s0crnpyx.js +0 -2
- package/dist/chunk-z75bp57x.js +0 -2
- package/dist/chunk-zrqremja.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Je}from"./chunk-
|
|
2
|
+
import{Je}from"./chunk-zaaeneq6.js";import{pt,On}from"./chunk-pxqh758g.js";import{Pe,cn,Xa,Ja}from"./chunk-hzjvpcmj.js";import{pr,fr,gr,hr,we}from"./chunk-hb08vrbb.js";import{A}from"./chunk-2h8ea0we.js";import{jo}from"./chunk-jf17b7y9.js";import{h}from"./chunk-0gqmp9sa.js";import{s}from"./chunk-889evdcy.js";import{N,i}from"./chunk-2h92dm3t.js";import{wa}from"./chunk-04kg16qs.js";import{ze,Se,$i,Ri,kn}from"./chunk-k9amsnfj.js";import{Zt,Ks}from"./chunk-cjj9b9wf.js";import{_n}from"./chunk-vqc4h16r.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import{V}from"./chunk-teahew39.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(o){return Q("sha256").update(o).digest("hex").slice(0,8)}function J(o=!1){let l=o?On():pt(),a=W(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function U(){let o=Je(),l=W(o);return{content:o,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(o={}){let l=new Set;return{context:new Proxy(o,{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(o,l,a={}){let r=q.resolve(o),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Xa();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)=>Pe(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await s(e,D,r,j,w),C=ze(b),P=Ja();return{route:l,sourceFile:o,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:cn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(o,l){let a=0,r=0;if(!m.existsSync(o))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(o,l),{copied:a,bytes:r}}async function Mu(o={}){let l=Date.now(),a=c.resolve(o.root||process.cwd()),r=c.resolve(a,o.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,o.componentsDir??e.componentsDir??"components"),_=c.resolve(a,o.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,o.layoutsDir??e.layoutsDir??"layouts"),d=o.publicDir??e.publicDir??"public",f=we(e.app?.head,{known:hr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=o.routeRules??e.routeRules??{},j=_n(w),b=o.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)Zt(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 n of P)m.mkdirSync(n,{recursive:!0});console.log("[stx build] Discovering routes...");let R=V(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((n)=>!Y.some((g)=>n.pattern.startsWith(`/${g}/`)||n.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(o.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 n of B){let g=j(n.pattern),O=g.rendering==="prerender";if(O&&(n.pattern.includes(":")||n.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${n.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(n.filePath,n.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:o.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=gr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=pr(t.html,u);if(f.htmlAttrs)t.html=fr(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 kn(t,{params:{},request:new Request(`http://stx.build${n.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 ${n.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=Se(t.html,D);let L=n.pattern==="/"?"index":n.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:n.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:n.pattern.includes(":")||n.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${n.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${n.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:n,bytes:g}=Z(E,c.join(r,"public"));if(n>0)console.log(`[stx build] Copied ${n} public asset${n===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=Bn(a);if(H){let{copied:n,bytes:g}=Z(H,c.join(r,"public",jn));if(n>0)console.log(`[stx build] Copied ${n} asset${n===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${qt}/`)}let F={runtime:v.filename,router:x.filename},T=$i(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Ks(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await jo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(wa(e._layerGraph),null,2));Ri(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{Mu};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{_o,Ea,r,Ct,te,S,Re,on,Ae,le,q,or,an,us,La,ln,cr,ps,gs,ja,Ao,Ba,Fa,za,Ha,Ie,Oe,ms,Me,n,pn,g,m,F,K,be,k,_}from"./chunk-hzjvpcmj.js";import{l,d,E,t,re,z,a,ve,zo,D,hn,Ho,Mt,Vo,ec,pr,tc,nt,nc,fr,rc,yn,Uo,sc,gr,hr,we,Wo}from"./chunk-hb08vrbb.js";import{Ot}from"./chunk-2h8ea0we.js";import{gn}from"./chunk-jf17b7y9.js";import{h}from"./chunk-0gqmp9sa.js";import{er,ts}from"./chunk-zaaeneq6.js";import{ua,da,Yn,Ke,pa,R}from"./chunk-2h92dm3t.js";import{mo,ho,yo,bo}from"./chunk-t9mfztcs.js";import{oa,Br}from"./chunk-rccpf74y.js";import{Dr,Mr,Lr}from"./chunk-wp0jtntj.js";import{Nr,qn}from"./chunk-sdknbvh8.js";import{Fr,io,ao,zr,Hr,co}from"./chunk-31yb0253.js";import{Zs}from"./chunk-prf164ct.js";import{ee,no,ro,so}from"./chunk-r7kmsq3n.js";import{Gn,ge,aa,Kn,ca}from"./chunk-teahew39.js";import{U,qe}from"./chunk-szyqxcfj.js";import{fa,ga}from"./chunk-e7z85137.js";import{C,bn,qo}from"./chunk-fbtv2k1p.js";import fs from"fs";import ce from"path";function lt(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -815,7 +815,7 @@ window.__stx_reactive = (function() {
|
|
|
815
815
|
|
|
816
816
|
return { initScope: initScope, reactive: reactive };
|
|
817
817
|
})();
|
|
818
|
-
`}function yt(c,e){let u=c.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let x=
|
|
818
|
+
`}function yt(c,e){let u=c.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let x=_(y,e,!0);if(x===void 0)return v;return String(x)}catch{return v}}),o="",f=0,i=null;while(f<u.length){let v=u[f];if(i&&v==="\\"){o+=v+(u[f+1]??""),f+=2;continue}if(v==="{"&&u[f+1]==="{"){let y=u.indexOf("}}",f+2);if(y!==-1){let x=u.slice(f,y+2);o+=p(u.slice(f+2,y),x,i),f=y+2;continue}}if(i){if(v===i)i=null}else if(v==="'"||v==='"'||v==="`")i=v;o+=v,f++}return o;function p(v,y,x){let b;try{b=_(v,e,!0)}catch{return y}if(b===void 0)return y;if(x){let w=String(b).replace(/\\/g,"\\\\").replace(new RegExp(x==="`"?"`":x,"g"),`\\${x}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return x==="`"?w.replace(/\$\{/g,"\\${"):w}if(typeof b==="string"){let w=b.trim();if(w.startsWith("{")&&w.endsWith("}")||w.startsWith("[")&&w.endsWith("]"))try{return JSON.parse(w),w}catch{}}return JSON.stringify(b)}}function nr(c,e){if(c.length===0)return"";let u=c.map((o)=>{let f=JSON.stringify(Object.fromEntries(o.refs)),i=yt(o.stateExpr,e),p=o.initExpr?yt(o.initExpr,e):null,v=JSON.stringify(i),y=p?JSON.stringify(p):"null";return`
|
|
819
819
|
(function() {
|
|
820
820
|
var scopeEl = document.querySelector('${o.selector}');
|
|
821
821
|
if (!scopeEl) return;
|
|
@@ -828,9 +828,9 @@ ${tr()}
|
|
|
828
828
|
${u}
|
|
829
829
|
</script>`}function vt(c,e,u){if(!sr(c))return c;let o=Xn(c);if(o.length===0)return c;let f=rr(c,o),i=nr(o,e),p=f.lastIndexOf("</body>");if(p!==-1)f=f.slice(0,p)+i+`
|
|
830
830
|
`+f.slice(p);else f+=i;return f}function rr(c,e){let u=0,o=c.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(f,i,p)=>{let v=e[u++];if(!v)return f;let y=/data-stx-scope="([^"]*)"/.exec(p);if(y)return v.id=y[1],v.selector=`[data-stx-scope="${v.id}"]`,f;return`<${i} data-stx-scope="${v.id}"${p}>`});return o=o.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),o=o.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),o=o.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),o=o.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),o}function sr(c){return/x-data\s*=\s*["']/.test(c)}import ir from"fs";import Ze from"path";import{createHighlighter as ar}from"ts-syntax-highlighter";var Qe=new Map;async function Ee(c,e={}){try{if(!await n(c))throw Error(`Markdown file not found: ${c}`);let o=(await ir.promises.stat(c)).mtime.getTime();if(e.cache&&Qe.has(c)){let w=Qe.get(c);if(w.updatedAt>=o)return{content:w.content,data:w.data}}let f=await Bun.file(c).text(),{data:i,content:p}=Yn(f),v=e.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=Ke(p,{gfm:!0});if(v.syntaxHighlighting?.enabled&&v.syntaxHighlighting?.serverSide)x=await lr(x,v.syntaxHighlighting?.defaultTheme||"github-dark",v.syntaxHighlighting?.highlightUnknownLanguages||!1);let b={content:x,data:i||{}};if(e.cache)Qe.set(c,{...b,updatedAt:o});return b}catch(u){if(e.debug)console.error(`Error reading/parsing markdown file ${c}:`,u);let o=u instanceof Error?u.message:String(u);return{content:g("Markdown File",`Error reading/parsing markdown file: ${o}`,c,"",0,""),data:{}}}}var Ue=null;async function lr(c,e,u){let o=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Ue)try{Ue=await ar({theme:e||"github-dark",cache:!0})}catch(v){return console.error("Failed to initialize ts-syntax-highlighter:",v),c}let f=async(v,y,x,b)=>{let w=b.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),T=x||(u?"text":"");if(!T)return v;try{if(!Ue.getSupportedLanguages().includes(T))return v;return(await Ue.highlight(w,T,{theme:e})).html}catch(A){console.error(`Error highlighting code block with language ${x}:`,A)}return v},i=c,p=c.matchAll(o);for(let v of p){let[y,x,b,w]=v,T=await f(y,x,b,w);i=i.replace(y,T)}return i}async function bt(c,e,u="",o={}){return await ur(c,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(p,v,y,x)=>{try{let b=v;if(!Ze.isAbsolute(v))b=Ze.resolve(Ze.dirname(u),v);let w={};if(y)try{try{w=JSON.parse(y)}catch{if(o.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 V of N){let X=V.indexOf(":");if(X>0){let L=V.substring(0,X).trim(),j=V.substring(X+1).trim(),H=j.startsWith('"')&&j.endsWith('"'),G=j.startsWith("'")&&j.endsWith("'");if(H||G)j=j.substring(1,j.length-1);w[L]=j}}}}catch(P){if(o.debug)console.error("Error parsing context in @markdown-file directive:",P)}let{content:T,data:A}=await Ee(b,o),O={...e,...A,...w},M=T,I=/\{\{([^}]+)\}\}/g;return M=M.replace(I,(P,N)=>{let V=N.trim();return O[V]!==void 0?String(O[V]):P}),M}catch(b){let w=b instanceof Error?b.message:String(b);return g("Markdown File",`Error including markdown file: ${w}`,u,c,x,p)}})}async function ur(c,e,u){let o=[],f;while((f=e.exec(c))!==null){let v=f[0],y=f.index,x=f;o.push(u(...x).then((b)=>({match:v,replacement:b,index:y})))}let i=await Promise.all(o);i.sort((v,y)=>y.index-v.index);let p=c;for(let{match:v,replacement:y}of i)p=p.replace(v,()=>y);return p}var wt=new WeakMap;function xt(c=16){let e=new Uint8Array(c);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ve(c,e){if(!c)return e?.nonceGenerator?.()??xt();let u=wt.get(c);if(!u)u=e?.nonceGenerator?.()??xt(),wt.set(c,u);return u}function dr(c,e){let u=[];for(let[o,f]of Object.entries(c)){if(f===void 0||f===null)continue;if(typeof f==="boolean"){if(f)u.push(o);continue}if(Array.isArray(f)){let i=[...f];if(e&&(o==="script-src"||o==="style-src"))i=i.filter((p)=>!p.startsWith("'nonce-")),i.push(`'nonce-${e}'`);if(i.length>0)u.push(`${o} ${i.join(" ")}`)}}return u.join("; ")}function kt(c,e){return`<meta http-equiv="Content-Security-Policy" content="${dr(c,e).replace(/&/g,"&").replace(/"/g,""")}">`}function St(c,e,u){if(!e.enabled||!e.addMetaTag)return c;if(c.includes('http-equiv="Content-Security-Policy"'))return c;if(!c.includes("<head>")&&!c.includes("<head "))return c;let o=e.useNonce?Ve(u,e):void 0,f=kt(e.directives,o);return c.replace(/<head([^>]*)>/,`<head$1>
|
|
831
|
-
${f}`)}function $t(c,e){let u=c;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(o,f)=>{if(f.includes("nonce="))return o;return`<script nonce="${e}"${f}>`}),u=u.replace(/<style([^>]*)>/gi,(o,f)=>{if(f.includes("nonce="))return o;return`<style nonce="${e}"${f}>`}),u}function Et(c,e,u,o){let f=c,i=o.csp;if(f=f.replace(/@csp\b/g,()=>{if(!i?.enabled||!i.directives)return"<!-- CSP not configured -->";let p=i.useNonce?Ve(e,i):void 0;return kt(i.directives,p)}),f=f.replace(/@cspNonce\b/g,()=>{if(!i?.enabled||!i.useNonce)return"";return Ve(e,i)}),i?.enabled&&i.useNonce)e.cspNonce=Ve(e,i);return f}import mr from"crypto";var yr=40,Tt="_token",Ye=null;function vr(c=yr){let e=mr.randomBytes(Math.ceil(c/2)).toString("hex").slice(0,c);return Ye=e,e}function br(){if(!Ye)vr();return Ye}function wr(c=Tt){let e=br();return`<input type="hidden" name="${c}" value="${e}">`}function Ct(c){return c.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,o)=>wr(o||Tt))}async function At(c,e,u,o){if(!o.customDirectives||o.customDirectives.length===0)return c;let f=c;for(let i of o.customDirectives){if(!i.name||typeof i.handler!=="function"){if(o.debug)console.warn("Invalid custom directive:",i);continue}if(i.hasEndTag)f=await xr(f,i,e,u,o);else f=await kr(f,i,e,u,o)}return f}async function xr(c,e,u,o,f){let{name:i,handler:p}=e,v=`@${i}`,y=`@end${i}`,x=c,b=_t(`${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(),V=await p(N,P,u,o);w.push({original:A,processed:V,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(f.debug)console.error(`Error processing custom directive @${i}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${i}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(x)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];x=x.replace(O,M)}return x}async function kr(c,e,u,o,f){let{name:i,handler:p}=e,v=c,y=[],x=[];if(e.rawParams){for(let T of Ho(v,_t(`(?<![\\w$@])@${i}\\s*\\(`,"g")))if(T.end!==-1)x.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=_t(`@${i}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)x.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of x)try{let M=Rt(e,A),I=await p("",M,u,o);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(f.debug)console.error(`Error processing custom directive @${i}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${i}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=_t(`@${i}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await p("",[],u,o);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(f.debug)console.error(`Error processing custom directive @${i}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${i}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(c,e){return c.rawParams?Mt(e):Sr(e)}function Sr(c){if(!c.trim())return[];let e=[],u="",o=!1,f="";for(let i=0;i<c.length;i++){let p=c[i];if((p==='"'||p==="'")&&(i===0||c[i-1]!=="\\"))if(!o)o=!0,f=p;else if(p===f)o=!1;else u+=p;else if(p===","&&!o)e.push(u.trim()),u="";else u+=p}if(u.trim())e.push(u.trim());return e.map((i)=>{let p=i.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Dt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,It=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function Se(c,e){if(typeof c!=="string"||c.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(c){if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap expects an options object");let e=c,{appearance:u,colorMode:o}=e;if(Se(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!o||typeof o!=="object"||Array.isArray(o))throw Error("@appearanceBootstrap colorMode must be an object");if(Se(o.key,"colorMode.key"),Se(o.attribute,"colorMode.attribute"),Se(o.default,"colorMode.default"),!It.test(o.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Dt.test(o.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(o.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let f=null;if(u){if(Se(u.key,"appearance.key"),Se(u.attribute,"appearance.attribute"),Se(u.default,"appearance.default"),!It.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Dt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((i)=>typeof i!=="string"||i.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");f={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:f,colorMode:{key:o.key,attribute:o.attribute,default:o.default},respectExisting:e.respectExisting===!0}}function _r(c){return JSON.stringify(c).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(c){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(c)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(c,e){let u=1,o=null,f=!1;for(let i=e+1;i<c.length;i++){let p=c[i];if(f){f=!1;continue}if(o){if(p==="\\")f=!0;else if(p===o)o=null;continue}if(p==='"'||p==="'"||p==="`"){o=p;continue}if(p==="(")u++;else if(p===")"&&--u===0)return i}return-1}function Pt(c,e){let u=c,o=/@appearanceBootstrap\s*\(/g,f;while((f=o.exec(u))!==null){let i=f.index+f[0].length-1,p=Cr(u,i);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(i+1,p).trim(),y=l(`(${v})`,e),x=Tr(Er(y));u=u.slice(0,f.index)+x+u.slice(p+1),o.lastIndex=f.index+x.length}return u}import Ar from"crypto";function Q(c){return F(String(c??""))}var jt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function ze(c,e,u,o){let f=c||e;return u?`${f} ${o}`:f}function me(c){return String(c).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function De(c,e){if(/\bid\s*=/i.test(c))return"";return` id="${Q(e)}"`}function et(c,e,u){if(!e)return"";let o="";if(!/\baria-invalid\s*=/i.test(u))o+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))o+=` aria-describedby="${Q(`${me(c)}-error`)}"`;return o}function Rr(){return Ar.randomUUID()}function We(c,e){let u=c;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let o=Rr();e.csrf={token:o}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(o,f)=>{let i=f.toUpperCase();if(f&&!["GET","POST"].includes(i))return`<input type="hidden" name="_method" value="${Q(i)}">`;return o}),u}function Nt(c,e,u=jt){let o=c;return o=o.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(f,i,p,v,y,x="")=>{let b=i||p||"POST",w=v||y||"",T=ye(x),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Q(O)}" action="${Q(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
831
|
+
${f}`)}function $t(c,e){let u=c;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(o,f)=>{if(f.includes("nonce="))return o;return`<script nonce="${e}"${f}>`}),u=u.replace(/<style([^>]*)>/gi,(o,f)=>{if(f.includes("nonce="))return o;return`<style nonce="${e}"${f}>`}),u}function Et(c,e,u,o){let f=c,i=o.csp;if(f=f.replace(/@csp\b/g,()=>{if(!i?.enabled||!i.directives)return"<!-- CSP not configured -->";let p=i.useNonce?Ve(e,i):void 0;return kt(i.directives,p)}),f=f.replace(/@cspNonce\b/g,()=>{if(!i?.enabled||!i.useNonce)return"";return Ve(e,i)}),i?.enabled&&i.useNonce)e.cspNonce=Ve(e,i);return f}import mr from"crypto";var yr=40,_t="_token",Ye=null;function vr(c=yr){let e=mr.randomBytes(Math.ceil(c/2)).toString("hex").slice(0,c);return Ye=e,e}function br(){if(!Ye)vr();return Ye}function wr(c=_t){let e=br();return`<input type="hidden" name="${c}" value="${e}">`}function Tt(c){return c.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,o)=>wr(o||_t))}async function At(c,e,u,o){if(!o.customDirectives||o.customDirectives.length===0)return c;let f=c;for(let i of o.customDirectives){if(!i.name||typeof i.handler!=="function"){if(o.debug)console.warn("Invalid custom directive:",i);continue}if(i.hasEndTag)f=await xr(f,i,e,u,o);else f=await kr(f,i,e,u,o)}return f}async function xr(c,e,u,o,f){let{name:i,handler:p}=e,v=`@${i}`,y=`@end${i}`,x=c,b=Ct(`${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(),V=await p(N,P,u,o);w.push({original:A,processed:V,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(f.debug)console.error(`Error processing custom directive @${i}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${i}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(x)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];x=x.replace(O,M)}return x}async function kr(c,e,u,o,f){let{name:i,handler:p}=e,v=c,y=[],x=[];if(e.rawParams){for(let T of Ho(v,Ct(`(?<![\\w$@])@${i}\\s*\\(`,"g")))if(T.end!==-1)x.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=Ct(`@${i}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)x.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of x)try{let M=Rt(e,A),I=await p("",M,u,o);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(f.debug)console.error(`Error processing custom directive @${i}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${i}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=Ct(`@${i}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await p("",[],u,o);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(f.debug)console.error(`Error processing custom directive @${i}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${i}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(c,e){return c.rawParams?Mt(e):Sr(e)}function Sr(c){if(!c.trim())return[];let e=[],u="",o=!1,f="";for(let i=0;i<c.length;i++){let p=c[i];if((p==='"'||p==="'")&&(i===0||c[i-1]!=="\\"))if(!o)o=!0,f=p;else if(p===f)o=!1;else u+=p;else if(p===","&&!o)e.push(u.trim()),u="";else u+=p}if(u.trim())e.push(u.trim());return e.map((i)=>{let p=i.trim();if(p.startsWith('"')&&p.endsWith('"')||p.startsWith("'")&&p.endsWith("'"))return p.substring(1,p.length-1);return p})}var Dt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,It=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function Se(c,e){if(typeof c!=="string"||c.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(c){if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap expects an options object");let e=c,{appearance:u,colorMode:o}=e;if(Se(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!o||typeof o!=="object"||Array.isArray(o))throw Error("@appearanceBootstrap colorMode must be an object");if(Se(o.key,"colorMode.key"),Se(o.attribute,"colorMode.attribute"),Se(o.default,"colorMode.default"),!It.test(o.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Dt.test(o.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(o.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let f=null;if(u){if(Se(u.key,"appearance.key"),Se(u.attribute,"appearance.attribute"),Se(u.default,"appearance.default"),!It.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Dt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((i)=>typeof i!=="string"||i.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");f={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:f,colorMode:{key:o.key,attribute:o.attribute,default:o.default},respectExisting:e.respectExisting===!0}}function _r(c){return JSON.stringify(c).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(c){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(c)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(c,e){let u=1,o=null,f=!1;for(let i=e+1;i<c.length;i++){let p=c[i];if(f){f=!1;continue}if(o){if(p==="\\")f=!0;else if(p===o)o=null;continue}if(p==='"'||p==="'"||p==="`"){o=p;continue}if(p==="(")u++;else if(p===")"&&--u===0)return i}return-1}function Pt(c,e){let u=c,o=/@appearanceBootstrap\s*\(/g,f;while((f=o.exec(u))!==null){let i=f.index+f[0].length-1,p=Cr(u,i);if(p===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(i+1,p).trim(),y=l(`(${v})`,e),x=Tr(Er(y));u=u.slice(0,f.index)+x+u.slice(p+1),o.lastIndex=f.index+x.length}return u}import Ar from"crypto";function Q(c){return F(String(c??""))}var jt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function ze(c,e,u,o){let f=c||e;return u?`${f} ${o}`:f}function me(c){return String(c).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function De(c,e){if(/\bid\s*=/i.test(c))return"";return` id="${Q(e)}"`}function et(c,e,u){if(!e)return"";let o="";if(!/\baria-invalid\s*=/i.test(u))o+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))o+=` aria-describedby="${Q(`${me(c)}-error`)}"`;return o}function Rr(){return Ar.randomUUID()}function We(c,e){let u=c;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let o=Rr();e.csrf={token:o}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(o,f)=>{let i=f.toUpperCase();if(f&&!["GET","POST"].includes(i))return`<input type="hidden" name="_method" value="${Q(i)}">`;return o}),u}function Nt(c,e,u=jt){let o=c;return o=o.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(f,i,p,v,y,x="")=>{let b=i||p||"POST",w=v||y||"",T=ye(x),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Q(O)}" action="${Q(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
832
832
|
${We("@csrf",e)}`,!["GET","POST"].includes(A))M+=`
|
|
833
|
-
${We(`@method('${A}')`,e)}`;return M}),o=o.replace(/@endform/g,"</form>"),o=o.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(f,i,p,v,y,x="")=>{let b=i||p||"",w=v||y||"",T=ye(x),A=Ne(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),V=ze(N?N[1]:"",u.input,P,u.inputError),X=T.replace(/class=['"][^'"]+['"]/i,"");return X=X.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Q(I)}" name="${Q(b)}"${De(T,me(b))} value="${Q(O)}" class="${V}"${et(b,P,T)}${X?` ${X}`:""}>`}),o=o.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(f,i,p="",v="")=>{let y=ye(p),x=Ne(i,e)||v.trim(),b=He(i,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=ze(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Q(i)}"${De(y,me(i))} class="${T}"${et(i,b,y)}${A?` ${A}`:""}>${Q(x)}</textarea>`}),o=o.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(f,i,p="",v)=>{let y=ye(p),x=Ne(i,e),b=He(i,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=ze(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,""),O=v;if(x!==void 0)O=v.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(M,I,P)=>{if((Array.isArray(x)?x.some((V)=>String(V)===P):String(x)===P)&&!I.includes("selected"))return I.replace(/(<option)/,"$1 selected");return M});return`<select name="${Q(i)}"${De(y,me(i))} class="${T}"${et(i,b,y)}${A?` ${A}`:""}>${O}</select>`}),o=o.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(f,i,p,v="")=>{let y=p===void 0?"1":p,x=p===void 0?me(i):`${me(i)}-${me(y)}`,b=ye(v),w=Ne(i,e),T=w!==void 0&&(Array.isArray(w)?w.some((I)=>String(I)===y):w===!0||String(w)===y),A=b.match(/class=['"]([^'"]+)['"]/i),O=A?A[1]:u.checkInput,M=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Q(i)}"${De(b,x)} value="${Q(y)}" class="${O}"${T?" checked":""}${M?` ${M}`:""}>`}),o=o.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(f,i,p,v="")=>{let y=ye(v),x=Ne(i,e),b=x!==void 0&&x===p,w=y.match(/class=['"]([^'"]+)['"]/i),T=w?w[1]:u.checkInput,A=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Q(i)}"${De(y,`${me(i)}-${me(p)}`)} value="${Q(p)}" class="${T}"${b?" checked":""}${A?` ${A}`:""}>`}),o=o.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(f,i,p="")=>{let v=ye(p),y=v.match(/accept=['"]([^'"]+)['"]/i),x=y?y[1]:"",b=v.includes("multiple"),w=He(i,e),T=v.match(/class=['"]([^'"]+)['"]/i),A=ze(T?T[1]:"",u.input,w,u.inputError),O=v.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),M=[`<input type="file" name="${Q(i)}"${De(v,me(i))}`,`class="${A}"`];if(x)M.push(`accept="${Q(x)}"`);if(b)M.push("multiple");if(O)M.push(O);return`${M.join(" ")}>`}),o=o.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(f,i,p="",v)=>{let y=ye(p),x=y.match(/class=['"]([^'"]+)['"]/i),b=x?x[1]:u.label,w=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Q(me(i))}" class="${b}"${w?` ${w}`:""}>${v}</label>`}),o}function Ht(c,e,u=jt){return c.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(o,f,i)=>{try{if(He(f,e)){let p=i.replace(/\{\{([^}]+)\}\}/g,(v,y,x)=>{let b=(w)=>K(i,x,String(w??""),!1,v.length);try{if(y.trim()==="$message"||y.trim()==="message")return b(Lt(f,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return b(e.errors.first(f));return b(Lt(f,e))}let w=y.trim();if(d(w)){let T=l(w,e);return T!==void 0?b(T):w}return w}catch{return y}});return`<div id="${Q(`${me(f)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),o}})}function He(c,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(c);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,c);return!1}function Lt(c,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(c);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,c)){let u=e.errors[c];return Array.isArray(u)?u[0]:String(u)}return""}function Ne(c,e){let u;if(e.old&&typeof e.old==="function")return e.old(c);if(e.old&&typeof e.old==="object")return e.old[c];if(c.endsWith("[]")){let o=c.slice(0,-2);if(u=e[o],u!==void 0)return u}return e[c]}function ye(c){if(!c.trim())return"";let e=[],u=c.trim(),o=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,f;while((f=o.exec(u))!==null){let[,i,,p]=f;e.push(`${i}="${p.trim()}"`)}return e.join(" ")}import*as tt from"path";async function Bt(c,e,u=""){if(tt.basename(u)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,c.replace(/@js[\s\S]*?@endjs/g,"");return qt(c,e,u,"@js","@endjs")}async function Ft(c,e,u=""){if(tt.basename(u)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((i)=>({...i,displayName:`User ${i.id}: ${i.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return c.replace(/@ts[\s\S]*?@endts/g,"")}return qt(c,e,u,"@ts","@endts")}async function qt(c,e,u,o,f){let i=c,p=
|
|
833
|
+
${We(`@method('${A}')`,e)}`;return M}),o=o.replace(/@endform/g,"</form>"),o=o.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(f,i,p,v,y,x="")=>{let b=i||p||"",w=v||y||"",T=ye(x),A=Ne(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),V=ze(N?N[1]:"",u.input,P,u.inputError),X=T.replace(/class=['"][^'"]+['"]/i,"");return X=X.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Q(I)}" name="${Q(b)}"${De(T,me(b))} value="${Q(O)}" class="${V}"${et(b,P,T)}${X?` ${X}`:""}>`}),o=o.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(f,i,p="",v="")=>{let y=ye(p),x=Ne(i,e)||v.trim(),b=He(i,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=ze(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Q(i)}"${De(y,me(i))} class="${T}"${et(i,b,y)}${A?` ${A}`:""}>${Q(x)}</textarea>`}),o=o.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(f,i,p="",v)=>{let y=ye(p),x=Ne(i,e),b=He(i,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=ze(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,""),O=v;if(x!==void 0)O=v.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(M,I,P)=>{if((Array.isArray(x)?x.some((V)=>String(V)===P):String(x)===P)&&!I.includes("selected"))return I.replace(/(<option)/,"$1 selected");return M});return`<select name="${Q(i)}"${De(y,me(i))} class="${T}"${et(i,b,y)}${A?` ${A}`:""}>${O}</select>`}),o=o.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(f,i,p,v="")=>{let y=p===void 0?"1":p,x=p===void 0?me(i):`${me(i)}-${me(y)}`,b=ye(v),w=Ne(i,e),T=w!==void 0&&(Array.isArray(w)?w.some((I)=>String(I)===y):w===!0||String(w)===y),A=b.match(/class=['"]([^'"]+)['"]/i),O=A?A[1]:u.checkInput,M=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Q(i)}"${De(b,x)} value="${Q(y)}" class="${O}"${T?" checked":""}${M?` ${M}`:""}>`}),o=o.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(f,i,p,v="")=>{let y=ye(v),x=Ne(i,e),b=x!==void 0&&x===p,w=y.match(/class=['"]([^'"]+)['"]/i),T=w?w[1]:u.checkInput,A=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Q(i)}"${De(y,`${me(i)}-${me(p)}`)} value="${Q(p)}" class="${T}"${b?" checked":""}${A?` ${A}`:""}>`}),o=o.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(f,i,p="")=>{let v=ye(p),y=v.match(/accept=['"]([^'"]+)['"]/i),x=y?y[1]:"",b=v.includes("multiple"),w=He(i,e),T=v.match(/class=['"]([^'"]+)['"]/i),A=ze(T?T[1]:"",u.input,w,u.inputError),O=v.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),M=[`<input type="file" name="${Q(i)}"${De(v,me(i))}`,`class="${A}"`];if(x)M.push(`accept="${Q(x)}"`);if(b)M.push("multiple");if(O)M.push(O);return`${M.join(" ")}>`}),o=o.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(f,i,p="",v)=>{let y=ye(p),x=y.match(/class=['"]([^'"]+)['"]/i),b=x?x[1]:u.label,w=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Q(me(i))}" class="${b}"${w?` ${w}`:""}>${v}</label>`}),o}function Ht(c,e,u=jt){return c.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(o,f,i)=>{try{if(He(f,e)){let p=i.replace(/\{\{([^}]+)\}\}/g,(v,y,x)=>{let b=(w)=>K(i,x,String(w??""),!1,v.length);try{if(y.trim()==="$message"||y.trim()==="message")return b(Lt(f,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return b(e.errors.first(f));return b(Lt(f,e))}let w=y.trim();if(d(w)){let T=l(w,e);return T!==void 0?b(T):w}return w}catch{return y}});return`<div id="${Q(`${me(f)}-error`)}" role="alert">${p}</div>`}return""}catch(p){return console.error("Error processing @error directive:",p),o}})}function He(c,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(c);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,c);return!1}function Lt(c,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(c);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,c)){let u=e.errors[c];return Array.isArray(u)?u[0]:String(u)}return""}function Ne(c,e){let u;if(e.old&&typeof e.old==="function")return e.old(c);if(e.old&&typeof e.old==="object")return e.old[c];if(c.endsWith("[]")){let o=c.slice(0,-2);if(u=e[o],u!==void 0)return u}return e[c]}function ye(c){if(!c.trim())return"";let e=[],u=c.trim(),o=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,f;while((f=o.exec(u))!==null){let[,i,,p]=f;e.push(`${i}="${p.trim()}"`)}return e.join(" ")}import*as tt from"path";async function Bt(c,e,u=""){if(tt.basename(u)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,c.replace(/@js[\s\S]*?@endjs/g,"");return qt(c,e,u,"@js","@endjs")}async function Ft(c,e,u=""){if(tt.basename(u)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((i)=>({...i,displayName:`User ${i.id}: ${i.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return c.replace(/@ts[\s\S]*?@endts/g,"")}return qt(c,e,u,"@ts","@endts")}async function qt(c,e,u,o,f){let i=c,p=Ct(`${o}([\\s\\S]*?)${f}`,"g"),v=[],y;while((y=p.exec(c))!==null)v.push({fullMatch:y[0],content:y[1]||"",index:y.index});for(let{fullMatch:x,content:b,index:w}of v)try{let T={...e,global:e},A=Object.keys(T),O=Object.values(T),M=b.trim();if(o==="@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 {};",V=`
|
|
834
834
|
${M}
|
|
835
835
|
${N}
|
|
836
836
|
`,L=Function(...A,V)(...O);if(L&&typeof L==="object")Object.assign(e,L);i=i.replace(x,"")}catch(T){console.error(`Error executing ${o} code block in ${u}:`,T);let A=T instanceof Error?T.message:String(T),O=g(`${o} Directive`,`Error executing code: ${A}`,u,c,w,x);console.error(O),i=i.replace(x,"")}return i}function Ir(c,e="_method"){let u=c.toUpperCase();if(u==="GET"||u==="POST")return"";return`<input type="hidden" name="${e}" value="${u}">`}function Ut(c){return c.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,u,o,f,i)=>Ir(o,i||"_method"))}async function Vt(c,e,u,o,f){if(!o.middleware||o.middleware.length===0)return c;let i=c,p=o.middleware.filter((v)=>v.timing===f);if(p.length===0)return i;for(let v of p){if(!v.name||typeof v.handler!=="function"){if(o.debug)console.warn("Invalid middleware:",v);continue}try{let y=await v.handler(i,e,u,o);if(typeof y==="string")i=y;else if(o.debug)console.warn(`Middleware ${v.name} did not return a string`)}catch(y){if(o.debug)console.error(`Error in middleware ${v.name}:`,y);if(o.debug){let x=g("Middleware",`Error in middleware '${v.name}': ${y instanceof Error?y.message:String(y)}`,u,c);i=i.replace(/<body[^>]*>/,`$&
|
|
@@ -854,35 +854,35 @@ ${I}
|
|
|
854
854
|
</style>`;o=o.replace(x,P),v.lastIndex=0}catch(I){}}}return o}import it from"path";var cs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ls=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ds(c,e){if(!e||!c.includes("/"))return c;let u=it.dirname(e);return c.replace(cs,(o,f,i,p)=>{let v=it.resolve(u,p);return`${f}${i}${v.split(it.sep).join("/")}${i}`})}function dn(c,e){if(!e||!c.includes("<script"))return c;return c.replace(ls,(u,o,f,i)=>`${o}${ds(f,e)}${i}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function fn(c){return c.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Sn(c,e){let u=c.length,o=e,f=!0,i=[],p=(v)=>v+9<=u&&c[v]==="<"&&c[v+1]==="/"&&(c[v+2]==="s"||c[v+2]==="S")&&(c[v+3]==="c"||c[v+3]==="C")&&(c[v+4]==="r"||c[v+4]==="R")&&(c[v+5]==="i"||c[v+5]==="I")&&(c[v+6]==="p"||c[v+6]==="P")&&(c[v+7]==="t"||c[v+7]==="T")&&(c[v+8]===">"||/\s/.test(c[v+8]));while(o<u){let v=c[o];if(p(o))return o;if(v==="/"&&c[o+1]==="/"){if(o=c.indexOf(`
|
|
855
855
|
`,o+2),o===-1)return-1;o+=1,f=!0;continue}if(v==="/"&&c[o+1]==="*"){let y=c.indexOf("*/",o+2);if(y===-1)return-1;o=y+2,f=!0;continue}if(v==="/"&&f){let y=o+1,x=!1;while(y<u){let b=c[y];if(b==="\\"){y+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){y++;break}else if(b===`
|
|
856
856
|
`){y=-1;break}y++}if(y===-1){o++,f=!1;continue}while(y<u&&/[a-z]/.test(c[y]))y++;o=y,f=!1;continue}if(v==="'"||v==='"'){let y=v;o++;while(o<u){if(c[o]==="\\"){o+=2;continue}if(c[o]===y){o++;break}if(c[o]===`
|
|
857
|
-
`)break;o++}f=!1;continue}if(v==="`"){o++;while(o<u){if(c[o]==="\\"){o+=2;continue}if(c[o]==="`"){o++;break}if(c[o]==="$"&&c[o+1]==="{"){i.push(!0),o+=2,f=!0;break}o++}if(i.length===0)f=!1;continue}if(v==="}"&&i.length>0){i.pop(),o++;while(o<u){if(c[o]==="\\"){o+=2;continue}if(c[o]==="`"){o++,f=!1;break}if(c[o]==="$"&&c[o+1]==="{"){i.push(!0),o+=2,f=!0;break}o++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))f=!1;else f=!0;o++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!o)return null;let f=o.index+o[0].length,i=c.indexOf("</script>",f);if(i===-1)return null;let p=c.indexOf(">",i);if(p===-1)return null;return{start:o.index,end:p+1}}var hs=4096;async function mn(c,e,u){if(u.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:o}=await import("./chunk-
|
|
857
|
+
`)break;o++}f=!1;continue}if(v==="`"){o++;while(o<u){if(c[o]==="\\"){o+=2;continue}if(c[o]==="`"){o++;break}if(c[o]==="$"&&c[o+1]==="{"){i.push(!0),o+=2,f=!0;break}o++}if(i.length===0)f=!1;continue}if(v==="}"&&i.length>0){i.pop(),o++;while(o<u){if(c[o]==="\\"){o+=2;continue}if(c[o]==="`"){o++,f=!1;break}if(c[o]==="$"&&c[o+1]==="{"){i.push(!0),o+=2,f=!0;break}o++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))f=!1;else f=!0;o++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!o)return null;let f=o.index+o[0].length,i=c.indexOf("</script>",f);if(i===-1)return null;let p=c.indexOf(">",i);if(p===-1)return null;return{start:o.index,end:p+1}}var hs=4096;async function mn(c,e,u){if(u.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:o}=await import("./chunk-v5r6abrq.js");return`<script ${c} src="${o(e)}"></script>`}async function Hn(c,e,u){try{let{registeredModuleIdsIn:o,buildModuleRegistryScript:f}=await r("stx/client-module-registry",()=>import("./chunk-g96m1a69.js")),i=[],p=await f(o(...c),{minify:qo(e.buildMode),collectInputs:i});for(let v of i)u?.add(v);if(!p)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-v5r6abrq.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(p)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${p.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ys(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let o=Gn(c);if(o===-1||o===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(o<u.start)return c.slice(0,o)+c.slice(u.start,u.end)+e+`
|
|
858
858
|
`+c.slice(o,u.start)+c.slice(u.end);let f=c.slice(u.start,u.end),i=c.slice(0,u.start)+c.slice(u.end),p=Gn(i);if(p===-1)return f+e+`
|
|
859
859
|
`+i;return i.slice(0,p)+f+e+`
|
|
860
|
-
`+i.slice(p)}function vs(c){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return c.replace(e,(u,o,f)=>{let i=c.slice(0,f);return i.lastIndexOf("<")>i.lastIndexOf(">")?`{{${o}}}`:`{<!--stx-literal-->{${o}}}`})}async function s(c,e,u,o,f){if(o.ssr===!1&&!o.autoShell&&o.buildMode==="spa")return c;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=be(c,u);let i=!e.__stxProcessingDepth;ln(e);for(let p of o._layerGraph?.configDependencies??[])f.add(p);if(i&&o.runtimeConfig)await gn(e,u,o.runtimeConfig);if(i)za(e),e.__stx_scope_seq??={n:0,key:ms(String(e.__filename??u))},e.__stx_head_injections=Vo(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((o.debug||!
|
|
860
|
+
`+i.slice(p)}function vs(c){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return c.replace(e,(u,o,f)=>{let i=c.slice(0,f);return i.lastIndexOf("<")>i.lastIndexOf(">")?`{{${o}}}`:`{<!--stx-literal-->{${o}}}`})}async function s(c,e,u,o,f){if(o.ssr===!1&&!o.autoShell&&o.buildMode==="spa")return c;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=be(c,u);let i=!e.__stxProcessingDepth;ln(e);for(let p of o._layerGraph?.configDependencies??[])f.add(p);if(i&&o.runtimeConfig)await gn(e,u,o.runtimeConfig);if(i)za(e),e.__stx_scope_seq??={n:0,key:ms(String(e.__filename??u))},e.__stx_head_injections=Vo(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((o.debug||!C()&&!bn())&&u&&u.endsWith(".stx"))Zs(c,u);try{return await te.timeAsync("template-processing",async()=>{let p=await bs(c,e,u,o,f);if(i)p=Ao(p);if(i&&o.autoShell&&o.buildMode!=="compile"){let v=we(o.app?.head,{known:hr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Wo(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?k(A,e,u):void 0,M=x.title||w||O,I=!x.title&&(!!w||!!O),P=x.meta||[],N=new Set(P.map((G)=>nt(G)).filter(Boolean)),V={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((G)=>!N.has(nt(G))),...P],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
861
861
|
`),...x.htmlAttrs&&{htmlAttrs:nc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},X=Uo(p);if(p=gr(p,V,{...I&&{titleIsHtml:!0},...o.app?.colorMode&&{colorMode:o.app.colorMode}},X),X)p=sc(p,v),p=fr(p,V.htmlAttrs);let L=p.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&p.includes("<head")){let G=L[1],J=ts(G);p=p.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
|
|
862
862
|
<meta name="stx-layout" content="${fn(G)}">
|
|
863
|
-
<meta name="stx-layout-group" content="${fn(J)}">`)}let j=p.match(/function (__stx_setup_\w+)\(/),H=j?U(p):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){p=qe(p,(J,Y)=>`<body${Y} data-stx="${j[1]}">`);let G=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");p=p.replace(G,"$1")}}if(i){let v=e.__stx_head_injections??Vo(),y=rc(p);if(y!==null)v.beforeClose.push(y);let x=tn(p);if(x!==null)v.afterOpen.push(x);if(o.offline?.enabled&&!p.includes("data-stx-offline"))v.beforeClose.push(nn);p=ec(p,v);let b=o.app?.colorMode;if(b)p=pr(p,b)}if(i)if($n(p,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await r("stx/store-loader",()=>import("./chunk-
|
|
863
|
+
<meta name="stx-layout-group" content="${fn(J)}">`)}let j=p.match(/function (__stx_setup_\w+)\(/),H=j?U(p):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){p=qe(p,(J,Y)=>`<body${Y} data-stx="${j[1]}">`);let G=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");p=p.replace(G,"$1")}}if(i){let v=e.__stx_head_injections??Vo(),y=rc(p);if(y!==null)v.beforeClose.push(y);let x=tn(p);if(x!==null)v.afterOpen.push(x);if(o.offline?.enabled&&!p.includes("data-stx-offline"))v.beforeClose.push(nn);p=ec(p,v);let b=o.app?.colorMode;if(b)p=pr(p,b)}if(i)if($n(p,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await r("stx/store-loader",()=>import("./chunk-bpm8tyvc.js")),M=o.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await mn("data-stx-stores",I,o)??b}catch{}y=await Hn([p,b],o,f);try{let{getFrameworkComposableScript:O}=await r("stx/framework-composables",()=>import("./chunk-vm26nak1.js"));T=await O(p)}catch{}try{let{getComposableScript:O}=await r("stx/composable-loader",()=>import("./chunk-67rvd6qy.js")),M=o.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(o._layerComposableDirs??M,p,I);if(P)w=await mn('data-stx-scoped data-stx-run="always" data-stx-composables',P,o)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
|
|
864
864
|
${O}`).join("");p=ys(p,A)}else{let y=await Hn([p],o,f);if(y){let x=p.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)p=p.slice(0,x)+y+`
|
|
865
|
-
`+p.slice(x)}}if(i)p=tc(p);if(i&&e.__stx_inject_css!==!1)p=await h(p,void 0,o.buildMode==="serve",!0);else if(i)p=an(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=vs(p),i&&e.__stx_runtime_config)p=Ot(p,e.__stx_runtime_config);if(i&&!e.__stx_defer_server_data){let v=cr(e);if(v){let y=/<head\b[^>]*>/i.exec(p),x=y?y.index+y[0].length:0;p=p.slice(0,x)+v+p.slice(x)}}return p})}catch(p){if(p instanceof z)throw p;let v=p instanceof Error?p.message:String(p),y=new re(`Template processing failed: ${v}`,u,void 0,void 0,c.substring(0,200)+(c.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),hn.logDetailedError(y,{filePath:u,template:c.substring(0,500)}),
|
|
865
|
+
`+p.slice(x)}}if(i)p=tc(p);if(i&&e.__stx_inject_css!==!1)p=await h(p,void 0,o.buildMode==="serve",!0);else if(i)p=an(p);if(p=p.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),p=vs(p),i&&e.__stx_runtime_config)p=Ot(p,e.__stx_runtime_config);if(i&&!e.__stx_defer_server_data){let v=cr(e);if(v){let y=/<head\b[^>]*>/i.exec(p),x=y?y.index+y[0].length:0;p=p.slice(0,x)+v+p.slice(x)}}return p})}catch(p){if(p instanceof z)throw p;let v=p instanceof Error?p.message:String(p),y=new re(`Template processing failed: ${v}`,u,void 0,void 0,c.substring(0,200)+(c.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),hn.logDetailedError(y,{filePath:u,template:c.substring(0,500)}),C()&&!o.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(o.debug)throw y;return zo.createFallbackContent("Template Processing",y)}}async function bs(c,e,u,o,f){let i=process.cwd(),p={...o,partialsDir:o.partialsDir&&!ce.isAbsolute(o.partialsDir)?ce.resolve(i,o.partialsDir):o.partialsDir,componentsDir:o.componentsDir&&!ce.isAbsolute(o.componentsDir)?ce.resolve(i,o.componentsDir):o.componentsDir,layoutsDir:o.layoutsDir&&!ce.isAbsolute(o.layoutsDir)?ce.resolve(i,o.layoutsDir):o.layoutsDir},v=p,y=c;await ks(u,e),xs(e,v),y=await ve(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=le(y,Ae,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=x.output;let b=x.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,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 un(y,u,f);let M={};y=Mr(y,M);let I={...e.__sections||{}},P="",N=mt(ft(c)),V=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let X=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(X)P=X[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
|
|
866
866
|
${y.trim()}
|
|
867
867
|
@endsection`}if(!P&&!V&&v.defaultLayout){let L=yn(y),j=/@section\s*\(/.test(y);if(!L||j){let H="",G=ce.dirname(u),J=v.layoutsDir?ce.dirname(v.layoutsDir):process.cwd();for(let Y=0;Y<20;Y++){let ne=ce.join(G,"_layout.stx");if(await n(ne)){H=ne;break}let se=ce.dirname(G);if(se===G||se.length<J.length)break;G=se}if(H)P=H;else if(v.layoutsDir){let Y=ce.isAbsolute(v.layoutsDir)?v.layoutsDir:ce.resolve(process.cwd(),v.layoutsDir),ne=ce.join(Y,`${v.defaultLayout}.stx`);if(await n(ne))P=ne}if(P&&!j)y=`@section('content')
|
|
868
868
|
${y.trim()}
|
|
869
869
|
@endsection`}}if(P&&y.includes("<script")){let L=q(y),j=L.scripts.map((H)=>vn(H,u)??H);y=or(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 G=l(H.trim(),e);if(G===void 0)return L;let Y=(e.__stx_inline_section_values??=[]).push(G)-1;return I[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,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=Lr(y,M),P){let L=[],j=q(y),H=le(j.output,on,(G,J)=>`\x00STX_ORPHAN_STYLE_${J}\x00`);if(y=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(G,J,Y)=>{let ne=J==="SCRIPT"?vn(j.scripts[Number(Y)],u):H.tokens[Number(Y)];if(ne)L.push(ne);return""}),L.length>0){let G=L.join(`
|
|
870
870
|
`);I.content=I.content?`${I.content}
|
|
871
871
|
${G}`:G,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,f.add(P);else L=await ve(()=>pn(P,u,p,f),null,()=>{throw new re(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ne=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return fs.readdirSync(ae).filter((ue)=>ue.endsWith(".stx")).map((ue)=>ue.replace(/\.stx$/,""))}catch{return[]}},se=[...ne(p.layoutsDir),...ne(p.fallbackLayoutsDir)].filter((oe,ae,ue)=>ue.indexOf(oe)===ae).sort(),de=`Layout not found: ${P} (referenced from ${u})`+(se.length>0?`. Available layouts: ${se.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"");if(D.log(Error(de),{layoutPath:P,filePath:u,available:se},"error"),console.error(`[stx] ${de}`),p.debug)throw new re(de,u);return y}let j=await ve(()=>Bun.file(L).text(),"",()=>{throw new re(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=dn(j,L);let H=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(p.debug)console.log(`Found nested layout: ${H[1]} in ${L}`);let ne={},se=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,ue,ke)=>(ne[ue]=ke.trim(),""));for(let[ae,ue]of Object.entries(ne))if(I[ae]&&I[ae].includes(Te)){let ke=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,ke)+ue+I[ae].slice(ke+Te.length)}else if(!I[ae])I[ae]=ue;let de={...e,__sections:I},oe=`@layout('${H[1]}')${se}`;return await s(oe,de,L,p,f)}let G=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),J=Mr(G,M),Y={};return J=J.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ne,se,de)=>(Y[se]=de.trim(),`@slot('${se}')`)),J=J.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ne,se,de)=>{if(I[se]){let oe=I[se];if(oe.includes(Te)){let ae=Y[se]||"",ue=oe.indexOf(Te);oe=oe.slice(0,ue)+ae+oe.slice(ue+Te.length)}return oe}return de||""}),J=ws(J,I),J=J.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),J=Lr(J,M),e.__originalFilePath=u,y=await kn(J,e,L,p,f),y=`<!-- stx-layout: ${P} -->
|
|
872
|
-
${y}`,w(y)}catch(L){if(L instanceof z)throw L;throw new re(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,p,f))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,o,f)=>{let i=e[o];if(i!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(i))return i}return f||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",o={};for(let[f,i]of Object.entries(process.env))if(f.startsWith(u)&&i!==void 0)o[f]=i;c.$env=o}async function ks(c,e){await ve(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function vn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function wn(c){return c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wn(c)}</span><span style="display:block;margin-top:4px">${wn(u)}</span></div>`}async function $s(c,e,u,o){let{scanScriptTags:f}=await r("stx/signal-processing",()=>import("./chunk-
|
|
873
|
-
`;if(i=Y(i,e),i=ne(i,e,u),i=Xt(i),i=no(i,e),i=
|
|
872
|
+
${y}`,w(y)}catch(L){if(L instanceof z)throw L;throw new re(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,p,f))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,o,f)=>{let i=e[o];if(i!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(i))return i}return f||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",o={};for(let[f,i]of Object.entries(process.env))if(f.startsWith(u)&&i!==void 0)o[f]=i;c.$env=o}async function ks(c,e){await ve(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function vn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function wn(c){return c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wn(c)}</span><span style="display:block;margin-top:4px">${wn(u)}</span></div>`}async function $s(c,e,u,o){let{scanScriptTags:f}=await r("stx/signal-processing",()=>import("./chunk-p7096wfv.js")),i=[],p=!C()&&!bn();for(let y of f(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await r("stx/variable-extractor",()=>import("./chunk-p314pg80.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(o?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!p)return;i.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}`),p)i.push({...O,markup:xn(A,"unknown",I.message)})}}if(i.length===0)return c;let v=c;for(let y of i.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:o}=await r("stx/expressions",()=>import("./chunk-1z1fmda6.js"));return o(c,e,{skipServer:!0})}catch(o){let f=o instanceof Error?o:Error(String(o));return D.log(f,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${f.message}`),c}}async function kn(c,e,u,o,f){let i=c,p=o;if(i=await $s(i,e,u,o),i=await Bt(i,e,u),i=await Ft(i,e,u),i=await Es(i,e,u),i=await At(i,e,u,p),be(i))i=io(i,e),i=Hr(i,e),i=zr(i,e);i=ao(i);let{processStreamDirectives:v}=await r("stx/streaming",()=>import("./chunk-9c3cq8ks.js"));i=v(i,e),i=qn(i,e,u,p,!0),i=await en(i,e,u,p,f),i=await Br(i,e,u,p,f),i=ua(i,e,u,p);let{processDeferDirectives:y}=await r("stx/defer",()=>import("./chunk-2f17h17f.js"));i=y(i,e,u);let{processTeleportDirectives:x}=await r("stx/teleport",()=>import("./chunk-wq712sw1.js"));i=x(i,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await r("stx/transitions",()=>import("./chunk-k2pa44rf.js"));i=b(i,e,u),i=w(i);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await r("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));i=T(i,e,u),i=A(i);let{processSuspenseDirectives:O}=await r("stx/suspense",()=>import("./chunk-weqc0ssb.js"));i=O(i,e,u);let{processAsyncDirectives:M}=await r("stx/async-components",()=>import("./chunk-67kj14at.js"));i=M(i,e,u);let{processKeepAliveDirectives:I}=await r("stx/keep-alive",()=>import("./chunk-6vzktvyw.js"));i=I(i,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:V}=await r("stx/virtual-scrolling",()=>import("./chunk-sf0wsq74.js"));i=P(i,e,u),i=N(i,e,u),i=V(i,e,u);let{processPartialHydrationDirectives:X,processStaticDirectives:L}=await r("stx/partial-hydration",()=>import("./chunk-9szxxgv5.js"));i=X(i,e,u),i=L(i);let{processComputedDirectives:j,processWatchDirectives:H}=await r("stx/computed",()=>import("./chunk-1xdzcy9d.js"));i=j(i,e,u),i=H(i,e,u);let{processFormValidationDirectives:G}=await r("stx/forms-validation",()=>import("./chunk-s2qv0y4x.js"));i=G(i,e,u);let{processHeadDirective:J,processTitleDirective:Y,processMetaDirective:ne,resetHead:se}=await r("stx/head",()=>import("./chunk-np1k9vsr.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)se();let de=J(i);if(i=de.content,de.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${de.headContent}
|
|
873
|
+
`;if(i=Y(i,e),i=ne(i,e,u),i=Xt(i),i=no(i,e),i=Tt(i),i=Ut(i),i=await Dr(i,e,u,p,f),i=await Br(i,e,u,p,f),e.__stxProcessingDepth===1)i=Ha(i,e);if(i=i.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),i=Ao(i),i=ee(i,e,u),i=Nr(i),i=La(i,e,{filePath:u,buildMode:p.buildMode}),i=ro(i,e),i=so(i,e),i=We(i,e),i=Nt(i,e),i=Ht(i,e),i=await bt(i,e,u,p),i=await pa(i,e,u),i=await fa(i,e,u,p),i=ga(i,e,u,p),i=mo(i,e,u,p),i=ho(i,e,u),i=yo(i,e,u,p),i=Et(i,e,u,p),i=ps(i,e),i=gs(i),i=ja(i),!p.skipEventDirectives)i=Ea(i,e,u);if(i=vt(i,e,u),p.debug){let B=/\bx-data\s*=/.test(i),W=Fr(c);if(B&&W)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
874
874
|
Both work on the same page, but they manage separate scopes.
|
|
875
875
|
Prefer signals (state/derived/effect) for new components.`)}i=oa(i,e),i=await k(i,e,u),i=Ba(i),i=Fa(i),i=pt(i);let{processXElementDirectives:oe}=await r("stx/x-element",()=>import("./chunk-zhxdpzga.js"));i=oe(i);let ae=e.__originalFilePath||u,ue=Ie(e);if(i=await co(i,p,ae,ue),i=Pt(i,e),i=await Wt(i,e,u,p),p.media?.image?.autoSiblings){let B=p.publicDir||"public",{rewriteImagesWithSiblings:W}=await r("stx/image-optimization/auto-sibling",()=>import("./chunk-shpc1ttk.js"));i=await W(i,{publicDir:B})}if(p.seo?.enabled)i=bo(i,e,p);let ke=(B,W,Z=!0)=>{if(!W)return B;let he=W.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ie=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(B),fe=ie?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ie[0]):null;if(he&&ie&&fe){if(Z){let Ce=ie.index+fe.index;B=B.slice(0,Ce)+he[0]+B.slice(Ce+fe[0].length)}if(W=W.replace(he[0],"").trim(),!W)return B}if(/<\/head>/i.test(B))return B.replace(/<\/head>/i,`${W}
|
|
876
876
|
</head>`);if(/<head\b[^>]*>/i.test(B))return B.replace(/(<head\b[^>]*>)/i,`$1
|
|
877
877
|
${W}`);if(/<html\b[^>]*>/i.test(B))return B.replace(/(<html\b[^>]*>)/i,`$1
|
|
878
878
|
<head>
|
|
879
879
|
${W}
|
|
880
|
-
</head>`);return B},{renderHead:En,getHead:_n}=await r("stx/head",()=>import("./chunk-
|
|
880
|
+
</head>`);return B},{renderHead:En,getHead:_n}=await r("stx/head",()=>import("./chunk-np1k9vsr.js")),je=e.__stx_runtime_head??_n();if(je.title||je.meta?.length||je.link?.length){let B=En(je);if(B)i=ke(i,B)}if(de.headContent)i=ke(i,de.headContent,!je.title);if(p.csp?.enabled&&p.csp.addMetaTag)i=St(i,p.csp,e);if(p.analytics?.enabled)i=gt(i,p);if(p.heatmap?.enabled)i=da(i,p);if(p.pwa?.enabled&&p.pwa.autoInject!==!1){let{injectPwaTags:B}=await r("stx/pwa/inject",()=>import("./chunk-ypsym37h.js"));i=B(i,p)}let Tn=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(i),Cn=/\bSTX\.\w+/.test(i),An=/window\.STX\s*=/.test(i);if(Tn&&Cn&&!An){let W=`<script data-stx-scoped data-stx-run="once">
|
|
881
881
|
${lt()}
|
|
882
882
|
</script>`;if(i.includes("</head>")){let Z=i.indexOf("</head>"),ie=i.slice(0,Z).indexOf("<script");if(ie!==-1){let fe=i.slice(0,ie),Ce=i.slice(ie);i=fe+W+`
|
|
883
883
|
`+Ce}else i=i.replace("</head>",`${W}
|
|
884
884
|
</head>`)}else if(i.includes("<body"))i=i.replace(/<body([^>]*)>/,`<body$1>
|
|
885
885
|
${W}`);else i=W+`
|
|
886
|
-
`+i}{let{scanScriptTags:B}=await r("stx/signal-processing",()=>import("./chunk-
|
|
886
|
+
`+i}{let{scanScriptTags:B}=await r("stx/signal-processing",()=>import("./chunk-p7096wfv.js")),W=[];for(let Z of B(i)){if(!/\bserver\b/i.test(Z.attrs))continue;let he=Z.start+Z.fullMatch.indexOf(">")+1,ie=Sn(i,he);if(ie===-1)continue;let fe=ie+9;while(fe<i.length&&/\s/.test(i[fe]))fe++;W.push({start:Z.start,end:fe})}if(W.length>0){let Z=Array(W.length+1),he=0;for(let ie=0;ie<W.length;ie++){let{start:fe,end:Ce}=W[ie];Z[ie]=i.slice(he,fe),he=Ce}Z[W.length]=i.slice(he),i=Z.join("")}}let at=us(i,u);if(at.hasScoped)i=at.html;let Rn=e.__stx_event_bindings||[],Ge=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(i),{scanScriptTags:Dn}=await r("stx/signal-processing",()=>import("./chunk-p7096wfv.js"));for(let B of Dn(i,{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:W,content:Z}of ct){Ge=!0;let he=Z;Re(Z,u,o.strict,e.__originalFilePath);let ie=await Oe(Z,{eventBindings:Rn,attrs:W,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:qo(o.buildMode),serverData:ue});i=i.replace(B,()=>ie)}if(Ge)e.__stx_event_bindings=[];if(!Ge&&e.__stxProcessingDepth===1){let B=e.__stx_event_bindings||[];if(B.length>0){let W=_o(B);if(W){let Z=i.lastIndexOf("</body>");i=Z===-1?i+W:i.slice(0,Z)+W+`
|
|
887
887
|
`+i.slice(Z)}e.__stx_event_bindings=[]}}if(!ge(i)&&aa(i))i=await Kn(i,p);if(i=ca(i),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")i=$t(i,e.cspNonce);return i}
|
|
888
888
|
export{ft,Ee,ta,Ys,Hn,s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X,J,Y,
|
|
2
|
+
import{X,J,Y,Cn,pe,ke,Rr,Fc,ut,Ut,En,Tn,$n,Z,Rn,An,Ar}from"./chunk-0jhdrgpr.js";import"./chunk-c1dkh0es.js";export{J as DEFAULT_FORMATS,Y as DEFAULT_QUALITY,X as DEFAULT_WIDTHS,Ar as ImageProcessingError,An as formatSize,Ut as generateSizes,ut as generateSrcSet,En as getFallbackVariant,Rr as getImageMetadata,Z as getMimeType,Rn as getTotalSize,Tn as groupVariantsByFormat,pe as isImageBackendAvailable,$n as isImageFile,Cn as isSharpAvailable,ke as processImage,Fc as resizeAndConvert};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{w}from"./chunk-
|
|
2
|
+
import{w}from"./chunk-hb08vrbb.js";function Ge(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=w(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function ht(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Ge(e,c);if(!o)return null;let i=o.endPos,u=ht(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=Ge(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function tn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function Ur(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=w(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=ht(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function lo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Ge(e,c);if(!o)return null;let i=o.endPos,u=ht(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=Ge(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Ge,ht,tn,Ur,lo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{rd,Li,il,sd,od,id,ad,cd,al,cl,ld,ud,dd,pd}from"./chunk-zyv28182.js";import"./chunk-889evdcy.js";import"./chunk-0gqmp9sa.js";import"./chunk-prf164ct.js";import"./chunk-sdknbvh8.js";import"./chunk-wp0jtntj.js";import"./chunk-rccpf74y.js";import"./chunk-r7kmsq3n.js";import"./chunk-31yb0253.js";import"./chunk-teahew39.js";import"./chunk-8nryyqb5.js";import"./chunk-v3kc2anv.js";import"./chunk-2h92dm3t.js";import"./chunk-e7z85137.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-hzjvpcmj.js";import"./chunk-jf17b7y9.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{il as SUSPENSE_RESOLVER_RUNTIME,Li as buildSuspenseResolveScript,cd as createStreamRenderer,id as extractStreamBoundaries,pd as generateHydrationRuntime,cl as islandDirective,ud as processSectionDirectives,od as processStreamDirectives,ld as registerStreamingDirectives,sd as renderStreamingPage,rd as streamTemplate,ad as streamTemplateSimple,dd as streamToResponse,al as streamingSuspenseDirective};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$u}from"./chunk-6c2pvrw8.js";import"./chunk-k9amsnfj.js";import"./chunk-cjj9b9wf.js";import"./chunk-teahew39.js";import"./chunk-2h92dm3t.js";import"./chunk-e7z85137.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-t9mfztcs.js";import"./chunk-zaaeneq6.js";import"./chunk-hzjvpcmj.js";import"./chunk-jf17b7y9.js";import"./chunk-2h8ea0we.js";import"./chunk-hb08vrbb.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{$u as startProductionServer};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{i}from"./chunk-
|
|
2
|
+
import{i}from"./chunk-2h92dm3t.js";import{Fs}from"./chunk-vqc4h16r.js";import p from"path";async function Ku(t={}){let d=performance.now(),o=t.root||process.cwd(),e=await i(o),u=t.ssr?.routeRules??e.routeRules??{};if(Fs(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:s}=await import("./ssg.js");n=await s({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:s}=await import("./chunk-ne72vxmc.js");l=await s({root:o,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
|
|
3
3
|
export{Ku};
|